bitium-capybara-webkit 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +26 -0
  5. data/Appraisals +7 -0
  6. data/CONTRIBUTING.md +58 -0
  7. data/GOALS +9 -0
  8. data/Gemfile +3 -0
  9. data/Gemfile.lock +74 -0
  10. data/LICENSE +19 -0
  11. data/NEWS.md +109 -0
  12. data/README.md +251 -0
  13. data/Rakefile +69 -0
  14. data/Vagrantfile +7 -0
  15. data/bin/Info.plist +22 -0
  16. data/capybara-webkit.gemspec +33 -0
  17. data/extconf.rb +2 -0
  18. data/gemfiles/2.0.gemfile +7 -0
  19. data/gemfiles/2.0.gemfile.lock +72 -0
  20. data/gemfiles/2.1.gemfile +7 -0
  21. data/gemfiles/2.1.gemfile.lock +71 -0
  22. data/lib/capybara-webkit.rb +1 -0
  23. data/lib/capybara/webkit.rb +18 -0
  24. data/lib/capybara/webkit/browser.rb +241 -0
  25. data/lib/capybara/webkit/connection.rb +106 -0
  26. data/lib/capybara/webkit/cookie_jar.rb +55 -0
  27. data/lib/capybara/webkit/driver.rb +185 -0
  28. data/lib/capybara/webkit/errors.rb +35 -0
  29. data/lib/capybara/webkit/matchers.rb +37 -0
  30. data/lib/capybara/webkit/node.rb +156 -0
  31. data/lib/capybara/webkit/socket_debugger.rb +46 -0
  32. data/lib/capybara/webkit/version.rb +7 -0
  33. data/lib/capybara_webkit_builder.rb +91 -0
  34. data/spec/browser_spec.rb +276 -0
  35. data/spec/capybara_webkit_builder_spec.rb +43 -0
  36. data/spec/connection_spec.rb +83 -0
  37. data/spec/cookie_jar_spec.rb +48 -0
  38. data/spec/driver_rendering_spec.rb +93 -0
  39. data/spec/driver_resize_window_spec.rb +48 -0
  40. data/spec/driver_spec.rb +2389 -0
  41. data/spec/errors_spec.rb +11 -0
  42. data/spec/integration/session_spec.rb +546 -0
  43. data/spec/selenium_compatibility_spec.rb +51 -0
  44. data/spec/self_signed_ssl_cert.rb +42 -0
  45. data/spec/spec_helper.rb +43 -0
  46. data/spec/support/app_runner.rb +90 -0
  47. data/src/Authenticate.cpp +19 -0
  48. data/src/Authenticate.h +12 -0
  49. data/src/Body.h +10 -0
  50. data/src/ClearCookies.cpp +13 -0
  51. data/src/ClearCookies.h +9 -0
  52. data/src/ClearPromptText.cpp +11 -0
  53. data/src/ClearPromptText.h +9 -0
  54. data/src/Command.cpp +25 -0
  55. data/src/Command.h +29 -0
  56. data/src/CommandFactory.cpp +51 -0
  57. data/src/CommandFactory.h +17 -0
  58. data/src/CommandParser.cpp +76 -0
  59. data/src/CommandParser.h +33 -0
  60. data/src/Connection.cpp +73 -0
  61. data/src/Connection.h +36 -0
  62. data/src/ConsoleMessages.cpp +14 -0
  63. data/src/ConsoleMessages.h +10 -0
  64. data/src/CurrentUrl.cpp +14 -0
  65. data/src/CurrentUrl.h +10 -0
  66. data/src/EnableLogging.cpp +10 -0
  67. data/src/EnableLogging.h +12 -0
  68. data/src/ErrorMessage.cpp +26 -0
  69. data/src/ErrorMessage.h +21 -0
  70. data/src/Evaluate.cpp +14 -0
  71. data/src/Evaluate.h +12 -0
  72. data/src/Execute.cpp +18 -0
  73. data/src/Execute.h +10 -0
  74. data/src/FindCss.cpp +13 -0
  75. data/src/FindCss.h +11 -0
  76. data/src/FindXpath.cpp +13 -0
  77. data/src/FindXpath.h +11 -0
  78. data/src/FrameFocus.cpp +68 -0
  79. data/src/FrameFocus.h +27 -0
  80. data/src/GetCookies.cpp +19 -0
  81. data/src/GetCookies.h +12 -0
  82. data/src/GetTimeout.cpp +9 -0
  83. data/src/GetTimeout.h +11 -0
  84. data/src/GetWindowHandle.cpp +11 -0
  85. data/src/GetWindowHandle.h +10 -0
  86. data/src/GetWindowHandles.cpp +21 -0
  87. data/src/GetWindowHandles.h +10 -0
  88. data/src/Header.cpp +19 -0
  89. data/src/Header.h +9 -0
  90. data/src/Headers.cpp +11 -0
  91. data/src/Headers.h +10 -0
  92. data/src/IgnoreDebugOutput.cpp +37 -0
  93. data/src/IgnoreDebugOutput.h +1 -0
  94. data/src/IgnoreSslErrors.cpp +13 -0
  95. data/src/IgnoreSslErrors.h +10 -0
  96. data/src/InvocationResult.cpp +31 -0
  97. data/src/InvocationResult.h +16 -0
  98. data/src/JavascriptAlertMessages.cpp +13 -0
  99. data/src/JavascriptAlertMessages.h +9 -0
  100. data/src/JavascriptCommand.cpp +15 -0
  101. data/src/JavascriptCommand.h +20 -0
  102. data/src/JavascriptConfirmMessages.cpp +13 -0
  103. data/src/JavascriptConfirmMessages.h +9 -0
  104. data/src/JavascriptInvocation.cpp +148 -0
  105. data/src/JavascriptInvocation.h +43 -0
  106. data/src/JavascriptPromptMessages.cpp +13 -0
  107. data/src/JavascriptPromptMessages.h +9 -0
  108. data/src/JsonSerializer.cpp +116 -0
  109. data/src/JsonSerializer.h +20 -0
  110. data/src/NetworkAccessManager.cpp +118 -0
  111. data/src/NetworkAccessManager.h +41 -0
  112. data/src/NetworkCookieJar.cpp +101 -0
  113. data/src/NetworkCookieJar.h +15 -0
  114. data/src/NetworkReplyProxy.cpp +91 -0
  115. data/src/NetworkReplyProxy.h +65 -0
  116. data/src/NoOpReply.cpp +32 -0
  117. data/src/NoOpReply.h +18 -0
  118. data/src/Node.cpp +20 -0
  119. data/src/Node.h +12 -0
  120. data/src/NullCommand.cpp +14 -0
  121. data/src/NullCommand.h +12 -0
  122. data/src/PageLoadingCommand.cpp +53 -0
  123. data/src/PageLoadingCommand.h +37 -0
  124. data/src/Render.cpp +18 -0
  125. data/src/Render.h +10 -0
  126. data/src/Reset.cpp +15 -0
  127. data/src/Reset.h +10 -0
  128. data/src/ResizeWindow.cpp +17 -0
  129. data/src/ResizeWindow.h +10 -0
  130. data/src/Response.cpp +35 -0
  131. data/src/Response.h +30 -0
  132. data/src/Server.cpp +23 -0
  133. data/src/Server.h +19 -0
  134. data/src/SetConfirmAction.cpp +11 -0
  135. data/src/SetConfirmAction.h +9 -0
  136. data/src/SetCookie.cpp +15 -0
  137. data/src/SetCookie.h +9 -0
  138. data/src/SetPromptAction.cpp +11 -0
  139. data/src/SetPromptAction.h +9 -0
  140. data/src/SetPromptText.cpp +11 -0
  141. data/src/SetPromptText.h +9 -0
  142. data/src/SetProxy.cpp +23 -0
  143. data/src/SetProxy.h +9 -0
  144. data/src/SetSkipImageLoading.cpp +12 -0
  145. data/src/SetSkipImageLoading.h +9 -0
  146. data/src/SetTimeout.cpp +20 -0
  147. data/src/SetTimeout.h +9 -0
  148. data/src/SetUrlBlacklist.cpp +15 -0
  149. data/src/SetUrlBlacklist.h +11 -0
  150. data/src/SocketCommand.cpp +21 -0
  151. data/src/SocketCommand.h +29 -0
  152. data/src/Status.cpp +13 -0
  153. data/src/Status.h +10 -0
  154. data/src/TimeoutCommand.cpp +71 -0
  155. data/src/TimeoutCommand.h +38 -0
  156. data/src/Title.cpp +11 -0
  157. data/src/Title.h +9 -0
  158. data/src/UnsupportedContentHandler.cpp +23 -0
  159. data/src/UnsupportedContentHandler.h +20 -0
  160. data/src/Version.cpp +13 -0
  161. data/src/Version.h +10 -0
  162. data/src/Visit.cpp +13 -0
  163. data/src/Visit.h +10 -0
  164. data/src/WebPage.cpp +376 -0
  165. data/src/WebPage.h +97 -0
  166. data/src/WebPageManager.cpp +142 -0
  167. data/src/WebPageManager.h +63 -0
  168. data/src/WindowFocus.cpp +33 -0
  169. data/src/WindowFocus.h +15 -0
  170. data/src/body.cpp +13 -0
  171. data/src/capybara.js +408 -0
  172. data/src/find_command.h +44 -0
  173. data/src/main.cpp +32 -0
  174. data/src/pointer.png +0 -0
  175. data/src/stable.h +39 -0
  176. data/src/webkit_server.pro +153 -0
  177. data/src/webkit_server.qrc +6 -0
  178. data/templates/Command.cpp +8 -0
  179. data/templates/Command.h +12 -0
  180. data/test/testignoredebugoutput.cpp +45 -0
  181. data/test/testwebkitserver.pro +5 -0
  182. data/vagrant_setup.sh +58 -0
  183. data/webkit_server.pro +6 -0
  184. metadata +357 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6766e996e23b3e13cef4eee25cfbd1a0545fbf31
4
+ data.tar.gz: 05fcbb29afff5c3b7f03a735099e104b62e7b8dd
5
+ SHA512:
6
+ metadata.gz: 341d1f369db830fa65db3926c60845dba50612eaa63c95ac6f022b8837557c5d7df8c75d173b5618d75a6b0038b2c37e41087c1987f223170de6506006f32cc9
7
+ data.tar.gz: 109d81a9f0cb72b4afea64989b7b904cc421e5ad01582170a238d588210235cb80b675a988c742352790aa87457b369c99fe84bcf75b65940a22330614d74bc1
@@ -0,0 +1,25 @@
1
+ *.swp
2
+ bin/webkit_server*
3
+ test/testwebkitserver
4
+ *.swo
5
+ *~
6
+ *.o
7
+ *.moc
8
+ Makefile*
9
+ qrc_*
10
+ *.xcodeproj
11
+ *.app
12
+ moc_*.cpp
13
+ .bundle
14
+ pkg
15
+ src/webkit_server
16
+ src/webkit_server.exe
17
+ .DS_Store
18
+ tmp
19
+ .rvmrc
20
+ src/debug
21
+ webkit_server.pro.user
22
+ .vagrant
23
+ *.gch
24
+ .ruby-version
25
+ .ruby-gemset
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,26 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ matrix:
6
+ exclude:
7
+ - rvm: 1.9.3
8
+ gemfile: gemfiles/2.0.gemfile
9
+ env: QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
10
+ - rvm: 2.0.0
11
+ gemfile: gemfiles/2.0.gemfile
12
+ env: QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
13
+ notifications:
14
+ email: false
15
+ script: xvfb-run rake
16
+ env:
17
+ - QMAKE=/usr/bin/qmake
18
+ - QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
19
+ gemfile:
20
+ - gemfiles/2.0.gemfile
21
+ - gemfiles/2.1.gemfile
22
+ before_install:
23
+ - sudo apt-add-repository -y ppa:canonical-qt5-edgers/qt5-proper
24
+ - sudo apt-get update
25
+ - sudo apt-get install libqt5webkit5-dev qtdeclarative5-dev qtlocation5-dev qtsensors5-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev qt4-default
26
+ install: bundle
@@ -0,0 +1,7 @@
1
+ appraise "2.0" do
2
+ gem "capybara", "~> 2.0.2"
3
+ end
4
+
5
+ appraise "2.1" do
6
+ gem "capybara", "~> 2.1.0"
7
+ end
@@ -0,0 +1,58 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ ## Dependencies
4
+
5
+ Some of the tests depend on the `identify` command that comes with Imagemagick.
6
+ Imagemagick can be installed via [homebrew](http://mxcl.github.com/homebrew/) on
7
+ Mac OS X:
8
+
9
+ brew install imagemagick
10
+
11
+ If you prefer, you can use a [Vagrant](http://www.vagrantup.com/) virtual
12
+ machine. The Vagrantfile in the capybara-webkit repository will get you up and
13
+ running with all the development dependencies:
14
+
15
+ gem install vagrant
16
+ vagrant up
17
+ vagrant ssh
18
+ cd /vagrant
19
+ rake
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork the repo.
24
+
25
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
26
+ to know that you have a clean slate: `bundle && bundle exec rake`
27
+
28
+ 3. Add a test for your change. Only refactoring and documentation changes
29
+ require no new tests. If you are adding functionality or fixing a bug, we need
30
+ a test!
31
+
32
+ 4. Make the test pass.
33
+
34
+ 5. Push to your fork and submit a pull request.
35
+
36
+
37
+ At this point you're waiting on us. We like to at least comment on, if not
38
+ accept, pull requests within three business days (and, typically, one business
39
+ day). We may suggest some changes or improvements or alternatives.
40
+
41
+ Some things that will increase the chance that your pull request is accepted,
42
+ taken straight from the Ruby on Rails guide:
43
+
44
+ * Use Rails idioms and helpers
45
+ * Include tests that fail without your code, and pass with it
46
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
47
+ whatever is affected by your contribution
48
+
49
+ Syntax:
50
+
51
+ * Two spaces, no tabs.
52
+ * No trailing whitespace. Blank lines should not have any space.
53
+ * Prefer &&/|| over and/or.
54
+ * MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
55
+ * a = b and not a=b.
56
+ * Follow the conventions you see used in the source already.
57
+
58
+ And in case we didn't emphasize it enough: we love tests!
data/GOALS ADDED
@@ -0,0 +1,9 @@
1
+ capybara-webkit hits 1.0.0 when:
2
+
3
+ * All shared examples from capybara are implemented. See
4
+ capybara:lib/capybara/spec/**/*rb for the shared example groups.
5
+ * Test failures are a result of issues in the developer's code and not
6
+ capybara-webkit.
7
+ * Test failures lead to clear explanations for what failed and what can
8
+ be done to resolve them.
9
+ * It handles iframes, cookies, page loading, and other oddities.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capybara-webkit (1.1.1)
5
+ capybara (>= 2.0.2, < 2.2.0)
6
+ json
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ appraisal (0.4.0)
12
+ bundler
13
+ rake
14
+ capybara (2.1.0)
15
+ mime-types (>= 1.16)
16
+ nokogiri (>= 1.3.3)
17
+ rack (>= 1.0.0)
18
+ rack-test (>= 0.5.4)
19
+ xpath (~> 2.0)
20
+ childprocess (0.3.9)
21
+ ffi (~> 1.0, >= 1.0.11)
22
+ diff-lcs (1.2.4)
23
+ ffi (1.9.0)
24
+ ffi (1.9.0-x86-mingw32)
25
+ json (1.8.1)
26
+ mime-types (2.0)
27
+ mini_magick (3.2.1)
28
+ subexec (~> 0.0.4)
29
+ mini_portile (0.5.2)
30
+ multi_json (1.7.8)
31
+ nokogiri (1.6.0)
32
+ mini_portile (~> 0.5.0)
33
+ rack (1.5.2)
34
+ rack-protection (1.3.2)
35
+ rack
36
+ rack-test (0.6.2)
37
+ rack (>= 1.0)
38
+ rake (0.9.2)
39
+ rspec (2.14.1)
40
+ rspec-core (~> 2.14.0)
41
+ rspec-expectations (~> 2.14.0)
42
+ rspec-mocks (~> 2.14.0)
43
+ rspec-core (2.14.4)
44
+ rspec-expectations (2.14.1)
45
+ diff-lcs (>= 1.1.3, < 2.0)
46
+ rspec-mocks (2.14.3)
47
+ rubyzip (0.9.9)
48
+ selenium-webdriver (2.33.0)
49
+ childprocess (>= 0.2.5)
50
+ multi_json (~> 1.0)
51
+ rubyzip
52
+ websocket (~> 1.0.4)
53
+ sinatra (1.3.5)
54
+ rack (~> 1.4)
55
+ rack-protection (~> 1.3)
56
+ tilt (~> 1.3, >= 1.3.3)
57
+ subexec (0.0.4)
58
+ tilt (1.3.3)
59
+ websocket (1.0.7)
60
+ xpath (2.0.0)
61
+ nokogiri (~> 1.3)
62
+
63
+ PLATFORMS
64
+ ruby
65
+ x86-mingw32
66
+
67
+ DEPENDENCIES
68
+ appraisal (~> 0.4.0)
69
+ capybara-webkit!
70
+ mini_magick
71
+ rake
72
+ rspec (~> 2.14.0)
73
+ selenium-webdriver
74
+ sinatra
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010-2012 thoughtbot, inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/NEWS.md ADDED
@@ -0,0 +1,109 @@
1
+ New for 1.1.1:
2
+ * Lock capybara dependency to < 2.2.0.
3
+
4
+ New for 1.1.0:
5
+
6
+ * Improve messages for ClickFailed errors to aid debugging.
7
+ * Fix long load times on Ruby 2.0.0-p195.
8
+ * Automatically save screenshots on ClickFailed errors.
9
+ * Render a mouse pointer in screenshots for the current mouse location.
10
+ * Silent debug messages from Qt.
11
+ * Fix OS X keychain bug in Qt 5 related to basic authentication.
12
+ * Fix issues visiting URLs with square brackets.
13
+ * Fail immediately when trying to install with unsupported versions of Qt.
14
+ * Fix race condition leading to InvalidResponseErrors.
15
+
16
+ New for 1.0.0:
17
+
18
+ * Fix a memory leak in the logger.
19
+ * Add Vagrant configuration.
20
+ * Deprecate the stdout option for Connection.
21
+ * Make Node#text work for svg elements.
22
+ * Add Driver#version to print version info.
23
+ * Click elements with native events.
24
+ * Fix test failures from warnings.
25
+ * Capybara 2.1 compatibility.
26
+ * Implement right click.
27
+ * Qt 5 compatibility.
28
+ * Set text fields using native key events.
29
+ * Clear localStorage on reset.
30
+
31
+ New for 0.14.1:
32
+
33
+ * Rescue from Errno::ESRCH in the exit hook in case webkit_server has already ended.
34
+ * Remove web font override for first-letter and first-line pseudo elements, which was causing issues for some users.
35
+ * Restore viewport dimensions after rendering screenshots.
36
+
37
+ New for 0.14.0:
38
+
39
+ * URL blacklist support.
40
+ * Various fixes for JavaScript console messages.
41
+ * Various compilation fixes.
42
+ * Fix status code and headers commands for iframes.
43
+ * Capybara 2.0 compatibility.
44
+ * Driver#render replaced by Session#save_screenshot.
45
+ * Driver#source and Driver#body return the HTML representation of the DOM. Unsupported content is returned as plain text.
46
+ * HTML5 multi-file upload support.
47
+ * Driver#url and Driver#requested_url removed.
48
+ * JavaScipt console messages and alerts are now written to the logger instead of directly to stdout.
49
+ * Dropped support for Qt 4.7.
50
+ * Fix deadlocks encountered during page load.
51
+ * Delete Response objects when commands have timed out.
52
+ * Fix an infinite loop when invalid credentials are used for HTTP auth.
53
+ * Ensure queued commands start only after pending commands have finished.
54
+ * Fix segfaults related to web fonts on OS X.
55
+
56
+ New for 0.13.0:
57
+
58
+ * Better detect page load success, and better handle load failures.
59
+ * HTTP Basic Auth support.
60
+ * within_window support.
61
+ * More useful and detailed debugging output.
62
+ * Catch up with recent capybara releases.
63
+ * Ignore errors from canceled requests.
64
+ * Follow how Selenium treats focus and blur form events.
65
+ * Control JavaScript prompts from Ruby.
66
+ * Each command has a configurable timeout.
67
+ * Performance improvements on Linux.
68
+ * Support empty `multiple` attributes.
69
+
70
+ New for 0.12.1:
71
+
72
+ * Fix integration with newer capybara for the debugging driver.
73
+
74
+ New for 0.12.0:
75
+ * Better windows support
76
+ * Support for localStorage
77
+ * Added support for oninput event
78
+ * Added resize_window method
79
+ * Server binds on LocalHost to prevent having to add firewall exceptions
80
+ * Reuse NetworkAccessManager to prevent "too many open files" errors
81
+ * Response messages are stored as QByteArray to prevent truncating content
82
+ * Browser no longer tries to read empty responses (Fixes jruby issues).
83
+ * Server will timeout if it can not start
84
+
85
+ New for 0.11.0:
86
+
87
+ * Allow interaction with invisible elements
88
+ * Use Timeout from stdlib since Capybara.timeout is being removed
89
+
90
+ New for 0.10.1:
91
+
92
+ * LANG environment variable is set to en_US.UTF-8 in order to avoid string encoding issues from qmake.
93
+ * pro, find_command, and CommandFactory are more structured.
94
+ * Changed wiki link and directing platform specific issues to the google group.
95
+ * Pass proper keycode value for keypress events.
96
+
97
+ New for 0.10.0:
98
+
99
+ * current_url now more closely matches the behavior of Selenium
100
+ * custom MAKE, QMAKE, and SPEC options can be set from the environment
101
+ * BUG: Selected attribute is no longer removed when selecting/deselecting. Only the property is changed.
102
+
103
+ New for 0.9.0:
104
+
105
+ * Raise an error when an invisible element receives #click.
106
+ * Raise ElementNotDisplayedError for #drag_to and #select_option when element is invisible.
107
+ * Trigger mousedown and mouseup events.
108
+ * Model mouse events more closely to the browser.
109
+ * Try to detech when a command starts a page load and wait for it to finish
@@ -0,0 +1,251 @@
1
+ capybara-webkit
2
+ ===============
3
+
4
+ [![Build Status](https://secure.travis-ci.org/thoughtbot/capybara-webkit.png?branch=master)](https://travis-ci.org/thoughtbot/capybara-webkit)
5
+ [![Code Climate](https://codeclimate.com/github/thoughtbot/capybara-webkit.png)](https://codeclimate.com/github/thoughtbot/capybara-webkit)
6
+
7
+ A [capybara](https://github.com/jnicklas/capybara) driver that uses [WebKit](http://webkit.org) via [QtWebKit](http://trac.webkit.org/wiki/QtWebKit).
8
+
9
+ Qt Dependency and Installation Issues
10
+ -------------------------------------
11
+
12
+ capybara-webkit depends on a WebKit implementation from Qt, a cross-platform
13
+ development toolkit. You'll need to download the Qt libraries to build and
14
+ install the gem. You can find instructions for downloading and installing QT on
15
+ the
16
+ [capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
17
+ capybara-webkit requires Qt version 4.8.
18
+
19
+ Windows Support
20
+ ---------------
21
+
22
+ Currently 32-bit Windows will compile capybara-webkit. Support for Windows is
23
+ provided by the open source community and Windows related issues should be
24
+ posted to [Stack Overflow].
25
+
26
+ [Stack Overflow]: http://stackoverflow.com/questions/tagged/capybara-webkit
27
+
28
+ Reporting Issues
29
+ ----------------
30
+
31
+ Without access to your application code we can't easily debug most crashes or
32
+ generic failures, so we've included a debug version of the driver that prints a
33
+ log of what happened during each test. Before filing a crash bug, please see
34
+ [Reporting Crashes]. You're much more likely to get a fix if you follow those
35
+ instructions.
36
+
37
+ If you're having trouble compiling or installing, please check out the [wiki].
38
+ If you don't have any luck there, please post to [Stack Overflow]. Please don't
39
+ open a Github issue for a system-specific compiler issue.
40
+
41
+ [Reporting Crashes]: http://stackoverflow.com/questions/tagged/capybara-webkit
42
+ [capybara-webkit wiki]: https://github.com/thoughtbot/capybara-webkit/wiki
43
+ [Stack Overflow]: http://stackoverflow.com/questions/tagged/capybara-webkit
44
+
45
+ CI
46
+ --
47
+
48
+ If you're like us, you'll be using capybara-webkit on CI.
49
+
50
+ On Linux platforms, capybara-webkit requires an X server to run, although it doesn't create any visible windows. Xvfb works fine for this. You can setup Xvfb yourself and set a DISPLAY variable, or try out the [headless gem](https://github.com/leonid-shevtsov/headless).
51
+
52
+ Usage
53
+ -----
54
+
55
+ Add the capybara-webkit gem to your Gemfile:
56
+
57
+ ```ruby
58
+ gem "capybara-webkit"
59
+ ```
60
+
61
+ Set your Capybara Javascript driver to webkit:
62
+
63
+ ```ruby
64
+ Capybara.javascript_driver = :webkit
65
+ ```
66
+
67
+ In cucumber, tag scenarios with @javascript to run them using a headless WebKit browser.
68
+
69
+ In RSpec, use the `:js => true` flag. See the [capybara documentation](http://rubydoc.info/gems/capybara#Using_Capybara_with_RSpec) for more information about using capybara with RSpec.
70
+
71
+ Take note of the transactional fixtures section of the [capybara README](https://github.com/jnicklas/capybara/blob/master/README.md).
72
+
73
+ If you're using capybara-webkit with Sinatra, don't forget to set
74
+
75
+ ```ruby
76
+ Capybara.app = MySinatraApp.new
77
+ ```
78
+
79
+ Non-Standard Driver Methods
80
+ ---------------------------
81
+
82
+ capybara-webkit supports a few methods that are not part of the standard capybara API. You can access these by calling `driver` on the capybara session. When using the DSL, that will look like `page.driver.method_name`.
83
+
84
+ **console_messages**: returns an array of messages printed using console.log
85
+
86
+ ```js
87
+ // In Javascript:
88
+ console.log("hello")
89
+ ```
90
+
91
+ ```ruby
92
+ # In Ruby:
93
+ page.driver.console_messages
94
+ => [{:source=>"http://example.com", :line_number=>1, :message=>"hello"}]
95
+ ```
96
+
97
+ **error_messages**: returns an array of Javascript errors that occurred
98
+
99
+ ```ruby
100
+ page.driver.error_messages
101
+ => [{:source=>"http://example.com", :line_number=>1, :message=>"SyntaxError: Parse error"}]
102
+ ```
103
+
104
+ **alert_messages, confirm_messages, prompt_messages**: returns arrays of Javascript dialog messages for each dialog type
105
+
106
+ ```js
107
+ // In Javascript:
108
+ alert("HI");
109
+ confirm("Ok?");
110
+ prompt("Number?", "42");
111
+ ```
112
+
113
+ ```ruby
114
+ # In Ruby:
115
+ page.driver.alert_messages
116
+ => ["Hi"]
117
+ page.driver.confirm_messages
118
+ => ["Ok?"]
119
+ page.driver.prompt_messages
120
+ => ["Number?"]
121
+ ```
122
+
123
+ **resize_window**: change the viewport size to the given width and height
124
+
125
+ ```ruby
126
+ page.driver.resize_window(500, 300)
127
+ page.driver.evaluate_script("window.innerWidth")
128
+ => 500
129
+ ```
130
+
131
+ **cookies**: allows read-only access of cookies for the current session
132
+
133
+ ```ruby
134
+ page.driver.cookies["alpha"]
135
+ => "abc"
136
+ ```
137
+
138
+ **accept_js_confirms!**: accept any Javascript confirm that is triggered by the page's Javascript
139
+
140
+ ```js
141
+ // In Javascript:
142
+ if (confirm("Ok?"))
143
+ console.log("Hi");
144
+ else
145
+ console.log("Bye");
146
+ ```
147
+
148
+ ```ruby
149
+ # In Ruby:
150
+ page.driver.accept_js_confirms!
151
+ visit "/"
152
+ page.driver.console_messages.first[:message]
153
+ => "Hi"
154
+ ```
155
+
156
+ **dismiss_js_confirms!**: dismiss any Javascript confirm that is triggered by the page's Javascript
157
+
158
+ ```js
159
+ // In Javascript:
160
+ if (confirm("Ok?"))
161
+ console.log("Hi");
162
+ else
163
+ console.log("Bye");
164
+ ```
165
+
166
+ ```ruby
167
+ # In Ruby:
168
+ page.driver.dismiss_js_confirms!
169
+ visit "/"
170
+ page.driver.console_messages.first[:message]
171
+ => "Bye"
172
+ ```
173
+
174
+ **accept_js_prompts!**: accept any Javascript prompt that is triggered by the page's Javascript
175
+
176
+ ```js
177
+ // In Javascript:
178
+ var a = prompt("Number?", "0")
179
+ console.log(a);
180
+ ```
181
+
182
+ ```ruby
183
+ # In Ruby:
184
+ page.driver.accept_js_prompts!
185
+ visit "/"
186
+ page.driver.console_messages.first[:message]
187
+ => "0"
188
+ ```
189
+
190
+ **dismiss_js_prompts!**: dismiss any Javascript prompt that is triggered by the page's Javascript
191
+
192
+ ```js
193
+ // In Javascript:
194
+ var a = prompt("Number?", "0")
195
+ if (a != null)
196
+ console.log(a);
197
+ else
198
+ console.log("you said no"));
199
+ ```
200
+
201
+ ```ruby
202
+ # In Ruby:
203
+ page.driver.dismiss_js_prompts!
204
+ visit "/"
205
+ page.driver.console_messages.first[:message]
206
+ => "you said no"
207
+ ```
208
+
209
+ **js_prompt_input=(value)**: set the text to use if a Javascript prompt is encountered and accepted
210
+
211
+ ```js
212
+ // In Javascript:
213
+ var a = prompt("Number?", "0")
214
+ console.log(a);
215
+ ```
216
+
217
+ ```ruby
218
+ # In Ruby:
219
+ page.driver.js_prompt_input = "42"
220
+ page.driver.accept_js_prompts!
221
+ visit "/"
222
+ page.driver.console_messages.first[:message]
223
+ => "42"
224
+ ```
225
+
226
+ **header**: set the given HTTP header for subsequent requests
227
+
228
+ ```ruby
229
+ page.driver.header 'Referer', 'https://www.thoughtbot.com'
230
+ ```
231
+
232
+ Contributing
233
+ ------------
234
+
235
+ See the CONTRIBUTING document.
236
+
237
+ About
238
+ -----
239
+
240
+ The capybara WebKit driver is maintained by Joe Ferris and Matt Horan. It was written by [thoughtbot, inc](http://thoughtbot.com/community) with the help of numerous [contributions from the open source community](https://github.com/thoughtbot/capybara-webkit/contributors).
241
+
242
+ Code for rendering the current webpage to a PNG is borrowed from Phantom.js' implementation.
243
+
244
+ ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
245
+
246
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
247
+
248
+ License
249
+ -------
250
+
251
+ capybara-webkit is Copyright (c) 2010-2013 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.