Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/scenarios/po/selectors_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
10 changes: 5 additions & 5 deletions tests/scenarios/site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ <h1>Your source for great widgets</h1>
</div>

<br><hr>
<div class="ct-to-be-removed">
<p id="disappear">I am another paragraph added to test remove button</p>
<div class="ct-to-be-hidden">
<p id="disappear">I am another paragraph added to test hide button</p>
</div>
<button id="remove-content">Click to remove content</button>
<button id="hide-content">Click to hide content</button>


</form>
Expand Down Expand Up @@ -63,10 +63,10 @@ <h1>Your source for great widgets</h1>
});

// 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);
});

Expand Down
16 changes: 8 additions & 8 deletions tests/scenarios/test_wait_until_not_visible.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ 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.element_should_not_be_visible("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.element_should_not_be_visible("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)

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)

Expand Down