Sha256: 76d62aca0eeea8fdb044366c3728eaa7f2514c0f683333c8200ca2f6d1f0e8be

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

AfterConfiguration do |config|
  puts("Specs are being executed from: #{config.spec_location}")
end

Before('~@practice','~@sequence') do
  @browser = Fluent::Browser.start
end

AfterStep('@pause') do
  print 'Press ENTER to continue...'
  STDIN.getc
end

After do |scenario|
  if scenario.failed?
    Dir::mkdir('results') if not File.directory?('results')
    screenshot = "./results/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png"

    if @browser
      # This way attempts to save the screenshot as a file.
      #@browser.driver.save_screenshot(screenshot)

      # This way the image is encoded into the results.
      encoded_img = @browser.driver.screenshot_as(:base64)
      embed("data:image/png;base64,#{encoded_img}", 'image/png')
    end
  end
  Fluent::Browser.stop
end

at_exit do
  Fluent::Browser.stop
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lucid-0.3.3 lib/lucid/generators/project/events-fluent.rb
lucid-0.3.0 lib/lucid/generators/project/events-fluent.rb