Skip to content

Instantly share code, notes, and snippets.

@gunesmes
Last active August 29, 2015 14:26
Show Gist options
  • Save gunesmes/82bc062820fc0ad9f1ec to your computer and use it in GitHub Desktop.
Save gunesmes/82bc062820fc0ad9f1ec to your computer and use it in GitHub Desktop.
Imperative vs Declarative
When(/^user submits the registration form with valid user information$/) do
enter_text IDs.items["Name"], "John"
enter_text IDs.items["Surname"], "Doe"
enter_text IDs.items["Email"], "[email protected]"
enter_text IDs.items["Password"], "Password1213"
touch IDs.items["Male"]
select_from_list IDs.items["Birt"], "1990"
touch IDs.items["Terms and Condition"]
touch IDs.items["Register"]
end
Then(/^user should see "(.*?)" pop\-up$/) do |popup|
expect(element_exists(IDs.items[popup]).to be true)
end
Scenario: User should see greeting message for succesfull registration
When user submits the registration form with valid user information
Then user should see "Welcome" pop-up
When(/^user enters "(.*?)" as "(.*?)"$/) do |field, text|
enter_text IDs.items[field] text
end
When(/^user selects gender as "(.*?)"$/) do |field|
touch IDs.items[field]
end
When(/^user selects "(.*?)" as "(.*?)"$/) do |list, value|
select_from_list IDs.items[list] value
end
When(/^user checks terms and conditions$/) do
touch IDs.items["Terms and Condition"]
end
When(/^user clicks at "(.*?)" button$/) do |button|
touch IDs.items[button]
end
Then(/^user should see "(.*?)" pop\-up$/) do |popup|
expect(element_exists(IDs.items[popup]).to be true)
end
Scenario: User should see greeting message for succesfull registeration
When user enters "Name" as "John"
And user enters "Surname" as "Doe"
And user enters "Email" as "[email protected]"
And user enters "Password" as "Pass123456"
And user selects gender as "Male"
And user selects "Birtday" as "1990"
And user checks terms and conditions
And user clicks at "Register" button
Then user should see "Welcome" pop-up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment