diff --git a/lib/capybara-screenshot.rb b/lib/capybara-screenshot.rb index 7d32560..a007f36 100644 --- a/lib/capybara-screenshot.rb +++ b/lib/capybara-screenshot.rb @@ -198,6 +198,10 @@ def self.capybara_tmp_path=(path) register_driver(:cuprite) do |driver, path| driver.render(path, :full => true) end + + register_driver(:playwright) do |driver, path| + driver.save_screenshot(path) + end end # Register filename prefix formatters diff --git a/spec/unit/saver_spec.rb b/spec/unit/saver_spec.rb index 7408b41..408e7ff 100644 --- a/spec/unit/saver_spec.rb +++ b/spec/unit/saver_spec.rb @@ -311,6 +311,19 @@ end end + describe "with playwright driver" do + before do + allow(capybara_mock).to receive(:current_driver).and_return(:playwright) + end + + it 'saves driver render' do + expect(driver_mock).to receive(:save_screenshot).with(screenshot_path) + + saver.save + expect(saver).to be_screenshot_saved + end + end + describe "with webkit driver" do before do allow(capybara_mock).to receive(:current_driver).and_return(:webkit)