Skip to content

Commit 6dcb660

Browse files
authored
Merge pull request #196 from rubycdp/fix-build-2
Fix build
2 parents 2bbf363 + 620b649 commit 6dcb660

File tree

12 files changed

+80
-40
lines changed

12 files changed

+80
-40
lines changed

.github/gemfiles/ferrum-master.gemfile

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/gemfiles/websocket-driver-6.x.gemfile renamed to .github/gemfiles/websocket-driver-0.6.x.gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
source "https://rubygems.org"
44

55
gem "websocket-driver", ">= 0.6", "< 0.7"
6-
gem "capybara", "~> 3.35.0"
6+
gem "capybara", "~> 3.37.1"
7+
gem "matrix"
78

89
gemspec path: "../../"

.github/gemfiles/capybara-3.x.gemfile renamed to .github/gemfiles/websocket-driver-0.7.x.gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
source "https://rubygems.org"
44

5-
gem "capybara", "~> 3.35.0"
5+
gem "websocket-driver", ">= 0.7", "< 0.8"
6+
gem "capybara", "~> 3.37.1"
7+
gem "matrix"
68

79
gemspec path: "../../"

.github/workflows/tests.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
gemfile: [capybara-3.x, websocket-driver-6.x, ferrum-master]
15-
ruby: [2.6, 2.7, 3.0]
14+
gemfile: [websocket-driver-0.6.x, websocket-driver-0.7.x]
15+
ruby: [2.7, 3.0, 3.1]
1616
runs-on: ubuntu-latest
1717
env:
1818
FERRUM_PROCESS_TIMEOUT: 20
19-
FERRUM_DEFAULT_TIMEOUT: 10
19+
FERRUM_DEFAULT_TIMEOUT: 15
2020
BUNDLE_GEMFILE: .github/gemfiles/${{ matrix.gemfile }}.gemfile
2121
steps:
2222
- name: Checkout code
@@ -37,10 +37,6 @@ jobs:
3737

3838
- name: Run tests
3939
run: bundle exec rake
40-
if: |
41-
matrix.gemfile != 'ferrum-master' ||
42-
(matrix.gemfile == 'ferrum-master' &&
43-
contains(github.event.pull_request.labels.*.name, 'master'))
4440

4541
- name: Archive artifacts
4642
uses: actions/upload-artifact@v2

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ Gemfile.*
33
pkg
44
.idea
55
.ruby-version
6-
save_path_tmp

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018-2021 Dmitry Vorotilin
3+
Copyright (c) 2018-2022 Dmitry Vorotilin
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

lib/capybara/cuprite/browser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def find_all(method, selector, within = nil)
187187
evaluate("_cuprite.find(arguments[0], arguments[1])", method, selector)
188188
end
189189

190-
nodes.map { |n| n.node? ? n : next }.compact
190+
nodes.select(&:node?)
191191
rescue Ferrum::JavaScriptError => e
192192
raise InvalidSelector.new(e.response, method, selector) if e.class_name == "InvalidSelector"
193193

lib/capybara/cuprite/page.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ def prepare_page
170170
response = @modal_response || params["defaultPrompt"]
171171
else
172172
with_text = params["message"] ? "with text `#{params['message']}` " : ""
173-
warn "Modal window #{with_text}has been opened, but you didn't wrap "\
174-
"your code into (`accept_prompt` | `dismiss_prompt` | "\
175-
"`accept_confirm` | `dismiss_confirm` | `accept_alert`), "\
173+
warn "Modal window #{with_text}has been opened, but you didn't wrap " \
174+
"your code into (`accept_prompt` | `dismiss_prompt` | " \
175+
"`accept_confirm` | `dismiss_confirm` | `accept_alert`), " \
176176
"accepting by default"
177177
options = { accept: true }
178178
response = params["defaultPrompt"]

spec/features/driver_spec.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ def session_url(path)
119119
end
120120

121121
it "allows the page to be scrolled" do
122-
@session.visit("/cuprite/long_page")
123-
@driver.resize(10, 10)
124-
@driver.scroll_to(200, 100)
122+
@session.visit("/cuprite/scroll_long_page")
123+
@driver.scroll_to(200, 500)
124+
125125
expect(
126126
@driver.evaluate_script("[window.scrollX, window.scrollY]")
127-
).to eq([200, 100])
127+
).to eq([200, 500])
128128
end
129129

130130
it "supports specifying viewport size with an option" do
@@ -154,7 +154,7 @@ def session_url(path)
154154
create_screenshot file, full: true
155155
File.open(file, "rb") do |f|
156156
expect(ImageSize.new(f.read).size).to eq(
157-
@driver.evaluate_script("[document.documentElement.clientWidth, document.documentElement.clientHeight]")
157+
@driver.evaluate_script("[document.documentElement.scrollWidth, document.documentElement.scrollHeight]")
158158
)
159159
end
160160
end
@@ -195,7 +195,7 @@ def session_url(path)
195195

196196
File.open(file, "rb") do |f|
197197
expect(ImageSize.new(f.read).size).to eq(
198-
@driver.evaluate_script("[document.documentElement.clientWidth, document.documentElement.clientHeight]")
198+
@driver.evaluate_script("[document.documentElement.scrollWidth, document.documentElement.scrollHeight]")
199199
)
200200
end
201201
end
@@ -763,8 +763,7 @@ def create_screenshot(file, *args)
763763
resources_size = {
764764
%r{/cuprite/jquery.min.js$} => File.size("#{CUPRITE_ROOT}/spec/support/public/jquery-1.11.3.min.js"),
765765
%r{/cuprite/jquery-ui.min.js$} => File.size("#{CUPRITE_ROOT}/spec/support/public/jquery-ui-1.11.4.min.js"),
766-
%r{/cuprite/test.js$} => File.size("#{CUPRITE_ROOT}/spec/support/public/test.js"),
767-
%r{/cuprite/with_js$} => 2405
766+
%r{/cuprite/test.js$} => File.size("#{CUPRITE_ROOT}/spec/support/public/test.js")
768767
}
769768

770769
resources_size.each do |resource, size|
@@ -927,7 +926,7 @@ def create_screenshot(file, *args)
927926
it "allows the driver to have a custom host" do
928927
# Use custom host "pointing" to localhost, specified by BROWSER_TEST_HOST env var.
929928
# Use /etc/hosts or iptables for this: https://superuser.com/questions/516208/how-to-change-ip-address-to-point-to-localhost
930-
host = ENV["BROWSER_TEST_HOST"]
929+
host = ENV.fetch("BROWSER_TEST_HOST", nil)
931930

932931
skip "BROWSER_TEST_HOST not set" if host.nil? # skip test if var is unspecified
933932

spec/features/session_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@
919919
@session.visit "/cuprite/with_js"
920920
expect(@session.driver.browser.page)
921921
.to receive(:warn).with(
922-
"Modal window with text `{T}ext \\w|th [reg.exp] (chara©+er$)?` has been opened, "\
923-
"but you didn't wrap your code into (`accept_prompt` | `dismiss_prompt` | `accept_confirm` "\
922+
"Modal window with text `{T}ext \\w|th [reg.exp] (chara©+er$)?` has been opened, " \
923+
"but you didn't wrap your code into (`accept_prompt` | `dismiss_prompt` | `accept_confirm` " \
924924
"| `dismiss_confirm` | `accept_alert`), accepting by default"
925925
)
926926

0 commit comments

Comments
 (0)