Module: Capybara::Screenshot::Diff
- Includes:
- DSL, Os
- Defined in:
- lib/capybara/screenshot/diff.rb,
lib/capybara/screenshot/diff/vcs.rb,
lib/capybara/screenshot/diff/version.rb,
lib/capybara/screenshot/diff/test_methods.rb,
lib/capybara/screenshot/diff/drivers/utils.rb,
lib/capybara/screenshot/diff/image_compare.rb,
lib/capybara/screenshot/diff/stabilization.rb,
lib/capybara/screenshot/diff/drivers/vips_driver.rb,
lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb
Overview
Module to track screen shot changes
Defined Under Namespace
Modules: Drivers, Stabilization, TestMethods, Utils, Vcs Classes: ImageCompare
Constant Summary collapse
- AVAILABLE_DRIVERS =
Utils.detect_available_drivers.freeze
- VERSION =
"1.6.2"
- LOADED_DRIVERS =
{}
Constants included from Os
Os::ON_LINUX, Os::ON_MAC, Os::ON_WINDOWS
Class Method Summary collapse
Methods included from Os
Class Method Details
.default_options ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/capybara/screenshot/diff.rb', line 65 def self. { area_size_limit: area_size_limit, color_distance_limit: color_distance_limit, driver: driver, shift_distance_limit: shift_distance_limit, skip_area: skip_area, stability_time_limit: Screenshot.stability_time_limit, tolerance: tolerance, wait: Capybara.default_max_wait_time } end |
.included(klass) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/capybara/screenshot/diff.rb', line 78 def self.included(klass) klass.include TestMethods klass.setup do if Capybara::Screenshot.window_size if page.driver.respond_to?(:resize) page.driver.resize(*Capybara::Screenshot.window_size) elsif selenium? page.driver.browser.manage.window.resize_to(*Capybara::Screenshot.window_size) end end end klass.teardown do if Capybara::Screenshot.active? && @test_screenshots test_screenshot_errors = @test_screenshots .map { |caller, name, compare| assert_image_not_changed(caller, name, compare) } @test_screenshots = nil # release the comparison objects from memory test_screenshot_errors.compact! if test_screenshot_errors.any? e = ASSERTION.new(test_screenshot_errors.join("\n\n")) e.set_backtrace(caller) if defined?(failures) failures << e else raise e end end end end end |