selenium-webdriver 3.5.0 → 4.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +246 -0
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/README.md +40 -40
- package/chrome.js +118 -134
- package/edge.js +43 -117
- package/example/chrome_android.js +8 -9
- package/example/chrome_mobile_emulation.js +8 -9
- package/example/firefox_channels.js +23 -19
- package/example/google_search.js +3 -3
- package/example/google_search_test.js +38 -27
- package/example/{chrome_headless.js → headless.js} +15 -7
- package/example/logging.js +40 -7
- package/firefox.js +789 -0
- package/http/index.js +62 -9
- package/http/util.js +11 -6
- package/ie.js +83 -97
- package/index.js +198 -114
- package/io/exec.js +29 -15
- package/io/index.js +1 -1
- package/io/zip.js +1 -1
- package/lib/actions.js +68 -63
- package/lib/atoms/get-attribute.js +86 -0
- package/lib/atoms/is-displayed.js +76 -76
- package/lib/by.js +7 -4
- package/lib/capabilities.js +310 -210
- package/lib/command.js +27 -51
- package/lib/error.js +100 -41
- package/lib/http.js +161 -120
- package/lib/input.js +1044 -8
- package/lib/logging.js +1 -5
- package/lib/promise.js +222 -3331
- package/lib/proxy.js +134 -39
- package/lib/session.js +2 -2
- package/lib/symbols.js +0 -0
- package/lib/until.js +1 -1
- package/lib/webdriver.js +717 -953
- package/net/index.js +21 -25
- package/net/portprober.js +51 -68
- package/package.json +17 -12
- package/proxy.js +0 -0
- package/remote/index.js +63 -44
- package/safari.js +41 -128
- package/testing/index.js +386 -315
- package/.npmignore +0 -2
- package/example/async_await_test.js +0 -68
- package/example/google_search_generator.js +0 -50
- package/example/parallel_flows.js +0 -54
- package/firefox/binary.js +0 -344
- package/firefox/extension.js +0 -224
- package/firefox/index.js +0 -626
- package/firefox/profile.js +0 -394
- package/lib/README +0 -5
- package/lib/atoms/getAttribute.js +0 -9
- package/lib/devmode.js +0 -34
- package/lib/events.js +0 -210
- package/lib/firefox/webdriver.json +0 -70
- package/lib/test/build.js +0 -151
- package/lib/test/data/ClickTest_testClicksASurroundingStrongTag.html +0 -11
- package/lib/test/data/Page.aspx +0 -17
- package/lib/test/data/Page.aspx.cs +0 -22
- package/lib/test/data/Redirect.aspx +0 -11
- package/lib/test/data/Redirect.aspx.cs +0 -9
- package/lib/test/data/Settings.StyleCop +0 -759
- package/lib/test/data/Web.Config +0 -59
- package/lib/test/data/actualXhtmlPage.xhtml +0 -14
- package/lib/test/data/ajaxy_page.html +0 -81
- package/lib/test/data/alerts.html +0 -85
- package/lib/test/data/banner.gif +0 -0
- package/lib/test/data/beach.jpg +0 -0
- package/lib/test/data/blank.html +0 -1
- package/lib/test/data/bodyTypingTest.html +0 -41
- package/lib/test/data/booleanAttributes.html +0 -19
- package/lib/test/data/child/childPage.html +0 -8
- package/lib/test/data/child/grandchild/grandchildPage.html +0 -8
- package/lib/test/data/clickEventPage.html +0 -26
- package/lib/test/data/click_frames.html +0 -10
- package/lib/test/data/click_jacker.html +0 -38
- package/lib/test/data/click_out_of_bounds.html +0 -23
- package/lib/test/data/click_out_of_bounds_overflow.html +0 -85
- package/lib/test/data/click_rtl.html +0 -19
- package/lib/test/data/click_source.html +0 -18
- package/lib/test/data/click_tests/click_iframe.html +0 -6
- package/lib/test/data/click_tests/click_in_iframe.html +0 -8
- package/lib/test/data/click_tests/disabled_element.html +0 -12
- package/lib/test/data/click_tests/disappearing_element.html +0 -62
- package/lib/test/data/click_tests/google_map.html +0 -15
- package/lib/test/data/click_tests/google_map.png +0 -0
- package/lib/test/data/click_tests/html5_submit_buttons.html +0 -16
- package/lib/test/data/click_tests/issue5237.html +0 -9
- package/lib/test/data/click_tests/issue5237_frame.html +0 -1
- package/lib/test/data/click_tests/issue5237_target.html +0 -10
- package/lib/test/data/click_tests/link_that_wraps.html +0 -11
- package/lib/test/data/click_tests/mapped_page1.html +0 -9
- package/lib/test/data/click_tests/mapped_page2.html +0 -9
- package/lib/test/data/click_tests/mapped_page3.html +0 -9
- package/lib/test/data/click_tests/overlapping_elements.html +0 -70
- package/lib/test/data/click_tests/partially_overlapping_elements.html +0 -124
- package/lib/test/data/click_tests/span_that_wraps.html +0 -11
- package/lib/test/data/click_tests/submitted_page.html +0 -9
- package/lib/test/data/click_tests/wrapped_overlapping_elements.html +0 -13
- package/lib/test/data/click_too_big.html +0 -10
- package/lib/test/data/click_too_big_in_frame.html +0 -11
- package/lib/test/data/clicks.html +0 -35
- package/lib/test/data/closeable_window.html +0 -8
- package/lib/test/data/cn-test.html +0 -156
- package/lib/test/data/colorPage.html +0 -20
- package/lib/test/data/cookies.html +0 -30
- package/lib/test/data/coordinates_tests/element_in_frame.html +0 -9
- package/lib/test/data/coordinates_tests/element_in_nested_frame.html +0 -9
- package/lib/test/data/coordinates_tests/page_with_element_out_of_view.html +0 -11
- package/lib/test/data/coordinates_tests/page_with_empty_element.html +0 -10
- package/lib/test/data/coordinates_tests/page_with_fixed_element.html +0 -12
- package/lib/test/data/coordinates_tests/page_with_hidden_element.html +0 -10
- package/lib/test/data/coordinates_tests/page_with_invisible_element.html +0 -10
- package/lib/test/data/coordinates_tests/page_with_transparent_element.html +0 -10
- package/lib/test/data/coordinates_tests/simple_page.html +0 -10
- package/lib/test/data/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- package/lib/test/data/css/ui-lightness/jquery-ui-1.8.10.custom.css +0 -573
- package/lib/test/data/cssTransform.html +0 -61
- package/lib/test/data/cssTransform2.html +0 -20
- package/lib/test/data/document_write_in_onload.html +0 -13
- package/lib/test/data/dragAndDropInsideScrolledDiv.html +0 -67
- package/lib/test/data/dragAndDropTest.html +0 -102
- package/lib/test/data/dragDropOverflow.html +0 -104
- package/lib/test/data/draggableLists.html +0 -67
- package/lib/test/data/droppableItems.html +0 -65
- package/lib/test/data/dynamic.html +0 -39
- package/lib/test/data/dynamicallyModifiedPage.html +0 -42
- package/lib/test/data/errors.html +0 -15
- package/lib/test/data/firefox/jetpack-sample.xpi +0 -0
- package/lib/test/data/firefox/sample.xpi +0 -0
- package/lib/test/data/firefox/webextension.xpi +0 -0
- package/lib/test/data/fixedFooterNoScroll.html +0 -13
- package/lib/test/data/fixedFooterNoScrollQuirksMode.html +0 -12
- package/lib/test/data/formPage.html +0 -175
- package/lib/test/data/formSelectionPage.html +0 -46
- package/lib/test/data/form_handling_js_submit.html +0 -30
- package/lib/test/data/framePage3.html +0 -7
- package/lib/test/data/frameScrollChild.html +0 -26
- package/lib/test/data/frameScrollPage.html +0 -14
- package/lib/test/data/frameScrollParent.html +0 -11
- package/lib/test/data/frameWithAnimals.html +0 -11
- package/lib/test/data/frame_switching_tests/bug4876.html +0 -9
- package/lib/test/data/frame_switching_tests/bug4876_iframe.html +0 -9
- package/lib/test/data/frame_switching_tests/deletingFrame.html +0 -29
- package/lib/test/data/frame_switching_tests/deletingFrame_iframe.html +0 -8
- package/lib/test/data/frame_switching_tests/deletingFrame_iframe2.html +0 -7
- package/lib/test/data/frameset.html +0 -14
- package/lib/test/data/framesetPage2.html +0 -7
- package/lib/test/data/framesetPage3.html +0 -4
- package/lib/test/data/globalscope.html +0 -15
- package/lib/test/data/hidden.html +0 -5
- package/lib/test/data/hidden_partially.html +0 -45
- package/lib/test/data/html5/blue.jpg +0 -0
- package/lib/test/data/html5/database.js +0 -84
- package/lib/test/data/html5/geolocation.js +0 -18
- package/lib/test/data/html5/green.jpg +0 -0
- package/lib/test/data/html5/red.jpg +0 -0
- package/lib/test/data/html5/status.html +0 -1
- package/lib/test/data/html5/test.appcache +0 -11
- package/lib/test/data/html5/yellow.jpg +0 -0
- package/lib/test/data/html5Page.html +0 -32
- package/lib/test/data/icon.gif +0 -0
- package/lib/test/data/idElements.html +0 -2
- package/lib/test/data/iframeAtBottom.html +0 -15
- package/lib/test/data/iframeWithAlert.html +0 -1
- package/lib/test/data/iframeWithIframe.html +0 -1
- package/lib/test/data/iframes.html +0 -11
- package/lib/test/data/injectableContent.html +0 -22
- package/lib/test/data/javascriptEnhancedForm.html +0 -30
- package/lib/test/data/javascriptPage.html +0 -285
- package/lib/test/data/jquery-1.3.2.js +0 -4376
- package/lib/test/data/js/jquery-1.4.4.min.js +0 -167
- package/lib/test/data/js/jquery-ui-1.8.10.custom.min.js +0 -782
- package/lib/test/data/js/skins/lightgray/content.inline.min.css +0 -1
- package/lib/test/data/js/skins/lightgray/content.min.css +0 -1
- package/lib/test/data/js/skins/lightgray/fonts/readme.md +0 -1
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.dev.svg +0 -175
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.eot +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.svg +0 -62
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce-small.woff +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.dev.svg +0 -153
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.eot +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.svg +0 -63
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.ttf +0 -0
- package/lib/test/data/js/skins/lightgray/fonts/tinymce.woff +0 -0
- package/lib/test/data/js/skins/lightgray/img/anchor.gif +0 -0
- package/lib/test/data/js/skins/lightgray/img/loader.gif +0 -0
- package/lib/test/data/js/skins/lightgray/img/object.gif +0 -0
- package/lib/test/data/js/skins/lightgray/img/trans.gif +0 -0
- package/lib/test/data/js/skins/lightgray/skin.ie7.min.css +0 -1
- package/lib/test/data/js/skins/lightgray/skin.min.css +0 -1
- package/lib/test/data/js/themes/modern/theme.min.js +0 -1
- package/lib/test/data/js/tinymce.min.js +0 -10
- package/lib/test/data/key_logger.html +0 -34
- package/lib/test/data/key_tests/remove_on_keypress.html +0 -36
- package/lib/test/data/keyboard_shortcut.html +0 -36
- package/lib/test/data/linked_image.html +0 -16
- package/lib/test/data/locators_tests/boolean_attribute_selected.html +0 -13
- package/lib/test/data/locators_tests/boolean_attribute_selected_html4.html +0 -13
- package/lib/test/data/longContentPage.html +0 -55
- package/lib/test/data/macbeth.html +0 -5255
- package/lib/test/data/map.png +0 -0
- package/lib/test/data/map_visibility.html +0 -8
- package/lib/test/data/markerTransparent.png +0 -0
- package/lib/test/data/messages.html +0 -15
- package/lib/test/data/meta-redirect.html +0 -11
- package/lib/test/data/missedJsReference.html +0 -11
- package/lib/test/data/modal_dialogs/modal_1.html +0 -21
- package/lib/test/data/modal_dialogs/modal_2.html +0 -21
- package/lib/test/data/modal_dialogs/modal_3.html +0 -15
- package/lib/test/data/modal_dialogs/modalindex.html +0 -21
- package/lib/test/data/mouseOver.html +0 -17
- package/lib/test/data/mousePositionTracker.html +0 -33
- package/lib/test/data/nestedElements.html +0 -164
- package/lib/test/data/overflow/x_auto_y_auto.html +0 -30
- package/lib/test/data/overflow/x_auto_y_hidden.html +0 -30
- package/lib/test/data/overflow/x_auto_y_scroll.html +0 -30
- package/lib/test/data/overflow/x_hidden_y_auto.html +0 -30
- package/lib/test/data/overflow/x_hidden_y_hidden.html +0 -30
- package/lib/test/data/overflow/x_hidden_y_scroll.html +0 -30
- package/lib/test/data/overflow/x_scroll_y_auto.html +0 -30
- package/lib/test/data/overflow/x_scroll_y_hidden.html +0 -30
- package/lib/test/data/overflow/x_scroll_y_scroll.html +0 -30
- package/lib/test/data/overflow-body.html +0 -15
- package/lib/test/data/pageWithOnBeforeUnloadMessage.html +0 -20
- package/lib/test/data/pageWithOnLoad.html +0 -6
- package/lib/test/data/pageWithOnUnload.html +0 -6
- package/lib/test/data/page_with_link_to_slow_loading_page.html +0 -6
- package/lib/test/data/plain.txt +0 -1
- package/lib/test/data/proxy/page1.html +0 -20
- package/lib/test/data/proxy/page2.html +0 -24
- package/lib/test/data/proxy/page3.html +0 -5
- package/lib/test/data/readOnlyPage.html +0 -24
- package/lib/test/data/rectangles.html +0 -40
- package/lib/test/data/resultPage.html +0 -25
- package/lib/test/data/rich_text.html +0 -161
- package/lib/test/data/safari/frames_benchmark.html +0 -31
- package/lib/test/data/screen/screen.css +0 -19
- package/lib/test/data/screen/screen.html +0 -72
- package/lib/test/data/screen/screen.js +0 -7
- package/lib/test/data/screen/screen_frame1.html +0 -72
- package/lib/test/data/screen/screen_frame2.html +0 -72
- package/lib/test/data/screen/screen_frames.html +0 -11
- package/lib/test/data/screen/screen_iframes.html +0 -12
- package/lib/test/data/screen/screen_too_long.html +0 -68
- package/lib/test/data/screen/screen_x_long.html +0 -72
- package/lib/test/data/screen/screen_x_too_long.html +0 -72
- package/lib/test/data/screen/screen_y_long.html +0 -72
- package/lib/test/data/screen/screen_y_too_long.html +0 -72
- package/lib/test/data/scroll.html +0 -27
- package/lib/test/data/scroll2.html +0 -21
- package/lib/test/data/scroll3.html +0 -8
- package/lib/test/data/scroll4.html +0 -7
- package/lib/test/data/scroll5.html +0 -18
- package/lib/test/data/scrolling_tests/frame_with_height_above_200.html +0 -26
- package/lib/test/data/scrolling_tests/frame_with_height_above_2000.html +0 -26
- package/lib/test/data/scrolling_tests/frame_with_nested_scrolling_frame.html +0 -11
- package/lib/test/data/scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/frame_with_small_height.html +0 -10
- package/lib/test/data/scrolling_tests/page_with_double_overflow_auto.html +0 -19
- package/lib/test/data/scrolling_tests/page_with_frame_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/page_with_nested_scrolling_frames.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/page_with_non_scrolling_frame.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_scrolling_frame.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_scrolling_frame_out_of_view.html +0 -12
- package/lib/test/data/scrolling_tests/page_with_tall_frame.html +0 -11
- package/lib/test/data/scrolling_tests/page_with_y_overflow_auto.html +0 -14
- package/lib/test/data/scrolling_tests/target_page.html +0 -9
- package/lib/test/data/selectPage.html +0 -58
- package/lib/test/data/selectableItems.html +0 -65
- package/lib/test/data/sessionCookie.html +0 -21
- package/lib/test/data/sessionCookieDest.html +0 -34
- package/lib/test/data/simple.xml +0 -5
- package/lib/test/data/simpleTest.html +0 -98
- package/lib/test/data/single_text_input.html +0 -12
- package/lib/test/data/slowLoadingAlert.html +0 -10
- package/lib/test/data/slowLoadingResourcePage.html +0 -12
- package/lib/test/data/slow_loading_iframes.html +0 -14
- package/lib/test/data/styledPage.html +0 -28
- package/lib/test/data/svgPiechart.xhtml +0 -81
- package/lib/test/data/svgTest.svg +0 -4
- package/lib/test/data/tables.html +0 -36
- package/lib/test/data/tinymce.html +0 -10
- package/lib/test/data/transformable.xml +0 -11
- package/lib/test/data/transformable.xsl +0 -37
- package/lib/test/data/transparentUpload.html +0 -70
- package/lib/test/data/underscore.html +0 -9
- package/lib/test/data/unicode_ltr.html +0 -8
- package/lib/test/data/upload.html +0 -45
- package/lib/test/data/userDefinedProperty.html +0 -8
- package/lib/test/data/veryLargeCanvas.html +0 -81
- package/lib/test/data/visibility-css.html +0 -21
- package/lib/test/data/win32frameset.html +0 -8
- package/lib/test/data/window_switching_tests/page_with_frame.html +0 -12
- package/lib/test/data/window_switching_tests/simple_page.html +0 -9
- package/lib/test/data/xhtmlFormPage.xhtml +0 -17
- package/lib/test/data/xhtmlTest.html +0 -76
- package/lib/test/fileserver.js +0 -321
- package/lib/test/httpserver.js +0 -120
- package/lib/test/index.js +0 -270
- package/lib/test/promise.js +0 -79
- package/lib/test/resources.js +0 -44
- package/opera.js +0 -405
- package/phantomjs.js +0 -282
- package/test/actions_test.js +0 -52
- package/test/chrome/options_test.js +0 -227
- package/test/chrome/service_test.js +0 -45
- package/test/cookie_test.js +0 -214
- package/test/element_finding_test.js +0 -426
- package/test/execute_script_test.js +0 -350
- package/test/fingerprint_test.js +0 -62
- package/test/firefox/extension_test.js +0 -120
- package/test/firefox/firefox_test.js +0 -261
- package/test/firefox/profile_test.js +0 -140
- package/test/http/http_test.js +0 -223
- package/test/http/util_test.js +0 -178
- package/test/io/io_test.js +0 -360
- package/test/io/zip_test.js +0 -128
- package/test/lib/by_test.js +0 -160
- package/test/lib/capabilities_test.js +0 -111
- package/test/lib/error_test.js +0 -305
- package/test/lib/events_test.js +0 -177
- package/test/lib/http_test.js +0 -696
- package/test/lib/logging_test.js +0 -272
- package/test/lib/promise_aplus_test.js +0 -78
- package/test/lib/promise_error_test.js +0 -884
- package/test/lib/promise_flow_test.js +0 -2288
- package/test/lib/promise_generator_test.js +0 -310
- package/test/lib/promise_test.js +0 -1109
- package/test/lib/testutil.js +0 -90
- package/test/lib/until_test.js +0 -478
- package/test/lib/webdriver_test.js +0 -2311
- package/test/logging_test.js +0 -167
- package/test/net/index_test.js +0 -60
- package/test/net/portprober_test.js +0 -128
- package/test/page_loading_test.js +0 -166
- package/test/phantomjs/execute_phantomjs_test.js +0 -59
- package/test/proxy_test.js +0 -180
- package/test/rect_test.js +0 -60
- package/test/remote_test.js +0 -117
- package/test/safari_test.js +0 -108
- package/test/session_test.js +0 -99
- package/test/stale_element_test.js +0 -63
- package/test/tag_name_test.js +0 -36
- package/test/testing/assert_test.js +0 -373
- package/test/testing/index_test.js +0 -224
- package/test/upload_test.js +0 -86
- package/test/window_test.js +0 -161
- package/testing/assert.js +0 -378
package/test/proxy_test.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var http = require('http'),
|
|
21
|
-
url = require('url');
|
|
22
|
-
|
|
23
|
-
var Browser = require('..').Browser,
|
|
24
|
-
promise = require('..').promise,
|
|
25
|
-
firefox = require('../firefox'),
|
|
26
|
-
proxy = require('../proxy'),
|
|
27
|
-
assert = require('../testing/assert'),
|
|
28
|
-
test = require('../lib/test'),
|
|
29
|
-
Server = require('../lib/test/httpserver').Server,
|
|
30
|
-
Pages = test.Pages;
|
|
31
|
-
|
|
32
|
-
test.suite(function(env) {
|
|
33
|
-
function writeResponse(res, body, encoding, contentType) {
|
|
34
|
-
res.writeHead(200, {
|
|
35
|
-
'Content-Length': Buffer.byteLength(body, encoding),
|
|
36
|
-
'Content-Type': contentType
|
|
37
|
-
});
|
|
38
|
-
res.end(body);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function writePacFile(res) {
|
|
42
|
-
writeResponse(res, [
|
|
43
|
-
'function FindProxyForURL(url, host) {',
|
|
44
|
-
' if (shExpMatch(url, "' + goodbyeServer.url('*') + '")) {',
|
|
45
|
-
' return "DIRECT";',
|
|
46
|
-
' }',
|
|
47
|
-
' return "PROXY ' + proxyServer.host() + '";',
|
|
48
|
-
'}'
|
|
49
|
-
].join('\n'), 'ascii', 'application/x-javascript-config');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var proxyServer = new Server(function(req, res) {
|
|
53
|
-
var pathname = url.parse(req.url).pathname;
|
|
54
|
-
if (pathname === '/proxy.pac') {
|
|
55
|
-
return writePacFile(res);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
writeResponse(res, [
|
|
59
|
-
'<!DOCTYPE html>',
|
|
60
|
-
'<title>Proxy page</title>',
|
|
61
|
-
'<h3>This is the proxy landing page</h3>'
|
|
62
|
-
].join(''), 'utf8', 'text/html; charset=UTF-8');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
var helloServer = new Server(function(req, res) {
|
|
66
|
-
writeResponse(res, [
|
|
67
|
-
'<!DOCTYPE html>',
|
|
68
|
-
'<title>Hello</title>',
|
|
69
|
-
'<h3>Hello, world!</h3>'
|
|
70
|
-
].join(''), 'utf8', 'text/html; charset=UTF-8');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
var goodbyeServer = new Server(function(req, res) {
|
|
74
|
-
writeResponse(res, [
|
|
75
|
-
'<!DOCTYPE html>',
|
|
76
|
-
'<title>Goodbye</title>',
|
|
77
|
-
'<h3>Goodbye, world!</h3>'
|
|
78
|
-
].join(''), 'utf8', 'text/html; charset=UTF-8');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// Cannot pass start directly to mocha's before, as mocha will interpret the optional
|
|
82
|
-
// port parameter as an async callback parameter.
|
|
83
|
-
function mkStartFunc(server) {
|
|
84
|
-
return function() {
|
|
85
|
-
return server.start();
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
test.before(mkStartFunc(proxyServer));
|
|
90
|
-
test.before(mkStartFunc(helloServer));
|
|
91
|
-
test.before(mkStartFunc(goodbyeServer));
|
|
92
|
-
|
|
93
|
-
test.after(proxyServer.stop.bind(proxyServer));
|
|
94
|
-
test.after(helloServer.stop.bind(helloServer));
|
|
95
|
-
test.after(goodbyeServer.stop.bind(goodbyeServer));
|
|
96
|
-
|
|
97
|
-
var driver;
|
|
98
|
-
test.beforeEach(function() { driver = null; });
|
|
99
|
-
test.afterEach(function() { return driver && driver.quit(); });
|
|
100
|
-
|
|
101
|
-
function createDriver(proxy) {
|
|
102
|
-
// For Firefox we need to explicitly enable proxies for localhost by
|
|
103
|
-
// clearing the network.proxy.no_proxies_on preference.
|
|
104
|
-
let profile = new firefox.Profile();
|
|
105
|
-
profile.setPreference('network.proxy.no_proxies_on', '');
|
|
106
|
-
|
|
107
|
-
return driver = env.builder()
|
|
108
|
-
.setFirefoxOptions(new firefox.Options().setProfile(profile))
|
|
109
|
-
.setProxy(proxy)
|
|
110
|
-
.build();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Proxy support not implemented.
|
|
114
|
-
test.ignore(env.browsers(Browser.IE, Browser.OPERA, Browser.SAFARI)).
|
|
115
|
-
describe('manual proxy settings', function() {
|
|
116
|
-
// phantomjs 1.9.1 in webdriver mode does not appear to respect proxy
|
|
117
|
-
// settings.
|
|
118
|
-
test.ignore(env.browsers(Browser.PHANTOM_JS)).
|
|
119
|
-
it('can configure HTTP proxy host', function*() {
|
|
120
|
-
yield createDriver(proxy.manual({
|
|
121
|
-
http: proxyServer.host()
|
|
122
|
-
}));
|
|
123
|
-
|
|
124
|
-
yield driver.get(helloServer.url());
|
|
125
|
-
yield assert(driver.getTitle()).equalTo('Proxy page');
|
|
126
|
-
yield assert(driver.findElement({tagName: 'h3'}).getText()).
|
|
127
|
-
equalTo('This is the proxy landing page');
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// PhantomJS does not support bypassing the proxy for individual hosts.
|
|
131
|
-
// geckodriver does not support the bypass option, this must be configured
|
|
132
|
-
// through profile preferences.
|
|
133
|
-
test.ignore(env.browsers(
|
|
134
|
-
Browser.FIREFOX,
|
|
135
|
-
'legacy-' + Browser.FIREFOX,
|
|
136
|
-
Browser.PHANTOM_JS)).
|
|
137
|
-
it('can bypass proxy for specific hosts', function*() {
|
|
138
|
-
yield createDriver(proxy.manual({
|
|
139
|
-
http: proxyServer.host(),
|
|
140
|
-
bypass: helloServer.host()
|
|
141
|
-
}));
|
|
142
|
-
|
|
143
|
-
yield driver.get(helloServer.url());
|
|
144
|
-
yield assert(driver.getTitle()).equalTo('Hello');
|
|
145
|
-
yield assert(driver.findElement({tagName: 'h3'}).getText()).
|
|
146
|
-
equalTo('Hello, world!');
|
|
147
|
-
|
|
148
|
-
yield driver.get(goodbyeServer.url());
|
|
149
|
-
yield assert(driver.getTitle()).equalTo('Proxy page');
|
|
150
|
-
yield assert(driver.findElement({tagName: 'h3'}).getText()).
|
|
151
|
-
equalTo('This is the proxy landing page');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// TODO: test ftp and https proxies.
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// PhantomJS does not support PAC file proxy configuration.
|
|
158
|
-
// Safari does not support proxies.
|
|
159
|
-
test.ignore(env.browsers(
|
|
160
|
-
Browser.IE, Browser.OPERA, Browser.PHANTOM_JS, Browser.SAFARI)).
|
|
161
|
-
describe('pac proxy settings', function() {
|
|
162
|
-
test.it('can configure proxy through PAC file', function*() {
|
|
163
|
-
yield createDriver(proxy.pac(proxyServer.url('/proxy.pac')));
|
|
164
|
-
|
|
165
|
-
yield driver.get(helloServer.url());
|
|
166
|
-
yield assert(driver.getTitle()).equalTo('Proxy page');
|
|
167
|
-
yield assert(driver.findElement({tagName: 'h3'}).getText()).
|
|
168
|
-
equalTo('This is the proxy landing page');
|
|
169
|
-
|
|
170
|
-
yield driver.get(goodbyeServer.url());
|
|
171
|
-
yield assert(driver.getTitle()).equalTo('Goodbye');
|
|
172
|
-
yield assert(driver.findElement({tagName: 'h3'}).getText()).
|
|
173
|
-
equalTo('Goodbye, world!');
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
// TODO: figure out how to test direct and system proxy settings.
|
|
178
|
-
describe.skip('direct proxy settings', function() {});
|
|
179
|
-
describe.skip('system proxy settings', function() {});
|
|
180
|
-
});
|
package/test/rect_test.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
const assert = require('assert');
|
|
21
|
-
|
|
22
|
-
const {By} = require('..');
|
|
23
|
-
const test = require('../lib/test');
|
|
24
|
-
|
|
25
|
-
test.suite(function(env) {
|
|
26
|
-
describe('rect commands', function() {
|
|
27
|
-
let driver;
|
|
28
|
-
let el;
|
|
29
|
-
|
|
30
|
-
test.before(function*() {
|
|
31
|
-
driver = yield env.builder().build();
|
|
32
|
-
yield driver.get(
|
|
33
|
-
'data:text/html,<!DOCTYPE html><style>'
|
|
34
|
-
+ '*{padding:0; margin:0}'
|
|
35
|
-
+ 'div{position: absolute; top: 50px; left: 50px;'
|
|
36
|
-
+ 'height: 50px;width:50px;background: green;}'
|
|
37
|
-
+ '</style><div>Hello</div>');
|
|
38
|
-
el = yield driver.findElement(By.css('div'));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
after(function() {
|
|
42
|
-
if (driver) {
|
|
43
|
-
return driver.quit();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test.it('WebElement.getLocation()', function*() {
|
|
48
|
-
let location = yield el.getLocation();
|
|
49
|
-
assert.equal(location.x, 50);
|
|
50
|
-
assert.equal(location.y, 50);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test.it('WebElement.getSize()', function*() {
|
|
54
|
-
let size = yield el.getSize();
|
|
55
|
-
assert.equal(size.width, 50);
|
|
56
|
-
assert.equal(size.height, 50);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
});
|
package/test/remote_test.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var assert = require('assert'),
|
|
21
|
-
fs = require('fs'),
|
|
22
|
-
path = require('path');
|
|
23
|
-
|
|
24
|
-
var promise = require('../').promise,
|
|
25
|
-
io = require('../io'),
|
|
26
|
-
cmd = require('../lib/command'),
|
|
27
|
-
remote = require('../remote');
|
|
28
|
-
|
|
29
|
-
const {enablePromiseManager} = require('../lib/test/promise');
|
|
30
|
-
|
|
31
|
-
describe('DriverService', function() {
|
|
32
|
-
describe('start()', function() {
|
|
33
|
-
var service;
|
|
34
|
-
|
|
35
|
-
beforeEach(function() {
|
|
36
|
-
service = new remote.DriverService(process.execPath, {
|
|
37
|
-
port: 1234,
|
|
38
|
-
args: ['-e', 'process.exit(1)']
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
afterEach(function() {
|
|
43
|
-
return service.kill();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('fails if child-process dies', function() {
|
|
47
|
-
this.timeout(1000);
|
|
48
|
-
return service.start(500).then(expectFailure, verifyFailure);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
enablePromiseManager(function() {
|
|
52
|
-
describe(
|
|
53
|
-
'failures propagate through control flow if child-process dies',
|
|
54
|
-
function() {
|
|
55
|
-
it('', function() {
|
|
56
|
-
this.timeout(1000);
|
|
57
|
-
|
|
58
|
-
return promise.controlFlow().execute(function() {
|
|
59
|
-
promise.controlFlow().execute(function() {
|
|
60
|
-
return service.start(500);
|
|
61
|
-
});
|
|
62
|
-
}).then(expectFailure, verifyFailure);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
function verifyFailure(e) {
|
|
68
|
-
assert.ok(!(e instanceof promise.CancellationError));
|
|
69
|
-
assert.equal('Server terminated early with status 1', e.message);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function expectFailure() {
|
|
73
|
-
throw Error('expected to fail');
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('FileDetector', function() {
|
|
79
|
-
class ExplodingDriver {
|
|
80
|
-
schedule() {
|
|
81
|
-
throw Error('unexpected call');
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
it('returns the original path if the file does not exist', function() {
|
|
86
|
-
return io.tmpDir().then(dir => {
|
|
87
|
-
let theFile = path.join(dir, 'not-there');
|
|
88
|
-
return (new remote.FileDetector)
|
|
89
|
-
.handleFile(new ExplodingDriver, theFile)
|
|
90
|
-
.then(f => assert.equal(f, theFile));
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('returns the original path if it is a directory', function() {
|
|
95
|
-
return io.tmpDir().then(dir => {
|
|
96
|
-
return (new remote.FileDetector)
|
|
97
|
-
.handleFile(new ExplodingDriver, dir)
|
|
98
|
-
.then(f => assert.equal(f, dir));
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('attempts to upload valid files', function() {
|
|
103
|
-
return io.tmpFile().then(theFile => {
|
|
104
|
-
return (new remote.FileDetector)
|
|
105
|
-
.handleFile(
|
|
106
|
-
new (class FakeDriver {
|
|
107
|
-
schedule(command) {
|
|
108
|
-
assert.equal(command.getName(), cmd.Name.UPLOAD_FILE);
|
|
109
|
-
assert.equal(typeof command.getParameters()['file'], 'string');
|
|
110
|
-
return Promise.resolve('success!');
|
|
111
|
-
}
|
|
112
|
-
}),
|
|
113
|
-
theFile)
|
|
114
|
-
.then(f => assert.equal(f, 'success!'));
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
package/test/safari_test.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
const webdriver = require('..'),
|
|
21
|
-
proxy = require('../proxy'),
|
|
22
|
-
safari = require('../safari'),
|
|
23
|
-
assert = require('../testing/assert'),
|
|
24
|
-
test = require('../lib/test');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
describe('safari.Options', function() {
|
|
28
|
-
describe('fromCapabilities', function() {
|
|
29
|
-
it('returns a new Options instance if none were defined', function() {
|
|
30
|
-
let options = safari.Options.fromCapabilities(
|
|
31
|
-
new webdriver.Capabilities());
|
|
32
|
-
assert(options).instanceOf(safari.Options);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('returns the options instance if present', function() {
|
|
36
|
-
let options = new safari.Options().setCleanSession(true),
|
|
37
|
-
caps = options.toCapabilities();
|
|
38
|
-
assert(safari.Options.fromCapabilities(caps)).equalTo(options);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('extracts supported WebDriver capabilities', function() {
|
|
42
|
-
let proxyPrefs = proxy.direct(),
|
|
43
|
-
logPrefs = {},
|
|
44
|
-
caps = webdriver.Capabilities.chrome()
|
|
45
|
-
.set(webdriver.Capability.PROXY, proxyPrefs)
|
|
46
|
-
.set(webdriver.Capability.LOGGING_PREFS, logPrefs);
|
|
47
|
-
|
|
48
|
-
let options = safari.Options.fromCapabilities(caps);
|
|
49
|
-
assert(options.proxy_).equalTo(proxyPrefs);
|
|
50
|
-
assert(options.logPrefs_).equalTo(logPrefs);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('toCapabilities', function() {
|
|
55
|
-
let options;
|
|
56
|
-
|
|
57
|
-
before(function() {
|
|
58
|
-
options = new safari.Options()
|
|
59
|
-
.setCleanSession(true);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('returns a new capabilities object if one is not provided', function() {
|
|
63
|
-
let caps = options.toCapabilities();
|
|
64
|
-
assert(caps).instanceOf(webdriver.Capabilities);
|
|
65
|
-
assert(caps.get('browserName')).equalTo('safari');
|
|
66
|
-
assert(caps.get('safari.options')).equalTo(options);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('adds to input capabilities object', function() {
|
|
70
|
-
let caps = webdriver.Capabilities.safari();
|
|
71
|
-
assert(options.toCapabilities(caps)).equalTo(caps);
|
|
72
|
-
assert(caps.get('safari.options')).equalTo(options);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('sets generic driver capabilities', function() {
|
|
76
|
-
let proxyPrefs = proxy.direct(),
|
|
77
|
-
loggingPrefs = {};
|
|
78
|
-
|
|
79
|
-
options
|
|
80
|
-
.setLoggingPrefs(loggingPrefs)
|
|
81
|
-
.setProxy(proxyPrefs);
|
|
82
|
-
|
|
83
|
-
let caps = options.toCapabilities();
|
|
84
|
-
assert(caps.get('proxy')).equalTo(proxyPrefs);
|
|
85
|
-
assert(caps.get('loggingPrefs')).equalTo(loggingPrefs);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test.suite(function(env) {
|
|
91
|
-
describe('safaridriver', function() {
|
|
92
|
-
let service;
|
|
93
|
-
|
|
94
|
-
afterEach(function() {
|
|
95
|
-
if (service) {
|
|
96
|
-
return service.kill();
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('can start safaridriver', function() {
|
|
101
|
-
service = new safari.ServiceBuilder().build();
|
|
102
|
-
|
|
103
|
-
return service.start().then(function(url) {
|
|
104
|
-
assert(url).matches(/127\.0\.0\.1/);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
}, {browsers: ['safari']});
|
package/test/session_test.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
const assert = require('../testing/assert');
|
|
21
|
-
const chrome = require('../chrome');
|
|
22
|
-
const edge = require('../edge');
|
|
23
|
-
const firefox = require('../firefox');
|
|
24
|
-
const ie = require('../ie');
|
|
25
|
-
const opera = require('../opera');
|
|
26
|
-
const phantomjs = require('../phantomjs');
|
|
27
|
-
const safari = require('../safari');
|
|
28
|
-
const test = require('../lib/test');
|
|
29
|
-
const {Browser} = require('../lib/capabilities');
|
|
30
|
-
const {Pages} = require('../lib/test');
|
|
31
|
-
const {WebDriver} = require('..');
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
test.suite(function(env) {
|
|
35
|
-
var browsers = env.browsers;
|
|
36
|
-
|
|
37
|
-
const BROWSER_MAP = new Map([
|
|
38
|
-
[Browser.CHROME, chrome.Driver],
|
|
39
|
-
[Browser.EDGE, edge.Driver],
|
|
40
|
-
[Browser.FIREFOX, firefox.Driver],
|
|
41
|
-
[Browser.INTERNET_EXPLORER, ie.Driver],
|
|
42
|
-
[Browser.OPERA, opera.Driver],
|
|
43
|
-
[Browser.PHANTOM_JS, phantomjs.Driver],
|
|
44
|
-
[Browser.SAFARI, safari.Driver],
|
|
45
|
-
]);
|
|
46
|
-
|
|
47
|
-
if (BROWSER_MAP.has(env.currentBrowser())) {
|
|
48
|
-
describe('builder creates thenable driver instances', function() {
|
|
49
|
-
let driver;
|
|
50
|
-
|
|
51
|
-
after(() => driver && driver.quit());
|
|
52
|
-
|
|
53
|
-
it(env.currentBrowser(), function() {
|
|
54
|
-
driver = env.builder().build();
|
|
55
|
-
|
|
56
|
-
const want = BROWSER_MAP.get(env.currentBrowser());
|
|
57
|
-
assert(driver).instanceOf(want,
|
|
58
|
-
`want ${want.name}, but got ${driver.name}`);
|
|
59
|
-
assert(typeof driver.then).equalTo('function');
|
|
60
|
-
|
|
61
|
-
return driver
|
|
62
|
-
.then(
|
|
63
|
-
d => assert(d)
|
|
64
|
-
.instanceOf(want, `want ${want.name}, but got ${d.name}`))
|
|
65
|
-
// Load something so the safari driver doesn't crash from starting and
|
|
66
|
-
// stopping in short time.
|
|
67
|
-
.then(() => driver.get(Pages.echoPage));
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
describe('session management', function() {
|
|
73
|
-
var driver;
|
|
74
|
-
test.before(function*() {
|
|
75
|
-
driver = yield env.builder().build();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test.after(function() {
|
|
79
|
-
return driver.quit();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test.it('can connect to an existing session', function*() {
|
|
83
|
-
yield driver.get(Pages.simpleTestPage);
|
|
84
|
-
yield assert(driver.getTitle()).equalTo('Hello WebDriver');
|
|
85
|
-
|
|
86
|
-
return driver.getSession().then(session1 => {
|
|
87
|
-
let driver2 = WebDriver.attachToSession(
|
|
88
|
-
driver.getExecutor(),
|
|
89
|
-
session1.getId());
|
|
90
|
-
|
|
91
|
-
return assert(driver2.getTitle()).equalTo('Hello WebDriver')
|
|
92
|
-
.then(_ => {
|
|
93
|
-
let session2Id = driver2.getSession().then(s => s.getId());
|
|
94
|
-
return assert(session2Id).equalTo(session1.getId());
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var fail = require('assert').fail;
|
|
21
|
-
|
|
22
|
-
var Browser = require('..').Browser,
|
|
23
|
-
By = require('..').By,
|
|
24
|
-
error = require('..').error,
|
|
25
|
-
until = require('..').until,
|
|
26
|
-
assert = require('../testing/assert'),
|
|
27
|
-
test = require('../lib/test'),
|
|
28
|
-
Pages = test.Pages;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
test.suite(function(env) {
|
|
32
|
-
var driver;
|
|
33
|
-
test.before(function*() { driver = yield env.builder().build(); });
|
|
34
|
-
test.after(function() { return driver.quit(); });
|
|
35
|
-
|
|
36
|
-
// Element never goes stale in Safari.
|
|
37
|
-
test.ignore(env.browsers(Browser.SAFARI)).
|
|
38
|
-
it(
|
|
39
|
-
'dynamically removing elements from the DOM trigger a ' +
|
|
40
|
-
'StaleElementReferenceError',
|
|
41
|
-
function*() {
|
|
42
|
-
yield driver.get(Pages.javascriptPage);
|
|
43
|
-
|
|
44
|
-
var toBeDeleted = yield driver.findElement(By.id('deleted'));
|
|
45
|
-
yield assert(toBeDeleted.getTagName()).isEqualTo('p');
|
|
46
|
-
|
|
47
|
-
yield driver.findElement(By.id('delete')).click();
|
|
48
|
-
yield driver.wait(until.stalenessOf(toBeDeleted), 5000);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test.it('an element found in a different frame is stale', function*() {
|
|
52
|
-
yield driver.get(Pages.missedJsReferencePage);
|
|
53
|
-
|
|
54
|
-
var frame = yield driver.findElement(By.css('iframe[name="inner"]'));
|
|
55
|
-
yield driver.switchTo().frame(frame);
|
|
56
|
-
|
|
57
|
-
var el = yield driver.findElement(By.id('oneline'));
|
|
58
|
-
yield driver.switchTo().defaultContent();
|
|
59
|
-
return el.getText().then(fail, function(e) {
|
|
60
|
-
assert(e).instanceOf(error.StaleElementReferenceError);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
package/test/tag_name_test.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
-
// or more contributor license agreements. See the NOTICE file
|
|
3
|
-
// distributed with this work for additional information
|
|
4
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
-
// to you under the Apache License, Version 2.0 (the
|
|
6
|
-
// "License"); you may not use this file except in compliance
|
|
7
|
-
// with the License. You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing,
|
|
12
|
-
// software distributed under the License is distributed on an
|
|
13
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
// KIND, either express or implied. See the License for the
|
|
15
|
-
// specific language governing permissions and limitations
|
|
16
|
-
// under the License.
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var By = require('..').By,
|
|
21
|
-
assert = require('../testing/assert'),
|
|
22
|
-
test = require('../lib/test');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
test.suite(function(env) {
|
|
26
|
-
var driver;
|
|
27
|
-
test.after(function() { return driver.quit(); });
|
|
28
|
-
|
|
29
|
-
test.it('should return lower case tag name', function*() {
|
|
30
|
-
driver = yield env.builder().build();
|
|
31
|
-
yield driver.get(test.Pages.formPage);
|
|
32
|
-
|
|
33
|
-
let el = yield driver.findElement(By.id('cheese'));
|
|
34
|
-
return assert(el.getTagName()).equalTo('input');
|
|
35
|
-
});
|
|
36
|
-
});
|