Created
October 11, 2011 10:54
-
-
Save nnarhinen/1277810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Login | |
In order to be able to log in securely | |
A user wants to make sure he is required to give correct username and password | |
Scenario: No credentials given | |
Given I am on the front page | |
When I submit "form-login" | |
Then I should see "Käyttäjätunnus tai salasana puuttuu" | |
Scenario: Wrong credentials | |
Given I am on the front page | |
When I type "foobar@foobar.tld" as "fe-loginemail" | |
And I type "foobar1234" as "fe-loginpassword" | |
And I submit "form-login" | |
Then I should see "Virheellinen käyttäjätunnus tai salasana" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "selenium-webdriver" | |
require "rspec/expectations" | |
driver = Selenium::WebDriver.for :chrome | |
at_exit do | |
driver.quit | |
end | |
Given /^I am on the front page$/ do | |
driver.navigate.to "http://localhost/~nnarhinen/foo/bar/src/pub/" | |
end | |
Then /^I should see "([^"]*)"$/ do |arg1| | |
driver.find_element(:tag_name => 'body').text.should =~ /#{arg1}/m | |
end | |
When /^I submit "([^"]*)"$/ do |form_id| | |
driver.find_element(:id => "#{form_id}").submit | |
end | |
When /^I type "([^"]*)" as "([^"]*)"$/ do |value, input_id| | |
driver.find_element(:id => "#{input_id}").send_keys "#{value}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment