browserstack-webdriver 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +791 -0
- data/README.md +31 -0
- data/build.desc +334 -0
- data/lib/selenium-client.rb +2 -0
- data/lib/selenium-webdriver.rb +1 -0
- data/lib/selenium/client.rb +37 -0
- data/lib/selenium/client/base.rb +132 -0
- data/lib/selenium/client/driver.rb +10 -0
- data/lib/selenium/client/errors.rb +9 -0
- data/lib/selenium/client/extensions.rb +118 -0
- data/lib/selenium/client/idiomatic.rb +488 -0
- data/lib/selenium/client/javascript_expression_builder.rb +116 -0
- data/lib/selenium/client/javascript_frameworks/jquery.rb +13 -0
- data/lib/selenium/client/javascript_frameworks/prototype.rb +13 -0
- data/lib/selenium/client/legacy_driver.rb +1720 -0
- data/lib/selenium/client/protocol.rb +104 -0
- data/lib/selenium/client/selenium_helper.rb +34 -0
- data/lib/selenium/rake/server_task.rb +157 -0
- data/lib/selenium/server.rb +248 -0
- data/lib/selenium/webdriver.rb +71 -0
- data/lib/selenium/webdriver/android.rb +9 -0
- data/lib/selenium/webdriver/android/bridge.rb +47 -0
- data/lib/selenium/webdriver/chrome.rb +26 -0
- data/lib/selenium/webdriver/chrome/bridge.rb +120 -0
- data/lib/selenium/webdriver/chrome/profile.rb +90 -0
- data/lib/selenium/webdriver/chrome/service.rb +75 -0
- data/lib/selenium/webdriver/common.rb +44 -0
- data/lib/selenium/webdriver/common/action_builder.rb +352 -0
- data/lib/selenium/webdriver/common/alert.rb +30 -0
- data/lib/selenium/webdriver/common/bridge_helper.rb +67 -0
- data/lib/selenium/webdriver/common/core_ext/base64.rb +9 -0
- data/lib/selenium/webdriver/common/core_ext/dir.rb +42 -0
- data/lib/selenium/webdriver/common/core_ext/string.rb +5 -0
- data/lib/selenium/webdriver/common/driver.rb +301 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_browser_connection.rb +17 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +39 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +25 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +13 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +22 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +19 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +22 -0
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +45 -0
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +43 -0
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +46 -0
- data/lib/selenium/webdriver/common/element.rb +293 -0
- data/lib/selenium/webdriver/common/error.rb +207 -0
- data/lib/selenium/webdriver/common/file_reaper.rb +47 -0
- data/lib/selenium/webdriver/common/html5/local_storage.rb +42 -0
- data/lib/selenium/webdriver/common/html5/location.rb +0 -0
- data/lib/selenium/webdriver/common/html5/session_storage.rb +44 -0
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +42 -0
- data/lib/selenium/webdriver/common/json_helper.rb +34 -0
- data/lib/selenium/webdriver/common/keyboard.rb +55 -0
- data/lib/selenium/webdriver/common/keys.rb +109 -0
- data/lib/selenium/webdriver/common/log_entry.rb +29 -0
- data/lib/selenium/webdriver/common/logs.rb +23 -0
- data/lib/selenium/webdriver/common/mouse.rb +72 -0
- data/lib/selenium/webdriver/common/navigation.rb +43 -0
- data/lib/selenium/webdriver/common/options.rb +136 -0
- data/lib/selenium/webdriver/common/platform.rb +218 -0
- data/lib/selenium/webdriver/common/port_prober.rb +42 -0
- data/lib/selenium/webdriver/common/profile_helper.rb +67 -0
- data/lib/selenium/webdriver/common/proxy.rb +149 -0
- data/lib/selenium/webdriver/common/search_context.rb +92 -0
- data/lib/selenium/webdriver/common/socket_poller.rb +105 -0
- data/lib/selenium/webdriver/common/target_locator.rb +81 -0
- data/lib/selenium/webdriver/common/timeouts.rb +38 -0
- data/lib/selenium/webdriver/common/touch_action_builder.rb +64 -0
- data/lib/selenium/webdriver/common/touch_screen.rb +105 -0
- data/lib/selenium/webdriver/common/wait.rb +63 -0
- data/lib/selenium/webdriver/common/window.rb +104 -0
- data/lib/selenium/webdriver/common/zipper.rb +82 -0
- data/lib/selenium/webdriver/firefox.rb +37 -0
- data/lib/selenium/webdriver/firefox/binary.rb +158 -0
- data/lib/selenium/webdriver/firefox/bridge.rb +70 -0
- data/lib/selenium/webdriver/firefox/extension.rb +52 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +106 -0
- data/lib/selenium/webdriver/firefox/profile.rb +263 -0
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +62 -0
- data/lib/selenium/webdriver/firefox/socket_lock.rb +61 -0
- data/lib/selenium/webdriver/firefox/util.rb +29 -0
- data/lib/selenium/webdriver/ie.rb +19 -0
- data/lib/selenium/webdriver/ie/bridge.rb +68 -0
- data/lib/selenium/webdriver/ie/server.rb +86 -0
- data/lib/selenium/webdriver/iphone.rb +9 -0
- data/lib/selenium/webdriver/iphone/bridge.rb +45 -0
- data/lib/selenium/webdriver/opera.rb +24 -0
- data/lib/selenium/webdriver/opera/bridge.rb +112 -0
- data/lib/selenium/webdriver/opera/service.rb +49 -0
- data/lib/selenium/webdriver/phantomjs.rb +22 -0
- data/lib/selenium/webdriver/phantomjs/bridge.rb +59 -0
- data/lib/selenium/webdriver/phantomjs/service.rb +90 -0
- data/lib/selenium/webdriver/remote.rb +22 -0
- data/lib/selenium/webdriver/remote/bridge.rb +644 -0
- data/lib/selenium/webdriver/remote/capabilities.rb +267 -0
- data/lib/selenium/webdriver/remote/commands.rb +193 -0
- data/lib/selenium/webdriver/remote/http/common.rb +74 -0
- data/lib/selenium/webdriver/remote/http/curb.rb +79 -0
- data/lib/selenium/webdriver/remote/http/default.rb +139 -0
- data/lib/selenium/webdriver/remote/http/persistent.rb +38 -0
- data/lib/selenium/webdriver/remote/response.rb +97 -0
- data/lib/selenium/webdriver/remote/server_error.rb +17 -0
- data/lib/selenium/webdriver/safari.rb +46 -0
- data/lib/selenium/webdriver/safari/bridge.rb +110 -0
- data/lib/selenium/webdriver/safari/browser.rb +20 -0
- data/lib/selenium/webdriver/safari/extension.rb +120 -0
- data/lib/selenium/webdriver/safari/server.rb +145 -0
- data/lib/selenium/webdriver/support.rb +5 -0
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +28 -0
- data/lib/selenium/webdriver/support/block_event_listener.rb +17 -0
- data/lib/selenium/webdriver/support/color.rb +110 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +112 -0
- data/lib/selenium/webdriver/support/select.rb +293 -0
- data/ruby.iml +13 -0
- data/spec/integration/selenium/client/api/backward_compatible_api_spec.rb +22 -0
- data/spec/integration/selenium/client/api/browser_xpath_library_spec.rb +17 -0
- data/spec/integration/selenium/client/api/click_spec.rb +39 -0
- data/spec/integration/selenium/client/api/cookie_spec.rb +39 -0
- data/spec/integration/selenium/client/api/element_spec.rb +14 -0
- data/spec/integration/selenium/client/api/highlight_located_element_spec.rb +19 -0
- data/spec/integration/selenium/client/api/retrieve_last_remote_control_logs_spec.rb +33 -0
- data/spec/integration/selenium/client/api/screenshot_spec.rb +31 -0
- data/spec/integration/selenium/client/api/select_window_spec.rb +46 -0
- data/spec/integration/selenium/client/api/start_stop_spec.rb +9 -0
- data/spec/integration/selenium/client/api/wait_for_ajax_spec.rb +27 -0
- data/spec/integration/selenium/client/api/wait_for_element_spec.rb +56 -0
- data/spec/integration/selenium/client/api/wait_for_field_value_spec.rb +52 -0
- data/spec/integration/selenium/client/api/wait_for_text_spec.rb +98 -0
- data/spec/integration/selenium/client/api/webdriver_backed_spec.rb +21 -0
- data/spec/integration/selenium/client/sample-app/public/jquery-1.3.2.js +4376 -0
- data/spec/integration/selenium/client/sample-app/public/jquery.html +55 -0
- data/spec/integration/selenium/client/sample-app/public/prototype-1.6.0.3.js +4320 -0
- data/spec/integration/selenium/client/sample-app/public/prototype.html +59 -0
- data/spec/integration/selenium/client/sample-app/sample_app.rb +32 -0
- data/spec/integration/selenium/client/spec_helper.rb +139 -0
- data/spec/integration/selenium/webdriver/app_cache_spec.rb +47 -0
- data/spec/integration/selenium/webdriver/browser_connection_spec.rb +20 -0
- data/spec/integration/selenium/webdriver/chrome/driver_spec.rb +28 -0
- data/spec/integration/selenium/webdriver/chrome/profile_spec.rb +63 -0
- data/spec/integration/selenium/webdriver/driver_spec.rb +266 -0
- data/spec/integration/selenium/webdriver/element_spec.rb +191 -0
- data/spec/integration/selenium/webdriver/error_spec.rb +30 -0
- data/spec/integration/selenium/webdriver/firefox/driver_spec.rb +21 -0
- data/spec/integration/selenium/webdriver/firefox/profile_spec.rb +141 -0
- data/spec/integration/selenium/webdriver/keyboard_spec.rb +57 -0
- data/spec/integration/selenium/webdriver/location_spec.rb +29 -0
- data/spec/integration/selenium/webdriver/mouse_spec.rb +57 -0
- data/spec/integration/selenium/webdriver/navigation_spec.rb +46 -0
- data/spec/integration/selenium/webdriver/opera/driver_spec.rb +47 -0
- data/spec/integration/selenium/webdriver/options_spec.rb +77 -0
- data/spec/integration/selenium/webdriver/remote/driver_spec.rb +19 -0
- data/spec/integration/selenium/webdriver/remote/element_spec.rb +26 -0
- data/spec/integration/selenium/webdriver/spec_helper.rb +36 -0
- data/spec/integration/selenium/webdriver/spec_support.rb +12 -0
- data/spec/integration/selenium/webdriver/spec_support/guards.rb +110 -0
- data/spec/integration/selenium/webdriver/spec_support/helpers.rb +51 -0
- data/spec/integration/selenium/webdriver/spec_support/rack_server.rb +123 -0
- data/spec/integration/selenium/webdriver/spec_support/test_environment.rb +239 -0
- data/spec/integration/selenium/webdriver/sql_database_spec.rb +59 -0
- data/spec/integration/selenium/webdriver/storage_spec.rb +96 -0
- data/spec/integration/selenium/webdriver/target_locator_spec.rb +186 -0
- data/spec/integration/selenium/webdriver/timeout_spec.rb +69 -0
- data/spec/integration/selenium/webdriver/touch_spec.rb +176 -0
- data/spec/integration/selenium/webdriver/window_spec.rb +70 -0
- data/spec/integration/selenium/webdriver/zipper_spec.rb +66 -0
- data/spec/unit/selenium/client/base_spec.rb +239 -0
- data/spec/unit/selenium/client/extensions_spec.rb +174 -0
- data/spec/unit/selenium/client/idiomatic_spec.rb +500 -0
- data/spec/unit/selenium/client/javascript_expression_builder_spec.rb +79 -0
- data/spec/unit/selenium/client/javascript_frameworks/jquery_spec.rb +10 -0
- data/spec/unit/selenium/client/javascript_frameworks/prototype_spec.rb +10 -0
- data/spec/unit/selenium/client/protocol_spec.rb +124 -0
- data/spec/unit/selenium/client/selenium_helper_spec.rb +56 -0
- data/spec/unit/selenium/client/spec_helper.rb +24 -0
- data/spec/unit/selenium/rake/task_spec.rb +79 -0
- data/spec/unit/selenium/server_spec.rb +150 -0
- data/spec/unit/selenium/webdriver/action_builder_spec.rb +97 -0
- data/spec/unit/selenium/webdriver/android/bridge_spec.rb +43 -0
- data/spec/unit/selenium/webdriver/chrome/bridge_spec.rb +137 -0
- data/spec/unit/selenium/webdriver/chrome/profile_spec.rb +57 -0
- data/spec/unit/selenium/webdriver/chrome/service_spec.rb +44 -0
- data/spec/unit/selenium/webdriver/error_spec.rb +41 -0
- data/spec/unit/selenium/webdriver/firefox/bridge_spec.rb +47 -0
- data/spec/unit/selenium/webdriver/ie/bridge_spec.rb +91 -0
- data/spec/unit/selenium/webdriver/iphone/bridge_spec.rb +42 -0
- data/spec/unit/selenium/webdriver/log_entry_spec.rb +11 -0
- data/spec/unit/selenium/webdriver/opera/bridge_spec.rb +44 -0
- data/spec/unit/selenium/webdriver/phantomjs/bridge_spec.rb +55 -0
- data/spec/unit/selenium/webdriver/proxy_spec.rb +106 -0
- data/spec/unit/selenium/webdriver/remote/bridge_spec.rb +16 -0
- data/spec/unit/selenium/webdriver/remote/capabilities_spec.rb +115 -0
- data/spec/unit/selenium/webdriver/remote/http/common_spec.rb +24 -0
- data/spec/unit/selenium/webdriver/remote/http/default_spec.rb +124 -0
- data/spec/unit/selenium/webdriver/search_context_spec.rb +61 -0
- data/spec/unit/selenium/webdriver/socket_poller_spec.rb +68 -0
- data/spec/unit/selenium/webdriver/spec_helper.rb +27 -0
- data/spec/unit/selenium/webdriver/support/color_spec.rb +119 -0
- data/spec/unit/selenium/webdriver/support/event_firing_spec.rb +111 -0
- data/spec/unit/selenium/webdriver/support/select_spec.rb +290 -0
- data/spec/unit/selenium/webdriver/wait_spec.rb +49 -0
- metadata +370 -0
data/ruby.iml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$">
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
|
7
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
8
|
+
</content>
|
9
|
+
<orderEntry type="jdk" jdkName="ruby-1.9" jdkType="RUBY_SDK" />
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
+
</component>
|
12
|
+
</module>
|
13
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Backward Compatible API" do
|
4
|
+
it "provides legacy driver methods" do
|
5
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
6
|
+
|
7
|
+
page.get_title.should eql("Click Page 1")
|
8
|
+
page.get_text("link").index("Click here for next page").should_not be_nil
|
9
|
+
|
10
|
+
links = page.get_all_links
|
11
|
+
links.length.should > 3
|
12
|
+
links[3].should eql("linkToAnchorOnThisPage")
|
13
|
+
|
14
|
+
page.click "link"
|
15
|
+
page.wait_for_page_to_load 5000
|
16
|
+
page.get_location.should =~ %r"/selenium-server/org/openqa/selenium/tests/html/test_click_page2.html"
|
17
|
+
|
18
|
+
page.click "previousPage"
|
19
|
+
page.wait_for_page_to_load 5000
|
20
|
+
page.get_location.should =~ %r"/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Browser XPath Library" do
|
4
|
+
|
5
|
+
it "can be set to default" do
|
6
|
+
page.browser_xpath_library = :default
|
7
|
+
end
|
8
|
+
|
9
|
+
it "can be set to ajaxslt" do
|
10
|
+
page.browser_xpath_library = :ajaxslt
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can be set to javascript-xpath" do
|
14
|
+
page.browser_xpath_library = :'javascript-xpath'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Click Instrumentation" do
|
4
|
+
it "clicks" do
|
5
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
6
|
+
page.text_content("link").should eql("Click here for next page")
|
7
|
+
|
8
|
+
page.click "link", :wait_for => :page
|
9
|
+
page.title.should eql("Click Page Target")
|
10
|
+
|
11
|
+
page.click "previousPage", :wait_for => :page
|
12
|
+
page.title.should eql("Click Page 1")
|
13
|
+
|
14
|
+
page.click "linkWithEnclosedImage", :wait_for => :page
|
15
|
+
page.title.should eql("Click Page Target")
|
16
|
+
|
17
|
+
page.click "previousPage", :wait_for => :page
|
18
|
+
page.click "enclosedImage", :wait_for => :page
|
19
|
+
page.title.should eql("Click Page Target")
|
20
|
+
|
21
|
+
page.click "previousPage", :wait_for => :page
|
22
|
+
page.click "extraEnclosedImage", :wait_for => :page
|
23
|
+
page.title.should eql("Click Page Target")
|
24
|
+
|
25
|
+
page.click "previousPage", :wait_for => :page
|
26
|
+
page.click "linkToAnchorOnThisPage"
|
27
|
+
page.title.should eql("Click Page 1")
|
28
|
+
|
29
|
+
page.click "linkWithOnclickReturnsFalse"
|
30
|
+
page.title.should eql("Click Page 1")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "double clicks" do
|
34
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
35
|
+
page.double_click "doubleClickable"
|
36
|
+
|
37
|
+
page.get_alert.should eql("double clicked!")
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Cookie Handling" do
|
4
|
+
it "deletes all cookies" do
|
5
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/path1/cookie1.html"
|
6
|
+
page.delete_all_visible_cookies
|
7
|
+
|
8
|
+
page.cookies.should be_empty
|
9
|
+
|
10
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/path2/cookie2.html"
|
11
|
+
page.delete_all_visible_cookies
|
12
|
+
|
13
|
+
page.cookies.should be_empty
|
14
|
+
end
|
15
|
+
|
16
|
+
it "can set cookies" do
|
17
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/path1/cookie1.html"
|
18
|
+
page.create_cookie "addedCookieForPath1=new value1"
|
19
|
+
page.create_cookie "addedCookieForPath2=new value2", :path => "/selenium-server/org/openqa/selenium/tests/html/path2/", :max_age => 60
|
20
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/path1/cookie1.html"
|
21
|
+
page.cookies.should =~ /addedCookieForPath1=new value1/
|
22
|
+
|
23
|
+
page.cookie?("addedCookieForPath1").should be_true
|
24
|
+
page.cookie("addedCookieForPath1").should eql("new value1")
|
25
|
+
page.cookie?("testCookie").should be_false
|
26
|
+
page.cookie?("addedCookieForPath2").should be_false
|
27
|
+
|
28
|
+
page.delete_cookie "addedCookieForPath1", "/selenium-server/org/openqa/selenium/tests/html/path1/"
|
29
|
+
page.cookies.should be_empty
|
30
|
+
|
31
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/path2/cookie2.html"
|
32
|
+
page.cookie("addedCookieForPath2").should eql("new value2")
|
33
|
+
page.cookie?("addedCookieForPath1").should be_false
|
34
|
+
|
35
|
+
page.delete_cookie "addedCookieForPath2", "/selenium-server/org/openqa/selenium/tests/html/path2/"
|
36
|
+
page.delete_cookie "addedCookieForPath2"
|
37
|
+
page.cookies.should be_empty
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Element API" do
|
4
|
+
it "can detect element presence" do
|
5
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_element_present.html"
|
6
|
+
page.element?('aLink').should be_true
|
7
|
+
|
8
|
+
page.click 'removeLinkAfterAWhile', :wait_for => :no_element, :element => "aLink"
|
9
|
+
page.element?('aLink').should be_false
|
10
|
+
|
11
|
+
page.click 'addLinkAfterAWhile', :wait_for => :element, :element => "aLink"
|
12
|
+
page.element?('aLink').should be_true
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Highlight Located Element" do
|
4
|
+
it "can be enabled and disabled on the fly" do
|
5
|
+
page.open "http://localhost:4567/jquery.html"
|
6
|
+
page.execution_delay = 1000
|
7
|
+
page.highlight_located_element = true
|
8
|
+
begin
|
9
|
+
page.text("calculator-result").should be_empty
|
10
|
+
|
11
|
+
page.type "calculator-expression", "2 + 2"
|
12
|
+
page.click "calculator-button" , :wait_for => :ajax, :javascript_framework => :jquery
|
13
|
+
|
14
|
+
page.value("calculator-result").should eql("4")
|
15
|
+
ensure
|
16
|
+
page.highlight_located_element = false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Remote Control Logs Retrieval" do
|
4
|
+
# it "can retrieve logs even when the is no session was started" do
|
5
|
+
# selenium_driver.stop
|
6
|
+
# logs = selenium_driver.retrieve_last_remote_control_logs
|
7
|
+
#
|
8
|
+
# logs.should =~ %r{request: retrieveLastRemoteControlLogs\[, \]}
|
9
|
+
# logs.should =~ %r{Got result: OK}
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# it "can retrieve logs even when no command were issued" do
|
13
|
+
# page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
14
|
+
# logs = selenium_driver.retrieve_last_remote_control_logs
|
15
|
+
#
|
16
|
+
# logs.should =~ %r{request: getNewBrowserSession\[\*[a-z0-9]+, http://localhost:4567, , \]}
|
17
|
+
# logs.should =~ %r{request: open\[http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html, \]}
|
18
|
+
# logs.should =~ %r{request: retrieveLastRemoteControlLogs\[, \]}
|
19
|
+
# logs.should =~ %r{org.openqa.selenium.server.SeleniumDriverResourceHandler - Got result: OK}
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# it "can retrieve logs even when commands were issued" do
|
23
|
+
# page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
24
|
+
# page.get_title
|
25
|
+
# logs = selenium_driver.retrieve_last_remote_control_logs
|
26
|
+
#
|
27
|
+
# logs.should =~ %r{request: getNewBrowserSession\[\*[a-z0-9]+, http://localhost:4567, , \]}
|
28
|
+
# logs.should =~ %r{request: open\[http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html, \]}
|
29
|
+
# logs.should =~ %r{request: getTitle\[, \]}
|
30
|
+
# logs.should =~ %r{request: retrieveLastRemoteControlLogs\[, \]}
|
31
|
+
# logs.should =~ %r{org.openqa.selenium.server.SeleniumDriverResourceHandler - Got result: OK}
|
32
|
+
# end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: binary
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
describe "Screenshot" do
|
6
|
+
it "can capture html for current page" do
|
7
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
8
|
+
page.get_html_source.should =~ /<head>/
|
9
|
+
end
|
10
|
+
|
11
|
+
it "captures PNG screenshot OS viewport as a file on Selenium RC local filesystem" do
|
12
|
+
tempfile = File.join(Dir.tmpdir, "selenium_screenshot.png")
|
13
|
+
|
14
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
15
|
+
page.capture_screenshot tempfile
|
16
|
+
|
17
|
+
File.exists?(tempfile).should be_true
|
18
|
+
File.open(tempfile, "rb") do |io|
|
19
|
+
magic = io.read(4)
|
20
|
+
magic.should == "\211PNG"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "captures PNG screenshot OS viewport as a Base64 encoded PNG image" do
|
25
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
|
26
|
+
encodedImage = page.capture_screenshot_to_string
|
27
|
+
pngImage = Base64.decode64(encodedImage)
|
28
|
+
|
29
|
+
pngImage.should =~ /^\211PNG/n
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Window Selection" do
|
4
|
+
it "selects and close popup windows" do
|
5
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_select_window.html"
|
6
|
+
page.click "popupPage", :wait_for => :popup, :window => "myPopupWindow", :select => true
|
7
|
+
|
8
|
+
page.location.should =~ %r{/tests/html/test_select_window_popup.html}
|
9
|
+
page.title.should =~ /Select Window Popup/
|
10
|
+
page.all_window_names.size.should eql(2)
|
11
|
+
page.all_window_names.include?("myPopupWindow").should be_true
|
12
|
+
|
13
|
+
page.close
|
14
|
+
page.select_window "null"
|
15
|
+
|
16
|
+
page.location.should =~ %r{/tests/html/test_select_window.html}
|
17
|
+
|
18
|
+
page.click "popupPage", :wait_for => :popup, :window => "myPopupWindow"
|
19
|
+
page.select_window "title=Select Window Popup"
|
20
|
+
|
21
|
+
page.location.should =~ %r{/tests/html/test_select_window_popup.html}
|
22
|
+
|
23
|
+
page.close
|
24
|
+
page.select_window "null"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "select an anonymous window (one that isn't assigned to a variable)" do
|
28
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_select_window.html"
|
29
|
+
page.click "popupAnonymous", :wait_for => :popup, :window => "anonymouspopup", :select => true
|
30
|
+
|
31
|
+
page.location.should =~ %r{/tests/html/test_select_window_popup.html}
|
32
|
+
|
33
|
+
page.click "closePage"
|
34
|
+
page.select_window "null"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "handles an onclick close handler" do
|
38
|
+
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_select_window.html"
|
39
|
+
page.click "popupAnonymous", :wait_for => :popup, :window => "anonymouspopup", :select => true
|
40
|
+
|
41
|
+
page.location.should =~ %r{/tests/html/test_select_window_popup.html}
|
42
|
+
|
43
|
+
page.click "closePage2"
|
44
|
+
page.select_window "null"
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Session Management" do
|
4
|
+
it "can call stop even when session was not started" do
|
5
|
+
in_separate_driver do
|
6
|
+
3.times { selenium_driver.close_current_browser_session }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Wait For Ajax" do
|
4
|
+
describe "Prototype" do
|
5
|
+
it "blocks until AJAX request is complete" do
|
6
|
+
page.open "http://localhost:4567/prototype.html"
|
7
|
+
page.text("calculator-result").should be_empty
|
8
|
+
page.type "calculator-expression", "2 + 2"
|
9
|
+
page.click "calculator-button", :wait_for => :ajax
|
10
|
+
|
11
|
+
page.value("calculator-result").should eql("4")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "jQuery" do
|
16
|
+
it "blocks until AJAX request is complete" do
|
17
|
+
page.open "http://localhost:4567/jquery.html"
|
18
|
+
|
19
|
+
page.text("calculator-result").should be_empty
|
20
|
+
|
21
|
+
page.type "calculator-expression", "2 + 2"
|
22
|
+
page.click "calculator-button" , :wait_for => :ajax, :javascript_framework => :jquery
|
23
|
+
|
24
|
+
page.value("calculator-result").should eql("4")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "#wait_for_element" do
|
4
|
+
it "does not block when element is present" do
|
5
|
+
page.open "http://localhost:4567/jquery.html"
|
6
|
+
page.wait_for_element "element-present-demo"
|
7
|
+
page.wait_for_element "id=element-present-demo"
|
8
|
+
page.wait_for_element "css=#element-present-demo"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "times out when element is not present" do
|
12
|
+
page.open "http://localhost:4567/jquery.html"
|
13
|
+
|
14
|
+
should_timeout do
|
15
|
+
page.wait_for_element "new-element", :timeout_in_seconds => 2
|
16
|
+
end
|
17
|
+
|
18
|
+
should_timeout do
|
19
|
+
page.wait_for_element "does-not-exists", :timeout_in_seconds => 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "detects dynamics changes in the DOM" do
|
24
|
+
page.open "http://localhost:4567/jquery.html"
|
25
|
+
page.click "create-element-button", :wait_for => :element, :element => 'new-element'
|
26
|
+
page.click "delete-element-button", :wait_for => :no_element, :element => 'new-element'
|
27
|
+
|
28
|
+
should_timeout do
|
29
|
+
page.wait_for_element "new-element", :timeout_in_seconds => 2
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "can handle quotes and double quotes in its locator definition" do
|
34
|
+
page.open "http://localhost:4567/jquery.html"
|
35
|
+
page.wait_for_element "//div[@id='element-present-demo']"
|
36
|
+
page.wait_for_no_element "//div[@id='new-element']"
|
37
|
+
page.click "create-element-button", :wait_for => :element, :element => "//div[@id='new-element']"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#wait_for_no_element" do
|
42
|
+
it "does not block when element is not present" do
|
43
|
+
page.open "http://localhost:4567/jquery.html"
|
44
|
+
page.wait_for_no_element "new-element"
|
45
|
+
page.wait_for_no_element "does-not-exists"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "times out when element is present" do
|
49
|
+
page.open "http://localhost:4567/jquery.html"
|
50
|
+
|
51
|
+
should_timeout do
|
52
|
+
page.wait_for_no_element "element-present-demo", :timeout_in_seconds => 2
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "#wait_for_field_value" do
|
4
|
+
it "blocks until field is updated" do
|
5
|
+
page.open "http://localhost:4567/jquery.html"
|
6
|
+
|
7
|
+
page.text("calculator-result").should be_empty
|
8
|
+
|
9
|
+
page.type "calculator-expression", "2 + 2"
|
10
|
+
page.click "calculator-button", :wait_for => :value,
|
11
|
+
:element => "calculator-result",
|
12
|
+
:value => "4"
|
13
|
+
|
14
|
+
page.value("calculator-result").should eql("4")
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
it "times out when field is never properly updated" do
|
19
|
+
page.open "http://localhost:4567/jquery.html"
|
20
|
+
|
21
|
+
page.text("calculator-result").should be_empty
|
22
|
+
page.type "calculator-expression", "2 + 2"
|
23
|
+
|
24
|
+
should_timeout do
|
25
|
+
page.click "calculator-button", :wait_for => :value,
|
26
|
+
:element => "calculator-result",
|
27
|
+
:value => "5",
|
28
|
+
:timeout_in_seconds => 2
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#wait_for_no_field_value" do
|
34
|
+
it "blocks until field is updated" do
|
35
|
+
page.open "http://localhost:4567/jquery.html"
|
36
|
+
|
37
|
+
page.text("calculator-result").should be_empty
|
38
|
+
page.type "calculator-expression", "2 + 2"
|
39
|
+
page.click "calculator-button", :wait_for => :no_value,
|
40
|
+
:element => "calculator-result",
|
41
|
+
:value => ""
|
42
|
+
|
43
|
+
page.value("calculator-result").should eql("4")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "times out when field is never properly updated" do
|
47
|
+
page.open "http://localhost:4567/jquery.html"
|
48
|
+
should_timeout do
|
49
|
+
page.wait_for_no_field_value "calculator-result", "", :timeout_in_seconds => 2
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require File.expand_path(__FILE__ + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "#wait_for_text" do
|
4
|
+
it "wait_for_text does not block when text is present" do
|
5
|
+
page.open "http://localhost:4567/jquery.html"
|
6
|
+
page.wait_for_text "jQuery - Selenium Ruby Client Sample App"
|
7
|
+
page.wait_for_text "jQuery - Selenium Ruby Client Sample App", :element => "title"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "wait_for_text timeouts when text is not present" do
|
11
|
+
page.open "http://localhost:4567/jquery.html"
|
12
|
+
|
13
|
+
should_timeout do
|
14
|
+
page.wait_for_text "We All Need Some Mojo", :timeout_in_seconds => 2
|
15
|
+
end
|
16
|
+
|
17
|
+
should_timeout do
|
18
|
+
page.wait_for_text "We All Need Some Mojo",
|
19
|
+
:element => "new-element", :timeout_in_seconds => 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "wait_for_text detects dynamics changes in the DOM" do
|
24
|
+
page.open "http://localhost:4567/jquery.html"
|
25
|
+
page.click "create-element-button", :wait_for => :text,
|
26
|
+
:text => "We All Need Some Mojo"
|
27
|
+
page.click "delete-element-button", :wait_for => :no_text,
|
28
|
+
:text => "We All Need Some Mojo"
|
29
|
+
page.click "create-element-button", :wait_for => :text,
|
30
|
+
:text => "We All Need Some Mojo",
|
31
|
+
:element => "new-element"
|
32
|
+
page.click "delete-element-button", :wait_for => :no_text,
|
33
|
+
:text => "We All Need Some Mojo",
|
34
|
+
:element => "new-element"
|
35
|
+
should_timeout do
|
36
|
+
page.wait_for_text "We All Need Some Mojo", :element => "new-element",
|
37
|
+
:timeout_in_seconds => 2
|
38
|
+
end
|
39
|
+
|
40
|
+
should_timeout do
|
41
|
+
page.wait_for_text "We All Need Some Mojo", :timeout_in_seconds => 2
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "wait_for_text can handle quotes and double quotes in its locator definition" do
|
46
|
+
page.open "http://localhost:4567/jquery.html"
|
47
|
+
|
48
|
+
page.wait_for_text "jQuery - Selenium Ruby Client Sample App", :element => "//h1[@id='title']"
|
49
|
+
page.wait_for_no_text "Some With A ' Single Quote"
|
50
|
+
|
51
|
+
page.click "create-element-button", :wait_for => :text,
|
52
|
+
:text => "We All Need Some Mojo",
|
53
|
+
:element => "//div[@id='new-element']"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "wait_for_text support incremental searches anywhere in the page" do
|
57
|
+
page.open "http://localhost:4567/jquery.html"
|
58
|
+
|
59
|
+
page.wait_for_text "Sample App"
|
60
|
+
page.wait_for_text "Ruby Client"
|
61
|
+
end
|
62
|
+
|
63
|
+
it "wait_for_text support matching text using regular expressions" do
|
64
|
+
page.open "http://localhost:4567/jquery.html"
|
65
|
+
|
66
|
+
page.wait_for_text(/Sample App/)
|
67
|
+
page.wait_for_text(/Sample.*App/)
|
68
|
+
page.wait_for_text(/Selenium.*Client/, :element => "//h1[@id='title']")
|
69
|
+
page.wait_for_no_text(/^Selenium.*Client$/, :element => "//h1[@id='title']")
|
70
|
+
page.wait_for_text(/here/, :element => "dangerous-characters")
|
71
|
+
page.wait_for_text(/' \/ \\/, :element => "dangerous-characters")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#wait_for_no_text" do
|
76
|
+
it "does not block when element is not present" do
|
77
|
+
page.open "http://localhost:4567/jquery.html"
|
78
|
+
page.wait_for_no_text "Does Not Exists"
|
79
|
+
page.wait_for_no_text "We All Need Some Mojo"
|
80
|
+
page.wait_for_no_text "No The Actual Title", :element => "title"
|
81
|
+
page.wait_for_no_text "We All Need Some Mojo", :element => "new-element"
|
82
|
+
page.wait_for_no_text "We All Need Some Mojo", :element => "does-not-exists"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "times out when element is present" do
|
86
|
+
page.open "http://localhost:4567/jquery.html"
|
87
|
+
|
88
|
+
should_timeout do
|
89
|
+
page.wait_for_no_text "jQuery - Selenium Ruby Client Sample App",
|
90
|
+
:timeout_in_seconds => 2
|
91
|
+
end
|
92
|
+
|
93
|
+
should_timeout do
|
94
|
+
page.wait_for_no_text "jQuery - Selenium Ruby Client Sample App",
|
95
|
+
:element => "title", :timeout_in_seconds => 2
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|