mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 758195 - Add test for implicit waits. r=jgriffin
This commit is contained in:
parent
5f08325792
commit
bd80db7e0b
@ -0,0 +1,28 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from marionette_test import MarionetteTestCase
|
||||
from errors import NoSuchElementException
|
||||
|
||||
class TestImplicitWaits(MarionetteTestCase):
|
||||
def testShouldImplicitlyWaitForASingleElement(self):
|
||||
test_html = self.marionette.absolute_url("test_dynamic.html")
|
||||
self.marionette.navigate(test_html)
|
||||
add = self.marionette.find_element("id", "adder")
|
||||
self.marionette.set_search_timeout("3000")
|
||||
add.click()
|
||||
# All is well if this doesnt throw
|
||||
self.marionette.find_element("id", "box0")
|
||||
|
||||
def testShouldStillFailToFindAnElementWhenImplicitWaitsAreEnabled(self):
|
||||
test_html = self.marionette.absolute_url("test_dynamic.html")
|
||||
self.marionette.navigate(test_html)
|
||||
self.marionette.set_search_timeout("3000")
|
||||
try:
|
||||
self.marionette.find_element("id", "box0")
|
||||
self.fail("Should have thrown a a NoSuchElementException")
|
||||
except NoSuchElementException:
|
||||
pass
|
||||
except Exception:
|
||||
self.fail("Should have thrown a NoSuchElementException")
|
@ -83,3 +83,5 @@ b2g = false
|
||||
b2g = false
|
||||
[test_window_type.py]
|
||||
b2g = false
|
||||
|
||||
[test_implicit_waits.py]
|
||||
|
38
testing/marionette/client/marionette/www/test_dynamic.html
Normal file
38
testing/marionette/client/marionette/www/test_dynamic.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript">
|
||||
var next = 0;
|
||||
|
||||
function addMore() {
|
||||
var box = document.createElement('DIV');
|
||||
box.id = 'box' + next++;
|
||||
box.className = 'redbox';
|
||||
box.style.width = '150px';
|
||||
box.style.height = '150px';
|
||||
box.style.backgroundColor = 'red';
|
||||
box.style.border = '1px solid black';
|
||||
box.style.margin = '5px';
|
||||
window.setTimeout(function() {
|
||||
document.body.appendChild(box);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function reveal() {
|
||||
var elem = document.getElementById('revealed');
|
||||
window.setTimeout(function() {
|
||||
elem.style.display = '';
|
||||
}, 1000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<input id="adder" type="button" value="Add a box!" onclick="addMore()"/>
|
||||
|
||||
<input id="reveal" type="button" value="Reveal a new input" onclick="reveal();" />
|
||||
|
||||
<input id="revealed" style="display:none;" />
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user