From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../tests/old-tests/webdriver/README.md | 38 +++ .../tests/old-tests/webdriver/base_test.py | 60 ++++ .../webdriver/command_contexts/__init__.py | 0 .../command_contexts/open_and_close_window_test.py | 64 ++++ .../webdriver/command_contexts/res/first-page.html | 11 + .../webdriver/command_contexts/res/other-page.html | 11 + .../command_contexts/window_handle_test.py | 33 ++ .../webdriver/command_contexts/window_size_test.py | 35 +++ .../tests/old-tests/webdriver/cookie/__init__.py | 0 .../old-tests/webdriver/cookie/cookie_test.py | 57 ++++ .../webdriver/cookie/res/cookie_container.html | 5 + .../webdriver/ecmascript/ecmascript_test.py | 17 + .../webdriver/ecmascript/res/ecmascript_test.html | 2 + .../webdriver/element_location/__init__.py | 0 .../element_location/element_location_test.py | 60 ++++ .../webdriver/element_location/res/elements.html | 10 + .../old-tests/webdriver/element_state/__init__.py | 0 .../webdriver/element_state/method_test.py | 107 +++++++ .../webdriver/element_state/properties.py | 17 + .../webdriver/element_state/res/0x0-pixels.html | 12 + .../webdriver/element_state/res/1x1-pixels.html | 12 + .../element_state/res/a-with-href-attribute.html | 5 + ...absolute-children-ancestor-hidden-overflow.html | 16 + .../webdriver/element_state/res/body_empty.html | 4 + .../webdriver/element_state/res/body_implicit.html | 3 + .../element_state/res/body_overflow_hidden.html | 4 + .../element_state/res/body_visibility_hidden.html | 4 + .../webdriver/element_state/res/display-block.html | 5 + .../element_state/res/display-none-child-link.html | 11 + .../res/display-none-child-paragraph.html | 11 + .../element_state/res/display-none-child.html | 11 + .../element_state/res/display-none-dynamic.html | 10 + .../display-none-parent-presedence-visibility.html | 15 + .../res/display-none-parent-presedence.html | 14 + .../webdriver/element_state/res/display-none.html | 11 + ...element-dynamically-moved-outside-viewport.html | 15 + .../res/element-hidden-by-other-element.html | 20 ++ .../res/element-hidden-by-z-index.html | 29 ++ ...nt-moved-behind-other-element-by-transform.html | 31 ++ ...lement-moved-outside-viewport-by-transform.html | 15 + .../res/element-outside-viewport.html | 13 + .../element-partially-hidden-by-other-element.html | 23 ++ .../element_state/res/element-selected.html | 89 ++++++ .../res/element-with-color-style-attribute.html | 5 + .../res/element-with-custom-attribute.html | 5 + .../res/element-with-id-attribute.html | 5 + .../res/element-with-same-color-as-background.html | 10 + ...ement-with-same-color-as-parent-background.html | 18 ++ .../res/element-with-style-attribute.html | 5 + .../res/element-without-attribute.html | 5 + .../webdriver/element_state/res/elements_text.html | 10 + .../res/get-element-attribute-extended.html | 72 +++++ .../hidden-input-type-checkbox-untogglable.html | 9 + .../res/hidden-input-type-text-writing.html | 9 + .../webdriver/element_state/res/hidden.html | 5 + .../element_state/res/img-with-src-attribute.html | 5 + .../res/input-morphs-into-hidden.html | 10 + .../res/input-type-hidden-unclickable.html | 5 + .../element_state/res/input-type-hidden.html | 5 + .../res/input-with-checked-attribute.html | 5 + .../res/input-without-checked-attribute.html | 5 + .../res/option-with-value-attribute.html | 7 + .../res/option-without-value-attribute.html | 7 + .../text-with-matching-color-and-background.html | 14 + .../res/text-with-same-color-as-background.html | 12 + .../text-with-same-color-as-parent-background.html | 14 + .../element_state/res/visibility-child-link.html | 11 + .../res/visibility-child-paragraph.html | 11 + .../res/visibility-child-presedence.html | 12 + .../element_state/res/visibility-child.html | 11 + .../element_state/res/visibility-hidden.html | 11 + .../element_state/res/visibility-visible.html | 5 + .../element_state/res/x-auto-y-hidden.html | 30 ++ .../element_state/res/x-hidden-y-auto.html | 30 ++ .../element_state/res/x-hidden-y-hidden.html | 30 ++ .../element_state/res/x-hidden-y-scroll.html | 30 ++ .../element_state/res/x-scroll-y-hidden.html | 30 ++ .../zero-sized-element-with-sizable-decendant.html | 14 + .../webdriver/element_state/selected_test.py | 210 +++++++++++++ .../webdriver/element_state/visibility_test.py | 324 +++++++++++++++++++ .../old-tests/webdriver/javascript/__init__.py | 0 .../webdriver/javascript/execute_script_test.py | 129 ++++++++ .../javascript/res/execute_script_test.html | 2 + .../res/return_array_of_dom_elements.html | 3 + .../javascript/res/return_document_body.html | 2 + .../webdriver/javascript/res/return_node_list.html | 3 + .../tests/old-tests/webdriver/modal/__init__.py | 0 .../old-tests/webdriver/modal/alerts_quit_test.py | 26 ++ .../tests/old-tests/webdriver/modal/alerts_test.py | 148 +++++++++ .../old-tests/webdriver/modal/res/alerts.html | 53 ++++ .../old-tests/webdriver/navigation/__init__.py | 0 .../old-tests/webdriver/navigation/auth_tests.py | 42 +++ .../old-tests/webdriver/navigation/forward.py | 24 ++ .../webdriver/navigation/forwardToNothing.py | 20 ++ .../webdriver/navigation/get_from_http_test.py | 60 ++++ .../webdriver/navigation/invalid_cert_test.py | 28 ++ .../old-tests/webdriver/navigation/refresh-page.py | 27 ++ .../old-tests/webdriver/navigation/refresh_page.py | 27 ++ .../webdriver/navigation/res/1s-meta-redirect.html | 4 + .../navigation/res/60s-meta-redirect.html | 4 + .../webdriver/navigation/res/authenticated.html | 5 + .../old-tests/webdriver/navigation/res/empty.html | 4 + .../webdriver/navigation/res/forwardNext.html | 6 + .../webdriver/navigation/res/forwardStart.html | 6 + .../webdriver/navigation/res/fragment.html | 9 + .../navigation/res/instant-meta-redirect.html | 4 + .../navigation/res/refreshPageDynamic.html | 10 + .../navigation/res/refreshPageStatic.html | 6 + .../webdriver/navigation/res/self-signed.key | 28 ++ .../tests/old-tests/webdriver/network.py | 30 ++ .../tests/old-tests/webdriver/runtests.py | 14 + .../tests/old-tests/webdriver/runtests_p0.py | 42 +++ .../old-tests/webdriver/screenshot/__init__.py | 1 + .../webdriver/screenshot/res/screenshot.html | 5 + .../webdriver/screenshot/take_screenshot.py | 15 + .../tests/old-tests/webdriver/timeouts/__init__.py | 0 .../webdriver/timeouts/implicit_waits_tests.py | 64 ++++ .../webdriver/timeouts/page_load_timeouts_tests.py | 26 ++ .../timeouts/res/implicit_waits_tests.html | 38 +++ .../timeouts/res/page_load_timeouts_tests.html | 12 + .../old-tests/webdriver/user_input/__init__.py | 0 .../old-tests/webdriver/user_input/clear_test.py | 53 ++++ .../old-tests/webdriver/user_input/click_test.py | 349 +++++++++++++++++++++ .../old-tests/webdriver/user_input/res/click.html | 45 +++ .../res/element_clear_contenteditable_page.html | 13 + .../res/element_clear_disabled_input_page.html | 11 + .../res/element_clear_disabled_textarea_page.html | 13 + .../res/element_clear_readonly_input_page.html | 11 + .../res/element_clear_readonly_textarea_page.html | 13 + .../res/element_clear_writable_input_page.html | 11 + .../res/element_clear_writable_textarea_page.html | 13 + .../user_input/res/text-form-landing.html | 8 + .../webdriver/user_input/res/text-form.html | 25 ++ .../webdriver/user_input/sendkeys_test.py | 96 ++++++ .../tests/old-tests/webdriver/webdriver.cfg | 35 +++ .../tests/old-tests/webdriver/windows/__init__.py | 1 + .../old-tests/webdriver/windows/res/win1.html | 5 + .../old-tests/webdriver/windows/res/win2.html | 5 + .../old-tests/webdriver/windows/res/win3.html | 5 + .../old-tests/webdriver/windows/res/win4.html | 5 + .../old-tests/webdriver/windows/res/win5.html | 5 + .../tests/old-tests/webdriver/windows/tabbing.py | 30 ++ .../webdriver/windows/window_manipulation.py | 43 +++ 143 files changed, 3638 insertions(+) create mode 100644 testing/web-platform/tests/old-tests/webdriver/README.md create mode 100644 testing/web-platform/tests/old-tests/webdriver/base_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/command_contexts/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/command_contexts/open_and_close_window_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/command_contexts/res/first-page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/command_contexts/res/other-page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/command_contexts/window_handle_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/command_contexts/window_size_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/cookie/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/cookie/cookie_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/cookie/res/cookie_container.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/ecmascript/ecmascript_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/ecmascript/res/ecmascript_test.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_location/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_location/element_location_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_location/res/elements.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/method_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/properties.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/0x0-pixels.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/1x1-pixels.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/a-with-href-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/absolute-children-ancestor-hidden-overflow.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/body_empty.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/body_implicit.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/body_overflow_hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/body_visibility_hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-block.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-link.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-paragraph.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-dynamic.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence-visibility.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-dynamically-moved-outside-viewport.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-other-element.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-z-index.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-behind-other-element-by-transform.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-outside-viewport-by-transform.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-outside-viewport.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-partially-hidden-by-other-element.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-selected.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-color-style-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-custom-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-id-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-background.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-parent-background.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-style-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/element-without-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/elements_text.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/get-element-attribute-extended.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-checkbox-untogglable.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-text-writing.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/img-with-src-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/input-morphs-into-hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden-unclickable.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/input-with-checked-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/input-without-checked-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/option-with-value-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/option-without-value-attribute.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-matching-color-and-background.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-background.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-parent-background.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-link.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-paragraph.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-presedence.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-visible.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/x-auto-y-hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-auto.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-scroll.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/x-scroll-y-hidden.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/res/zero-sized-element-with-sizable-decendant.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/selected_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/element_state/visibility_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/javascript/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/javascript/execute_script_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/javascript/res/execute_script_test.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/javascript/res/return_array_of_dom_elements.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/javascript/res/return_document_body.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/javascript/res/return_node_list.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/modal/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/modal/alerts_quit_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/modal/alerts_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/modal/res/alerts.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/auth_tests.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/forward.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/forwardToNothing.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/get_from_http_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/invalid_cert_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/refresh-page.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/refresh_page.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/1s-meta-redirect.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/60s-meta-redirect.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/authenticated.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/empty.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardNext.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardStart.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/fragment.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/instant-meta-redirect.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageDynamic.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageStatic.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/navigation/res/self-signed.key create mode 100644 testing/web-platform/tests/old-tests/webdriver/network.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/runtests.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/runtests_p0.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/screenshot/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/screenshot/res/screenshot.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/screenshot/take_screenshot.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/timeouts/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/timeouts/implicit_waits_tests.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/timeouts/page_load_timeouts_tests.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/timeouts/res/implicit_waits_tests.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/timeouts/res/page_load_timeouts_tests.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/clear_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/click_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/click.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_contenteditable_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_input_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_textarea_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_input_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_textarea_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_input_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_textarea_page.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form-landing.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/user_input/sendkeys_test.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/webdriver.cfg create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/__init__.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/res/win1.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/res/win2.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/res/win3.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/res/win4.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/res/win5.html create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/tabbing.py create mode 100644 testing/web-platform/tests/old-tests/webdriver/windows/window_manipulation.py (limited to 'testing/web-platform/tests/old-tests/webdriver') diff --git a/testing/web-platform/tests/old-tests/webdriver/README.md b/testing/web-platform/tests/old-tests/webdriver/README.md new file mode 100644 index 000000000..7a89fb78a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/README.md @@ -0,0 +1,38 @@ +# W3C Browser Automation Specification Tests + +This repository defines a set of conformance tests for the W3C web +browser automation specification known as WebDriver. The purpose is +for the different driver implementations to be tested to determine +whether they meet the recognized standard. + +## How to run the tests + +1. Go to the WebDriver tests: `cd _WEBDRIVER_TEST_ROOT_` +2. Run the tests: `python runtests.py` +3. Run the test against a different config specified in webdriver.cfg: + `WD_BROWSER=chrome python runtests.py` + +To be run a specific test file you can just run `python test_file.py` + +Similarly you can specify a different browser to run against if in webdriver.cfg: + `WD_BROWSER=chrome python ecmascript/ecmascript_test.py` + +Note: that you will need likely need to start the driver's server before running. + +## Updating configuration + +The _webdriver.cfg_ file holds any configuration that the tests might +require. Change the value of browser to your needs. This will then +be picked up by WebDriverBaseTest when tests are run. + +Be sure not to commit your _webdriver.cfg_ changes when your create or modify tests. + +## How to write tests + +1. Create a test file per section from the specification. +2. For each test there needs to be one or more corresponding HTML + files that will be used for testing. HTML files are not to be + reused between tests. HTML files and other support files + should be stored in a folder named 'res'. +3. Test name should explain the intention of the test e.g. `def + test_navigate_and_return_title(self):` diff --git a/testing/web-platform/tests/old-tests/webdriver/base_test.py b/testing/web-platform/tests/old-tests/webdriver/base_test.py new file mode 100644 index 000000000..851099936 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/base_test.py @@ -0,0 +1,60 @@ +import ConfigParser +import json +import os +import sys +import unittest + +from network import get_lan_ip + +repo_root = os.path.abspath(os.path.join(__file__, "../..")) +sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver")) +sys.path.insert(1, os.path.join(repo_root, "tools", "wptserve")) +from wptserve import server +from selenium import webdriver + + +class WebDriverBaseTest(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.driver = create_driver() + + cls.webserver = server.WebTestHttpd(host=get_lan_ip()) + cls.webserver.start() + cls.webserver.where_is = cls.webserver.get_url + + @classmethod + def tearDownClass(cls): + cls.webserver.stop() + if cls.driver: + cls.driver.quit() + + +def create_driver(): + config = ConfigParser.ConfigParser() + config.read('webdriver.cfg') + section = os.environ.get("WD_BROWSER", 'firefox') + if config.has_option(section, 'url'): + url = config.get(section, "url") + else: + url = 'http://127.0.0.1:4444/wd/hub' + capabilities = None + if config.has_option(section, 'capabilities'): + try: + capabilities = json.loads(config.get(section, "capabilities")) + except: + pass + mode = 'compatibility' + if config.has_option(section, 'mode'): + mode = config.get(section, 'mode') + if section == 'firefox': + driver = webdriver.Firefox() + elif section == 'chrome': + driver = webdriver.Chrome() + elif section == 'edge': + driver = webdriver.Remote() + elif section == 'ie': + driver = webdriver.Ie() + elif section == 'selendroid': + driver = webdriver.Android() + + return driver diff --git a/testing/web-platform/tests/old-tests/webdriver/command_contexts/__init__.py b/testing/web-platform/tests/old-tests/webdriver/command_contexts/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/command_contexts/open_and_close_window_test.py b/testing/web-platform/tests/old-tests/webdriver/command_contexts/open_and_close_window_test.py new file mode 100644 index 000000000..61d04d93d --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/command_contexts/open_and_close_window_test.py @@ -0,0 +1,64 @@ +import os +import sys +import random +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + +repo_root = os.path.abspath(os.path.join(__file__, "../../..")) +sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver")) +from webdriver import exceptions + + +class OpenAndCloseWindowTest(base_test.WebDriverBaseTest): + def setUp(self): + self.driver.get(self.webserver.where_is("command_contexts/res/first-page.html")) + + def tearDown(self): + handles = self.driver.get_window_handles() + + for i in range(len(handles) - 1): + self.driver.switch_to_window(handles[i]) + self.driver.close() + + self.driver.switch_to_window(self.driver.get_window_handles()[0]) + + def test_open_new_window(self): + handles = self.driver.get_window_handles() + self.driver.find_element_by_id("open_new_window").click() + self.assertEquals(len(handles) + 1, len(self.driver.get_window_handles())) + + def test_get_window_handles_returns_the_windows_that_have_been_opened(self): + self.driver.find_element_by_id("open_new_window").click() + handles = self.driver.get_window_handles() + self.driver.switch_to_window(handles[0]) + url1 = self.driver.get_current_url() + self.driver.switch_to_window(handles[1]) + url2 = self.driver.get_current_url() + + if url1 == self.webserver.where_is("controlling_windows/res/other-page.html"): + self.assertEquals(url2, self.webserver.where_is("controlling_windows/res/first-page.html")) + elif url1 == self.webserver.where_is("controlling_windows/res/first-page.html"): + self.assertEquals(url2, self.webserver.where_is("controlling_windows/res/other-page.html")) + else: + self.fail("The wrong set of URLs were returned") + + def test_close_window(self): + open_windows = len(self.driver.get_window_handles()) + + self.driver.find_element_by_id("open_new_window").click() + self.assertEquals(1 + open_windows, len(self.driver.get_window_handles())) + + self.driver.close() + self.assertEquals(open_windows, len(self.driver.get_window_handles())) + + def test_command_sent_to_closed_window_returns_no_such_window_exception(self): + self.driver.find_element_by_id("open_new_window").click() + self.driver.close() + + with self.assertRaises(exceptions.NoSuchWindowException): + self.driver.get_window_handle() + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/command_contexts/res/first-page.html b/testing/web-platform/tests/old-tests/webdriver/command_contexts/res/first-page.html new file mode 100644 index 000000000..e4aa13ebd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/command_contexts/res/first-page.html @@ -0,0 +1,11 @@ + + + + + + First Page + + + Open new window + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/command_contexts/res/other-page.html b/testing/web-platform/tests/old-tests/webdriver/command_contexts/res/other-page.html new file mode 100644 index 000000000..4bb487452 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/command_contexts/res/other-page.html @@ -0,0 +1,11 @@ + + + + + + Other Page + + + Open new window + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/command_contexts/window_handle_test.py b/testing/web-platform/tests/old-tests/webdriver/command_contexts/window_handle_test.py new file mode 100644 index 000000000..6d8e569f0 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/command_contexts/window_handle_test.py @@ -0,0 +1,33 @@ +import os +import sys +import random +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + +repo_root = os.path.abspath(os.path.join(__file__, "../../..")) +sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver")) +from webdriver import exceptions + + +class WindowHandleTest(base_test.WebDriverBaseTest): + def setUp(self): + self.driver.get(self.webserver.where_is("command_contexts/res/first-page.html")) + + def test_window_handle_is_not_current(self): + handle = self.driver.get_window_handle() + self.assertNotEquals(handle, "current") + + def test_window_handles_are_unique(self): + number_of_windows = 20 + new_window_button = self.driver.find_element_by_id("open_new_window") + for i in range(0, number_of_windows): + new_window_button.click() + + handles = self.driver.get_window_handles() + if len(handles) > len(set(handles)): + self.fail('At least one window handle was repeated') + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/command_contexts/window_size_test.py b/testing/web-platform/tests/old-tests/webdriver/command_contexts/window_size_test.py new file mode 100644 index 000000000..955e9fea0 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/command_contexts/window_size_test.py @@ -0,0 +1,35 @@ +import os +import sys +import random +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + +repo_root = os.path.abspath(os.path.join(__file__, "../../..")) +sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver")) +from webdriver import exceptions + +class WindowSizeTest(base_test.WebDriverBaseTest): + + def test_set_and_get_window_size(self): + self.driver.get(self.webserver.where_is("command_contexts/res/first-page.html")) + + initial_dimensions = self.driver.get_window_size() + + new_dimensions = { + "height": initial_dimensions["height"] - 100, + "width": initial_dimensions["width"] - 100} + + try: + self.driver.set_window_size(new_dimensions["height"], new_dimensions["width"]) + + actual_dimensions = self.driver.get_window_size() + + self.assertDictEqual(new_dimensions, actual_dimensions) + except exceptions.UnsupportedOperationException: + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/cookie/__init__.py b/testing/web-platform/tests/old-tests/webdriver/cookie/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/cookie/cookie_test.py b/testing/web-platform/tests/old-tests/webdriver/cookie/cookie_test.py new file mode 100644 index 000000000..e57d46713 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/cookie/cookie_test.py @@ -0,0 +1,57 @@ +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 CookieTest(base_test.WebDriverBaseTest): + def setUp(self): + self.driver.get(self.webserver.where_is("cookie/res/cookie_container.html")) + + def test_can_create_a_well_formed_cookie( self ): + self.driver.add_cookie({'name': 'foo', 'value': 'bar'}) + + def test_cookies_should_allow_secure_to_be_set( self ): + name = 'foo' + self.driver.add_cookie({'name': name, + 'value': 'bar', + 'path': '/', + 'secure': (True)}) + self.assertTrue(self.driver.get_cookie(name)[0]['secure']) + + def test_secure_defaults_to_false( self ): + name = 'foo' + value = 'bar' + + self.driver.add_cookie({ 'name': name, + 'value': value}) + + self.assertFalse(self.driver.get_cookie(name)[0]['secure']) + + def test_should_throw_an_exception_when_semicolon_exists_in_the_cookie_attribute(self): + invalid_name = 'foo;bar' + try: + self.driver.add_cookie({'name': invalid_name, 'value': 'foobar'}) + self.fail( 'should have thrown exceptions.' ) + + except exceptions.UnableToSetCookieException: + pass + except exceptions.InvalidCookieDomainException: + pass + + def test_should_throw_an_exception_the_name_is_null(self): + try: + self.driver.add_cookie({'name': None, 'value': 'foobar'}) + self.fail( 'should have thrown exceptions.' ) + + except exceptions.UnableToSetCookieException: + pass + except exceptions.InvalidCookieDomainException: + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/cookie/res/cookie_container.html b/testing/web-platform/tests/old-tests/webdriver/cookie/res/cookie_container.html new file mode 100644 index 000000000..bb6b209bb --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/cookie/res/cookie_container.html @@ -0,0 +1,5 @@ + + +Cookie Container + + diff --git a/testing/web-platform/tests/old-tests/webdriver/ecmascript/ecmascript_test.py b/testing/web-platform/tests/old-tests/webdriver/ecmascript/ecmascript_test.py new file mode 100644 index 000000000..89764bf68 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/ecmascript/ecmascript_test.py @@ -0,0 +1,17 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class EcmasScriptTest(base_test.WebDriverBaseTest): + def test_that_ecmascript_returns_document_title(self): + self.driver.get(self.webserver.where_is("ecmascript/res/ecmascript_test.html")) + result = self.driver.execute_script("return document.title;"); + self.assertEquals("ecmascript test", result); + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/ecmascript/res/ecmascript_test.html b/testing/web-platform/tests/old-tests/webdriver/ecmascript/res/ecmascript_test.html new file mode 100644 index 000000000..346e2ef75 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/ecmascript/res/ecmascript_test.html @@ -0,0 +1,2 @@ + +ecmascript test \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_location/__init__.py b/testing/web-platform/tests/old-tests/webdriver/element_location/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/element_location/element_location_test.py b/testing/web-platform/tests/old-tests/webdriver/element_location/element_location_test.py new file mode 100644 index 000000000..aff548ea5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_location/element_location_test.py @@ -0,0 +1,60 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + +class ElementLocationTest(base_test.WebDriverBaseTest): + def test_find_element_by_name(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_element_by_name("name") + self.assertEquals("name", e.text) + + def test_find_element_by_css_selector(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_element_by_css_selector("#id") + self.assertEquals("id", e.text) + + def test_find_element_by_link_text(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_element_by_link_text("link text") + self.assertEquals("link text", e.text) + + def test_find_element_by_partial_link_text(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_element_by_partial_link_text("link tex") + self.assertEquals("link text", e.text) + + def test_find_element_by_xpath(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_element_by_xpath("//*[@id='id']") + self.assertEquals("id", e.text) + + def test_find_elements_by_name(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_elements_by_name("name") + self.assertEquals("name", e[0].text) + + def test_find_elements_by_css_selector(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_elements_by_css_selector("#id") + self.assertEquals("id", e[0].text) + + def test_find_elements_by_link_text(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_elements_by_link_text("link text") + self.assertEquals("link text", e[0].text) + + def test_find_elements_by_partial_link_text(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_elements_by_partial_link_text("link tex") + self.assertEquals("link text", e[0].text) + + def test_find_elements_by_xpath(self): + self.driver.get(self.webserver.where_is("element_location/res/elements.html")) + e = self.driver.find_elements_by_xpath("//*[@id='id']") + self.assertEquals("id", e[0].text) + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/element_location/res/elements.html b/testing/web-platform/tests/old-tests/webdriver/element_location/res/elements.html new file mode 100644 index 000000000..45b7c2370 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_location/res/elements.html @@ -0,0 +1,10 @@ + + + +Element location + + +
id
+
name
+ link text + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/__init__.py b/testing/web-platform/tests/old-tests/webdriver/element_state/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/method_test.py b/testing/web-platform/tests/old-tests/webdriver/element_state/method_test.py new file mode 100644 index 000000000..85b240c7a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/method_test.py @@ -0,0 +1,107 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class GetElementAttributeTest(base_test.WebDriverBaseTest): + def test_get_element_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/element-with-id-attribute.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertEqual("myId", el.get_attribute("id")) + + def test_style_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/element-with-style-attribute.html")) + el = self.driver.find_element_by_css_selector("div") + expected_style = """ + font-family: \"Gill Sans Extrabold\",Helvetica,sans-serif; + line-height: 1.2; font-weight: bold; + """ + self.assertEqual(expected_style, el.get_attribute("style")) + + def test_color_serialization_of_style_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/element-with-color-style-attribute.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertEqual("color: rgba(255, 0, 0, 1.0);", el.get_attribute("style")) + + def test_true_if_boolean_attribute_present(self): + self.driver.get(self.webserver.where_is("element_state/res/input-with-checked-attribute.html")) + el = self.driver.find_element_by_css_selector("input") + self.assertEqual("true", el.get_attribute("checked")) + + def test_none_if_boolean_attribute_absent(self): + self.driver.get(self.webserver.where_is("element_state/res/input-without-checked-attribute.html")) + el = self.driver.find_element_by_css_selector("input") + self.assertIsNone(el.get_attribute("checked")) + + def test_option_with_attribute_value(self): + self.driver.get(self.webserver.where_is("element_state/res/option-with-value-attribute.html")) + el = self.driver.find_element_by_css_selector("option") + self.assertEqual("value1", el.get_attribute("value")) + + def test_option_without_value_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/option-without-value-attribute.html")) + el = self.driver.find_element_by_css_selector("option") + self.assertEqual("Value 1", el.get_attribute("value")) + + def test_a_href_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/a-with-href-attribute.html")) + el = self.driver.find_element_by_css_selector("a") + self.assertEqual("http://web-platform.test:8000/path#fragment", el.get_attribute("href")) + + def test_img_src_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/img-with-src-attribute.html")) + el = self.driver.find_element_by_css_selector("img") + self.assertEqual("http://web-platform.test:8000/images/blue.png", el.get_attribute("src")) + + def test_custom_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/element-with-custom-attribute.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertEqual("attribute value", el.get_attribute("webdriver-custom-attribute")) + + def test_attribute_not_present(self): + self.driver.get(self.webserver.where_is("element_state/res/element-without-attribute.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertIsNone(el.get_attribute("class")) + + def test_find_attribute_with_special_characters(self): + self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html")) + element = self.driver.find_element_by_id("id_special_char_attribute_name") + attribute = element.get_attribute("*") + self.assertEquals("special_char_attribute_name", attribute) + + def test_find_attribute_with_special_char_name_and_value(self): + self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html")) + element = self.driver.find_element_by_id("id_special_char_attribute_name_and_value") + attribute = element.get_attribute("@") + self.assertEquals("(", attribute) + + def test_find_attribute_with_numeric_name(self): + self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html")) + element = self.driver.find_element_by_id("id_attribute_name_numeric") + attribute = element.get_attribute("1") + self.assertEquals("numeric attribute name", attribute) + + def test_find_attribute_with_numeric_value(self): + self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html")) + element = self.driver.find_element_by_id("id_attribute_value_numeric") + attribute = element.get_attribute("one") + self.assertEquals("2", attribute) + + def test_find_attribute_with_negative_numeric_name(self): + self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html")) + element = self.driver.find_element_by_id("id_attribute_negative_numeric_name") + attribute = element.get_attribute("-5") + self.assertEquals("attribute name is -5", attribute) + + def test_find_attribute_with_negative_numeric_value(self): + self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html")) + element = self.driver.find_element_by_id("id_attribute_negative_numeric_value") + attribute = element.get_attribute("negative_numeric_value") + self.assertEquals("-9", attribute) + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/properties.py b/testing/web-platform/tests/old-tests/webdriver/element_state/properties.py new file mode 100644 index 000000000..a76770085 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/properties.py @@ -0,0 +1,17 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class GetElementPropertiesTest(base_test.WebDriverBaseTest): + def test_get_element_text(self): + self.driver.get(self.webserver.where_is("element_state/res/elements_text.html")) + e = self.driver.find_element_by_name("name") + self.assertEquals("name", e.text) + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/0x0-pixels.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/0x0-pixels.html new file mode 100644 index 000000000..3b081ca09 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/0x0-pixels.html @@ -0,0 +1,12 @@ + + +0x0 pixel element + + + +
This element is not visible.
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/1x1-pixels.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/1x1-pixels.html new file mode 100644 index 000000000..f9b2cbc3c --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/1x1-pixels.html @@ -0,0 +1,12 @@ + + +1x1 pixel element + + + +

This element is visible.

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/a-with-href-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/a-with-href-attribute.html new file mode 100644 index 000000000..7722426a3 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/a-with-href-attribute.html @@ -0,0 +1,5 @@ + + +"a" element with not fully qualified url + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/absolute-children-ancestor-hidden-overflow.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/absolute-children-ancestor-hidden-overflow.html new file mode 100644 index 000000000..fcf104414 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/absolute-children-ancestor-hidden-overflow.html @@ -0,0 +1,16 @@ + + +Parent node visible with absolutely positioned children, where ancestor overflow is hidden + + + +
+
grated
+
cheese
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_empty.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_empty.html new file mode 100644 index 000000000..0f4dff691 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_empty.html @@ -0,0 +1,4 @@ + + +BODY element has no children. MUST be reported displayed + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_implicit.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_implicit.html new file mode 100644 index 000000000..f45815380 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_implicit.html @@ -0,0 +1,3 @@ + + +BODY tag is omitted; BODY element MUST be reported displayed diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_overflow_hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_overflow_hidden.html new file mode 100644 index 000000000..1411ef37b --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_overflow_hidden.html @@ -0,0 +1,4 @@ + + +BODY element with style=overflow:hidden. MUST be reported displayed + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_visibility_hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_visibility_hidden.html new file mode 100644 index 000000000..ce4d41036 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/body_visibility_hidden.html @@ -0,0 +1,4 @@ + + +BODY element with style=visibility:hidden. MUST be reported displayed + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-block.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-block.html new file mode 100644 index 000000000..0f31557e6 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-block.html @@ -0,0 +1,5 @@ + + +display: block; + +

This element is visible.

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-link.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-link.html new file mode 100644 index 000000000..88bdef6b5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-link.html @@ -0,0 +1,11 @@ + + +display: none applies to child node links + + + +
+ hidden +
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-paragraph.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-paragraph.html new file mode 100644 index 000000000..31ab16da4 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child-paragraph.html @@ -0,0 +1,11 @@ + + +display: none applies to child node paragraphs + + + +
+

hidden

+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child.html new file mode 100644 index 000000000..b45ea0e5a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-child.html @@ -0,0 +1,11 @@ + + +display: none applies to child nodes + + + +
+
Brie is good
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-dynamic.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-dynamic.html new file mode 100644 index 000000000..074f0b3c1 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-dynamic.html @@ -0,0 +1,10 @@ + + +display: none set dynamically + +

Should not be visible + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence-visibility.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence-visibility.html new file mode 100644 index 000000000..37ca02391 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence-visibility.html @@ -0,0 +1,15 @@ + + +display: none on parent takes presedence over visibility: visible on child node + + + +

+
+ hidden +
+
+in \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence.html new file mode 100644 index 000000000..0f166d1e5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none-parent-presedence.html @@ -0,0 +1,14 @@ + + +display: none on parent takes presedence + + + +
+
+ hidden +
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none.html new file mode 100644 index 000000000..469fc934b --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/display-none.html @@ -0,0 +1,11 @@ + + +display: none; + + + +

This element is not visible.

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-dynamically-moved-outside-viewport.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-dynamically-moved-outside-viewport.html new file mode 100644 index 000000000..e31912bfd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-dynamically-moved-outside-viewport.html @@ -0,0 +1,15 @@ + + +Element outside viewport + + + +
hidden
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-other-element.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-other-element.html new file mode 100644 index 000000000..a2cf645a3 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-other-element.html @@ -0,0 +1,20 @@ + + +Element hidden by other element + + + +
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-z-index.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-z-index.html new file mode 100644 index 000000000..05e8eebeb --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-hidden-by-z-index.html @@ -0,0 +1,29 @@ + + +Element hidden by z-index + + + +
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-behind-other-element-by-transform.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-behind-other-element-by-transform.html new file mode 100644 index 000000000..f91e729de --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-behind-other-element-by-transform.html @@ -0,0 +1,31 @@ + + +Element moved behind other element by transform + + + +
+
+ diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-outside-viewport-by-transform.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-outside-viewport-by-transform.html new file mode 100644 index 000000000..51f6ee89f --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-moved-outside-viewport-by-transform.html @@ -0,0 +1,15 @@ + + +Element moved outside viewpor by transform + + + +
Cheddar!
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-outside-viewport.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-outside-viewport.html new file mode 100644 index 000000000..e3382ad09 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-outside-viewport.html @@ -0,0 +1,13 @@ + + +Element outside viewport + + + +
hidden
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-partially-hidden-by-other-element.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-partially-hidden-by-other-element.html new file mode 100644 index 000000000..3d0325928 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-partially-hidden-by-other-element.html @@ -0,0 +1,23 @@ + + +Element partially hidden by other element + + + +
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-selected.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-selected.html new file mode 100644 index 000000000..c2ad98924 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-selected.html @@ -0,0 +1,89 @@ + + + + + + + + + + + + +

Input Checkbox Elements

+selected-8 + +selected-9 + +unselected-10 +unselected-11 + +unselected-12 + +unselected-13 +selected-10 + +

Input Radio Elements

+
Group 1:
+selected-11 +
Group 2:
+selected-12 + +
Group 3:
+unselected-14 +selected-13 +
Group 4:
+unselected-15 +selected-14 +
Group 5:
+unselected-16 +unselected-17 + +
Group 6
+selected-15 +unselected-18 + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-color-style-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-color-style-attribute.html new file mode 100644 index 000000000..acf2fc095 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-color-style-attribute.html @@ -0,0 +1,5 @@ + + +Element with color style attribute + +
 
\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-custom-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-custom-attribute.html new file mode 100644 index 000000000..8f84b97ff --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-custom-attribute.html @@ -0,0 +1,5 @@ + + +Element with custom attribute + +
 
\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-id-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-id-attribute.html new file mode 100644 index 000000000..7512344f5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-id-attribute.html @@ -0,0 +1,5 @@ + + +Element with id attribute + +
 
\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-background.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-background.html new file mode 100644 index 000000000..aaea9a935 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-background.html @@ -0,0 +1,10 @@ + + +Element with same color as background + + + +
 
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-parent-background.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-parent-background.html new file mode 100644 index 000000000..80a4118df --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-same-color-as-parent-background.html @@ -0,0 +1,18 @@ + + +Element with same color as background + + + +
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-style-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-style-attribute.html new file mode 100644 index 000000000..b163a751a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-with-style-attribute.html @@ -0,0 +1,5 @@ + + +Element with style attribute + +
 
\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-without-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-without-attribute.html new file mode 100644 index 000000000..b03d4545b --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/element-without-attribute.html @@ -0,0 +1,5 @@ + + +Element without attribute + +
 
\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/elements_text.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/elements_text.html new file mode 100644 index 000000000..45b7c2370 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/elements_text.html @@ -0,0 +1,10 @@ + + + +Element location + + +
id
+
name
+ link text + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/get-element-attribute-extended.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/get-element-attribute-extended.html new file mode 100644 index 000000000..1fff60f03 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/get-element-attribute-extended.html @@ -0,0 +1,72 @@ + + +Get Element Attribute Extended + +Span +Span + +
+
+
+

h1 element, id:h1_div1.1_div1

+
+
+ +
+
+
+ Span +
+
+
+ +
+ anchor text 123 + anchor text 123 + + +
+ +
+
+
+ + Span + Span +
+ +
+ + + +
+
+
+
+
+
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-checkbox-untogglable.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-checkbox-untogglable.html new file mode 100644 index 000000000..7e7c2e238 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-checkbox-untogglable.html @@ -0,0 +1,9 @@ + + +Hidden INPUT @type="checkbox" is untogglable + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-text-writing.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-text-writing.html new file mode 100644 index 000000000..a1db85009 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden-input-type-text-writing.html @@ -0,0 +1,9 @@ + + +Typing in hidden input is impossible + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden.html new file mode 100644 index 000000000..0e8097e97 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/hidden.html @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/img-with-src-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/img-with-src-attribute.html new file mode 100644 index 000000000..057bb9bf5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/img-with-src-attribute.html @@ -0,0 +1,5 @@ + + +"img" element with not fully qualified url + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-morphs-into-hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-morphs-into-hidden.html new file mode 100644 index 000000000..98b954855 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-morphs-into-hidden.html @@ -0,0 +1,10 @@ + + +INPUT motphs into @type="hidden" + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden-unclickable.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden-unclickable.html new file mode 100644 index 000000000..b06822b10 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden-unclickable.html @@ -0,0 +1,5 @@ + + +INPUT @type="hidden" is unclickable + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden.html new file mode 100644 index 000000000..b7195709d --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-type-hidden.html @@ -0,0 +1,5 @@ + + +INPUT @type="hidden" are always hidden + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-with-checked-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-with-checked-attribute.html new file mode 100644 index 000000000..d7aad5ea5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-with-checked-attribute.html @@ -0,0 +1,5 @@ + + +Input with checked attribute + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-without-checked-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-without-checked-attribute.html new file mode 100644 index 000000000..9f1d5ad35 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/input-without-checked-attribute.html @@ -0,0 +1,5 @@ + + +Input without checked attribute + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/option-with-value-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/option-with-value-attribute.html new file mode 100644 index 000000000..5ef08c405 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/option-with-value-attribute.html @@ -0,0 +1,7 @@ + + +Option with value attribute + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/option-without-value-attribute.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/option-without-value-attribute.html new file mode 100644 index 000000000..5f6087ddd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/option-without-value-attribute.html @@ -0,0 +1,7 @@ + + +Option without value attribute + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-matching-color-and-background.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-matching-color-and-background.html new file mode 100644 index 000000000..d6591ef04 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-matching-color-and-background.html @@ -0,0 +1,14 @@ + + +Text with matching color and background + + + +

+ This on the other hand, should be visible +

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-background.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-background.html new file mode 100644 index 000000000..e6290d576 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-background.html @@ -0,0 +1,12 @@ + + +Text with same color as background + + + +

+ Shouldn't be visible. +

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-parent-background.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-parent-background.html new file mode 100644 index 000000000..f7480f509 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/text-with-same-color-as-parent-background.html @@ -0,0 +1,14 @@ + + +Text with same color as parent background + + + +
+

+ Should not be visible +

+
g diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-link.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-link.html new file mode 100644 index 000000000..638c3c9ee --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-link.html @@ -0,0 +1,11 @@ + + +visibility: hidden applies to child node of type A + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-paragraph.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-paragraph.html new file mode 100644 index 000000000..8f703ba54 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-paragraph.html @@ -0,0 +1,11 @@ + + +visibility: hidden applies to child nodes of type P + + + +
+

Brie is good

+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-presedence.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-presedence.html new file mode 100644 index 000000000..adf679c8a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child-presedence.html @@ -0,0 +1,12 @@ + + +visibility: visible on child node takes presedence + + + +
+
Brie is good
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child.html new file mode 100644 index 000000000..5464025fa --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-child.html @@ -0,0 +1,11 @@ + + +visibility: hidden applies to child nodes + + + +
+
Brie is good
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-hidden.html new file mode 100644 index 000000000..24e89499f --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-hidden.html @@ -0,0 +1,11 @@ + + +visibility: hidden; + + + +

This element is not visible.

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-visible.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-visible.html new file mode 100644 index 000000000..e0c090217 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/visibility-visible.html @@ -0,0 +1,5 @@ + + +visibility: visible; + +

This element is visible.

diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-auto-y-hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-auto-y-hidden.html new file mode 100644 index 000000000..e9ce24c73 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-auto-y-hidden.html @@ -0,0 +1,30 @@ + + + + Page with overflow + + + +
+
+
Click right
+
+
+ Right clicked:
+ Bottom clicked:
+ Bottom-right clicked:
+
+
+
Click bottom-right
+
+ Click bottom +
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-auto.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-auto.html new file mode 100644 index 000000000..22b5049ff --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-auto.html @@ -0,0 +1,30 @@ + + + + Page with overflow + + + +
+
+
Click right
+
+
+ Right clicked:
+ Bottom clicked:
+ Bottom-right clicked:
+
+
+
Click bottom-right
+
+ Click bottom +
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-hidden.html new file mode 100644 index 000000000..c26b48aea --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-hidden.html @@ -0,0 +1,30 @@ + + + + Page with overflow + + + +
+
+
Click right
+
+
+ Right clicked:
+ Bottom clicked:
+ Bottom-right clicked:
+
+
+
Click bottom-right
+
+ Click bottom +
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-scroll.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-scroll.html new file mode 100644 index 000000000..b98b79a7e --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-hidden-y-scroll.html @@ -0,0 +1,30 @@ + + + + Page with overflow + + + +
+
+
Click right
+
+
+ Right clicked:
+ Bottom clicked:
+ Bottom-right clicked:
+
+
+
Click bottom-right
+
+ Click bottom +
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-scroll-y-hidden.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-scroll-y-hidden.html new file mode 100644 index 000000000..9348681ac --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/x-scroll-y-hidden.html @@ -0,0 +1,30 @@ + + + + Page with overflow + + + +
+
+
Click right
+
+
+ Right clicked:
+ Bottom clicked:
+ Bottom-right clicked:
+
+
+
Click bottom-right
+
+ Click bottom +
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/res/zero-sized-element-with-sizable-decendant.html b/testing/web-platform/tests/old-tests/webdriver/element_state/res/zero-sized-element-with-sizable-decendant.html new file mode 100644 index 000000000..f7e37f855 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/res/zero-sized-element-with-sizable-decendant.html @@ -0,0 +1,14 @@ + + +Zero sized element with sizable decendant + + + +
+
+   +
+
diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/selected_test.py b/testing/web-platform/tests/old-tests/webdriver/element_state/selected_test.py new file mode 100644 index 000000000..9c80f29f6 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/selected_test.py @@ -0,0 +1,210 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class GetElementSelectedTest(base_test.WebDriverBaseTest): + def test_selected_1(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-1") + + self.assertEquals(element.is_selected(), True) + + def test_selected_2(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-2") + + self.assertEquals(element.is_selected(), True) + + def test_selected_3(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-3") + + self.assertEquals(element.is_selected(), True) + + def test_selected_4(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-4") + + self.assertEquals(element.is_selected(), True) + + def test_selected_5(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-5") + + self.assertEquals(element.is_selected(), True) + + def test_selected_6(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-6") + + self.assertEquals(element.is_selected(), True) + + def test_selected_7(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-7") + + self.assertEquals(element.is_selected(), True) + + def test_selected_8(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-8") + + self.assertEquals(element.is_selected(), True) + + def test_selected_9(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-9") + + self.assertEquals(element.is_selected(), True) + + def test_selected_10(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-10") + + self.assertEquals(element.is_selected(), True) + + def test_selected_11(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-11") + + self.assertEquals(element.is_selected(), True) + + def test_selected_12(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-12") + + self.assertEquals(element.is_selected(), True) + + def test_selected_13(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-13") + + self.assertEquals(element.is_selected(), True) + + def test_selected_14(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-14") + + self.assertEquals(element.is_selected(), True) + + def test_selected_15(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("selected-15") + + self.assertEquals(element.is_selected(), True) + + def test_unselected_1(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-1") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_2(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-2") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_3(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-3") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_4(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-4") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_5(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-5") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_6(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-6") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_7(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-7") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_8(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-8") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_9(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-9") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_10(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-10") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_11(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-11") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_12(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-12") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_13(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-13") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_14(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-14") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_15(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-15") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_16(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-16") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_17(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-17") + + self.assertEquals(element.is_selected(), False) + + def test_unselected_18(self): + self.driver.get(self.webserver.where_is("element_state/res/element-selected.html")) + element = self.driver.find_element_by_id("unselected-18") + + self.assertEquals(element.is_selected(), False) + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/element_state/visibility_test.py b/testing/web-platform/tests/old-tests/webdriver/element_state/visibility_test.py new file mode 100644 index 000000000..58218a7ff --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/element_state/visibility_test.py @@ -0,0 +1,324 @@ +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 NaturalNonVisibleElementsTest(base_test.WebDriverBaseTest): + def test_0x0_pixel_element_is_not_visible(self): + self.driver.get(self.webserver.where_is("element_state/res/0x0-pixels.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertFalse(el.is_displayed()) + + def test_0x0_pixel_text_node_is_visible(self): + self.driver.get(self.webserver.where_is("element_state/res/0x0-pixels-text-node.html")) + el = self.driver.find_element_by_css_selector("p") + self.assertTrue(el.is_displayed()) + + def test_1x1_pixel_element(self): + self.driver.get(self.webserver.where_is("element_state/res/1x1-pixels.html")) + el = self.driver.find_element_by_css_selector("p") + self.assertTrue(el.is_displayed()) + + def test_zero_sized_element_is_shown_if_decendant_has_size(self): + self.driver.get(self.webserver.where_is("element_state/res/zero-sized-element-with-sizable-decendant.html")) + parent = self.driver.find_element_by_css_selector("#parent") + child = self.driver.find_element_by_css_selector("#child") + + self.assertTrue(parent.is_displayed()) + self.assertTrue(child.is_displayed()) + + def test_input_type_hidden_is_never_visible(self): + self.driver.get(self.webserver.where_is("element_state/res/input-type-hidden.html")) + input = self.driver.find_element_by_css_selector("input") + self.assertFalse(input.is_displayed()) + + def test_input_morphs_into_hidden(self): + self.driver.get(self.webserver.where_is("element_state/res/input-morphs-into-hidden.html")) + input = self.driver.find_element_by_css_selector("input") + self.assertFalse(input.is_displayed()) + + def test_parent_node_visible_when_all_children_are_absolutely_positioned_and_overflow_is_hidden(self): + pass + + def test_parent_of_absolutely_positioned_elements_visible_where_ancestor_overflow_is_hidden(self): + """When a parent's ancestor hides any overflow, absolutely positioned child elements are + still visible. The parent container is also considered visible by webdriver for this + reason because it is interactable.""" + + self.driver.get(self.webserver.where_is("element_state/res/absolute-children-ancestor-hidden-overflow.html")) + + children = self.driver.find_elements_by_css_selector(".child") + assert all(child.is_displayed() for child in children) + + parent = self.driver.find_element_by_css_selector("#parent") + assert parent.is_displayed() + + def test_element_hidden_by_overflow_x_is_not_visible(self): + # TODO(andreastt): This test should probably be split in three. Also it's making two + # assertions. + pages = ["element_state/res/x-hidden-y-hidden.html", + "element_state/res/x-hidden-y-scroll.html", + "element_state/res/x-hidden-y-auto.html"] + + for page in pages: + self.driver.get(self.webserver.where_is(page)) + right = self.driver.find_element_by_css_selector("#right") + bottom_right = self.driver.find_element_by_css_selector("#bottom-right") + + self.assertFalse(right.is_displayed()) + self.assertFalse(bottom_right.is_displayed()) + + def test_element_hidden_by_overflow_y_is_not_visible(self): + # TODO(andreastt): This test should probably be split in three. Also it's making two + # assertions. + pages = ["element_state/res/x-hidden-y-hidden.html", + "element_state/res/x-scroll-y-hidden.html", + "element_state/res/x-auto-y-hidden.html"] + + for page in pages: + self.driver.get(self.webserver.where_is(page)) + bottom = self.driver.find_element_by_css_selector("#bottom") + bottom_right = self.driver.find_element_by_css_selector("#bottom-right") + + self.assertFalse(bottom.is_displayed()) + self.assertFalse(bottom_right.is_displayed()) + + def test_parent_node_visible_when_all_children_are_absolutely_position_and_overflow_is_hidden(self): + pass + + def test_element_scrollable_by_overflow_x_is_visible(self): + pass + + def test_element_scrollable_by_overflow_y_is_visible(self): + pass + + def test_element_scrollable_by_overflow_x_and_y_is_visible(self): + pass + + def test_element_scrollable_by_overflow_y_is_visible(self): + pass + + def test_element_outside_viewport(self): + self.driver.get(self.webserver.where_is("element_state/res/element-outside-viewport.html")) + hidden = self.driver.find_element_by_css_selector("div") + self.assertFalse(hidden.is_displayed()) + + def test_element_dynamically_moved_outside_viewport(self): + self.driver.get(self.webserver.where_is("element_state/res/element-dynamically-moved-outside-viewport.html")) + hidden = self.driver.find_element_by_css_selector("div") + self.assertFalse(hidden.is_displayed()) + + def test_element_hidden_by_other_element(self): + self.driver.get(self.webserver.where_is("element_state/res/element-hidden-by-other-element.html")) + overlay = self.driver.find_element_by_css_selector("#overlay") + hidden = self.driver.find_element_by_css_selector("#hidden") + + self.assertTrue(overlay.is_displayed()) + self.assertFalse(hidden.is_displayed()) + + def test_element_partially_hidden_by_other_element(self): + self.driver.get(self.webserver.where_is("element_state/res/element-partially-hidden-by-other-element.html")) + partial = self.driver.find_element_by_css_selector("#partial") + self.assertTrue(partial.is_displayed()) + + def test_element_hidden_by_z_index(self): + self.driver.get(self.webserver.where_is("element_state/res/element-hidden-by-z-index.html")) + overlay = self.driver.find_element_by_css_selector("#overlay") + hidden = self.driver.find_element_by_css_selector("#hidden") + + self.assertTrue(overlay.is_displayed()) + self.assertFalse(hidden.is_displayed()) + + def test_element_moved_outside_viewport_by_transform(self): + self.driver.get(self.webserver.where_is("element_state/res/element-moved-outside-viewport-by-transform.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertFalse(el.is_displayed()) + + def test_element_moved_behind_other_element_by_transform(self): + self.driver.get(self.webserver.where_is("element_state/res/element-moved-behind-other-element-by-transform.html")) + overlay = self.driver.find_element_by_css_selector("#overlay") + hidden = self.driver.find_element_by_css_selector("#hidden") + + self.assertTrue(overlay.is_displayed()) + self.assertFalse(hidden.is_displayed()) + + def test_text_with_same_color_as_background(self): + self.driver.get(self.webserver.where_is("element_state/res/text-with-same-color-as-background.html")) + p = self.driver.find_element_by_css_selector("p") + self.assertFalse(p.is_displayed()) + + def test_text_with_same_color_as_parent_background(self): + self.driver.get(self.webserver.where_is("element_state/res/text-with-same-color-as-parent-background.html")) + p = self.driver.find_element_by_css_selector("p") + self.assertFalse(p.is_displayed()) + + def test_text_with_matching_color_and_background(self): + self.driver.get(self.webserver.where_is("element_state/res/text-with-matching-color-and-background.html")) + p = self.driver.find_element_by_css_selector("p") + self.assertTrue(p.is_displayed()) + + def test_element_with_same_color_as_background(self): + self.driver.get(self.webserver.where_is("element_state/res/element-with-same-color-as-background.html")) + el = self.driver.find_element_by_css_selector("div") + self.assertFalse(el.is_displayed()) + + def test_element_with_same_color_as_parent_background(self): + self.driver.get(self.webserver.where_is("element_state/res/element-with-same-color-as-parent-background.html")) + hidden = self.driver.find_element_by_css_selector("#hidden") + self.assertFalse(hidden.is_displayed()) + + +class BodyElementIsAlwaysDisplayedTest(base_test.WebDriverBaseTest): + def assert_body_is_displayed_on(self, page): + self.driver.get(self.webserver.where_is(page)) + body = self.driver.find_element_by_css_selector("body") + assert body.is_displayed() + + def test_implicit(self): + self.assert_body_is_displayed_on("element_state/res/body_implicit.html") + + def test_empty(self): + self.assert_body_is_displayed_on("element_state/res/body_empty.html") + + def test_visibility_hidden(self): + self.assert_body_is_displayed_on("element_state/res/body_visibility_hidden.html") + + def test_overflow_hidden(self): + self.assert_body_is_displayed_on("element_state/res/body_overflow_hidden.html") + + +class DisplayTest(base_test.WebDriverBaseTest): + def test_display_block(self): + self.driver.get(self.webserver.where_is("element_state/res/display-block.html")) + el = self.driver.find_element_by_css_selector("p") + self.assertTrue(el.is_displayed()) + + def test_display_none(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none.html")) + el = self.driver.find_element_by_css_selector("p") + self.assertFalse(el.is_displayed()) + + def test_display_none_hides_child_node(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none-child.html")) + parent = self.driver.find_element_by_css_selector("#parent") + child = self.driver.find_element_by_css_selector("#child") + + self.assertFalse(parent.is_displayed()) + self.assertFalse(child.is_displayed()) + + def test_display_none_hides_child_node_link(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none-child-link.html")) + child = self.driver.find_element_by_css_selector("#child") + self.assertFalse(child.is_displayed()) + + def test_display_none_hides_child_node_paragraph(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none-child-paragraph.html")) + child = self.driver.find_element_by_css_selector("#child") + self.assertFalse(child.is_displayed()) + + def test_display_none_on_parent_takes_presedence(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none-parent-presedence.html")) + child = self.driver.find_element_by_css_selector("#child") + self.assertFalse(child.is_displayed()) + + def test_display_none_on_parent_takes_presedence_over_visibility_visible(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none-parent-presedence-visibility.html")) + child = self.driver.find_element_by_css_selector("#child") + self.assertFalse(child.is_displayed()) + + def test_display_none_hidden_dynamically(self): + self.driver.get(self.webserver.where_is("element_state/res/display-none-dynamic.html")) + hidden = self.driver.find_element_by_css_selector("#hidden") + self.assertFalse(hidden.is_displayed()) + + +class VisibilityTest(base_test.WebDriverBaseTest): + def test_element_state_hidden(self): + self.driver.get(self.webserver.where_is("element_state/res/visibility-hidden.html")) + el = self.driver.find_element_by_css_selector("p") + self.assertFalse(el.is_displayed()) + + def test_element_state_visible(self): + self.driver.get(self.webserver.where_is("element_state/res/visibility-visible.html")) + el = self.driver.find_element_by_css_selector("p") + self.assertTrue(el.is_displayed()) + + def test_visibility_hidden_hides_child_node(self): + self.driver.get(self.webserver.where_is("element_state/res/visibility-child.html")) + parent = self.driver.find_element_by_css_selector("#parent") + child = self.driver.find_element_by_css_selector("#child") + + self.assertFalse(parent.is_displayed()) + self.assertFalse(child.is_displayed()) + + def test_visibility_hidden_hides_child_node_link(self): + self.driver.get(self.webserver.where_is("element_state/res/visibility-child-link.html")) + parent = self.driver.find_element_by_css_selector("#parent") + child = self.driver.find_element_by_css_selector("#child") + + self.assertFalse(parent.is_displayed()) + self.assertFalse(child.is_displayed()) + + def test_visibility_hidden_hides_child_node_paragraph(self): + self.driver.get(self.webserver.where_is("element_state/res/visibility-child-paragraph.html")) + parent = self.driver.find_element_by_css_selector("#parent") + child = self.driver.find_element_by_css_selector("#child") + + self.assertFalse(parent.is_displayed()) + self.assertFalse(child.is_displayed()) + + def test_visibility_hidden_on_child_takes_precedence(self): + self.driver.get(self.webserver.where_is("element_state/res/visibility-child-presedence.html")) + child = self.driver.find_element_by_css_selector("#child") + self.assertTrue(child.is_displayed()) + + def test_visibility_hidden_on_parent_takes_precedence_over_display_block(self): + pass + + def test_visibility_hidden_set_dynamically(self): + pass + + def test_should_show_element_not_visible_with_hidden_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/hidden.html")) + singleHidden = self.driver.find_element_by_css_selector('#singleHidden') + self.assertFalse(singleHidden.is_displayed()) + + def test_should_show_element_not_visible_when_parent_element_has_hidden_attribute(self): + self.driver.get(self.webserver.where_is("element_state/res/hidden.html")) + child = self.driver.find_element_by_css_selector('#child') + self.assertFalse(child.is_displayed()) + + +class VisibilityInteractionTest(base_test.WebDriverBaseTest): + def test_input_hidden_is_unclickable(self): + self.driver.get(self.webserver.where_is("element_state/res/input-type-hidden-unclickable.html")) + input = self.driver.find_element_by_css_selector("input") + + with self.assertRaises(exceptions.ElementNotVisibleException): + input.click() + + def test_hidden_input_checkbox_is_untogglable(self): + self.driver.get(self.webserver.where_is("element_state/res/hidden-input-type-checkbox-untogglable.html")) + checkbox = self.driver.find_element_by_css_selector("input") + + with self.assertRaises(exceptions.ElementNotVisibleException): + checkbox.click() + + def test_typing_in_hidden_input_is_impossible(self): + self.driver.get(self.webserver.where_is("element_state/res/hidden-input-type-text-writing.html")) + textfield = self.driver.find_element_by_css_selector("input") + + with self.assertRaises(exceptions.ElementNotVisibleException): + textfield.send_keys("Koha is a popular Indian cheese") + + +class OpacityTest(base_test.WebDriverBaseTest): + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/javascript/__init__.py b/testing/web-platform/tests/old-tests/webdriver/javascript/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/javascript/execute_script_test.py b/testing/web-platform/tests/old-tests/webdriver/javascript/execute_script_test.py new file mode 100644 index 000000000..dd7cfca94 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/javascript/execute_script_test.py @@ -0,0 +1,129 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test +from selenium.webdriver.remote.webelement import WebElement + + +class ExecuteScriptTest(base_test.WebDriverBaseTest): + def test_ecmascript_translates_null_return_to_none(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + result = self.driver.execute_script("return null;") + self.assertIsNone(result) + + def test_ecmascript_translates_undefined_return_to_none(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + result = self.driver.execute_script("var undef; return undef;") + self.assertIsNone(result) + + def test_can_return_numbers_from_scripts(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + self.assertEquals(1, self.driver.execute_script("return 1;")) + self.assertEquals(3.14, self.driver.execute_script("return 3.14;")) + + def test_can_return_strings_from_scripts(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + self.assertEquals("hello, world!", + self.driver.execute_script("return 'hello, world!'")) + + def test_can_return_booleans_from_scripts(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + self.assertTrue(self.driver.execute_script("return true;")) + self.assertFalse(self.driver.execute_script("return false;")) + + def test_can_return_an_array_of_primitives(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + + result = self.driver.execute_script("return [1, false, null, 3.14]") + self.assertListEqual([1, False, None, 3.14], result) + + def test_can_return_nested_arrays(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + result = self.driver.execute_script("return [[1, 2, [3]]]") + + self.assertIsInstance(result, list) + self.assertEquals(1, len(result)) + + result = result[0] + self.assertListEqual([1, 2], result[:2]) + self.assertListEqual([3], result[2]) + + def test_can_return_object_literals(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + + result = self.driver.execute_script("return {}") + self.assertDictEqual({}, result) + + result = self.driver.execute_script("return {a: 1, b: false, c: null}") + self.assertDictEqual({ + "a": 1, + "b": False, + "c": None + }, result) + + def test_can_return_complex_object_literals(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + result = self.driver.execute_script("return {a:{b: 'hello'}}") + self.assertIsInstance(result, dict) + self.assertIsInstance(result['a'], dict) + self.assertDictEqual({"b": "hello"}, result["a"]) + + def test_dom_element_return_value_is_translated_to_a_web_element(self): + self.driver.get(self.webserver.where_is( + "javascript/res/return_document_body.html")) + + result = self.driver.execute_script("return document.body") + self.assertEquals(result.text, "Hello, world!") + + def test_return_an_array_of_dom_elements(self): + self.driver.get(self.webserver.where_is( + "javascript/res/return_array_of_dom_elements.html")) + + result = self.driver.execute_script( + "var nodes = document.getElementsByTagName('div');" + "return [nodes[0], nodes[1]]") + + self.assertIsInstance(result, list) + self.assertEquals(2, len(result)) + self.assertEquals("a", result[0].text) + self.assertEquals("b", result[1].text) + + def test_node_list_return_value_is_translated_to_list_of_web_elements(self): + self.driver.get(self.webserver.where_is( + "javascript/res/return_array_of_dom_elements.html")) + + result = self.driver.execute_script( + "return document.getElementsByTagName('div');") + + self.assertIsInstance(result, list) + self.assertEquals(2, len(result)) + self.assertEquals("a", result[0].text) + self.assertEquals("b", result[1].text) + + def test_return_object_literal_with_dom_element_property(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + result = self.driver.execute_script("return {a: document.body}") + self.assertIsInstance(result, dict) + self.assertEquals("body", result["a"].tag_name) + + def test_scripts_execute_in_anonymous_function_and_do_not_pollute_global_scope(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + self.driver.execute_script("var x = 1;") + self.assertEquals("undefined", self.driver.execute_script("return typeof x;")); + + def test_scripts_can_modify_context_window_object(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + self.driver.execute_script("window.x = 1;") + self.assertEquals("number", self.driver.execute_script("return typeof x;")); + self.assertEquals(1, self.driver.execute_script("return x;")); + + def test_that_ecmascript_returns_document_title(self): + self.driver.get(self.webserver.where_is("javascript/res/execute_script_test.html")) + result = self.driver.execute_script("return document.title;") + self.assertEquals("executeScript test", result) + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/javascript/res/execute_script_test.html b/testing/web-platform/tests/old-tests/webdriver/javascript/res/execute_script_test.html new file mode 100644 index 000000000..9491b441a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/javascript/res/execute_script_test.html @@ -0,0 +1,2 @@ + +executeScript test \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_array_of_dom_elements.html b/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_array_of_dom_elements.html new file mode 100644 index 000000000..32827f950 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_array_of_dom_elements.html @@ -0,0 +1,3 @@ + +
a
+
b
diff --git a/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_document_body.html b/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_document_body.html new file mode 100644 index 000000000..ba1eab446 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_document_body.html @@ -0,0 +1,2 @@ + +
Hello, world!
diff --git a/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_node_list.html b/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_node_list.html new file mode 100644 index 000000000..32827f950 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/javascript/res/return_node_list.html @@ -0,0 +1,3 @@ + +
a
+
b
diff --git a/testing/web-platform/tests/old-tests/webdriver/modal/__init__.py b/testing/web-platform/tests/old-tests/webdriver/modal/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/modal/alerts_quit_test.py b/testing/web-platform/tests/old-tests/webdriver/modal/alerts_quit_test.py new file mode 100644 index 000000000..83f7d1450 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/modal/alerts_quit_test.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 +from selenium.webdriver.support import wait + + +class AlertsQuitTest(base_test.WebDriverBaseTest): + def setUp(self): + self.wait = wait.WebDriverWait(self.driver, 5, ignored_exceptions=[exceptions.NoAlertPresentException]) + self.driver.get(self.webserver.where_is('modal/res/alerts.html')) + + def test_can_quit_when_an_alert_is_present(self): + self.driver.find_element_by_css_selector('#alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + self.driver.quit() + with self.assertRaises(Exception): + alert.accept() + AlertsQuitTest.driver = None + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/modal/alerts_test.py b/testing/web-platform/tests/old-tests/webdriver/modal/alerts_test.py new file mode 100644 index 000000000..5f6f8a9f5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/modal/alerts_test.py @@ -0,0 +1,148 @@ +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 +from selenium.webdriver.support import wait + +class AlertsTest(base_test.WebDriverBaseTest): + def setUp(self): + self.wait = wait.WebDriverWait(self.driver, 5, ignored_exceptions = [exceptions.NoAlertPresentException]) + self.driver.get(self.webserver.where_is('modal/res/alerts.html')) + + def tearDown(self): + try: + self.driver.switch_to_alert().dismiss() + except exceptions.NoAlertPresentException: + pass + + # Alerts + def test_should_allow_user_to_accept_an_alert(self): + self.driver.find_element_by_css_selector('#alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + self.driver.current_url + + def test_should_allow_user_to_accept_an_alert_with_no_text(self): + self.driver.find_element_by_css_selector('#empty-alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + self.driver.current_url + + def test_should_allow_user_to_dismiss_an_alert(self): + self.driver.find_element_by_css_selector('#alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.dismiss() + self.driver.current_url + + def test_should_allow_user_to_get_text_of_an_alert(self): + self.driver.find_element_by_css_selector('#alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.text + alert.accept() + self.assertEquals('cheese', value) + + def test_setting_the_value_of_an_alert_throws(self): + self.driver.find_element_by_css_selector('#alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + with self.assertRaises(exceptions.ElementNotVisibleException): + alert.send_keys('cheese') + alert.accept() + + def test_alert_should_not_allow_additional_commands_if_dismissed(self): + self.driver.find_element_by_css_selector('#alert').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + with self.assertRaises(exceptions.NoAlertPresentException): + alert.text + + # Prompts + def test_should_allow_user_to_accept_a_prompt(self): + self.driver.find_element_by_css_selector('#prompt').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == '') + + def test_should_allow_user_to_dismiss_a_prompt(self): + self.driver.find_element_by_css_selector('#prompt').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.dismiss() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == 'null') + + def test_should_allow_user_to_set_the_value_of_a_prompt(self): + self.driver.find_element_by_css_selector('#prompt').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.send_keys('cheese') + alert.accept() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == 'cheese') + + def test_should_allow_user_to_get_text_of_a_prompt(self): + self.driver.find_element_by_css_selector('#prompt').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.text + alert.accept() + self.assertEquals('Enter something', value) + + def test_prompt_should_not_allow_additional_commands_if_dismissed(self): + self.driver.find_element_by_css_selector('#prompt').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + with self.assertRaises(exceptions.NoAlertPresentException): + alert.text + + def test_prompt_should_use_default_value_if_no_keys_sent(self): + self.driver.find_element_by_css_selector('#prompt-with-default').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == 'This is a default value') + + def test_prompt_should_have_null_value_if_dismissed(self): + self.driver.find_element_by_css_selector('#prompt-with-default').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.dismiss() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == 'null') + + # Confirmations + def test_should_allow_user_to_accept_a_confirm(self): + self.driver.find_element_by_css_selector('#confirm').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == 'true') + + def test_should_allow_user_to_dismiss_a_confirm(self): + self.driver.find_element_by_css_selector('#confirm').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.dismiss() + self.wait.until(lambda x: x.find_element_by_css_selector('#text').text == 'false') + + def test_setting_the_value_of_a_confirm_throws(self): + self.driver.find_element_by_css_selector('#confirm').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + with self.assertRaises(exceptions.ElementNotVisibleException): + alert.send_keys('cheese') + alert.accept() + + def test_should_allow_user_to_get_text_of_a_confirm(self): + self.driver.find_element_by_css_selector('#confirm').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.text + alert.accept() + self.assertEquals('cheese', value) + + def test_confirm_should_not_allow_additional_commands_if_dismissed(self): + self.driver.find_element_by_css_selector('#confirm').click() + alert = self.wait.until(lambda x: x.switch_to_alert()) + alert.accept() + with self.assertRaises(exceptions.NoAlertPresentException): + alert.text + +""" + def test_switch_to_missing_alert_fails(self): + with self.assertRaises(exceptions.NoAlertPresentException): + self.driver.switch_to_alert() +""" + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/modal/res/alerts.html b/testing/web-platform/tests/old-tests/webdriver/modal/res/alerts.html new file mode 100644 index 000000000..36c5dc139 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/modal/res/alerts.html @@ -0,0 +1,53 @@ + + + + + Testing Alerts + + + + + +

Testing Alerts and Stuff

+ +

This tests alerts: click me

+ +

This tests alerts: click me

+ +

Let's make the prompt happen

+ +

Let's make the prompt with default happen

+ +

Let's make TWO prompts happen

+ +

This tests confirm: test confirm

+ +
+
+
+ + + diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/__init__.py b/testing/web-platform/tests/old-tests/webdriver/navigation/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/auth_tests.py b/testing/web-platform/tests/old-tests/webdriver/navigation/auth_tests.py new file mode 100644 index 000000000..52a18cdb8 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/auth_tests.py @@ -0,0 +1,42 @@ +import os +import sys +import unittest +import ConfigParser + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test +from selenium.common import exceptions +from wptserve import server +from wptserve.router import any_method +from wptserve.handlers import basic_auth_handler + +class WebDriverAuthTest(unittest.TestCase): + + # Set up class to start HTTP Server that responds to + # test URLs with various 401 responses + @classmethod + def setUpClass(cls): + cls.driver = base_test.create_driver() + cls.webserver = server.WebTestHttpd(routes=[(any_method, "*", basic_auth_handler)]) + cls.webserver.start() + + @classmethod + def tearDownClass(cls): + cls.driver.quit() + cls.webserver.stop() + + # Test that when 401 is seen by browser, a WebDriver response is still sent + def test_response_401_auth_basic(self): + page = self.webserver.get_url('navigation/res/authenticated.html') + self.driver.set_page_load_timeout(5) + try: + self.driver.get( page ) + # if we got a responses instead of timeout, that's success + self.assertTrue(True) + except exceptions.TimeoutException: + self.fail("Did not get response from browser.") + except: + self.fail("Unexpected failure. Please investigate.") + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/forward.py b/testing/web-platform/tests/old-tests/webdriver/navigation/forward.py new file mode 100644 index 000000000..67ca83227 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/forward.py @@ -0,0 +1,24 @@ +import unittest +import sys +import os + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class ForwardTest(base_test.WebDriverBaseTest): + # Get a static page that must be the same upon refresh + def test_forward(self): + self.driver.get(self.webserver.where_is('navigation/res/forwardStart.html')) + self.driver.get(self.webserver.where_is('navigation/res/forwardNext.html')) + nextbody = self.driver.find_element_by_css_selector("body").text + self.driver.back() + currbody = self.driver.find_element_by_css_selector("body").text + self.assertNotEqual(nextbody, currbody) + self.driver.forward() + currbody = self.driver.find_element_by_css_selector("body").text + self.assertEqual(nextbody, currbody) + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/forwardToNothing.py b/testing/web-platform/tests/old-tests/webdriver/navigation/forwardToNothing.py new file mode 100644 index 000000000..99759681a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/forwardToNothing.py @@ -0,0 +1,20 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class ForwardToNothingTest(base_test.WebDriverBaseTest): + # Get a static page that must be the same upon refresh + def test_forwardToNothing(self): + self.driver.get(self.webserver.where_is('navigation/forwardStart.html')) + body = self.driver.find_element_by_css_selector("body").text + self.driver.forward() + currbody = self.driver.find_element_by_css_selector("body").text + self.assertEqual(body, currbody) + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/get_from_http_test.py b/testing/web-platform/tests/old-tests/webdriver/navigation/get_from_http_test.py new file mode 100644 index 000000000..d28a0d0b1 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/get_from_http_test.py @@ -0,0 +1,60 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class GetFromHttpTest(base_test.WebDriverBaseTest): + def testGetUrlWithNoRedirectionOverHttp(self): + page = self.webserver.where_is('navigation/res/empty.html') + self.driver.get(page) + url = self.driver.current_url + self.assertEquals(page, url) + + + def testGetWillFollowTheLocationHeader(self): + page = self.webserver.where_is('navigation/redirect') + self.driver.get(page) + expected = self.webserver.where_is('navigation/res/empty.html') + url = self.driver.current_url + self.assertEquals(expected, url) + + + def testGetWillFollowMetaRefreshThatRefreshesInstantly(self): + page = self.webserver.where_is('navigation/res/instant-meta-redirect.html') + self.driver.get(page) + expected = self.webserver.where_is('navigation/res/empty.html') + url = self.driver.current_url + self.assertEquals(expected, url) + + + def testGetWillFollowMetaRefreshThatRefreshesAfterOneSecond(self): + page = self.webserver.where_is('navigation/res/1s-meta-redirect.html') + self.driver.get(page) + expected = self.webserver.where_is('navigation/res/empty.html') + url = self.driver.current_url + self.assertEquals(expected, url) + + + def testGetWillNotFollowMetaRefreshThatRefreshesAfterMoreThanOneSecond(self): + page = self.webserver.where_is('navigation/res/60s-meta-redirect.html') + self.driver.get(page) + url = self.driver.current_url + self.assertEquals(page, url) + + + def testGetFragmentInCurrentDocumentDoesNotReloadPage(self): + page = self.webserver.where_is("navigation/res/fragment.html") + fragment_page = "%s#%s" % (page, "fragment") + + self.driver.get(page) + self.driver.execute_script("state = true") + + self.driver.get(fragment_page) + self.assertEquals(True, self.driver.execute_script("return state")) + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/invalid_cert_test.py b/testing/web-platform/tests/old-tests/webdriver/navigation/invalid_cert_test.py new file mode 100644 index 000000000..b980146ee --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/invalid_cert_test.py @@ -0,0 +1,28 @@ +import BaseHTTPServer +import os +import ssl +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +here = os.path.dirname(os.path.abspath(__file__)) + + +class InvalidCertTest(base_test.WebDriverBaseTest): + def testCanNavigateToSiteWithSelfSignedCert(self): + self.webserver.httpd.socket = ssl.wrap_socket( + self.webserver.httpd.socket, + certfile=os.path.join(here, 'res/self-signed.key'), + server_side=True) + expected = self.webserver.where_is( + 'navigation/res/empty.html').replace('http:', 'https:', 1) + + self.driver.get(expected) + self.assertEquals(expected, self.driver.current_url) + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/refresh-page.py b/testing/web-platform/tests/old-tests/webdriver/navigation/refresh-page.py new file mode 100644 index 000000000..b0638e568 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/refresh-page.py @@ -0,0 +1,27 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class RefreshPageTest(base_test.WebDriverBaseTest): + # Get a static page that must be the same upon refresh + def test_refreshPage(self): + self.driver.get(self.webserver.where_is('navigation/res/refreshPageStatic.html')) + body = self.driver.find_element_by_css("body").text + self.driver.execute_script("document.getElementById('body').innerHTML=''") + self.driver.refresh() + newbody = self.driver.find_element_by_css("body").text + self.assertEqual(body, newbody) + + self.driver.get(self.webserver.where_is('navigation/res/refreshPageDynamic.html')) + body = self.driver.find_element_by_css("body").text + self.driver.refresh() + newbody = self.driver.find_element_by_css("body").text + self.assertNotEqual(body, newbody) + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/refresh_page.py b/testing/web-platform/tests/old-tests/webdriver/navigation/refresh_page.py new file mode 100644 index 000000000..1e1899008 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/refresh_page.py @@ -0,0 +1,27 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class RefreshPageTest(base_test.WebDriverBaseTest): + # Get a static page that must be the same upon refresh + def test_refreshPage(self): + self.driver.get(self.webserver.where_is('navigation/res/refreshPageStatic.html')) + body = self.driver.find_element_by_css_selector("body").text + self.driver.execute_script("document.getElementById('body').innerHTML=''") + self.driver.refresh() + newbody = self.driver.find_element_by_css_selector("body").text + self.assertEqual(body, newbody) + + self.driver.get(self.webserver.where_is('navigation/res/refreshPageDynamic.html')) + body = self.driver.find_element_by_css_selector("body").text + self.driver.refresh() + newbody = self.driver.find_element_by_css_selector("body").text + self.assertNotEqual(body, newbody) + + +if __name__ == '__main__': + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/1s-meta-redirect.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/1s-meta-redirect.html new file mode 100644 index 000000000..44fd332bd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/1s-meta-redirect.html @@ -0,0 +1,4 @@ + + + +meta-redirect diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/60s-meta-redirect.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/60s-meta-redirect.html new file mode 100644 index 000000000..9e56bc96a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/60s-meta-redirect.html @@ -0,0 +1,4 @@ + + + +meta-redirect diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/authenticated.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/authenticated.html new file mode 100644 index 000000000..c77449344 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/authenticated.html @@ -0,0 +1,5 @@ + + + +authentication successful +

You're in!

\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/empty.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/empty.html new file mode 100644 index 000000000..da58ac21d --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/empty.html @@ -0,0 +1,4 @@ + + + +Cheese diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardNext.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardNext.html new file mode 100644 index 000000000..edd77f866 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardNext.html @@ -0,0 +1,6 @@ + + + +This is the next page. + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardStart.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardStart.html new file mode 100644 index 000000000..3ab4f3cdd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/forwardStart.html @@ -0,0 +1,6 @@ + + + +This is the start page. + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/fragment.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/fragment.html new file mode 100644 index 000000000..bd09434a6 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/fragment.html @@ -0,0 +1,9 @@ + + +Fragment + + + +

I wish I were a pea, alas I am only a fragment.

\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/instant-meta-redirect.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/instant-meta-redirect.html new file mode 100644 index 000000000..c6ad7c9f2 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/instant-meta-redirect.html @@ -0,0 +1,4 @@ + + + +meta-redirect diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageDynamic.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageDynamic.html new file mode 100644 index 000000000..bedd20c35 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageDynamic.html @@ -0,0 +1,10 @@ + + + +This is a dynamic page. It will always have different content if refreshed. +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageStatic.html b/testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageStatic.html new file mode 100644 index 000000000..7d339aa9d --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/refreshPageStatic.html @@ -0,0 +1,6 @@ + + + +This is a static page. It will always have the same content if refreshed. + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/navigation/res/self-signed.key b/testing/web-platform/tests/old-tests/webdriver/navigation/res/self-signed.key new file mode 100644 index 000000000..bca61cdf7 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/navigation/res/self-signed.key @@ -0,0 +1,28 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDoww50sF8aKYNe1owbtsEilK2KOZx2F1Iv+EElpO7N2hDarIBu +9f87H+03b5RpI9oCSFCo67wTdCJ0A4B8SLwV2SUZY78CGJB1A8kXqP04tz0S0SYD +2TQRliwTxx1r7pDv1VmLc7XZRE6n6FFKTEjKmdUhCwHuQfC1sOkCXqSzFQIDAQAB +AoGAS5XcAeSsXXCRqqB9SxqjyTkCydo/htG37L/vV+whaFOiGYDfDClyQp7xh4kC +Zsovp4IYP2Kd5qtV7NqeRL3R5Z/Dxf6+6G4HdbI7np5m7A7cU32hMIzxi5M55Lo6 +gveNgHb3uy+R+tZTyab6saUxFy1DqbMh/2ga4lbatRm7JdkCQQD9C8+Q3nN8FkH4 +sKbOnHsKEV27459EYz7WnENiwhcYByBt7vw9BPM/LrO4UzWtgNjtRtxBpFeVT/V+ +dF7OZuH/AkEA63qhJcs6Ru3G29R3kJ82ttyHU1INawB/7od3bKp3rE+jUwNG7ZbQ +mtRdPTI02/OOeqZKeo46JX3D57gfMRDC6wJABZk/TGs/jt1HNGNkLWoU5tIfisqs +eWzgtQrcCtFUhXmS5BvHhOoZH6q+2zMsGtyg8A8DTIiAT5NnURbuCg8IrQJAd3kh +d85zw/byFSjofPz6wq6DDngsDKUVQ42BvyWCUG+bewvHmdYSAuxKXjkx7oLVQE9M +rH+q6sizc8bMNJW/fwJBAPcobQ59ZGAEWrnDdtbWnNS1ieSV8p6u7sg20HvrUIPS +TIQXeems9IKu0xs0dnLXNucm4ur8MnE7snkvWZnx2C8= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICAzCCAWwCCQCc6Lx6zkc0BDANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJV +UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMCAXDTEzMDcxMjIyMzMxNVoYDzIyODcwNDI2MjIzMzE1WjBFMQsw +CQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEhMB8GA1UECgwYSW50ZXJu +ZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo +ww50sF8aKYNe1owbtsEilK2KOZx2F1Iv+EElpO7N2hDarIBu9f87H+03b5RpI9oC +SFCo67wTdCJ0A4B8SLwV2SUZY78CGJB1A8kXqP04tz0S0SYD2TQRliwTxx1r7pDv +1VmLc7XZRE6n6FFKTEjKmdUhCwHuQfC1sOkCXqSzFQIDAQABMA0GCSqGSIb3DQEB +BQUAA4GBAD6atn+xbACigA9+EmcZo2bpAzxLAuXOAVEBM6J7Nrd8pk1D3PRP0QPg +UxjIDQ7ZqEWwLAcKb6AIfWwJ2Wj7q5LSX5nEFnUXggpywfUNTuZaR/fquUVnhMaO +tF8fQB9AYSa1WjqUbIKlns3Z2RhUv2DSEifi6UNjsf2UpmDTxtkN +-----END CERTIFICATE----- diff --git a/testing/web-platform/tests/old-tests/webdriver/network.py b/testing/web-platform/tests/old-tests/webdriver/network.py new file mode 100644 index 000000000..0674b989d --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/network.py @@ -0,0 +1,30 @@ +# this comes from this stack overflow post: +# http://stackoverflow.com/a/1947766/725944 + +# module for getting the lan ip address of the computer + +import os +import socket + +if os.name != "nt": + import fcntl + import struct + def get_interface_ip(ifname): + sckt = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + return socket.inet_ntoa(fcntl.ioctl( + sckt.fileno(), + 0x8915, # SIOCGIFADDR + struct.pack('256s', ifname[:15]) + )[20:24]) + +def get_lan_ip(): + ip = socket.gethostbyname(socket.gethostname()) + if ip.startswith("127.") and os.name != "nt": + interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"] + for ifname in interfaces: + try: + ip = get_interface_ip(ifname) + break + except IOError: + pass + return ip diff --git a/testing/web-platform/tests/old-tests/webdriver/runtests.py b/testing/web-platform/tests/old-tests/webdriver/runtests.py new file mode 100644 index 000000000..1cd9a3836 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/runtests.py @@ -0,0 +1,14 @@ +import unittest + +from unittest import TestLoader, TextTestRunner, TestSuite + +if __name__ == "__main__": + + loader = TestLoader() + suite = TestSuite(( + loader.discover(".", pattern="*.py") + )) + + runner = TextTestRunner(verbosity=2) + runner.run(suite) + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/runtests_p0.py b/testing/web-platform/tests/old-tests/webdriver/runtests_p0.py new file mode 100644 index 000000000..dc52c14be --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/runtests_p0.py @@ -0,0 +1,42 @@ +import unittest + +from unittest import TestLoader, TextTestRunner, TestSuite + +from cookie import cookie_test +from navigation import forward +from navigation import forwardToNothing +from navigation import get_from_http_test +from navigation import refresh_page +from element_location import element_location_test +from element_state import visibility_test +from element_state import method_test +from element_state import properties +from javascript import execute_script_test +from user_input import clear_test +from windows import window_manipulation +from windows import tabbing + + + +if __name__ == "__main__": + + loader = TestLoader() + suite = TestSuite(( + loader.loadTestsFromModule(cookie_test), + loader.loadTestsFromModule(forward), + loader.loadTestsFromModule(forwardToNothing), + loader.loadTestsFromModule(element_location_test), + loader.loadTestsFromModule(visibility_test), + loader.loadTestsFromModule(execute_script_test), + loader.loadTestsFromModule(clear_test), + loader.loadTestsFromModule(method_test), + loader.loadTestsFromModule(properties), + loader.loadTestsFromModule(refresh_page), + loader.loadTestsFromModule(get_from_http_test), + loader.loadTestsFromModule(window_manipulation), + loader.loadTestsFromModule(tabbing) + )) + + runner = TextTestRunner(verbosity=2) + runner.run(suite) + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/screenshot/__init__.py b/testing/web-platform/tests/old-tests/webdriver/screenshot/__init__.py new file mode 100644 index 000000000..0c8107beb --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/screenshot/__init__.py @@ -0,0 +1 @@ +__author__ = 'b-redeg' diff --git a/testing/web-platform/tests/old-tests/webdriver/screenshot/res/screenshot.html b/testing/web-platform/tests/old-tests/webdriver/screenshot/res/screenshot.html new file mode 100644 index 000000000..057bb9bf5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/screenshot/res/screenshot.html @@ -0,0 +1,5 @@ + + +"img" element with not fully qualified url + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/screenshot/take_screenshot.py b/testing/web-platform/tests/old-tests/webdriver/screenshot/take_screenshot.py new file mode 100644 index 000000000..20ff2bff2 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/screenshot/take_screenshot.py @@ -0,0 +1,15 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + + +class ScreenShotTest(base_test.WebDriverBaseTest): + # Get a static page that must be the same upon refresh + def test_screenShot(self): + self.driver.get(self.webserver.where_is('screenshot/res/screen.html')) + +if __name__ == '__main__': + unittest.main() 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 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 @@ + + + + + + + + + + + + + + \ 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 @@ + + + + Hello WebDriver + + +

Page Load Timeouts Test

+
+ Say Cheese +
+ + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/__init__.py b/testing/web-platform/tests/old-tests/webdriver/user_input/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/clear_test.py b/testing/web-platform/tests/old-tests/webdriver/user_input/clear_test.py new file mode 100644 index 000000000..34e82e159 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/clear_test.py @@ -0,0 +1,53 @@ +# -*- mode: python; fill-column: 100; comment-column: 100; -*- + +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 ElementClearTest(base_test.WebDriverBaseTest): + def test_writable_text_input_element_should_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_writable_input_page.html")) + e = self.driver.find_element_by_css_selector("#writableTextInput") + e.clear() + self.assertEquals("", e.get_attribute("value")) + + def test_disabled_text_input_element_should_not_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_disabled_input_page.html")) + e = self.driver.find_element_by_css_selector("#disabledTextInput") + self.assertRaises(exceptions.InvalidElementStateException, lambda: e.clear()) + + def test_read_only_text_input_element_should_not_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_readonly_input_page.html")) + e = self.driver.find_element_by_css_selector("#readOnlyTextInput") + self.assertRaises(exceptions.InvalidElementStateException, lambda: e.clear()) + + def test_writable_text_area_element_should_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_writable_textarea_page.html")) + e = self.driver.find_element_by_css_selector("#writableTextArea") + e.clear() + self.assertEquals("", e.get_attribute("value")) + + def test_disabled_text_area_element_should_not_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_disabled_textarea_page.html")) + e = self.driver.find_element_by_css_selector("#disabledTextArea") + self.assertRaises(exceptions.InvalidElementStateException, lambda: e.clear()) + + def test_read_only_text_input_element_should_not_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_readonly_textarea_page.html")) + e = self.driver.find_element_by_css_selector("#readOnlyTextArea") + self.assertRaises(exceptions.InvalidElementStateException, lambda: e.clear()) + + def test_content_editable_area_should_clear(self): + self.driver.get(self.webserver.where_is("user_input/res/element_clear_contenteditable_page.html")) + e = self.driver.find_element_by_css_selector("#contentEditableElement") + e.clear() + self.assertEquals("", e.text) + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/click_test.py b/testing/web-platform/tests/old-tests/webdriver/user_input/click_test.py new file mode 100644 index 000000000..c151f9bcd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/click_test.py @@ -0,0 +1,349 @@ +import os +import sys +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + +repo_root = os.path.abspath(os.path.join(__file__, "../../..")) +sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver")) +from webdriver import exceptions, wait + + +class ClickTest(base_test.WebDriverBaseTest): + def setUp(self): + self.wait = wait.WebDriverWait(self.driver, 5, ignored_exceptions = [exceptions.NoSuchAlertException]) + self.driver.get(self.webserver.where_is('modal/res/alerts.html')) + + def tearDown(self): + try: + self.driver.switch_to_alert().dismiss() + except exceptions.NoSuchAlertException: + pass + + def test_click_div(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("div") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "div") + + def test_click_p(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("p") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "p") + + def test_click_h1(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("h1") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "h1") + + def test_click_pre(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("pre") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "pre") + + def test_click_ol(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("ol") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "ol") + + def test_click_ul(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("ul") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "ul") + + def test_click_a(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("a") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "a") + + def test_click_img(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("img") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "img") + + def test_click_video(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("video") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "video") + + def test_click_canvas(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("canvas") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "canvas") + + def test_click_progress(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("progress") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "progress") + + def test_click_textarea(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("textarea") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "textarea") + + def test_click_button(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("button") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "button") + + def test_click_svg(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("svg") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "svg") + + def test_click_input_range(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_range") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_range") + + def test_click_input_button(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_button") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_button") + + def test_click_input_submit(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_submit") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_submit") + + def test_click_input_reset(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_reset") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_reset") + + def test_click_input_checkbox(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_checkbox") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_checkbox") + + def test_click_input_radio(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_radio") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_radio") + + def test_click_input_text(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_text") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_text") + + def test_click_input_number(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_number") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_number") + + def test_click_input_tel(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_tel") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_tel") + + def test_click_input_url(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_url") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_url") + + def test_click_input_email(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_email") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_email") + + def test_click_input_search(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_search") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_search") + + def test_click_input_image(self): + self.driver.get(self.webserver.where_is("user_input/res/click.html")) + + element = self.driver.find_element_by_id("input_image") + element.click() + + alert = self.wait.until(lambda x: x.switch_to_alert()) + value = alert.get_text() + alert.accept() + + self.assertEquals(value, "input_image") + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/click.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/click.html new file mode 100644 index 000000000..3517bfca8 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/click.html @@ -0,0 +1,45 @@ + + + + + + + + + +
div
+

p

+

h1

+
pre
+
    ol
+ + a + + + canvas + progress + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_contenteditable_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_contenteditable_page.html new file mode 100644 index 000000000..2d65d3880 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_contenteditable_page.html @@ -0,0 +1,13 @@ + + + +Clear Elements Test + + + +
+This is a contentEditable area +
+ + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_input_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_input_page.html new file mode 100644 index 000000000..b0f21235f --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_input_page.html @@ -0,0 +1,11 @@ + + + +Clear Elements Test + + + + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_textarea_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_textarea_page.html new file mode 100644 index 000000000..e274a0582 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_disabled_textarea_page.html @@ -0,0 +1,13 @@ + + + +Clear Elements Test + + + + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_input_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_input_page.html new file mode 100644 index 000000000..5d3a7ac67 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_input_page.html @@ -0,0 +1,11 @@ + + + +Clear Elements Test + + + + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_textarea_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_textarea_page.html new file mode 100644 index 000000000..d11241e86 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_readonly_textarea_page.html @@ -0,0 +1,13 @@ + + + +Clear Elements Test + + + + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_input_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_input_page.html new file mode 100644 index 000000000..448cd37df --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_input_page.html @@ -0,0 +1,11 @@ + + + +Clear Elements Test + + + + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_textarea_page.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_textarea_page.html new file mode 100644 index 000000000..d16657aa5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/element_clear_writable_textarea_page.html @@ -0,0 +1,13 @@ + + + +Clear Elements Test + + + + + + + diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form-landing.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form-landing.html new file mode 100644 index 000000000..345e60e04 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form-landing.html @@ -0,0 +1,8 @@ + + + + Text Form Landing + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form.html b/testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form.html new file mode 100644 index 000000000..d99ec899d --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/res/text-form.html @@ -0,0 +1,25 @@ + + + Text Form + + + + +

+
+ + + + +
+ + \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/user_input/sendkeys_test.py b/testing/web-platform/tests/old-tests/webdriver/user_input/sendkeys_test.py new file mode 100644 index 000000000..d2edcbabd --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/user_input/sendkeys_test.py @@ -0,0 +1,96 @@ +import os +import sys +import random +import unittest + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test + +repo_root = os.path.abspath(os.path.join(__file__, "../../..")) +sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver")) +from webdriver import exceptions + + +class SendKeysTest(base_test.WebDriverBaseTest): + def setUp(self): + self.driver.get(self.webserver.where_is("user_input/res/text-form.html")) + + def test_send_simple_string(self): + element = self.driver.find_element_by_id("Text1") + element.send_keys("lorem ipsum") + + self.assertEquals(self.driver.find_element_by_id("text").get_text(), u"lorem ipsum") + + def test_send_return(self): + element = self.driver.find_element_by_id("Text1") + returnkey = unichr(int("E006", 16)) + element.send_keys([returnkey]) + + self.assertEquals(u"" + self.driver.get_current_url(), u"" + self.webserver.where_is("user_input/res/text-form-landing.html?e=mc2")) + + def test_send_backspace(self): + element = self.driver.find_element_by_id("Text1") + element.send_keys("world ") + element.send_keys("wide ") + element.send_keys("web ") + element.send_keys("consortium") + + backspace= unichr(int("E003", 16)) + for i in range(0, 11): + element.send_keys([backspace]) + + self.assertEquals(self.driver.find_element_by_id("text").get_text(), u"world wide web") + + def test_send_tab(self): + element1 = self.driver.find_element_by_id("Text1") + element2 = self.driver.find_element_by_id("Text2") + element1.send_keys("typing here") + + tab= unichr(int("E004", 16)) + element1.send_keys([tab]) + + output = self.driver.find_element_by_id("output") + tab_pressed = output.get_attribute("checked") + self.assertEquals(tab_pressed, u"true") + + def test_send_shift(self): + element = self.driver.find_element_by_id("Text1") + element.send_keys("low ") + + shift= unichr(int("E008", 16)) + element.send_keys([shift , "u", "p", shift]) + + self.assertEquals(self.driver.find_element_by_id("text").get_text(), u"low UP") + + def test_send_arrow_keys(self): + element = self.driver.find_element_by_id("Text1") + + element.send_keys("internet") + + backspace= unichr(int("E003", 16)) + left= unichr(int("E012", 16)) + right= unichr(int("E014", 16)) + for i in range(0, 4): + element.send_keys([left]) + + element.send_keys([backspace]) + element.send_keys([right]) + element.send_keys("a") + + self.assertEquals(self.driver.find_element_by_id("text").get_text(), u"intranet") + + def test_select_text_with_shift(self): + element = self.driver.find_element_by_id("Text1") + + element.send_keys("WebDriver") + backspace= unichr(int("E003", 16)) + shift= unichr(int("E008", 16)) + left= unichr(int("E012", 16)) + + element.send_keys([shift, left, left, left, left, left, left, backspace]) + + self.assertEquals(self.driver.find_element_by_id("text").get_text(), u"Web") + + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/webdriver.cfg b/testing/web-platform/tests/old-tests/webdriver/webdriver.cfg new file mode 100644 index 000000000..cb74f56ce --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/webdriver.cfg @@ -0,0 +1,35 @@ +# to add more browsers specify a [section header] with the name +# the 'browser' is currently required +# url and capabilities are optional +# url is the 'command_executor' argument passed in to the 'browser' class +# capabilities is the 'desired_capabilities' argument. + +[firefox] +capabilities: {"browserName": "firefox"} +mode: compatibility + +[selendroid] +capabilities: {"platform": "ANDROID", "browserName": "android"} +mode: compatibility + +[chrome] +url: http://localhost:9515 +capabilities: {"browserName": "chrome"} +mode: compatibility + +[ie] +capabilities: {"browserName": "ie"} +mode: compatibility + +[edge] +capabilities: {"browserName": "edge"} +mode: compatibility + +[ios-driver] +capabilities: {"browserName": "iphone"} +mode: compatibility + +[blackberry] +url: http://169.254.0.1:1338 +capabilities: {"browserName": "blackberry"} +mode: compatibility diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/__init__.py b/testing/web-platform/tests/old-tests/webdriver/windows/__init__.py new file mode 100644 index 000000000..0c8107beb --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/__init__.py @@ -0,0 +1 @@ +__author__ = 'b-redeg' diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/res/win1.html b/testing/web-platform/tests/old-tests/webdriver/windows/res/win1.html new file mode 100644 index 000000000..b8bf7e80b --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/res/win1.html @@ -0,0 +1,5 @@ + + +window one + +
win2
\ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/res/win2.html b/testing/web-platform/tests/old-tests/webdriver/windows/res/win2.html new file mode 100644 index 000000000..81a068fa8 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/res/win2.html @@ -0,0 +1,5 @@ + + +window two + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/res/win3.html b/testing/web-platform/tests/old-tests/webdriver/windows/res/win3.html new file mode 100644 index 000000000..d3ee6944b --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/res/win3.html @@ -0,0 +1,5 @@ + + +window three + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/res/win4.html b/testing/web-platform/tests/old-tests/webdriver/windows/res/win4.html new file mode 100644 index 000000000..ef35f7617 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/res/win4.html @@ -0,0 +1,5 @@ + + +window four + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/res/win5.html b/testing/web-platform/tests/old-tests/webdriver/windows/res/win5.html new file mode 100644 index 000000000..673d2a19a --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/res/win5.html @@ -0,0 +1,5 @@ + + +window five + +  \ No newline at end of file diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/tabbing.py b/testing/web-platform/tests/old-tests/webdriver/windows/tabbing.py new file mode 100644 index 000000000..a6b5f99bf --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/tabbing.py @@ -0,0 +1,30 @@ +# -*- mode: python; fill-column: 100; comment-column: 100; -*- + +import os +import sys +import unittest +import time + +sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../.."))) +import base_test +from selenium.common import exceptions +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.common.action_chains import ActionChains + + +class tabbingTest(base_test.WebDriverBaseTest): + def test_open_close_tab(self): + self.driver.get(self.webserver.where_is("windows/res/win1.html")) + self.driver.find_element_by_tag_name("div").click() + h = self.driver.window_handles + self.assertEquals(2, len(h)) + self.driver.switch_to.window(h[1]) + try: + self.driver.switch_to.window("does not exist") + self.fail("NoSuchWindowException expected") + except exceptions.NoSuchWindowException: + pass + self.driver.close() + +if __name__ == "__main__": + unittest.main() diff --git a/testing/web-platform/tests/old-tests/webdriver/windows/window_manipulation.py b/testing/web-platform/tests/old-tests/webdriver/windows/window_manipulation.py new file mode 100644 index 000000000..027716727 --- /dev/null +++ b/testing/web-platform/tests/old-tests/webdriver/windows/window_manipulation.py @@ -0,0 +1,43 @@ +# -*- mode: python; fill-column: 100; comment-column: 100; -*- + +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 WindowingTest(base_test.WebDriverBaseTest): + def test_maximize(self): + #self.driver.get(self.webserver.where_is("windows/res/win1.html")) + self.driver.maximize_window() + + def test_window_size_manipulation(self): + #self.driver.get(self.webserver.where_is("windows/res/win1.html")) + self.driver.set_window_size(400, 400) + window_size = self.driver.get_window_size() + self.assertTrue("width" in window_size) + self.assertTrue("height" in window_size) + self.assertEquals({"width": 400, "height":400}, window_size) + + """ + todo: make that work + see: https://w3c.github.io/webdriver/webdriver-spec.html#setwindowsize + result = self.driver.set_window_size(100, 100) + self.assertTrue("status" in result) + self.assertEquals(result["status"], 500) + """ + + def test_window_position_manipulation(self): + #self.driver.get(self.webserver.where_is("windows/res/win1.html")) + self.driver.set_window_position(400, 400) + window_position = self.driver.get_window_position() + self.assertTrue("x" in window_position) + self.assertTrue("y" in window_position) + self.assertEquals({"x": 400, "y": 400}, window_position) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3