Class: BrowserShooter::Base
- Inherits:
-
Object
- Object
- BrowserShooter::Base
- Defined in:
- lib/browser_shooter/base.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Class Method Summary collapse
-
.run_test(suite, test, browser, config) ⇒ Object
Runs a single test with all its commands in an specific browser.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Base
constructor
A new instance of Base.
-
#run ⇒ Object
Main method.
Constructor Details
#initialize(opts) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/browser_shooter/base.rb', line 5 def initialize( opts ) @opts = opts end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
3 4 5 |
# File 'lib/browser_shooter/base.rb', line 3 def opts @opts end |
Class Method Details
.run_test(suite, test, browser, config) ⇒ Object
Runs a single test with all its commands in an specific browser
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/browser_shooter/base.rb', line 36 def self.run_test( suite, test, browser, config ) BrowserShooter::Logger.log( "Executing #{suite.name} | #{test.name} | #{browser.name}", true ) output_path = "#{config["output_path"]}/#{suite.name}/#{test.name}/#{browser.name}" driver = nil begin driver = Selenium::WebDriver.for( :remote, :url => browser.url, :desired_capabilities => browser.type.to_sym ) driver.manage.timeouts.implicit_wait = config["timeout"] logs = BrowserShooter::Commander.script( test.commands, driver, browser, output_path ) BrowserShooter::LogExporter.export( logs, "#{output_path}/logs" ) ensure driver.quit if driver end end |
Instance Method Details
#run ⇒ Object
Main method. Loads the configuration, filter the suites, runs the tests and exports the logs.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/browser_shooter/base.rb', line 10 def run BrowserShooter::Logger.verbose = opts[:verbose] BrowserShooter::Logger.log( "Starting script running with version #{BrowserShooter::VERSION}..." ) config = BrowserShooter::Configurator.new( opts ) suites = config.suites suites.each do |suite| suite.tests.each do |test| suite.browsers.each do |browser| BrowserShooter::Base.run_test( suite, test, browser, config ) end end end BrowserShooter::Logger.log( "... script running ended." ) BrowserShooter::Logger.log( "Logs and Shots are in: #{config["output_path"]}", true ) BrowserShooter::Logger.log( "BYE!" ) end |