Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build #398

Merged
merged 3 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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