Sha256: 98f6647b95cbeb5d0115751fa2030b266460626cdb68745fef9e7220464a8181

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 KB

Contents

# Configuration for watir-rspec
require "watir/rspec"

RSpec.configure do |config|
  # Use Watir::RSpec::HtmlFormatter to get links to the screenshots, html and
  # all other files created during the failing examples.
  config.add_formatter(:progress) if config.formatters.empty?
  config.add_formatter(Watir::RSpec::HtmlFormatter)

  # Open up the browser for each example.
  config.before :all, type: :feature do
    @browser = Watir::Browser.new
  end

  # Close that browser after each example.
  config.after :all, type: :feature do
    @browser.close if @browser
  end

  # Include RSpec::Helper into each of your example group for making it possible to
  # write in your examples instead of:
  #   @browser.goto "localhost"
  #   @browser.text_field(name: "first_name").set "Bob"
  #
  # like this:
  #   goto "localhost"
  #   text_field(name: "first_name").set "Bob"
  #
  # This needs that you've used @browser as an instance variable name in
  # before :all block.
  config.include Watir::RSpec::Helper, type: :feature

  # Include RSpec::Matchers into each of your example group for making it possible to
  # use #within with some of RSpec matchers for easier asynchronous testing:
  #   expect(@browser.text_field(name: "first_name")).to exist.within(2)
  #   expect(@browser.text_field(name: "first_name")).to be_present.within(2)
  #   expect(@browser.text_field(name: "first_name")).to be_visible.within(2)
  #
  # You can also use #during to test if something stays the same during the specified period:
  #   expect(@browser.text_field(name: "first_name")).to exist.during(2)
  # config.include Watir::RSpec::Matchers, type: :feature
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nodes-0.2.8 spec/support/watir.rb
nodes-0.2.7 spec/support/watir.rb
nodes-0.2.6 spec/support/watir.rb
nodes-0.2.5 spec/support/watir.rb
nodes-0.2.4 spec/support/watir.rb