Class: Janus::Command::Record
- Inherits:
-
Object
- Object
- Janus::Command::Record
- Defined in:
- lib/janus/command/record.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(configuration) ⇒ Record
constructor
A new instance of Record.
- #record_screenshot(browser, test) ⇒ Object
- #record_screenshots_for_browser(browser) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Record
Returns a new instance of Record.
12 13 14 |
# File 'lib/janus/command/record.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/record.rb', line 16 def execute Sauce::Connect.connect!(quiet: true) if @configuration.tunnel? puts 'Recording screenshots...' puts '' @configuration.browsers.each do |browser| record_screenshots_for_browser(browser) end end |
#record_screenshot(browser, test) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/janus/command/record.rb', line 38 def record_screenshot(browser, test) selenium = Janus::IO::Selenium.new(@configuration.username, @configuration.access_key, browser) screenshot = selenium.read(test) directory = Janus::IO::Directory.new(@configuration.directory, browser) directory.write(test, screenshot) print '✔ '.green rescue print '✖ '.red ensure puts test.name end |
#record_screenshots_for_browser(browser) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/janus/command/record.rb', line 27 def record_screenshots_for_browser(browser) puts "#{browser}" puts '' @configuration.tests.each do |test| record_screenshot(browser, test) end puts '' end |