Sha256: 82896593a320e8cc9b1b48fee640b47559c4b471b36db4ff64c45c5f2544aca7

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'cucumber'
require 'capybara/cucumber'
require_relative '../../boot'

World(Capybara::Settings)
World(DataGenerator)

log.settings_as_formatted_text
DataStorage.store('sauce', :start_time, Time.now.utc)
DataStorage.store('sauce', :status, true)

if sauce_driver?
  Capybara.drivers[:sauce][].options[:desired_capabilities][:name] = Capybara::Settings.suite_name
end

Before do |scenario|
  log.print_feature_name(scenario.feature.name)
  log.print_scenario_name(scenario.name)
  @session_start = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
end

After do |scenario|
  if sauce_driver?
    DataStorage.store('sauce', :status, false) if scenario.failed?
    session_end = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
    log.info "SAUCE VIDEO #@session_start - #{session_end} URL: #{sauce_resource_path('video.flv')}"
  elsif ie_browser?
    log.info 'IE reset session'
    page.execute_script("void(document.execCommand('ClearAuthenticationCache', false));")
  end
  DataStorage.clear_all_ns
end

at_exit do
  if sauce_driver?
    log.info "SAUCE SERVER LOG URL: #{Capybara::Settings.sauce_resource_path('selenium-server.log')}"
    Capybara::Settings.update_sauce_job_status(passed: DataStorage.extract('sauce', :status))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
howitzer-1.1.1 generators/cucumber/templates/env.rb
howitzer-1.1.0 generators/cucumber/templates/env.rb