Bug 1335778 - Harden test_page_timeout_fail against intermittent failures. r=ato

Tests for page timeout durations have to use an HTTPD handler that delays
or slows down document load. Otherwise there a risk that the timeout error
is not returned before the document finishes loading.

MozReview-Commit-ID: HGGcXfCuaSH

--HG--
extra : rebase_source : c79b01ca4e56e21877c6fe94309b7b0424d9b552
This commit is contained in:
Henrik Skupin 2017-04-13 14:57:25 +02:00
Родитель 2a85a061ba
Коммит 0c281b238c
1 изменённых файлов: 9 добавлений и 5 удалений

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

@ -24,8 +24,9 @@ class TestTimeouts(MarionetteTestCase):
def test_page_timeout_fail(self):
self.marionette.timeout.page_load = 0
test_html = self.marionette.absolute_url("test.html")
self.assertRaises(MarionetteException, self.marionette.navigate, test_html)
test_html = self.marionette.absolute_url("slow")
with self.assertRaises(MarionetteException):
self.marionette.navigate(test_html)
def test_page_timeout_pass(self):
self.marionette.timeout.page_load = 60
@ -36,9 +37,11 @@ class TestTimeouts(MarionetteTestCase):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.marionette.timeout.implicit = 1
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
with self.assertRaises(NoSuchElementException):
self.marionette.find_element(By.ID, "I'm not on the page")
self.marionette.timeout.implicit = 0
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
with self.assertRaises(NoSuchElementException):
self.marionette.find_element(By.ID, "I'm not on the page")
@skip_if_mobile("Bug 1317121 - android emulator is too slow")
def test_search_timeout_found_settimeout(self):
@ -82,7 +85,8 @@ class TestTimeouts(MarionetteTestCase):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.marionette.timeout.script = 1
self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "var x = 1;")
with 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")