Bug 1316622 - Correct Marionette timeouts tests; r=automatedtester,whimboo

MozReview-Commit-ID: 48JLDwc2sw4

--HG--
extra : rebase_source : 21f689abe584f3c9de98dafde07d85a8d0dc67fc
This commit is contained in:
Andreas Tolfsen 2016-11-10 21:06:00 +00:00
Родитель 0e34276dbf
Коммит b980bd27cc
1 изменённых файлов: 19 добавлений и 7 удалений

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

@ -21,21 +21,21 @@ class TestTimeouts(MarionetteTestCase):
self.marionette.navigate(test_html)
def test_page_timeout_fail(self):
self.marionette.set_page_load_timeout(0)
self.marionette.timeout.page_load = 0
test_html = self.marionette.absolute_url("test.html")
self.assertRaises(MarionetteException, self.marionette.navigate, test_html)
def test_page_timeout_pass(self):
self.marionette.set_page_load_timeout(60000)
self.marionette.timeout.page_load = 60
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
def test_search_timeout_notfound_settimeout(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.marionette.set_search_timeout(1000)
self.marionette.timeout.implicit = 1
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
self.marionette.set_search_timeout(0)
self.marionette.timeout.implicit = 0
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
def test_search_timeout_found_settimeout(self):
@ -43,7 +43,7 @@ class TestTimeouts(MarionetteTestCase):
self.marionette.navigate(test_html)
button = self.marionette.find_element(By.ID, "createDivButton")
button.click()
self.marionette.set_search_timeout(8000)
self.marionette.timeout.implicit = 8
self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "newDiv")))
def test_search_timeout_found(self):
@ -56,13 +56,13 @@ class TestTimeouts(MarionetteTestCase):
def test_execute_async_timeout_settimeout(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.marionette.set_script_timeout(10000)
self.marionette.timeout.script = 1
self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "var x = 1;")
def test_no_timeout_settimeout(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.marionette.set_script_timeout(10000)
self.marionette.timeout.script = 1
self.assertTrue(self.marionette.execute_async_script("""
var callback = arguments[arguments.length - 1];
setTimeout(function() { callback(true); }, 500);
@ -78,3 +78,15 @@ class TestTimeouts(MarionetteTestCase):
def test_deprecated_set_timeouts_command(self):
body = {"implicit": 3000}
self.marionette._send_message("timeouts", body)
def test_deprecated_set_search_timeout(self):
self.marionette.set_search_timeout(1000)
self.assertEqual(1, self.marionette.timeout.implicit)
def test_deprecated_set_script_timeout(self):
self.marionette.set_script_timeout(2000)
self.assertEqual(2, self.marionette.timeout.script)
def test_deprecated_set_page_load_timeout(self):
self.marionette.set_page_load_timeout(3000)
self.assertEqual(3, self.marionette.timeout.page_load)