1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/spec/session/screenshot_spec.rb
2016-10-04 11:10:29 -07:00

18 lines
436 B
Ruby

# coding: US-ASCII
# frozen_string_literal: true
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