blob: d6b501b3ac84cd1e40ba1cd721ba9c9ed57a69e4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
require "abstract_unit"
require "action_dispatch/system_testing/test_helpers/screenshot_helper"
require "capybara/dsl"
class ScreenshotHelperTest < ActiveSupport::TestCase
test "image path is saved in tmp directory" do
new_test = ActionDispatch::SystemTestCase.new("x")
assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
end
test "image path includes failures text if test did not pass" do
new_test = ActionDispatch::SystemTestCase.new("x")
new_test.stub :passed?, false do
assert_equal "tmp/screenshots/failures_x.png", new_test.send(:image_path)
end
end
test "image path does not include failures text if test skipped" do
new_test = ActionDispatch::SystemTestCase.new("x")
new_test.stub :passed?, false do
new_test.stub :skipped?, true do
assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
end
end
end
test "rack_test driver does not support screenshot" do
begin
original_driver = Capybara.current_driver
Capybara.current_driver = :rack_test
new_test = ActionDispatch::SystemTestCase.new("x")
assert_not new_test.send(:supports_screenshot?)
ensure
Capybara.current_driver = original_driver
end
end
test "selenium driver supports screenshot" do
begin
original_driver = Capybara.current_driver
Capybara.current_driver = :selenium
new_test = ActionDispatch::SystemTestCase.new("x")
assert new_test.send(:supports_screenshot?)
ensure
Capybara.current_driver = original_driver
end
end
end
|