From e613da05d79f1ff3d0522cf323eb12cbdf2ce02f Mon Sep 17 00:00:00 2001 From: frishber Date: Fri, 24 Apr 2015 08:46:17 -0400 Subject: [PATCH 1/2] Hiding the element for wait_till_not_visible instead of removing it --- tests/scenarios/po/selectors_page.py | 4 ++-- tests/scenarios/site/index.html | 10 +++++----- tests/scenarios/test_wait_until_not_visible.py | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/scenarios/po/selectors_page.py b/tests/scenarios/po/selectors_page.py index 01a9864..27cea6a 100755 --- a/tests/scenarios/po/selectors_page.py +++ b/tests/scenarios/po/selectors_page.py @@ -6,7 +6,7 @@ class Page(RobotPage): selectors = { "search-button": "css=#go", "inputs": "css=input", - "remove-button": "css=button#remove-content", - "para-to-be-removed": "css=p#disappear", + "hide-button": "css=button#hide-content", + "para-to-be-hidden": "css=p#disappear", "delayed-content-button":"css=button#delayed-content" } diff --git a/tests/scenarios/site/index.html b/tests/scenarios/site/index.html index 4b83777..136d16f 100755 --- a/tests/scenarios/site/index.html +++ b/tests/scenarios/site/index.html @@ -26,10 +26,10 @@

Your source for great widgets



-
-

I am another paragraph added to test remove button

+
+

I am another paragraph added to test hide button

- + @@ -63,10 +63,10 @@

Your source for great widgets

}); // clicking on remove me button removes the delayed content - jQuery("#remove-content").click( function(e) { + jQuery("#hide-content").click( function(e) { e.preventDefault(); setTimeout( function() { - jQuery(".ct-to-be-removed").remove(); + jQuery(".ct-to-be-hidden").hide(); }, 5000); }); diff --git a/tests/scenarios/test_wait_until_not_visible.py b/tests/scenarios/test_wait_until_not_visible.py index ee33f34..00efca1 100755 --- a/tests/scenarios/test_wait_until_not_visible.py +++ b/tests/scenarios/test_wait_until_not_visible.py @@ -8,19 +8,19 @@ def setUp(self): self.p.open() def test_wait_until_element_not_visible(self): - self.p.click_element("remove-button") - self.p.wait_until_element_is_not_visible("para-to-be-removed") - self.p.page_should_not_contain_element("para-to-be-removed") + self.p.click_element("hide-button") + self.p.wait_until_element_is_not_visible("para-to-be-hidden") + self.p.page_should_not_contain_element("para-to-be-hidden") def test_wait_for_element_not_visible(self): - self.p.click_element("remove-button") - self.p.wait_for(lambda: not self.p.is_visible("para-to-be-removed")) - self.p.page_should_not_contain_element("para-to-be-removed") + self.p.click_element("hide-button") + self.p.wait_for(lambda: not self.p.is_visible("para-to-be-hidden")) + self.p.page_should_not_contain_element("para-to-be-hidden") def test_wait_until_element_not_visible_throws_exception(self): try: self.p.click_element("delayed-content-button") - self.p.wait_until_element_is_not_visible("para-to-be-removed", 8) + self.p.wait_until_element_is_not_visible("para-to-be-hidden", 8) except Exception, e: self.assertTrue(isinstance(e, AssertionError)) self.assertIn("still matched after", e.message) @@ -28,7 +28,7 @@ def test_wait_until_element_not_visible_throws_exception(self): def test_wait_for_element_not_visible_throws_exception(self): try: self.p.click_element("delayed-content-button") - self.p.wait_for(lambda: not self.p.is_visible("para-to-be-removed"), 8, 'Element did not disappear') + self.p.wait_for(lambda: not self.p.is_visible("para-to-be-hidden"), 8, 'Element did not disappear') except Exception, e: self.assertIn("Element did not disappear", e.msg) From 22b2e530e2adb2baf7f12993c80c592b297902cc Mon Sep 17 00:00:00 2001 From: frishber Date: Tue, 2 Jun 2015 10:53:18 -0400 Subject: [PATCH 2/2] Replacing checks for existence of element with checks for visibility --- tests/scenarios/test_wait_until_not_visible.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scenarios/test_wait_until_not_visible.py b/tests/scenarios/test_wait_until_not_visible.py index 00efca1..1fd0f4c 100755 --- a/tests/scenarios/test_wait_until_not_visible.py +++ b/tests/scenarios/test_wait_until_not_visible.py @@ -10,12 +10,12 @@ def setUp(self): def test_wait_until_element_not_visible(self): self.p.click_element("hide-button") self.p.wait_until_element_is_not_visible("para-to-be-hidden") - self.p.page_should_not_contain_element("para-to-be-hidden") + self.p.element_should_not_be_visible("para-to-be-hidden") def test_wait_for_element_not_visible(self): self.p.click_element("hide-button") self.p.wait_for(lambda: not self.p.is_visible("para-to-be-hidden")) - self.p.page_should_not_contain_element("para-to-be-hidden") + self.p.element_should_not_be_visible("para-to-be-hidden") def test_wait_until_element_not_visible_throws_exception(self): try: