mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-26 18:56:10 +01:00
add a cucumber test to simulate expiration of a session
Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
parent
520e45fe6b
commit
7b3c07a754
5 changed files with 72 additions and 30 deletions
|
|
@ -49,3 +49,11 @@ Feature: Existing user logging in
|
|||
| search page | search page | Logout (Test User) |
|
||||
| "top secret" project for user "testuser" | "top secret" project for user "testuser" | Logout (Test User) |
|
||||
| context page for "@secret location" for user "testuser" | context page for "@secret location" for user "testuser" | Logout (Test User) |
|
||||
|
||||
@selenium @wip
|
||||
Scenario: When session expires, you should be logged out
|
||||
When I go to the login page
|
||||
And I submit the login form as user "testuser" with password "secret"
|
||||
Then I should be on the login page
|
||||
When my session expires
|
||||
Then I should see "Session has timed out"
|
||||
|
|
@ -2,6 +2,7 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password
|
|||
visit login_path
|
||||
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)
|
||||
|
|
@ -13,5 +14,20 @@ end
|
|||
When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do |username, password|
|
||||
fill_in 'Login', :with => username
|
||||
fill_in 'Password', :with => password
|
||||
uncheck "Stay logged in:"
|
||||
click_button
|
||||
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);
|
||||
|
||||
# force check of expiry bypassing timeout
|
||||
js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});'
|
||||
selenium.run_script(js);
|
||||
|
||||
sleep(2)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field, todo_name
|
|||
selenium.click("//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
selenium.type("css=form.edit_todo_form input[name=#{field}]", new_value)
|
||||
selenium.click("css=button.positive", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
# TODO: change to a wait_for
|
||||
sleep(5)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue