get login, mobile and notes features passing

This commit is contained in:
Reinier Balt 2012-05-12 13:37:36 +02:00
parent 7c935652fb
commit 005723cb4f
52 changed files with 167 additions and 196 deletions

View file

@ -50,7 +50,7 @@ Feature: Existing user logging in
| "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) |
@javascript
@javascript @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"

View file

@ -1,9 +1,9 @@
Feature: Create project from template
In order to be able to create a project from a template
As a user this installed Tracks with console access
As a user who has installed Tracks with console access
I want to run the script to add projects and actions from a template
These scenario's need selenium so that there is a Tracks server running
These scenarios are tagged javascript so that there is a Tracks server running
to use from the command line script
Background:
@ -14,7 +14,7 @@ Feature: Create project from template
And I have logged in as "testuser" with password "secret"
And I have a context called "Context A"
@javascript
@javascript @announce @wip
Scenario: Create a project with one task
Given a template that looks like
"""

View file

@ -27,4 +27,4 @@ Feature: Manage users
Scenario: Delete account from users page
When I go to the manage users page
And I delete the user "testuser"
Then I should see that a user named "testuser" is not present
Then I should see that a user named "testuser" is not present

View file

@ -1,8 +1,8 @@
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
step "I go to the login page"
fill_in "Login", :with => username
fill_in "Password", :with => password
uncheck "Stay logged in:"
fill_in "user_login", :with => username
fill_in "user_password", :with => password
uncheck "user_noexpiry"
click_button "Sign in"
logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)"
@ -25,6 +25,7 @@ When /^my session expires$/ do
# force check of expiry bypassing timeout
js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});'
page.execute_script(js);
sleep 1
end
When /^I log out of Tracks$/ do

View file

@ -11,19 +11,17 @@ When /^I execute the script$/ do
step "I cd to \"../..\""
context_id = @current_user.contexts.first.id
port = Capybara.current_session.driver.rack_server.port
# assumes there is a context with id=1
cli = "ruby doc/tracks_template_cli.rb -c #{context_id} -f tmp/aruba/template.txt"
login = "GTD_LOGIN=testuser"
pass = "GTD_PASSWORD=secret"
port = Capybara.current_session.driver.rack_server.port
gtd_todos_url = "GTD_TODOS_URL=http://localhost:#{port}/todos.xml"
gtd_projects_url = "GTD_PROJECTS_URL=http://localhost:#{port}/projects.xml"
gtd_context_url_prefix = "GTD_CONTEXT_URL_PREFIX=http://localhost:#{port}/contexts/"
gtd_context_url = "GTD_CONTEXT_URL=http://localhost:#{port}/contexts.xml"
command = "#{gtd_todos_url} #{gtd_projects_url} #{gtd_context_url_prefix} #{gtd_context_url} #{login} #{pass} #{cli}"
step "I run \"#{command}\""
# puts "output = #{combined_output}"
set_env('GTD_LOGIN','testuser')
set_env('GTD_PASSWORD', 'secret')
set_env('GTD_TODOS_URL', 'http://localhost:#{port}/todos.xml')
set_env('GTD_PROJECTS_URL', "http://localhost:#{port}/projects.xml")
set_env('GTD_CONTEXT_URL_PREFIX', "http://localhost:#{port}/contexts/")
set_env("GTD_CONTEXT_URL","http://localhost:#{port}/contexts.xml")
step "I run `#{cli}`"
end

View file

@ -13,7 +13,7 @@ Given /^the following user records with hash algorithm$/ do |table|
algorithm = hash[:algorithm]
hash.delete("algorithm")
user = Factory(:user, hash)
user = FactoryGirl.create(:user, hash)
case algorithm
when 'bcrypt'
@ -22,7 +22,7 @@ Given /^the following user records with hash algorithm$/ do |table|
BCrypt::Password.new(user.crypted_password).should == password
when 'sha1'
user.password = user.password_confirmation = nil
user.write_attribute :crypted_password, user.sha1(password)
user.send(:write_attribute, :crypted_password, user.sha1(password))
user.save
user.reload
user.crypted_password.should == user.sha1(password)