Sha256: 1c8ba0a415d3209dcea329b3c764b2deee202651ad7dfaeea1c7ffd17073043f

Contents?: true

Size: 1.25 KB

Versions: 1

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.title)
  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

1 entries across 1 versions & 1 rubygems

Version Path
howitzer-1.0.2 generators/cucumber/templates/env.rb