Skip to content

Commit

Permalink
fix: build (#398)
Browse files Browse the repository at this point in the history
* fix: build
  • Loading branch information
route authored Sep 13, 2023
1 parent 502655a commit da18ec2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion spec/browser/xvfb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions spec/browser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions spec/page/screenshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit da18ec2

Please sign in to comment.