Sha256: e1ce1253018c5f14744f43ef7e7af38c37f713928e8e20e13e41079b13eaa123

Contents?: true

Size: 1.21 KB

Versions: 15

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true
<%- if visual? -%>

require 'tmpdir'
require_relative '../../helpers/allure_helper'
require_relative '../../helpers/driver_helper'
require_relative '../../helpers/visual_helper'

include DriverHelper
include VisualHelper

Before do
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
  @grid_runner = VisualHelper.create_grid_runner
  @eyes = VisualHelper.create_eyes(@grid_runner)
  VisualHelper.configure_eyes @eyes
  @driver = @eyes.open(driver: driver)
end

After do |scenario|
  Dir.mktmpdir do |temp_folder|
    screenshot = driver.save_screenshot("#{temp_folder}/#{scenario.name}.png")
    AllureHelper.add_screenshot(scenario.name, screenshot)
  end
  @eyes.close
  @driver.quit
  @eyes.abort_async
  results = @grid_runner.get_all_test_results
  puts results
end

<%- else -%>

<%- if axe? && cucumber? -%>
require 'axe-rspec'
<%- end -%>
require 'rspec'
require 'tmpdir'
require_relative '../../helpers/allure_helper'

Before do
  driver.manage.window.maximize
end

After do |scenario|
  Dir.mktmpdir do |temp_folder|
    screenshot = driver.save_screenshot("#{temp_folder}/#{scenario.name}.png")
    AllureHelper.add_screenshot(scenario.name, screenshot)
  end
  driver.quit
end
<%- end -%>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby_raider-1.0.8 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.7 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.6 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.5 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.4 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.3 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.2 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.1 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-1.0.0 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-0.9.9 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-0.9.8 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-0.9.7 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-0.9.6 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-0.9.5 lib/generators/cucumber/templates/partials/selenium_env.tt
ruby_raider-0.9.4 lib/generators/cucumber/templates/partials/selenium_env.tt