Skip to content

Commit 7ae91d8

Browse files
committed
Merge remote-tracking branch 'upstream/main' into support-time-inputs
2 parents 85b71ef + 04becb9 commit 7ae91d8

24 files changed

+231
-111
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: rubycdp

.github/gemfiles/websocket-driver-0.6.x.gemfile

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

.github/gemfiles/websocket-driver-0.7.x.gemfile

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

.github/workflows/tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
gemfile: [websocket-driver-0.6.x, websocket-driver-0.7.x]
15-
ruby: [2.7, "3.0", 3.1, 3.2, 3.3]
14+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
1615
runs-on: ubuntu-latest
1716
env:
1817
FERRUM_PROCESS_TIMEOUT: 25
1918
FERRUM_DEFAULT_TIMEOUT: 15
20-
BUNDLE_GEMFILE: .github/gemfiles/${{ matrix.gemfile }}.gemfile
2119
steps:
2220
- name: Checkout code
2321
uses: actions/checkout@v4
@@ -33,6 +31,11 @@ jobs:
3331
with:
3432
chrome-version: stable
3533

34+
- name: Fix GA Chrome Permissions
35+
run: |
36+
sudo chown root:root /opt/hostedtoolcache/setup-chrome/chromium/stable/x64/chrome-sandbox
37+
sudo chmod 4755 /opt/hostedtoolcache/setup-chrome/chromium/stable/x64/chrome-sandbox
38+
3639
- name: Run tests
3740
run: |
3841
mkdir -p /tmp/cuprite
@@ -42,5 +45,5 @@ jobs:
4245
uses: actions/upload-artifact@v4
4346
if: ${{ failure() }}
4447
with:
45-
name: footprints
48+
name: artifacts-ruby-v${{ matrix.ruby }}
4649
path: /tmp/cuprite/

.rspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
--color
2-
--format=doc
2+
--format=progress
33
--require spec_helper

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Naming/FileName:
1616
Exclude:
1717
- 'gemfiles/*.gemfile'
1818

19+
Style/OptionalBooleanParameter:
20+
Enabled: false
21+
1922
Style/StringLiterals:
2023
EnforcedStyle: double_quotes
2124

CHANGELOG.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1-
## [Unreleased](https://github.com/rubycdp/ferrum/compare/v0.15...main) ##
1+
## [Unreleased](https://github.com/rubycdp/ferrum/compare/v0.15.1...main) ##
22

33
### Added
44

55
### Changed
6-
- `@window_size` attribute is moved from Ferrum viewport size is still inherited [#253]
6+
7+
### Fixed
8+
9+
### Removed
10+
11+
12+
## [0.15.1](https://github.com/rubycdp/ferrum/compare/v0.15...0.15.1) - (Jun 15, 2024) ##
13+
14+
### Added
15+
16+
- Support for `Driver#send_keys`, the `:focused` filter, and `Driver#active_element` [#261]
17+
18+
### Changed
19+
- `@window_size` attribute is moved from Ferrum, viewport size is still inherited [#253]
20+
- Compatibility with latest Ferrum. Browser instance is not passed everywhere now [#254]
21+
- `Cuprite::Browser` methods are located in `Options`.
22+
- `#window_size`
23+
- `#url_blacklist`
24+
- `#url_whitelist`
25+
- `#timeout`
26+
- `Page#new` arguments are changed to `client, context_id:, target_id:`
27+
- `Target#attached?` renamed to `Target#connected?`
28+
- Ferrum doesn't restart browser automatically, Cuprite does
29+
- `Browser#close_window` removes target id asap from the target list
730

831
### Fixed
932
- Detect whether element is in the viewport and clickable before click [#251]

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ gem "byebug", "~> 11.1", platforms: %i[mri mingw x64_mingw]
66
gem "chunky_png", "~> 1.4"
77
gem "image_size", "~> 3.0"
88
gem "launchy", "~> 2.5"
9-
gem "pdf-reader", "~> 2.5"
9+
gem "pdf-reader", "~> 2.12"
1010
gem "puma", ">= 5.6.7"
1111
gem "rake", "~> 13.0"
1212
gem "rspec", "~> 3.10"
1313
gem "rubocop", "~> 1.22"
1414
gem "rubocop-rake", require: false
15-
gem "sinatra", "~> 2.1"
15+
gem "sinatra", "~> 3.2"
1616

1717
gemspec

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ end
6161
`Cuprite`-specific options are:
6262

6363
* options `Hash`
64-
* `:url_blacklist` (Array) - array of strings to match against requested URLs
65-
* `:url_whitelist` (Array) - array of strings to match against requested URLs
64+
* `:url_blacklist` (Array) - array of regexes to match against requested URLs
65+
* `:url_whitelist` (Array) - array of regexes to match against requested URLs
6666

6767

6868
## Debugging
@@ -122,13 +122,17 @@ be automatically cleared at the end of the test.
122122

123123
## Network traffic
124124

125-
* `page.driver.network_traffic` Inspect network traffic (loaded resources) on
126-
the current page. This returns an array of request objects.
125+
* `page.driver.network_traffic` allows you to inspect network traffic (i.e., loaded resources) on the current page. It returns an array of `Ferrum::Network::Exchange` objects, each representing a network request/response exchange. You can query both the request and response details of each exchange.
127126

128127
```ruby
129-
page.driver.network_traffic # => [Request, ...]
130-
request = page.driver.network_traffic.first
131-
request.response
128+
# Retrieve all network exchanges
129+
network_traffic = page.driver.network_traffic
130+
131+
# Access the first exchange
132+
first_exchange = network_traffic.first
133+
134+
# Inspect the response of the first request
135+
response = first_exchange.response
132136
```
133137

134138
* `page.driver.wait_for_network_idle` Natively waits for network idle and if
@@ -183,27 +187,29 @@ Besides capybara screenshot method you can get image as Base64:
183187

184188
## Proxy
185189

186-
* `page.driver.set_proxy(ip, port, type, user, password)`
190+
* `page.driver.set_proxy(ip, port, user, password)`
187191

188192

189-
## URL Blacklisting & Whitelisting
193+
## URL Blocklisting & Allowlisting
190194

191-
Cuprite supports URL blacklisting, which allows you to prevent scripts from
195+
Cuprite supports URL blocklisting, which allows you to prevent scripts from
192196
running on designated domains:
193197

194198
```ruby
195-
page.driver.browser.url_blacklist = %r{http://www.example.com}
199+
page.driver.browser.url_blocklist = %r{http://www.example.com}
196200
```
197201

198-
and also URL whitelisting, which allows scripts to only run on designated
202+
and also URL allowlisting, which allows scripts to only run on designated
199203
domains:
200204

201205
```ruby
202-
page.driver.browser.url_whitelist = %r{http://www.example.com}
206+
page.driver.browser.url_allowlist = %r{http://www.example.com}
203207
```
204208

205-
If you are experiencing slower run times, consider creating a URL whitelist of
206-
domains that are essential or a blacklist of domains that are not essential,
209+
For legacy support, `url_blacklist=` and `url_whitelist=` continue to work respectively.
210+
211+
If you are experiencing slower run times, consider creating a URL allowlist of
212+
domains that are essential or a blocklist of domains that are not essential,
207213
such as ad networks or analytics, to your testing environment.
208214

209215
## License

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require "rspec/core/rake_task"
66

77
RSpec::Core::RakeTask.new("test") do |t|
88
t.ruby_opts = "-w"
9+
t.rspec_opts = "--format=documentation" if ENV["CI"]
910
end
1011

1112
task default: :test

0 commit comments

Comments
 (0)