capybara-rack_test-screenshot 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6039bb83ad6f645896e9d1ee68894c2e7ebbee5403a49239b21968115e0231f1
4
- data.tar.gz: f4189a2f768e6dcd6067042edc04978e854d349f030b0430eab80a62f4309b90
3
+ metadata.gz: cbf0f91a0871cfcf1d7699d39cb12af5751b8f61b91145105700648f1ddd18a9
4
+ data.tar.gz: 8fc85a157154d03ca8b2381bf308db6c477cad54078d4a277d8f29f22392751a
5
5
  SHA512:
6
- metadata.gz: 9852f3e869492a90c8eb6711d91c280b3ee8362e3a9b2a30be1f84031d4458ef75992766da1650fc34405faedb2765dcd36c9583b29a45f902679428dff6d716
7
- data.tar.gz: 1f1b23aa92132b47e40aa7badbd811b289c361a8dcc3abc6c0a61b3b1a0514b4cd430476a5fc39b203e3c5a41dd5e500acb74f161fbf97b356dca9fa6b6b462f
6
+ metadata.gz: c4466b91fdd44ff5d3bf17546cb042c855c2ce589fca8b17faf7bbe6d1d517b015aa19ddc5a5901d5c01afc546fcd49ff828d3a8edc4f0b148fa8482810b8083
7
+ data.tar.gz: dc049da05acf59a5642b9947630b1195b9e25d4f6f53d85722dfe16214c8d4a70207238666491b76b73370044f717d60572aebb48c9e12b27dbd5040ed7830d2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2025-08-07
4
+
5
+ - Make sure default playwright version is compatible with the Ruby client
6
+
7
+ ## [0.1.1] - 2025-06-10
8
+
9
+ - Add compatibility with `capybara-screenshot` gem
10
+
3
11
  ## [0.1.0] - 2024-03-14
4
12
 
5
13
  - Initial release
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/capybara-rack_test-screenshot.svg)](https://rubygems.org/gems/capybara-rack_test-screenshot)
2
+
1
3
  # Generate screenshots with RackTest
2
4
 
3
5
  Makes `save_screenshot` behave as if you were using a regular browser when using `rack` as your Capybara driver.
@@ -16,16 +18,11 @@ RSpec.configure do |config|
16
18
  puts "Screenshot at #{path}"
17
19
  end
18
20
  end
19
-
20
- # Or for Rails projects
21
- config.after(:each) do |example|
22
- if example.exception
23
- take_screenshot(screenshot: 'inline')
24
- end
25
- end
26
21
  end
27
22
  ```
28
23
 
24
+ Also makes failing Rails System tests behave the same between `rack` and JS drivers.
25
+
29
26
  ## Installation
30
27
 
31
28
  Install the gem and add to the application's Gemfile by executing:
@@ -41,7 +38,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
41
38
  You'll need to configure `Capybara.asset_host` in order for Playwright to render the page properly. This should point to a running development server of your application.
42
39
 
43
40
  ```rb
44
- Capybara.asset_host = "http://localhost:3000
41
+ Capybara.asset_host = "http://localhost:3000"
45
42
  ```
46
43
 
47
44
  Optional settings:
@@ -93,6 +90,10 @@ RSpec.configure do |config|
93
90
  end
94
91
  ```
95
92
 
93
+ ## capybara-screenshot
94
+
95
+ This gem is compatible with `capybara-screenshot`. You'll need to list `capybara-screenshot` before this gem in your Gemfile.
96
+
96
97
  ## Development
97
98
 
98
99
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module RackTest
5
5
  module Screenshot
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.2"
7
7
  end
8
8
  end
9
9
  end
@@ -67,7 +67,10 @@ module Capybara
67
67
  end
68
68
 
69
69
  def playwright_cli_executable_path
70
- ENV['PLAYWRIGHT_CLI_EXE_PATH'] || 'npx playwright'
70
+ ENV['PLAYWRIGHT_CLI_EXE_PATH'] || begin
71
+ version = Gem::Version.create(Playwright::COMPATIBLE_PLAYWRIGHT_VERSION)
72
+ "npx playwright@#{version.release}"
73
+ end
71
74
  end
72
75
 
73
76
  def ensure_asset_host!
@@ -105,3 +108,9 @@ end
105
108
  if defined?(Rails)
106
109
  require_relative 'screenshot/railtie'
107
110
  end
111
+
112
+ if defined?(Capybara::Screenshot)
113
+ Capybara::Screenshot.register_driver(:rack_test) do |driver, path|
114
+ driver.save_screenshot(path)
115
+ end
116
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-rack_test-screenshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theodor Tonum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-14 00:00:00.000000000 Z
11
+ date: 2025-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara