Sha256: c765e9e582a0f0e2ed88e193d7a143e93c099fa94ee1b2e2426e8d86aaca6d57

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'rspec'
require_relative 'allure_helper'
<% if automation == 'watir' %>
require_relative 'browser_helper'
<% else %>
require_relative 'driver_helper'
<% end %>

module Raider
  module SpecHelper

    AllureHelper.configure
    RSpec.configure do |config|
      config.formatter = AllureHelper.formatter
      config.before(:each) do
        <% if automation == 'watir' %>
        BrowserHelper.new_browser
        <% else %>
        DriverHelper.new_driver
        <% end %>
        <% if %w[appium_ios].include? automation %>
        DriverHelper.driver.start_driver
        <% end %>
      end

      config.after(:each) do
        example_name = self.class.descendant_filtered_examples.first.description
        status = self.class.descendant_filtered_examples.first.execution_result.status
        <%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__))).result(binding).strip! %>
        AllureHelper.add_screenshot example_name if status == :failed
        <%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__))).result(binding).strip! %>
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_raider-0.2.2 lib/generators/templates/helpers/spec_helper.tt
ruby_raider-0.2.1 lib/generators/templates/helpers/spec_helper.tt
ruby_raider-0.2.0 lib/generators/templates/helpers/spec_helper.tt