Bug 936019 - fix intermittent test_findelement.py, r=jgriffin

This commit is contained in:
Malini Das 2013-11-11 16:59:27 -05:00
Родитель 97f56301da
Коммит 05b3b947f1
3 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -125,9 +125,10 @@ class TestElements(MarionetteTestCase):
def test_timeout(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
button = self.marionette.find_element("id", "createDivButton")
button.click()
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "newDiv")
self.assertTrue(True, self.marionette.set_search_timeout(4000))
self.marionette.navigate(test_html)
self.assertTrue(True, self.marionette.set_search_timeout(8000))
self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "newDiv")))
def test_css_selector_scope_doesnt_start_at_rootnode(self):

Просмотреть файл

@ -33,12 +33,16 @@ class TestTimeouts(MarionetteTestCase):
def test_searchtimeout_found_settimeout(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.marionette.timeouts("implicit", 4000)
button = self.marionette.find_element("id", "createDivButton")
button.click()
self.marionette.timeouts("implicit", 8000)
self.assertEqual(HTMLElement, type(self.marionette.find_element("id", "newDiv")))
def test_searchtimeout_found(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
button = self.marionette.find_element("id", "createDivButton")
button.click()
self.assertRaises(NoSuchElementException, self.marionette.find_element, "id", "newDiv")
def test_execute_async_timeout_settimeout(self):

Просмотреть файл

@ -11,13 +11,15 @@
<h1 id="testh1">Test Page</h1>
<script type="text/javascript">
window.ready = true;
setTimeout(addDelayedElement, 1000);
function addDelayedElement() {
var newDiv = document.createElement("div");
newDiv.id = "newDiv";
var newContent = document.createTextNode("I am a newly created div!");
newDiv.appendChild(newContent);
document.body.appendChild(newDiv);
setTimeout(createDiv, 2000);
function createDiv() {
var newDiv = document.createElement("div");
newDiv.id = "newDiv";
var newContent = document.createTextNode("I am a newly created div!");
newDiv.appendChild(newContent);
document.body.appendChild(newDiv);
}
}
function clicked() {
var link = document.getElementById("mozLink");
@ -31,5 +33,6 @@
</div>
<input name="myInput" type="text" value="asdf"/>
<input name="myCheckBox" type="checkbox" />
<input id="createDivButton" type="button" value="create a div" onclick="addDelayedElement()" />
</body>
</html>