Sha256: b5d6780662103a4b8a98a22618892ef3e0d75b3260c882d7e347b10222d62395

Contents?: true

Size: 869 Bytes

Versions: 8

Compression:

Stored size: 869 Bytes

Contents

require 'leap_salesforce_ui'
RSpec.configure do |config|
  config.before(:each) do |example|
    # Default to first test user defined for each test
    LeapSalesforce.ui_user = LeapSalesforce::Users.list.first
    # Start browser with test name as metadata
    LeapSalesforce.browser example.full_description
  end

  config.after(:each) do |example|
    screenshot = "logs/#{tidy_description(example.full_description.to_s)}_failure.png"
    LeapSalesforce.browser.screenshot.save screenshot if example.exception
    LeapSalesforce.close_browser # Fresh browser for each test
  end

  # Tidy RSpec example description so it's suitable for a screenshot name
  # @return [String] Description of test suitable for file name
  def tidy_description(rspec_description)
    rspec_description.delete("#<RSpec::Core::Example").delete('>".:{}').delete("=").delete(" ")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
leap_salesforce_ui-0.3.0 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.2.0 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.1.9 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.1.8 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.1.7 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.1.6 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.1.5 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb
leap_salesforce_ui-0.1.4 lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb