Sha256: 4a0ee62c7f5ac5f0219bda315544ee6786871e966bc165263c64b332f4f8ac1a
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require File.join(File.dirname(__FILE__), '..', '..', 'lib/rwiki') require 'rspec' require 'cucumber/web/tableish' require 'capybara' require 'capybara/cucumber' # Selenium setup require 'selenium/webdriver' Capybara.register_driver :selenium do |app| profile = Selenium::WebDriver::Firefox::Profile.new load_firebug_extension = false profile.add_extension File.expand_path(File.join(File.dirname(__FILE__), 'firebug-1.6.1-fx.xpi')) if load_firebug_extension Capybara::Driver::Selenium.new(app, :profile => profile) end Capybara.default_driver = :selenium World do Rwiki::App.set(:environment, :test) Rwiki::App.set(:logging, false) # do not output logs on the STDOUT Capybara.app = Rwiki::App include RSpec::Expectations include RSpec::Matchers require File.expand_path(File.join(File.dirname(__FILE__), '../../spec/support/tmpdir_helper')) include TmpdirHelper Before do create_tmpdir! end After do |scenario| if scenario.failed? screenshots_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'reports', 'screenshots')) FileUtils.mkdir_p(screenshots_dir) unless Dir.exists?(screenshots_dir) feature_file = if scenario.is_a?(Cucumber::Ast::OutlineTable::ExampleRow) scenario.scenario_outline.feature.file else scenario.feature.file end file_name = "#{feature_file.split('/').last}-#{scenario.line}.png" page.driver.browser.save_screenshot(File.join(screenshots_dir, file_name)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rwiki-0.2.5 | features/support/env.rb |