Skip to content

Instantly share code, notes, and snippets.

@gunesmes
Last active June 14, 2019 13:51
Show Gist options
  • Save gunesmes/2aed614cc3fb35755cca to your computer and use it in GitHub Desktop.
Save gunesmes/2aed614cc3fb35755cca to your computer and use it in GitHub Desktop.
Feature: As a customer
In order to buy something
From the amazon.com
I want to login the page
Scenario: User goes to login page
Given I am on home page of Amazon
When I click "Hello. Sign in" button
Then I should see login form
Scenario Outline: Member logins the page
Given I am on login page of Amazon
And I sign in with <username> and <password>
Then Page should have content <message>
Examples:
| username | password | message |
| username@mail.com | wrong.password | There was a problem with your request |
| username@mail.com | correct.password| Hello, user_name |
Given(/^I am on home page of Amazon$/) do
visit "/"
end
When (/^I click "(.*?)" button$/) do |button|
click_link(button)
end
Then(/^I should see login form$/) do
has_content? 'What is your e-mail address?'
end
Given(/^I am on login page of Amazon$/) do
#stay on the login page
end
When(/^I sign in with (.*) and (.*)$/) do |username, password|
fill_in "ap_email", :with => username
fill_in "ap_password", :with => password
click_on("signInSubmit-input")
end
Then(/^Page should have content (.*)$/) do |message|
has_content? message
end
yunus-mac:cucumber_capybara_selenium mesutgunes$ cucumber test/features/
Feature: As a customer
In order to buy something
From the amazon.com
I want to login the page
Scenario: User goes to login page # test/features/login.feature:6
Given I am on home page of Amazon # test/features/step_definitions/login_steps.rb:1
When I click "Hello. Sign in" button # test/features/step_definitions/login_steps.rb:5
Then I should see login form # test/features/step_definitions/login_steps.rb:9
Scenario Outline: Member logins the page # test/features/login.feature:11
Given I am on login page of Amazon # test/features/step_definitions/login_steps.rb:13
And I sign in with <username> and <password> # test/features/step_definitions/login_steps.rb:17
Then Page should have content <message> # test/features/step_definitions/login_steps.rb:24
Examples:
| username | password | message |
| username@mail.com | wrong.password | There was a problem with your request |
| gunesmes@yahoo.com | correct.password | Hello, mesut |
3 scenarios (3 passed)
9 steps (9 passed)
0m12.833s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment