From 0399f6c77be635bb519bda9f41286caad0e4d7fb Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Wed, 13 Sep 2023 09:53:34 +0300 Subject: [PATCH 1/3] fix: build --- spec/page/screenshot_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/page/screenshot_spec.rb b/spec/page/screenshot_spec.rb index 8442cbe8..fee140b8 100644 --- a/spec/page/screenshot_spec.rb +++ b/spec/page/screenshot_spec.rb @@ -138,17 +138,20 @@ def create_screenshot(**options) it "supports screenshotting the page with different quality settings" do file2 = "#{PROJECT_ROOT}/spec/tmp/screenshot2.jpeg" file3 = "#{PROJECT_ROOT}/spec/tmp/screenshot3.jpeg" - FileUtils.rm_f([file2, file3]) + file4 = "#{PROJECT_ROOT}/spec/tmp/screenshot4.#{format}" + FileUtils.rm_f([file2, file3, file4]) begin browser.go_to browser.screenshot(path: file, quality: 0) # ignored for png browser.screenshot(path: file2) # defaults to a quality of 75 browser.screenshot(path: file3, quality: 100) - expect(File.size(file)).to be > File.size(file2) # png by default is bigger + browser.screenshot(path: file4, quality: 60) # ignored for png + + expect(File.size(file)).to eq(File.size(file4)) expect(File.size(file2)).to be < File.size(file3) ensure - FileUtils.rm_f([file2, file3]) + FileUtils.rm_f([file2, file3, file4]) end end From 86b4b3c3a38375538951331301bf491594c70bbc Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Wed, 13 Sep 2023 10:36:25 +0300 Subject: [PATCH 2/3] fix: build --- spec/browser/xvfb_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/browser/xvfb_spec.rb b/spec/browser/xvfb_spec.rb index 6f5fd016..cbeb7b8a 100644 --- a/spec/browser/xvfb_spec.rb +++ b/spec/browser/xvfb_spec.rb @@ -50,7 +50,8 @@ expect(process.xvfb.screen_size).to eq("1024x768x24") ensure xvfb_browser&.quit - expect(process_alive?(process.xvfb.pid)).to be(false) + pid = process&.xvfb&.pid + expect(process_alive?(pid)).to be(false) if pid end end From 46cf0375fcd029da90a76e27c4c22ff7c446b096 Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Wed, 13 Sep 2023 10:43:37 +0300 Subject: [PATCH 3/3] fix: build --- spec/browser_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/browser_spec.rb b/spec/browser_spec.rb index 6c167ca5..4a2370ec 100644 --- a/spec/browser_spec.rb +++ b/spec/browser_spec.rb @@ -468,6 +468,7 @@ page.go_to("/ferrum/simple") end + sleep 1 # It may take longer to close the target expect(browser.contexts.size).to eq(1) expect(browser.targets.size).to eq(0) end