summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/old-tests/webdriver/timeouts
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/old-tests/webdriver/timeouts
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/old-tests/webdriver/timeouts')
-rw-r--r--testing/web-platform/tests/old-tests/webdriver/timeouts/__init__.py0
-rw-r--r--testing/web-platform/tests/old-tests/webdriver/timeouts/implicit_waits_tests.py64
-rw-r--r--testing/web-platform/tests/old-tests/webdriver/timeouts/page_load_timeouts_tests.py26
-rw-r--r--testing/web-platform/tests/old-tests/webdriver/timeouts/res/implicit_waits_tests.html38
-rw-r--r--testing/web-platform/tests/old-tests/webdriver/timeouts/res/page_load_timeouts_tests.html12
5 files changed, 140 insertions, 0 deletions
diff --git a/testing/web-platform/tests/old-tests/webdriver/timeouts/__init__.py b/testing/web-platform/tests/old-tests/webdriver/timeouts/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/old-tests/webdriver/timeouts/__init__.py
diff --git a/testing/web-platform/tests/old-tests/webdriver/timeouts/implicit_waits_tests.py b/testing/web-platform/tests/old-tests/webdriver/timeouts/implicit_waits_tests.py
new file mode 100644
index 000000000..5faa0ad12
--- /dev/null
+++ b/testing/web-platform/tests/old-tests/webdriver/timeouts/implicit_waits_tests.py
@@ -0,0 +1,64 @@
+import os
+import sys
+import unittest
+
+sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
+import base_test
+from selenium.common import exceptions
+
+
+class ImplicitWaitsTests(base_test.WebDriverBaseTest):
+ def setUp(self):
+ self.driver.get(self.webserver.where_is('timeouts/res/implicit_waits_tests.html'))
+
+ def test_find_element_by_id(self):
+ add = self.driver.find_element_by_css_selector("#adder")
+ self.driver.implicitly_wait(3)
+ add.click()
+ self.driver.find_element_by_css_selector("#box0") # All is well if this doesn't throw.
+
+ def test_should_still_fail_to_find_an_element_when_implicit_waits_are_enabled(self):
+ self.driver.implicitly_wait(0.5)
+ try:
+ self.driver.find_element_by_css_selector("#box0")
+ self.fail("Expected NoSuchElementException to have been thrown")
+ except exceptions.NoSuchElementException as e:
+ pass
+ except Exception as e:
+ self.fail("Expected NoSuchElementException but got " + str(e))
+
+ def test_should_return_after_first_attempt_to_find_one_after_disabling_implicit_waits(self):
+ self.driver.implicitly_wait(3)
+ self.driver.implicitly_wait(0)
+ try:
+ self.driver.find_element_by_css_selector("#box0")
+ self.fail("Expected NoSuchElementException to have been thrown")
+ except exceptions.NoSuchElementException as e:
+ pass
+ except Exception as e:
+ self.fail("Expected NoSuchElementException but got " + str(e))
+
+ def test_should_implicitly_wait_until_at_least_one_element_is_found_when_searching_for_many(self):
+ add = self.driver.find_element_by_css_selector("#adder")
+ self.driver.implicitly_wait(2)
+ add.click()
+ add.click()
+ elements = self.driver.find_elements_by_css_selector(".redbox")
+ self.assertTrue(len(elements) >= 1)
+
+ def test_should_still_fail_to_find_an_element_by_class_when_implicit_waits_are_enabled(self):
+ self.driver.implicitly_wait(0.5)
+ elements = self.driver.find_elements_by_css_selector(".redbox")
+ self.assertEqual(0, len(elements))
+
+ def test_should_return_after_first_attempt_to_find_many_after_disabling_implicit_waits(self):
+ add = self.driver.find_element_by_css_selector("#adder")
+ self.driver.implicitly_wait(1.1)
+ self.driver.implicitly_wait(0)
+ add.click()
+ elements = self.driver.find_elements_by_css_selector(".redbox")
+ self.assertEqual(0, len(elements))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/testing/web-platform/tests/old-tests/webdriver/timeouts/page_load_timeouts_tests.py b/testing/web-platform/tests/old-tests/webdriver/timeouts/page_load_timeouts_tests.py
new file mode 100644
index 000000000..2f0d3beeb
--- /dev/null
+++ b/testing/web-platform/tests/old-tests/webdriver/timeouts/page_load_timeouts_tests.py
@@ -0,0 +1,26 @@
+import os
+import sys
+import unittest
+
+sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
+import base_test
+from selenium.common import exceptions
+
+
+class PageLoadTimeoutTest(base_test.WebDriverBaseTest):
+ def test_should_timeout_on_page_load_taking_too_long(self):
+ self.driver.set_page_load_timeout(0.01)
+ with self.assertRaises(exceptions.TimeoutException):
+ self.load_page()
+
+ def test_should_not_timeout_on_page_load(self):
+ self.driver.set_page_load_timeout(30)
+ self.load_page()
+ pass
+
+ def load_page(self):
+ self.driver.get(self.webserver.where_is('timeouts/res/page_load_timeouts_tests.html'))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/testing/web-platform/tests/old-tests/webdriver/timeouts/res/implicit_waits_tests.html b/testing/web-platform/tests/old-tests/webdriver/timeouts/res/implicit_waits_tests.html
new file mode 100644
index 000000000..ce39877fa
--- /dev/null
+++ b/testing/web-platform/tests/old-tests/webdriver/timeouts/res/implicit_waits_tests.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<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> \ No newline at end of file
diff --git a/testing/web-platform/tests/old-tests/webdriver/timeouts/res/page_load_timeouts_tests.html b/testing/web-platform/tests/old-tests/webdriver/timeouts/res/page_load_timeouts_tests.html
new file mode 100644
index 000000000..555e19b70
--- /dev/null
+++ b/testing/web-platform/tests/old-tests/webdriver/timeouts/res/page_load_timeouts_tests.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Hello WebDriver</title>
+</head>
+<body>
+ <h1>Page Load Timeouts Test</h1>
+ <div>
+ Say Cheese
+ </div>
+</body>
+</html>