otherinbox-capybara-webkit 0.12.0 → 0.12.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/GOALS +9 -0
  2. data/README.md +1 -1
  3. data/capybara-webkit.gemspec +1 -1
  4. data/lib/capybara/webkit.rb +11 -4
  5. data/lib/capybara/{driver/webkit → webkit}/browser.rb +27 -3
  6. data/lib/capybara/{driver/webkit → webkit}/connection.rb +45 -47
  7. data/lib/capybara/{driver/webkit → webkit}/cookie_jar.rb +1 -1
  8. data/lib/capybara/webkit/driver.rb +150 -0
  9. data/lib/capybara/webkit/errors.rb +10 -0
  10. data/lib/capybara/{driver/webkit → webkit}/node.rb +2 -2
  11. data/lib/capybara/{driver/webkit → webkit}/socket_debugger.rb +1 -1
  12. data/lib/capybara/{driver/webkit → webkit}/version.rb +1 -1
  13. data/lib/capybara_webkit_builder.rb +17 -3
  14. data/spec/browser_spec.rb +38 -25
  15. data/spec/connection_spec.rb +5 -5
  16. data/spec/cookie_jar_spec.rb +3 -3
  17. data/spec/driver_rendering_spec.rb +19 -26
  18. data/spec/driver_resize_window_spec.rb +3 -3
  19. data/spec/driver_spec.rb +907 -829
  20. data/spec/integration/driver_spec.rb +4 -3
  21. data/spec/spec_helper.rb +14 -6
  22. data/spec/support/app_runner.rb +91 -0
  23. data/src/Authenticate.cpp +18 -0
  24. data/src/Authenticate.h +12 -0
  25. data/src/Body.h +3 -5
  26. data/src/ClearCookies.cpp +3 -5
  27. data/src/ClearCookies.h +3 -5
  28. data/src/Command.cpp +4 -15
  29. data/src/Command.h +3 -14
  30. data/src/CommandFactory.cpp +10 -6
  31. data/src/CommandFactory.h +3 -2
  32. data/src/CommandParser.cpp +1 -1
  33. data/src/Connection.cpp +22 -11
  34. data/src/Connection.h +4 -2
  35. data/src/ConsoleMessages.cpp +2 -1
  36. data/src/ConsoleMessages.h +3 -5
  37. data/src/CurrentUrl.cpp +2 -1
  38. data/src/CurrentUrl.h +3 -5
  39. data/src/EnableLogging.cpp +10 -0
  40. data/src/EnableLogging.h +12 -0
  41. data/src/Evaluate.cpp +2 -1
  42. data/src/Evaluate.h +3 -5
  43. data/src/Execute.cpp +2 -1
  44. data/src/Execute.h +3 -5
  45. data/src/Find.cpp +3 -2
  46. data/src/Find.h +3 -5
  47. data/src/FrameFocus.cpp +3 -2
  48. data/src/FrameFocus.h +3 -4
  49. data/src/GetCookies.cpp +3 -4
  50. data/src/GetCookies.h +3 -5
  51. data/src/GetWindowHandle.cpp +11 -0
  52. data/src/GetWindowHandle.h +10 -0
  53. data/src/GetWindowHandles.cpp +20 -0
  54. data/src/GetWindowHandles.h +10 -0
  55. data/src/Header.cpp +2 -1
  56. data/src/Header.h +3 -5
  57. data/src/Headers.cpp +2 -1
  58. data/src/Headers.h +3 -5
  59. data/src/IgnoreSslErrors.cpp +4 -3
  60. data/src/IgnoreSslErrors.h +3 -5
  61. data/src/JavascriptInvocation.cpp +1 -1
  62. data/src/JavascriptInvocation.h +1 -1
  63. data/src/NetworkAccessManager.cpp +19 -1
  64. data/src/NetworkAccessManager.h +10 -0
  65. data/src/Node.cpp +6 -1
  66. data/src/Node.h +4 -5
  67. data/src/NullCommand.cpp +5 -2
  68. data/src/NullCommand.h +4 -3
  69. data/src/PageLoadingCommand.cpp +12 -7
  70. data/src/PageLoadingCommand.h +6 -9
  71. data/src/Render.cpp +2 -1
  72. data/src/Render.h +3 -5
  73. data/src/RequestedUrl.cpp +2 -1
  74. data/src/RequestedUrl.h +3 -5
  75. data/src/Reset.cpp +3 -17
  76. data/src/Reset.h +3 -8
  77. data/src/ResizeWindow.cpp +2 -1
  78. data/src/ResizeWindow.h +3 -5
  79. data/src/Server.cpp +2 -3
  80. data/src/Server.h +0 -2
  81. data/src/SetCookie.cpp +3 -4
  82. data/src/SetCookie.h +3 -5
  83. data/src/SetProxy.cpp +2 -1
  84. data/src/SetProxy.h +3 -5
  85. data/src/SetSkipImageLoading.cpp +3 -2
  86. data/src/SetSkipImageLoading.h +3 -5
  87. data/src/SocketCommand.cpp +21 -0
  88. data/src/SocketCommand.h +29 -0
  89. data/src/Source.cpp +2 -1
  90. data/src/Source.h +3 -4
  91. data/src/Status.cpp +2 -1
  92. data/src/Status.h +3 -5
  93. data/src/UnsupportedContentHandler.cpp +1 -1
  94. data/src/Url.cpp +2 -1
  95. data/src/Url.h +3 -5
  96. data/src/Visit.cpp +3 -2
  97. data/src/Visit.h +3 -5
  98. data/src/WebPage.cpp +86 -39
  99. data/src/WebPage.h +22 -8
  100. data/src/WebPageManager.cpp +117 -0
  101. data/src/WebPageManager.h +56 -0
  102. data/src/WindowFocus.cpp +32 -0
  103. data/src/WindowFocus.h +15 -0
  104. data/src/body.cpp +2 -1
  105. data/src/find_command.h +6 -2
  106. data/src/webkit_server.pro +14 -0
  107. data/templates/Command.cpp +2 -4
  108. data/templates/Command.h +3 -3
  109. metadata +29 -10
  110. data/lib/capybara/driver/webkit.rb +0 -135
@@ -1,135 +0,0 @@
1
- require "capybara"
2
- require "capybara/driver/webkit/version"
3
- require "capybara/driver/webkit/node"
4
- require "capybara/driver/webkit/connection"
5
- require "capybara/driver/webkit/browser"
6
- require "capybara/driver/webkit/socket_debugger"
7
- require "capybara/driver/webkit/cookie_jar"
8
-
9
- class Capybara::Driver::Webkit
10
- class WebkitInvalidResponseError < StandardError
11
- end
12
-
13
- class WebkitNoResponseError < StandardError
14
- end
15
-
16
- class NodeNotAttachedError < Capybara::ElementNotFound
17
- end
18
-
19
- attr_reader :browser
20
-
21
- def initialize(app, options={})
22
- @app = app
23
- @options = options
24
- @rack_server = Capybara::Server.new(@app)
25
- @rack_server.boot if Capybara.run_server
26
- @browser = options[:browser] || Browser.new(Connection.new(options))
27
- end
28
-
29
- def current_url
30
- browser.current_url
31
- end
32
-
33
- def requested_url
34
- browser.requested_url
35
- end
36
-
37
- def visit(path)
38
- browser.visit(url(path))
39
- end
40
-
41
- def find(query)
42
- browser.find(query).map { |native| Node.new(self, native) }
43
- end
44
-
45
- def source
46
- browser.source
47
- end
48
-
49
- def body
50
- browser.body
51
- end
52
-
53
- def header(key, value)
54
- browser.header(key, value)
55
- end
56
-
57
- def execute_script(script)
58
- value = browser.execute_script script
59
- value.empty? ? nil : value
60
- end
61
-
62
- def evaluate_script(script)
63
- browser.evaluate_script script
64
- end
65
-
66
- def console_messages
67
- browser.console_messages
68
- end
69
-
70
- def error_messages
71
- browser.error_messages
72
- end
73
-
74
- def response_headers
75
- browser.response_headers
76
- end
77
-
78
- def status_code
79
- browser.status_code
80
- end
81
-
82
- def resize_window(width, height)
83
- browser.resize_window(width, height)
84
- end
85
-
86
- def within_frame(frame_id_or_index)
87
- browser.frame_focus(frame_id_or_index)
88
- begin
89
- yield
90
- ensure
91
- browser.frame_focus
92
- end
93
- end
94
-
95
- def within_window(handle)
96
- raise Capybara::NotSupportedByDriverError
97
- end
98
-
99
- def wait?
100
- true
101
- end
102
-
103
- def wait_until(*args)
104
- end
105
-
106
- def reset!
107
- browser.reset!
108
- end
109
-
110
- def has_shortcircuit_timeout?
111
- false
112
- end
113
-
114
- def render(path, options={})
115
- options[:width] ||= 1000
116
- options[:height] ||= 10
117
-
118
- browser.render path, options[:width], options[:height]
119
- end
120
-
121
- def server_port
122
- @rack_server.port
123
- end
124
-
125
- def cookies
126
- @cookie_jar ||= CookieJar.new(browser)
127
- end
128
-
129
- private
130
-
131
- def url(path)
132
- @rack_server.url(path)
133
- end
134
- end
135
-