migrate logging_in

This commit is contained in:
Reinier Balt 2012-01-27 12:09:34 +01:00
parent b874b49336
commit 75f2afc2e1
4 changed files with 16 additions and 24 deletions

View file

@ -3,10 +3,8 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password
fill_in "Login", :with => username
fill_in "Password", :with => password
uncheck "Stay logged in:"
click_button
if response.respond_to? :selenium
selenium.wait_for_page_to_load(5000)
end
click_button "Sign in »"
logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)"
response.should contain(logout_regexp)
@current_user = User.find_by_login(username)
@ -16,21 +14,17 @@ When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do
fill_in 'Login', :with => username
fill_in 'Password', :with => password
uncheck "Stay logged in:"
click_button
click_button "Sign in »"
end
When /^my session expires$/ do
selenium.wait_for_page_to_load(5000)
# use expire_session to force expiry of session
js = '$.ajax({type: "GET", url: "/login/expire_session", dataType: "script", async: false});'
selenium.run_script(js);
page.execute_script(js);
# force check of expiry bypassing timeout
js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});'
selenium.run_script(js);
sleep(2)
page.execute_script(js);
end
When /^I log out of Tracks$/ do

View file

@ -1,6 +1,3 @@
Then /^I should be redirected to (.+?)$/ do |page_name|
request.headers['HTTP_REFERER'].should_not be_nil
request.headers['HTTP_REFERER'].should_not == request.request_uri
Then "I should be on #{page_name}"
end