Class: Janus::Command::Validate
- Inherits:
-
Object
- Object
- Janus::Command::Validate
- Defined in:
- lib/janus/command/validate.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(configuration) ⇒ Validate
constructor
A new instance of Validate.
- #validate_screenshot(browser, test) ⇒ Object
- #validate_screenshots_for_browser(browser) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Validate
Returns a new instance of Validate.
12 13 14 |
# File 'lib/janus/command/validate.rb', line 12 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/janus/command/validate.rb', line 16 def execute Sauce::Connect.connect!(quiet: true) if @configuration.tunnel? puts 'Validating screenshots...' puts '' @configuration.browsers.each do |browser| validate_screenshots_for_browser(browser) end end |
#validate_screenshot(browser, test) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/janus/command/validate.rb', line 38 def validate_screenshot(browser, test) selenium = Janus::IO::Selenium.new(@configuration.username, @configuration.access_key, browser) fresh = selenium.read(test) directory = Janus::IO::Directory.new(@configuration.directory, browser) original = directory.read(test) engine = Janus::Core::Engine.create(@configuration) engine.execute(original, fresh) print '✔ '.green rescue print '✖ '.red ensure puts test.name end |
#validate_screenshots_for_browser(browser) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/janus/command/validate.rb', line 27 def validate_screenshots_for_browser(browser) puts "#{browser}" puts '' @configuration.tests.each do |test| validate_screenshot(browser, test) end puts '' end |