mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Support Capybara 2.13 and fix some hound warnings
This commit is contained in:
parent
14af2e7d10
commit
1617ee424c
10 changed files with 41 additions and 37 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,8 @@
|
|||
*.swp
|
||||
bin/webkit_server*
|
||||
test/testwebkitserver
|
||||
test/moc_predefs.h
|
||||
test/target_wrapper.sh
|
||||
*.swo
|
||||
*~
|
||||
*.o
|
||||
|
|
|
@ -28,7 +28,7 @@ matrix:
|
|||
gemfile: gemfiles/2.7.gemfile
|
||||
env: QMAKE=/usr/lib/x86_64-linux-gnu/qt4/bin/qmake
|
||||
- rvm: 1.9.3
|
||||
gemfile: gemfiles/2.12.gemfile
|
||||
gemfile: gemfiles/2.13.gemfile
|
||||
env: QMAKE=/usr/lib/x86_64-linux-gnu/qt4/bin/qmake
|
||||
- rvm: 2.3.3
|
||||
gemfile: gemfiles/master.gemfile
|
||||
|
@ -36,7 +36,7 @@ matrix:
|
|||
- gemfile: gemfiles/master.gemfile
|
||||
gemfile:
|
||||
- gemfiles/2.7.gemfile
|
||||
- gemfiles/2.12.gemfile
|
||||
- gemfiles/2.13.gemfile
|
||||
before_install:
|
||||
- gem install bundler
|
||||
install: bundle
|
||||
|
|
|
@ -5,8 +5,8 @@ appraise "2.7" do
|
|||
gem 'nokogiri', '< 1.7.0', :platforms=>[:ruby_19, :jruby_19] # 1.7.0 requires ruby 2.1+
|
||||
end
|
||||
|
||||
appraise "2.12" do
|
||||
gem "capybara", "~> 2.12.0"
|
||||
appraise "2.13" do
|
||||
gem "capybara", "~> 2.13.0"
|
||||
gem 'addressable', '< 2.5.0', :platforms=>[:ruby_19, :jruby_19] # 2.5 requires public_suffix which requires ruby 2.0
|
||||
gem 'nokogiri', '< 1.7.0', :platforms=>[:ruby_19, :jruby_19] # 1.7.0 requires ruby 2.1+
|
||||
end
|
||||
|
|
18
Gemfile.lock
18
Gemfile.lock
|
@ -2,7 +2,7 @@ PATH
|
|||
remote: .
|
||||
specs:
|
||||
capybara-webkit (1.13.0)
|
||||
capybara (>= 2.3.0, < 2.13.0)
|
||||
capybara (>= 2.3.0, < 2.14.0)
|
||||
json
|
||||
|
||||
GEM
|
||||
|
@ -13,7 +13,7 @@ GEM
|
|||
appraisal (0.4.1)
|
||||
bundler
|
||||
rake
|
||||
capybara (2.12.0)
|
||||
capybara (2.13.0)
|
||||
addressable
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
|
@ -21,7 +21,7 @@ GEM
|
|||
rack-test (>= 0.5.4)
|
||||
xpath (~> 2.0)
|
||||
diff-lcs (1.3)
|
||||
ffi (1.9.17-java)
|
||||
ffi (1.9.18-java)
|
||||
json (1.8.6)
|
||||
json (1.8.6-java)
|
||||
launchy (2.4.3)
|
||||
|
@ -30,12 +30,12 @@ GEM
|
|||
addressable (~> 2.3)
|
||||
spoon (~> 0.0.1)
|
||||
mime-types (2.99.3)
|
||||
mini_magick (4.6.0)
|
||||
mini_magick (4.6.1)
|
||||
mini_portile2 (2.1.0)
|
||||
nokogiri (1.7.0.1)
|
||||
nokogiri (1.7.1)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
nokogiri (1.7.0.1-java)
|
||||
nokogiri (1.7.0.1-x86-mingw32)
|
||||
nokogiri (1.7.1-java)
|
||||
nokogiri (1.7.1-x86-mingw32)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
public_suffix (2.0.5)
|
||||
rack (1.6.5)
|
||||
|
@ -63,7 +63,7 @@ GEM
|
|||
tilt (>= 1.3, < 3)
|
||||
spoon (0.0.6)
|
||||
ffi
|
||||
tilt (2.0.6)
|
||||
tilt (2.0.7)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
|
||||
|
@ -84,4 +84,4 @@ DEPENDENCIES
|
|||
sinatra
|
||||
|
||||
BUNDLED WITH
|
||||
1.14.3
|
||||
1.14.5
|
||||
|
|
|
@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.requirements << "Qt >= 4.8"
|
||||
|
||||
s.add_runtime_dependency("capybara", ">= 2.3.0", "< 2.13.0")
|
||||
s.add_runtime_dependency("capybara", ">= 2.3.0", "< 2.14.0")
|
||||
s.add_runtime_dependency("json")
|
||||
|
||||
s.add_development_dependency("rspec", "~> 3.5")
|
||||
|
|
|
@ -4,7 +4,7 @@ source "https://rubygems.org"
|
|||
|
||||
gem "mime-types", "< 3.0", :platforms=>[:ruby_19, :jruby_19]
|
||||
gem "json", "< 2.0", :platforms=>[:ruby_19, :jruby_19]
|
||||
gem "capybara", "~> 2.12.0"
|
||||
gem "capybara", "~> 2.13.0"
|
||||
gem "addressable", "< 2.5.0", :platforms=>[:ruby_19, :jruby_19]
|
||||
gem "nokogiri", "< 1.7.0", :platforms=>[:ruby_19, :jruby_19]
|
||||
|
|
@ -420,7 +420,7 @@ module Capybara::Webkit
|
|||
def encode_args(args)
|
||||
args.map do |arg|
|
||||
if arg.is_a?(Capybara::Webkit::Node)
|
||||
{ 'element-581e-422e-8be1-884c4e116226' => arg.native }.to_json
|
||||
{ "element-581e-422e-8be1-884c4e116226" => arg.native }.to_json
|
||||
else
|
||||
arg.to_json
|
||||
end
|
||||
|
@ -432,10 +432,10 @@ module Capybara::Webkit
|
|||
when Array
|
||||
result.map { |r| decode_result(r) }
|
||||
when Hash
|
||||
if element_ref = result['element-581e-422e-8be1-884c4e116226']
|
||||
if element_ref = result["element-581e-422e-8be1-884c4e116226"]
|
||||
Capybara::Webkit::Node.new(self, element_ref, @browser)
|
||||
else
|
||||
result.each { |k,v| result[k] = decode_result(v) }
|
||||
result.each { |k, v| result[k] = decode_result(v) }
|
||||
end
|
||||
else
|
||||
result
|
||||
|
|
|
@ -166,32 +166,33 @@ module Capybara::Webkit
|
|||
|
||||
def convert_to_named_keys(key)
|
||||
if key.is_a? Array
|
||||
key.map {|k| convert_to_named_keys(k)}
|
||||
key.map { |k| convert_to_named_keys(k)}
|
||||
else
|
||||
case key
|
||||
when :cancel, :help, :backspace, :tab, :clear, :return, :enter, :insert, :delete, :pause, :escape,
|
||||
:space, :end, :home, :left, :up, :right, :down, :semicolon,
|
||||
:f1, :f2, :f3, :f4, :f5, :f6, :f7, :f8, :f9, :f10, :f11, :f12,
|
||||
:shift, :control, :alt, :meta
|
||||
{ "key" => key.to_s.capitalize }
|
||||
{ "key" => key.to_s.capitalize }
|
||||
when :equals
|
||||
{ "key" => "Equal" }
|
||||
when :page_up
|
||||
{ "key" => "PageUp" }
|
||||
when :page_down
|
||||
{ "key" => "PageDown" }
|
||||
when :numpad0, :numpad1, :numpad2, :numpad3, :numpad4, :numpad5, :numpad6, :numpad7, :numpad9, :numpad9
|
||||
{ "key" => key[-1], "modifier" => 'Keypad' }
|
||||
when :numpad0, :numpad1, :numpad2, :numpad3, :numpad4,
|
||||
:numpad5, :numpad6, :numpad7, :numpad9, :numpad9
|
||||
{ "key" => key[-1], "modifier" => "keypad" }
|
||||
when :multiply
|
||||
{ "key" => "Asterisk", "modifier" => 'Keypad' }
|
||||
{ "key" => "Asterisk", "modifier" => "keypad" }
|
||||
when :divide
|
||||
{ "key" => "Slash", "modifier" => 'Keypad' }
|
||||
{ "key" => "Slash", "modifier" => "keypad" }
|
||||
when :add
|
||||
{ "key" => "Plus", "modifier" => 'Keypad' }
|
||||
{ "key" => "Plus", "modifier" => "keypad" }
|
||||
when :subtract
|
||||
{ "key" => "Minus", "modifier" => 'Keypad' }
|
||||
{ "key" => "Minus", "modifier" => "keypad" }
|
||||
when :decimal
|
||||
{"key" => "Period", "modifier" => 'Keypad'}
|
||||
{ "key" => "Period", "modifier" => "keypad" }
|
||||
when :command
|
||||
{ "key" => "Meta" }
|
||||
when String
|
||||
|
|
|
@ -524,17 +524,17 @@ describe Capybara::Webkit::Driver do
|
|||
|
||||
it "evaluates Javascript and returns an element" do
|
||||
result = driver.evaluate_script(%<document.getElementById('greeting')>)
|
||||
expect(result).to eq driver.find_css('#greeting').first
|
||||
expect(result).to eq driver.find_css("#greeting").first
|
||||
end
|
||||
|
||||
it "evaluates Javascript and returns a structure containing elements" do
|
||||
result = driver.evaluate_script(%<({ 'a': document.getElementById('greeting'), 'b': { 'c': document.querySelectorAll('#greeting, #checktest') } })>)
|
||||
expect(result).to eq({
|
||||
'a' => driver.find_css('#greeting').first,
|
||||
'b' => {
|
||||
'c' => driver.find_css('#greeting, #checktest')
|
||||
}
|
||||
})
|
||||
expect(result).to eq(
|
||||
"a" => driver.find_css("#greeting").first,
|
||||
"b" => {
|
||||
"c" => driver.find_css("#greeting, #checktest")
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
it "evaluates Javascript and returns null" do
|
||||
|
@ -1379,7 +1379,8 @@ describe Capybara::Webkit::Driver do
|
|||
it "releases modifiers correctly" do
|
||||
input = driver.find_xpath("//input").first
|
||||
input.send_keys("a", [:shift, :left], "a")
|
||||
expect(driver.find_css("#key_events").first.text).to eq "d:65 u:65 d:16 d:37 u:37 u:16 d:65 u:65"
|
||||
event_text = driver.find_css("#key_events").first.text
|
||||
expect(event_text).to eq "d:65 u:65 d:16 d:37 u:37 u:16 d:65 u:65"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ Capybara = {
|
|||
CapybaraInvocation.namedKeyup(mods.pop().key);
|
||||
}
|
||||
} else {
|
||||
key = keys.key
|
||||
key = keys.key;
|
||||
if (["Shift", "Control", "Alt", "Meta"].indexOf(key) > -1){
|
||||
CapybaraInvocation.namedKeydown(key);
|
||||
this.keyModifiersStack[this.keyModifiersStack.length-1].push(keys);
|
||||
|
@ -490,7 +490,7 @@ Capybara = {
|
|||
arg[_j] = this.wrapResult(arg[_j]);
|
||||
}
|
||||
} else if (arg && arg.nodeType == 1 && arg.tagName) {
|
||||
return {'element-581e-422e-8be1-884c4e116226': this.registerNode(arg) }
|
||||
return {'element-581e-422e-8be1-884c4e116226': this.registerNode(arg)};
|
||||
} else if (arg === null) {
|
||||
return undefined;
|
||||
} else if ( typeof arg == 'object' ) {
|
||||
|
|
Loading…
Reference in a new issue