mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-18 13:18:09 +01:00
migrate logging_in
This commit is contained in:
parent
b874b49336
commit
75f2afc2e1
4 changed files with 16 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue