mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
dbd0d8b3ef
This adds a new method `save_and_open_screenshot` that saves the screenshot then opens it for inspection. Refactor duplicate logic for `save_and_open_page` and `save_and_open_screenshot`
16 lines
407 B
Ruby
16 lines
407 B
Ruby
#coding: US-ASCII
|
|
Capybara::SpecHelper.spec "#save_screenshot" do
|
|
let(:image_path) { File.join(Dir.tmpdir, 'capybara-screenshot.png') }
|
|
|
|
before do
|
|
@session.visit '/'
|
|
end
|
|
|
|
it "should generate PNG file", :requires => [:screenshot] do
|
|
path = @session.save_screenshot image_path
|
|
|
|
magic = File.read(image_path, 4)
|
|
expect(magic).to eq "\x89PNG"
|
|
expect(path).to eq image_path
|
|
end
|
|
end
|