2009-05-22 23:14:40 +02:00
|
|
|
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
|
2012-02-15 21:42:06 +01:00
|
|
|
step "I go to the login page"
|
2010-02-02 22:52:32 +01:00
|
|
|
fill_in "Login", :with => username
|
|
|
|
|
fill_in "Password", :with => password
|
2010-11-10 23:48:56 +01:00
|
|
|
uncheck "Stay logged in:"
|
2012-01-27 12:09:34 +01:00
|
|
|
click_button "Sign in »"
|
|
|
|
|
|
2011-02-26 14:20:51 +01:00
|
|
|
logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)"
|
2012-01-30 03:42:47 +01:00
|
|
|
page.should have_content(logout_regexp)
|
2009-05-22 23:14:40 +02:00
|
|
|
@current_user = User.find_by_login(username)
|
2009-04-13 22:26:20 +02:00
|
|
|
end
|
2009-04-17 08:56:11 +02:00
|
|
|
|
2009-05-22 23:14:40 +02:00
|
|
|
When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do |username, password|
|
|
|
|
|
fill_in 'Login', :with => username
|
|
|
|
|
fill_in 'Password', :with => password
|
2010-11-10 23:48:56 +01:00
|
|
|
uncheck "Stay logged in:"
|
2012-01-27 12:09:34 +01:00
|
|
|
click_button "Sign in »"
|
2010-02-02 22:52:32 +01:00
|
|
|
end
|
2010-11-10 23:48:56 +01:00
|
|
|
|
|
|
|
|
When /^my session expires$/ do
|
|
|
|
|
# use expire_session to force expiry of session
|
|
|
|
|
js = '$.ajax({type: "GET", url: "/login/expire_session", dataType: "script", async: false});'
|
2012-01-27 12:09:34 +01:00
|
|
|
page.execute_script(js);
|
2011-08-18 12:48:59 +02:00
|
|
|
|
2010-11-10 23:48:56 +01:00
|
|
|
# force check of expiry bypassing timeout
|
|
|
|
|
js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});'
|
2012-01-27 12:09:34 +01:00
|
|
|
page.execute_script(js);
|
2010-11-10 23:48:56 +01:00
|
|
|
end
|
2011-08-18 12:48:59 +02:00
|
|
|
|
|
|
|
|
When /^I log out of Tracks$/ do
|
2012-02-15 21:42:06 +01:00
|
|
|
step "I go to the logout page"
|
2011-08-18 12:48:59 +02:00
|
|
|
end
|