Sha256: 8f5f91b51604ef5c65220ec8d8d42adabd750f05dce4c551b4652cc3a02e343f

Contents?: true

Size: 952 Bytes

Versions: 7

Compression:

Stored size: 952 Bytes

Contents

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

Before('~@practice') do
  @browser = Symbiont::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

    # This is an alternative way to embed.
    #embed screenshot, 'image/png'
  end
  Symbiont::Browser.stop
end

at_exit do
  Symbiont::Browser.stop
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lucid-0.1.1 lib/lucid/generators/project/events-symbiont.rb
lucid-0.1.0 lib/lucid/generators/project/events-symbiont.rb
lucid-0.0.9 lib/lucid/generators/project/events-symbiont.rb
lucid-0.0.8 lib/lucid/generators/project/events-symbiont.rb
lucid-0.0.7 lib/lucid/generators/project/events-symbiont.rb
lucid-0.0.6 lib/lucid/generators/project/events-symbiont.rb
lucid-0.0.5 lib/lucid/generators/project/events-symbiont.rb