Merge branch 'master' into rails4

Conflicts:
	Gemfile.lock
	config/routes.rb
This commit is contained in:
Reinier Balt 2013-06-17 09:25:02 +02:00
commit 4a485558e2
51 changed files with 5475 additions and 5015 deletions

View file

@ -68,10 +68,10 @@ Feature: dependencies
And "test 2" depends on "test 1"
When I go to the "dependencies" project
Then I should see "test 2" in the deferred container
And I should see "test 1" in the action container
And I should see "test 1" in the context container for "@pc"
When I mark "test 1" as complete
Then I should see "test 1" in the completed container
And I should see "test 2" in the action container
And I should see "test 2" in the context container for "@pc"
And I should not see "test 2" in the deferred container
And I should see empty message for deferred todos of project
@ -86,9 +86,9 @@ Feature: dependencies
And "test 2" depends on "test 1"
When I go to the "dependencies" project
Then I should see "test 2" in the deferred container
And I should see "test 1" in the action container
And I should see "test 1" in the context container for "@pc"
When I delete the action "test 1"
Then I should see "test 2" in the action container
Then I should see "test 2" in the context container for "@pc"
And I should not see "test 2" in the deferred container
And I should see empty message for deferred todos of project
@ -111,7 +111,7 @@ Feature: dependencies
Then I should see "test 3" within the dependencies of "test 1"
And I should not see "test 2"
@javascript
@javascript
Scenario: Dragging an action to a completed action will not add it as a dependency
Given I have a context called "@pc"
And I have a project "dependencies" that has the following todos
@ -122,7 +122,7 @@ Feature: dependencies
When I go to the "dependencies" project
And I drag "test 1" to "test 3"
Then I should see an error flash message saying "Cannot add this action as a dependency to a completed action!"
And I should see "test 1" in the project container of "dependencies"
And I should see "test 1" in the context container for "@pc"
@javascript
Scenario Outline: Marking a successor as complete will update predecessor
@ -148,7 +148,7 @@ Feature: dependencies
| tag page for "bla" | context |
| tag page for "bla" | project |
@javascript
@javascript
Scenario Outline: Marking a successor as active will update predecessor
Given I have a context called "@pc"
And I have selected the view for group by <grouping>
@ -171,5 +171,6 @@ Feature: dependencies
Scenarios:
| page | grouping |
| "dependencies" project | project |
| "dependencies" project | context |
| tag page for "bla" | context |
| tag page for "bla" | project |

View file

@ -55,7 +55,7 @@ Feature: Edit a next action from every page
@javascript @wip
Scenario Outline: Changing container of the todo in that container will hide it
# this script fails on https://code.google.com/p/selenium/issues/detail?id=3075 for selenium-webdriver > 2.14.
# and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This may work on webkit though
# and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This may work with webkit though
Given I have a todo "delete me" in the context "@home" in the project "do it"
And I have a project "go for it"
And I have selected the view for group by <grouping>
@ -77,6 +77,7 @@ Feature: Edit a next action from every page
@javascript
Scenario Outline: Deleting the last todo in container will show empty message # only project, context, tag, not todo
Given I have a context called "@home"
And I have selected the view for group by <grouping>
And I have a project "my project" that has the following todos
| context | description | tags |
| @home | first action | test, bla |
@ -90,12 +91,15 @@ Feature: Edit a next action from every page
Then I should see empty message for todos of <page type>
Scenarios:
| page | page type |
| "my project" project | project |
| context page for "@home" | context |
| tag page for "bla" | tag |
| page | page type | grouping |
| "my project" project | project | project |
| "my project" project | project | context |
| context page for "@home" | context | context |
| context page for "@home" | context | project |
| tag page for "bla" | tag | context |
| tag page for "bla" | tag | project |
@javascript
@javascript
Scenario Outline: I can mark an active todo complete and it will update empty messages
Given I have a context called "visible context"
And I have a project called "visible project"
@ -134,7 +138,7 @@ Feature: Edit a next action from every page
| "visible project" project | project |
| context page for "visible context" | context |
@javascript
@javascript
Scenario Outline: I can mark a completed todo active and it will update empty messages and context containers
Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context"
And I have selected the view for group by <grouping>
@ -155,8 +159,8 @@ Feature: Edit a next action from every page
| home page | home | context | container for context "visible context" |
| home page | home | project | container for project "visible project" |
@javascript
Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without context containers
@javascript
Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without hideable containers
Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context"
When I go to the <page>
Then I should see empty message for todos of <page type>

View file

@ -42,7 +42,7 @@ Feature: View, add, remove notes
And I edit the first note to "edited note"
Then I should see "edited note"
@javascript
@javascript
Scenario: Toggle all notes
Given I have a context called "@pc"
And I have a project "take notes" that has the following todos

View file

@ -123,7 +123,7 @@ Feature: Edit a project
Scenario: Moving the todo to the tickler will move todo to tickler container and update empty messages
Given I have a project "test" with 1 todos
When I go to the "test" project
Then I should see "todo 1" in the action container
Then I should see "todo 1" in the context container for "Context A"
And I should see empty message for deferred todos of project
And I should see empty message for completed todos of project
When I defer "todo 1" for 1 day

View file

@ -97,7 +97,9 @@ Feature: Add new next action from every page
| tickler page | context | not see |
| tickler page | project | not see |
| "test project" project | context | see |
| "test project" project | project | see |
| context page for "test context" | context | see |
| context page for "test context" | project | see |
| tag page for "starred" | context | see |
| tag page for "starred" | project | see |
@ -124,7 +126,9 @@ Feature: Add new next action from every page
| tickler page | not see | 0 | 3 | context |
| tickler page | not see | 0 | 3 | project |
| "testing" project | see | 3 | 3 | context |
| "testing" project | see | 3 | 3 | project |
| context page for "test context" | see | 2 | 3 | context |
| context page for "test context" | see | 2 | 3 | project |
| tag page for "starred" | see | 2 | 3 | context |
| tag page for "starred" | see | 2 | 3 | project |
@ -199,9 +203,13 @@ Feature: Add new next action from every page
| tickler page | context | not see | not see |
| tickler page | project | not see | not see |
| "visible project" project | project | not see | see |
| "visible project" project | context | not see | see |
| "hidden project" project | project | see | not see |
| "hidden project" project | context | see | not see |
| context page for "visible context" | context | not see | see |
| context page for "visible context" | project | not see | see |
| context page for "other context" | context | not see | not see |
| context page for "other context" | project | not see | not see |
| tag page for "starred" | context | not see | not see |
| tag page for "starred" | project | not see | not see |
| tag page for "test" | context | see | see |

View file

@ -11,7 +11,9 @@ When(/^I collapse the project container of "(.*?)"$/) do |project_name|
end
When /^I toggle all collapsed context containers$/ do
click_link 'Toggle collapsed contexts'
open_view_menu do
click_link 'Toggle collapsed contexts'
end
end
####### Context #######
@ -91,7 +93,6 @@ Then(/^I should (not see|see) "([^"]*)" in the (completed|done today|done this w
id = 'completed_rest_of_month_container' if container == 'done this month'
css = "div##{id} div#line_todo_#{find_todo(todo_description).id}"
page.should have_css(css)
check_css_visibility(visible, css)
end
@ -138,9 +139,8 @@ end
Then /^I should (see|not see) empty message for (done today|done this week|done this month|completed todos|deferred todos|todos) (of done actions|of context|of project|of home|of tag)/ do |visible, state, type|
css = "error: wrong state"
css = "div#c#{@context.id}-empty-d" if state == "todos" && type == "of context"
css = "div#p#{@project.id}-empty-d" if state == "todos" && type == "of project"
css = "div#no_todos_in_view" if state == "todos" && (type == "of home" || type == "of tag")
css = "div#c#{@context.id}-empty-d" if state == "todos"
css = "div#no_todos_in_view" if state == "todos" && ["of home", "of tag", "of context", "of project"].include?(type)
css = "div#completed_today_container" if state == "done today"
css = "div#completed_rest_of_week_container" if state == "done this week"
css = "div#completed_rest_of_month_container" if state == "done this month"

View file

@ -1,13 +1,7 @@
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
step "I go to the login page"
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}\)"
page.should have_content(logout_regexp)
@current_user = User.where(:login => username).first
user = User.where(:login => username).first
request_signin_as(user)
@current_user = user
end
When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do |username, password|

View file

@ -30,7 +30,7 @@ When /^I edit the first note to "([^"]*)"$/ do |note_body|
end
end
When /^I toggle the note of "([^"]*)"$/ do |todo_description|
When(/^I toggle the note of "([^"]*)"$/) do |todo_description|
todo = @current_user.todos.where(:description => todo_description).first
todo.should_not be_nil
@ -39,7 +39,9 @@ When /^I toggle the note of "([^"]*)"$/ do |todo_description|
end
When /^I click Toggle Notes$/ do
click_link 'Toggle notes'
open_view_menu do
click_link 'Toggle notes'
end
end
When /^I toggle all notes$/ do

View file

@ -70,9 +70,9 @@ Given /^I have ([0-9]+) todos$/ do |count|
end
Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |action_description, project_name, tags, context_name|
context = @current_user.contexts.where(:name => context_name).first_or_create
project = @current_user.projects.where(:name => project_name).first_or_create
@todo = @current_user.todos.create!(:context_id => context.id, :project_id => project.id, :description => action_description)
@context = @current_user.contexts.where(:name => context_name).first_or_create
@project = @current_user.projects.where(:name => project_name).first_or_create
@todo = @current_user.todos.create!(:context_id => @context.id, :project_id => @project.id, :description => action_description)
@todo.tag_with(tags)
@todo.save
end

View file

@ -0,0 +1,52 @@
class SessionBackdoorController < ::ApplicationController
skip_before_filter :login_required
def create
session['user_id'] = params[:user_id]
user = User.find(params[:user_id])
set_current_user(user)
user.remember_me
cookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at }
redirect_to root_path
end
def expire_session
current_user.forget_me if logged_in?
cookies.delete :auth_token
session['user_id'] = nil
reset_session
session['expiry_time'] = Time.now
respond_to do |format|
format.html { render :text => "Session expired for test purposes"}
format.js { render :text => "" }
end
end
end
module TracksLoginHelper
begin
_routes = Rails.application.routes
_routes.disable_clear_and_finalize = true
_routes.clear!
Rails.application.routes_reloader.paths.each{ |path| load(path) }
_routes.draw do
# here you can add any route you want
match "/test_login_backdoor", to: "session_backdoor#create"
match "login/expire_session", to: "session_backdoor#expire_session"
end
ActiveSupport.on_load(:action_controller) { _routes.finalize! }
ensure
_routes.disable_clear_and_finalize = false
end
def request_signin_as(user)
visit "/test_login_backdoor?user_id=#{user.id}"
end
def signin_as(user)
session[:user_id] = user.id
@current_user = user
end
end

View file

@ -97,6 +97,23 @@ module TracksStepHelper
execute_javascript("$('#{sortable_css}').simulateDragSortable({move: #{delta}, handle: '.grip'});")
end
def open_view_menu
view_menu = "ul.sf-menu li#menu_view"
# click menu
view_menu_link = "#{view_menu} a#menu_view_link"
page.should have_css(view_menu_link, :visible => true)
page.find(view_menu_link).click
# wait for menu to be visible
view_menu_item = "#{view_menu} li#menu_view_toggle_contexts"
page.should have_css(view_menu_item)
within view_menu do
yield
end
end
def open_submenu_for(todo)
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
page.should have_css(submenu_arrow, :visible=>true)

View file

@ -1,3 +1,4 @@
World(TracksLoginHelper)
World(TracksStepHelper)
World(TracksFormHelper)
World(TracksIdHelper)
World(TracksIdHelper)

View file

@ -60,7 +60,7 @@ Feature: Toggle the containers
And I should not see the todo "test 2"
And I should not see the todo "test 3"
@javascript
@javascript
Scenario: I can hide all collapsed context containers
Given I have the following contexts
| context | hide |
@ -87,7 +87,7 @@ Feature: Toggle the containers
And I should not see the context container for "@boss"
And I should not see the context container for "@ipad"
@javascript
@javascript
Scenario: I can hide all collapsed project containers
Given I have the following contexts
| context | hide |