capybara-webkit 1.14.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: adb3d932baa61a8938f10d7262631a313584a190
4
- data.tar.gz: df339e2e1777df21576775f21a38188a972edb62
2
+ SHA256:
3
+ metadata.gz: f98f26d98fee3ba5650659c14fee6a562e6229a3bc67eb031b1854c3a846e115
4
+ data.tar.gz: e5ff61d1a3c60ac7d95a5ede81da61ba9cfd5a322993297875fb3b7bec832bcf
5
5
  SHA512:
6
- metadata.gz: 3154fa91673bf59aa710a48ed94ed93d2da7f3e2146e15cd9f99f952ac440b6b49b6784cbcc063ffe05dd4aa38c3108296fc14244ea316662c1d8000de0f870a
7
- data.tar.gz: 08883b67a4e99e083eb65bfeee24d00d0775626d16d905c1a86aaa2e2f6e712b8efcd7b13c0f50e328f95d7ac016ae23375f69ffe755aede97f17f6eba28aa83
6
+ metadata.gz: fcdf7fc7c653219f05a956f3c4d273d48f20fce6a59b5938c7333f5fc78b31ea13a531617d80928576847c7c99916fea09708d9dca087d4737090d47a28cb311
7
+ data.tar.gz: 211921dbfcde185453e09ea907c9c435ece722a50169b92a73b471a74bf0e33148113a9508b8324a3bcd8ac4c02d302e88d93819fd2d5e4c0ba7c6d04e46b7c3
@@ -2,10 +2,9 @@ sudo: required
2
2
  dist: trusty
3
3
  language: ruby
4
4
  rvm:
5
- - 1.9.3
6
- - 2.1
7
5
  - 2.2
8
- - jruby-19mode
6
+ - 2.4
7
+ - 2.5
9
8
  notifications:
10
9
  email: false
11
10
  script: xvfb-run bundle exec rake
@@ -25,18 +24,18 @@ addons:
25
24
  matrix:
26
25
  include:
27
26
  - rvm: 1.9.3
28
- gemfile: gemfiles/2.7.gemfile
29
- env: QMAKE=/usr/lib/x86_64-linux-gnu/qt4/bin/qmake
30
- - rvm: 1.9.3
31
- gemfile: gemfiles/2.13.gemfile
27
+ gemfile: gemfiles/2.15.gemfile
32
28
  env: QMAKE=/usr/lib/x86_64-linux-gnu/qt4/bin/qmake
29
+ - rvm: jruby-19mode
30
+ gemfile: gemfiles/2.15.gemfile
33
31
  - rvm: 2.3.3
34
32
  gemfile: gemfiles/master.gemfile
33
+ - rvm: jruby-9.1.13.0
34
+ gemfile: Gemfile
35
35
  allow_failures:
36
36
  - gemfile: gemfiles/master.gemfile
37
37
  gemfile:
38
- - gemfiles/2.7.gemfile
39
- - gemfiles/2.13.gemfile
38
+ - Gemfile
40
39
  before_install:
41
40
  - gem install bundler
42
41
  install: bundle
data/Appraisals CHANGED
@@ -1,16 +1,10 @@
1
- appraise "2.7" do
2
- gem "capybara", "~> 2.7.0"
3
- gem "rspec", "~> 2.14.0"
4
- gem 'addressable', '< 2.5.0', :platforms=>[:ruby_19, :jruby_19] # 2.5 requires public_suffix which requires ruby 2.0
5
- gem 'nokogiri', '< 1.7.0', :platforms=>[:ruby_19, :jruby_19] # 1.7.0 requires ruby 2.1+
6
- end
7
-
8
- appraise "2.13" do
9
- gem "capybara", "~> 2.13.0"
1
+ appraise "2.15" do
2
+ gem "capybara", "~> 2.15.0"
10
3
  gem 'addressable', '< 2.5.0', :platforms=>[:ruby_19, :jruby_19] # 2.5 requires public_suffix which requires ruby 2.0
11
4
  gem 'nokogiri', '< 1.7.0', :platforms=>[:ruby_19, :jruby_19] # 1.7.0 requires ruby 2.1+
12
5
  end
13
6
 
14
7
  appraise "master" do
15
8
  gem "capybara", github: "jnicklas/capybara"
9
+ gem "puma"
16
10
  end
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
- gem "mime-types", "< 3.0", platforms: [:ruby_19, :jruby_19]
5
4
  gem "json", "< 2.0", :platforms=>[:ruby_19, :jruby_19]
@@ -2,24 +2,25 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  capybara-webkit (1.14.0)
5
- capybara (>= 2.3.0, < 2.14.0)
5
+ capybara (>= 2.3, < 4.0)
6
6
  json
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.5.0)
12
- public_suffix (~> 2.0, >= 2.0.2)
13
- appraisal (0.4.1)
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
+ appraisal (2.2.0)
14
14
  bundler
15
15
  rake
16
- capybara (2.13.0)
16
+ thor (>= 0.14.0)
17
+ capybara (2.17.0)
17
18
  addressable
18
- mime-types (>= 1.16)
19
+ mini_mime (>= 0.1.3)
19
20
  nokogiri (>= 1.3.3)
20
21
  rack (>= 1.0.0)
21
22
  rack-test (>= 0.5.4)
22
- xpath (~> 2.0)
23
+ xpath (>= 2.0, < 4.0)
23
24
  diff-lcs (1.3)
24
25
  ffi (1.9.18-java)
25
26
  json (1.8.6)
@@ -29,43 +30,43 @@ GEM
29
30
  launchy (2.4.3-java)
30
31
  addressable (~> 2.3)
31
32
  spoon (~> 0.0.1)
32
- mime-types (2.99.3)
33
- mini_magick (4.6.1)
34
- mini_portile2 (2.1.0)
35
- nokogiri (1.7.1)
36
- mini_portile2 (~> 2.1.0)
37
- nokogiri (1.7.1-java)
38
- nokogiri (1.7.1-x86-mingw32)
39
- mini_portile2 (~> 2.1.0)
40
- public_suffix (2.0.5)
41
- rack (1.6.5)
42
- rack-protection (1.5.3)
33
+ mini_magick (4.8.0)
34
+ mini_mime (1.0.0)
35
+ mini_portile2 (2.3.0)
36
+ mustermann (1.0.1)
37
+ nokogiri (1.8.1)
38
+ mini_portile2 (~> 2.3.0)
39
+ public_suffix (3.0.0)
40
+ rack (2.0.3)
41
+ rack-protection (2.0.0)
43
42
  rack
44
- rack-test (0.6.3)
45
- rack (>= 1.0)
43
+ rack-test (0.8.2)
44
+ rack (>= 1.0, < 3)
46
45
  rake (11.3.0)
47
- rspec (3.5.0)
48
- rspec-core (~> 3.5.0)
49
- rspec-expectations (~> 3.5.0)
50
- rspec-mocks (~> 3.5.0)
51
- rspec-core (3.5.4)
52
- rspec-support (~> 3.5.0)
53
- rspec-expectations (3.5.0)
46
+ rspec (3.7.0)
47
+ rspec-core (~> 3.7.0)
48
+ rspec-expectations (~> 3.7.0)
49
+ rspec-mocks (~> 3.7.0)
50
+ rspec-core (3.7.0)
51
+ rspec-support (~> 3.7.0)
52
+ rspec-expectations (3.7.0)
54
53
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.5.0)
56
- rspec-mocks (3.5.0)
54
+ rspec-support (~> 3.7.0)
55
+ rspec-mocks (3.7.0)
57
56
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.5.0)
59
- rspec-support (3.5.0)
60
- sinatra (1.4.8)
61
- rack (~> 1.5)
62
- rack-protection (~> 1.4)
63
- tilt (>= 1.3, < 3)
57
+ rspec-support (~> 3.7.0)
58
+ rspec-support (3.7.0)
59
+ sinatra (2.0.0)
60
+ mustermann (~> 1.0)
61
+ rack (~> 2.0)
62
+ rack-protection (= 2.0.0)
63
+ tilt (~> 2.0)
64
64
  spoon (0.0.6)
65
65
  ffi
66
- tilt (2.0.7)
67
- xpath (2.0.0)
68
- nokogiri (~> 1.3)
66
+ thor (0.20.0)
67
+ tilt (2.0.8)
68
+ xpath (3.0.0)
69
+ nokogiri (~> 1.8)
69
70
 
70
71
  PLATFORMS
71
72
  java
@@ -73,15 +74,14 @@ PLATFORMS
73
74
  x86-mingw32
74
75
 
75
76
  DEPENDENCIES
76
- appraisal (~> 0.4.0)
77
+ appraisal
77
78
  capybara-webkit!
78
79
  json (< 2.0)
79
80
  launchy
80
- mime-types (< 3.0)
81
81
  mini_magick
82
82
  rake (< 12.0.0)
83
83
  rspec (~> 3.5)
84
84
  sinatra
85
85
 
86
86
  BUNDLED WITH
87
- 1.14.5
87
+ 1.16.0
data/NEWS.md CHANGED
@@ -1,3 +1,17 @@
1
+ New for 1.15.0:
2
+
3
+ * Fire events on select when options is within an optgroup
4
+ * Support threadsafe/per session config mode
5
+ * Support for Capybara 2.15
6
+ * Support #refresh
7
+ * Work around form fields overriding form element methods
8
+ * Explicitly shutdown webkit_server when shutting down
9
+ * Only override font in Qt versions where it's needed
10
+ * Make select elements generate the events specified by WebDriver spec
11
+ * Node#[] prefers properties over attributes
12
+ * Add time to logging
13
+ * Don't check node ancestors for CSS visibility setting
14
+
1
15
  New for 1.14.0:
2
16
 
3
17
  * Fix the 'Reset' command in debug builds (on Windows)
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  capybara-webkit
2
2
  ===============
3
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)
4
+ [![Build Status](https://secure.travis-ci.org/thoughtbot/capybara-webkit.svg?branch=master)](https://travis-ci.org/thoughtbot/capybara-webkit)
5
+ [![Code Climate](https://codeclimate.com/github/thoughtbot/capybara-webkit.svg)](https://codeclimate.com/github/thoughtbot/capybara-webkit)
6
6
 
7
7
  A [capybara](https://github.com/jnicklas/capybara) driver that uses [WebKit](http://webkit.org) via [QtWebKit](http://trac.webkit.org/wiki/QtWebKit).
8
8
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.requirements << "Qt >= 4.8"
23
23
 
24
- s.add_runtime_dependency("capybara", ">= 2.3.0", "< 2.14.0")
24
+ s.add_runtime_dependency("capybara", ">= 2.3", "< 4.0")
25
25
  s.add_runtime_dependency("json")
26
26
 
27
27
  s.add_development_dependency("rspec", "~> 3.5")
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency("sinatra")
30
30
  s.add_development_dependency("mini_magick")
31
31
  s.add_development_dependency("rake", "< 12.0.0")
32
- s.add_development_dependency("appraisal", "~> 0.4.0")
32
+ s.add_development_dependency("appraisal")
33
33
  s.add_development_dependency("launchy")
34
34
  end
35
35
 
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "json", "< 2.0", platforms: [:ruby_19, :jruby_19]
6
+ gem "capybara", "~> 2.15.0"
7
+ gem "addressable", "< 2.5.0", platforms: [:ruby_19, :jruby_19]
8
+ gem "nokogiri", "< 1.7.0", platforms: [:ruby_19, :jruby_19]
9
+
10
+ gemspec path: "../"
@@ -2,8 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "mime-types", "< 3.0", :platforms=>[:ruby_19, :jruby_19]
6
- gem "json", "< 2.0", :platforms=>[:ruby_19, :jruby_19]
7
- gem "capybara", :github=>"jnicklas/capybara"
5
+ gem "capybara", github: "jnicklas/capybara"
6
+ gem "puma"
8
7
 
9
- gemspec :path=>"../"
8
+ gemspec path: "../"
@@ -84,7 +84,7 @@ module Capybara::Webkit
84
84
  def frame_focus(selector=nil)
85
85
  if selector.respond_to?(:base)
86
86
  selector.base.invoke("focus_frame")
87
- elsif selector.is_a? Fixnum
87
+ elsif selector.is_a? Integer
88
88
  command("FrameFocus", "", selector.to_s)
89
89
  elsif selector
90
90
  command("FrameFocus", selector)
@@ -134,7 +134,7 @@ module Capybara::Webkit
134
134
  end
135
135
 
136
136
  def get_window_handles
137
- JSON.parse(command('GetWindowHandles'))
137
+ JSON.parse(command("GetWindowHandles"))
138
138
  end
139
139
 
140
140
  def window_handles
@@ -144,7 +144,7 @@ module Capybara::Webkit
144
144
  end
145
145
 
146
146
  def get_window_handle
147
- command('GetWindowHandle')
147
+ command("GetWindowHandle")
148
148
  end
149
149
 
150
150
  def window_handle
@@ -236,12 +236,17 @@ https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
236
236
  end
237
237
 
238
238
  def evaluate_script(script, *args)
239
- json = command('Evaluate', script, args.to_json)
239
+ json = command("Evaluate", script, args.to_json)
240
+ JSON.parse("[#{json}]").first
241
+ end
242
+
243
+ def evaluate_async_script(script, *args)
244
+ json = command("EvaluateAsync", script, args.to_json)
240
245
  JSON.parse("[#{json}]").first
241
246
  end
242
247
 
243
248
  def execute_script(script, *args)
244
- command('Execute', script, args.to_json)
249
+ command("Execute", script, args.to_json)
245
250
  end
246
251
 
247
252
  def render(path, width, height)
@@ -289,6 +294,10 @@ https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
289
294
  command("GoForward")
290
295
  end
291
296
 
297
+ def refresh
298
+ command("Refresh")
299
+ end
300
+
292
301
  def allow_url(url)
293
302
  command("AllowUrl", url)
294
303
  end
@@ -91,6 +91,11 @@ module Capybara::Webkit
91
91
  decode_result(result)
92
92
  end
93
93
 
94
+ def evaluate_async_script(script, *args)
95
+ result = @browser.evaluate_async_script(script, *encode_args(args))
96
+ decode_result(result)
97
+ end
98
+
94
99
  def console_messages
95
100
  @browser.console_messages
96
101
  end
@@ -241,6 +246,10 @@ module Capybara::Webkit
241
246
  @browser.go_forward
242
247
  end
243
248
 
249
+ def refresh
250
+ @browser.refresh
251
+ end
252
+
244
253
  def accept_modal(type, options={})
245
254
  options = modal_action_options_for_browser(options)
246
255
 
@@ -359,7 +368,11 @@ module Capybara::Webkit
359
368
  end
360
369
 
361
370
  def default_wait_time
362
- Capybara.respond_to?(:default_max_wait_time) ? Capybara.default_max_wait_time : Capybara.default_wait_time
371
+ if respond_to?(:session_options) && session_options
372
+ session_options.default_max_wait_time
373
+ else
374
+ Capybara.respond_to?(:default_max_wait_time) ? Capybara.default_max_wait_time : Capybara.default_wait_time
375
+ end
363
376
  end
364
377
 
365
378
  def find_modal(type, id, options)
@@ -1,7 +1,7 @@
1
1
  module Capybara::Webkit
2
2
  class Node < Capybara::Driver::Node
3
- def initialize(session, base, browser)
4
- super(session, base)
3
+ def initialize(driver, base, browser)
4
+ super(driver, base)
5
5
  @browser = browser
6
6
  end
7
7
 
@@ -15,16 +15,18 @@ module Capybara::Webkit
15
15
  end
16
16
 
17
17
  def [](name)
18
- value = invoke("attribute", name)
19
- if name == 'checked' || name == 'disabled' || name == 'multiple'
20
- value == 'true'
18
+ name = name.to_s
19
+ tn = tag_name
20
+ if (tn == "img" && name == "src") || (tn == "a" && name == "href")
21
+ # Although the attribute matters, the property is consistent. Return that in
22
+ # preference to the attribute for links and images.
23
+ # if attribute exists get the property
24
+ val = invoke(:attribute, name) && invoke(:property, name)
21
25
  else
22
- if invoke("hasAttribute", name) == 'true'
23
- value
24
- else
25
- nil
26
- end
26
+ val = invoke(:property, name)
27
+ val = invoke(:attribute, name) if val.nil? || val.is_a?(Hash)
27
28
  end
29
+ val
28
30
  end
29
31
 
30
32
  def value
@@ -43,7 +45,8 @@ module Capybara::Webkit
43
45
  invoke 'setInnerHTML', value
44
46
  end
45
47
 
46
- def set(value)
48
+ def set(value, options = {})
49
+ warn "Options passed to Node#set but capybara-webkit doesn't currently support any - ignoring" unless options.empty?
47
50
  invoke "set", *[value].flatten
48
51
  end
49
52
 
@@ -66,16 +69,16 @@ module Capybara::Webkit
66
69
  end
67
70
  end
68
71
 
69
- def click
70
- invoke("leftClick")
72
+ def click(keys = [], offset = {})
73
+ invoke("leftClick", keys.to_json, offset.to_json)
71
74
  end
72
75
 
73
- def double_click
74
- invoke("doubleClick")
76
+ def double_click(keys = [], offset = {})
77
+ invoke("doubleClick", keys.to_json, offset.to_json)
75
78
  end
76
79
 
77
- def right_click
78
- invoke("rightClick")
80
+ def right_click(keys = [], offset = {})
81
+ invoke("rightClick", keys.to_json, offset.to_json)
79
82
  end
80
83
 
81
84
  def hover
@@ -91,15 +94,15 @@ module Capybara::Webkit
91
94
  end
92
95
 
93
96
  def visible?
94
- invoke("visible") == "true"
97
+ invoke("visible") == true
95
98
  end
96
99
 
97
100
  def selected?
98
- invoke("selected") == "true"
101
+ invoke("selected") == true
99
102
  end
100
103
 
101
104
  def checked?
102
- self['checked']
105
+ !!self["checked"]
103
106
  end
104
107
 
105
108
  def disabled?
@@ -139,7 +142,8 @@ module Capybara::Webkit
139
142
  end
140
143
 
141
144
  def invoke(name, *args)
142
- @browser.command "Node", name, allow_unattached_nodes?, native, *args
145
+ result = @browser.command "Node", name, allow_unattached_nodes?, native, *args
146
+ JSON.parse(result, quirks_mode: true)
143
147
  end
144
148
 
145
149
  def allow_unattached_nodes?
@@ -147,11 +151,14 @@ module Capybara::Webkit
147
151
  end
148
152
 
149
153
  def automatic_reload?
150
- Capybara.respond_to?(:automatic_reload) && Capybara.automatic_reload
154
+ session_option(:automatic_reload)
151
155
  end
152
156
 
153
157
  def attached?
154
- @browser.command("Node", "isAttached", native) == "true"
158
+ warn "[DEPRECATION] The Capybara::Webkit::Node#attached? " \
159
+ "method is deprecated without replacement."
160
+ result = @browser.command("Node", "isAttached", native)
161
+ JSON.parse(result, quirks_mode: true)
155
162
  end
156
163
 
157
164
  def multiple_select?
@@ -159,11 +166,19 @@ module Capybara::Webkit
159
166
  end
160
167
 
161
168
  def ==(other)
162
- invoke("equals", other.native) == "true"
169
+ invoke("equals", other.native)
163
170
  end
164
171
 
165
172
  private
166
173
 
174
+ def session_option(name)
175
+ if driver.respond_to?(:session_options)
176
+ driver.session_options.public_send(name)
177
+ else
178
+ Capybara.respond_to?(name) && Capybara.public_send(name)
179
+ end
180
+ end
181
+
167
182
  def convert_to_named_keys(key)
168
183
  if key.is_a? Array
169
184
  key.map { |k| convert_to_named_keys(k)}