Skip to content

Commit da18ec2

Browse files
authored
fix: build (#398)
* fix: build
1 parent 502655a commit da18ec2

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

spec/browser/xvfb_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
expect(process.xvfb.screen_size).to eq("1024x768x24")
5151
ensure
5252
xvfb_browser&.quit
53-
expect(process_alive?(process.xvfb.pid)).to be(false)
53+
pid = process&.xvfb&.pid
54+
expect(process_alive?(pid)).to be(false) if pid
5455
end
5556
end
5657

spec/browser_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@
468468
page.go_to("/ferrum/simple")
469469
end
470470

471+
sleep 1 # It may take longer to close the target
471472
expect(browser.contexts.size).to eq(1)
472473
expect(browser.targets.size).to eq(0)
473474
end

spec/page/screenshot_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,20 @@ def create_screenshot(**options)
138138
it "supports screenshotting the page with different quality settings" do
139139
file2 = "#{PROJECT_ROOT}/spec/tmp/screenshot2.jpeg"
140140
file3 = "#{PROJECT_ROOT}/spec/tmp/screenshot3.jpeg"
141-
FileUtils.rm_f([file2, file3])
141+
file4 = "#{PROJECT_ROOT}/spec/tmp/screenshot4.#{format}"
142+
FileUtils.rm_f([file2, file3, file4])
142143

143144
begin
144145
browser.go_to
145146
browser.screenshot(path: file, quality: 0) # ignored for png
146147
browser.screenshot(path: file2) # defaults to a quality of 75
147148
browser.screenshot(path: file3, quality: 100)
148-
expect(File.size(file)).to be > File.size(file2) # png by default is bigger
149+
browser.screenshot(path: file4, quality: 60) # ignored for png
150+
151+
expect(File.size(file)).to eq(File.size(file4))
149152
expect(File.size(file2)).to be < File.size(file3)
150153
ensure
151-
FileUtils.rm_f([file2, file3])
154+
FileUtils.rm_f([file2, file3, file4])
152155
end
153156
end
154157

0 commit comments

Comments
 (0)