Sha256: c1ef7bd3ffadde79e542830658097391c9b625038a3bec1dbc5c2bd1f2f1d330

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require 'csv'
require 'yaml'

require 'acceptance_test'

require 'acceptance_test/gherkin_helper'

data_reader = lambda {|source_path| CSV.read(File.expand_path(source_path)) }
GherkinHelper.instance.enable_external_source data_reader

acceptance_test = AcceptanceTest.instance

Before do |scenario|
  config_name = File.expand_path("spec/acceptance_config.yml")
  config = HashWithIndifferentAccess.new(YAML.load_file(config_name))

  acceptance_test.configure config

  acceptance_test.before acceptance_test.metadata_from_scenario(scenario)
end

After do |scenario|
  acceptance_test.after acceptance_test.metadata_from_scenario(scenario)

  reset_session!
end

Given(/^I am within wikipedia\.com$/) do
  Capybara.app_host = "http://wikipedia.com"
end

Given /^I am on wikipedia\.com$/ do
  visit('/')
end

When /^I enter "([^"]*)"$/ do |_|
  fill_in "searchInput", :with => "Capybara"
end

When(/^I enter word (.*)$/) do |keyword|
  keyword = keyword.gsub("\"", '')

  fill_in "searchInput", :with => keyword
end

Then /^I should see css "([^"]*)"$/ do |css|
  expect(page).to have_css(css)
end

When(/^I click submit button$/) do
  find(".formBtn", match: :first).click
end

Then(/^I should see results: "([^"]*)"$/) do |results|
  expect(page).to have_content "Hydrochoerus hydrochaeris"
end

Then(/^I should see keyword results: (.*)$/) do |keyword|
  expect(page).to have_content keyword
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acceptance_test-1.5.5 features/wikipedia/step_definitions/steps.rb
acceptance_test-1.5.4 features/wikipedia/step_definitions/steps.rb
acceptance_test-1.5.3 features/wikipedia/step_definitions/steps.rb
acceptance_test-1.5.2 features/wikipedia/step_definitions/steps.rb
acceptance_test-1.5.1 features/wikipedia/step_definitions/steps.rb