Sha256: 2e637d2ddd24336d5ab7877f43c16cd0fed091c24bcba61830cd4be254daf936

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

require ::File.expand_path("../cornucopia", File.dirname(__FILE__))
load ::File.expand_path("capybara/install_finder_extensions.rb", File.dirname(__FILE__))
load ::File.expand_path("site_prism/install_element_extensions.rb", File.dirname(__FILE__))

Around do |scenario, block|
  seed_value = Cornucopia::Util::Configuration.seed ||
      100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)

  scenario.instance_variable_set :@seed_value, seed_value

  Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
  Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages

  Cornucopia::Util::ReportBuilder.current_report.within_test("#{scenario.feature.title} : #{scenario.title}") do
    block.call
  end

  if scenario.failed?
    seed_value = scenario.instance_variable_get(:@seed_value)
    puts ("random seed for testing was: #{seed_value}")

    Cornucopia::Util::ReportBuilder.current_report.
        within_section("Test Error: #{scenario.feature.title}:#{scenario.title}") do |report|
      configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber

      configured_report.add_report_objects scenario: scenario, cucumber: self
      configured_report.generate_report(report)
    end
  else
    Cornucopia::Util::ReportBuilder.current_report.test_succeeded
  end

  Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
  Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
end

at_exit do
  Cornucopia::Util::ReportBuilder.current_report.close
end

Cornucopia::Util::ReportBuilder.new_report("cucumber_report")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cornucopia-0.1.20 lib/cornucopia/cucumber_hooks.rb
cornucopia-0.1.19 lib/cornucopia/cucumber_hooks.rb