mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-08 00:34:19 +01:00
add some pending cucumber scenarios and fix a small bug it uncovered
This commit is contained in:
parent
30c578f93a
commit
f544c80fbc
15 changed files with 290 additions and 65 deletions
|
|
@ -8,6 +8,9 @@ Feature: Edit a context
|
|||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@pc"
|
||||
And I have a project called "test project"
|
||||
And I have 2 todos in project "test project" in context "@pc" with tags "starred"
|
||||
|
||||
@selenium
|
||||
Scenario: In place edit of context name
|
||||
|
|
@ -19,17 +22,52 @@ Feature: Edit a context
|
|||
Then he should see that a context named "Errands" is not present
|
||||
And he should see that a context named "OutAndAbout" is present
|
||||
|
||||
@selenium
|
||||
Scenario: Editing the context of a todo will remove the todo
|
||||
Given this is a pending scenario
|
||||
When I go to the the context page for "@pc"
|
||||
Then the badge should show 2
|
||||
When I edit the context of "todo 1" to "@laptop"
|
||||
Then I should not see "todo 1"
|
||||
And the badge should show 1
|
||||
|
||||
@selenium
|
||||
Scenario: Editing the description of a a todo will update that todo
|
||||
Given this is a pending scenario
|
||||
When I go to the the context page for "@pc"
|
||||
And I edit the description of "todo 1" to "changed"
|
||||
Then I should not see "todo 1"
|
||||
And I should see "changed"
|
||||
|
||||
@selenium
|
||||
Scenario: Editing the context of the last todo will remove the todo and show empty message
|
||||
Given this is a pending scenario
|
||||
When I go to the the context page for "@pc"
|
||||
And I edit the context of "todo 1" to "@laptop"
|
||||
Then I should not see "todo 1"
|
||||
And the badge should show 1
|
||||
When I edit the context of "todo 2" to "@laptop"
|
||||
Then I should not see "todo 2"
|
||||
And the badge should show 0
|
||||
And I should see "Currently there are no incomplete actions in this context"
|
||||
|
||||
@selenium
|
||||
Scenario: Adding a todo to a hidden project will not show the todo
|
||||
Given this is a pending scenario
|
||||
Given I have a hidden project called "hidden project"
|
||||
When I go to the the context page for "@pc"
|
||||
And I edit the project of "todo 1" to "hidden project"
|
||||
Then I should not see "todo 1"
|
||||
When I submit a new action with description "todo X" to project "hidden project" in the context "@pc"
|
||||
Then I should not see "todo X"
|
||||
When I go to the "hidden project" project
|
||||
Then I should see "todo 1"
|
||||
And I should see "todo X"
|
||||
And the badge should show 2
|
||||
|
||||
@selenium
|
||||
Scenario: Adding a todo to a hidden context will show that todo
|
||||
Given this is a pending scenario
|
||||
Given I have a hidden context called "@personal"
|
||||
When I go to the the context page for "@pc"
|
||||
And I edit the context of "todo 1" to "@personal"
|
||||
Then I should not see "todo 1"
|
||||
When I go to the context page for "@personal"
|
||||
Then I should see "todo 1"
|
||||
When I submit a new action with description "todo X" to project "test project" in the context "@personal"
|
||||
Then I should see "todo X"
|
||||
|
|
|
|||
|
|
@ -92,8 +92,24 @@ Feature: dependencies
|
|||
And I should not see "test 2" in the deferred container
|
||||
And I should see the empty message in the deferred container
|
||||
|
||||
@selenium
|
||||
Scenario: Deleting a successor will update predecessor
|
||||
Given this is a pending scenario
|
||||
Given I have a context called "@pc"
|
||||
And I have a project "dependencies" that has the following todos
|
||||
| description | context |
|
||||
| test 1 | @pc |
|
||||
| test 2 | @pc |
|
||||
| test 3 | @pc |
|
||||
And "test 2" depends on "test 1"
|
||||
And "test 3" depends on "test 1"
|
||||
When I go to the "dependencies" project
|
||||
And I expand the dependencies of "test 1"
|
||||
Then I should see "test 2" within the dependencies of "test 1"
|
||||
And I should see "test 3" within the dependencies of "test 1"
|
||||
When I delete the action "test 2"
|
||||
And I expand the dependencies of "test 1"
|
||||
Then I should see "test 3" within the dependencies of "test 1"
|
||||
And I should not see "test 2"
|
||||
|
||||
@selenium
|
||||
Scenario: Dragging an action to a completed action will not add it as a dependency
|
||||
|
|
|
|||
|
|
@ -153,9 +153,38 @@ Feature: Edit a next action from every page
|
|||
| tag page for "starred" |
|
||||
| calendar page |
|
||||
|
||||
Scenario: I can edit a todo to move it to another context
|
||||
# for home and tickler and tag
|
||||
Given this is a pending scenario
|
||||
@selenium
|
||||
Scenario Outline: I can edit a todo to move it to another context
|
||||
Given I have a context called "@pc"
|
||||
And I have a context called "@laptop"
|
||||
And I have a project "my project" that has the following todos
|
||||
| context | description | tags |
|
||||
| @pc | first action | bla |
|
||||
| @laptop | second action | bla |
|
||||
When I go to the <page>
|
||||
Then I should see "first action" in the context container for "@pc"
|
||||
When I edit the context of "first action" to "@laptop"
|
||||
Then I should not see "first action" in the context container for "@pc"
|
||||
Then I should see "first action" in the context container for "@laptop"
|
||||
|
||||
Scenarios:
|
||||
| page |
|
||||
| home page |
|
||||
| tag page for "bla" |
|
||||
|
||||
@selenium
|
||||
Scenario: I can edit a todo to move it to another context in tickler page
|
||||
Given I have a context called "@pc"
|
||||
And I have a context called "@laptop"
|
||||
And I have a project "my project" that has the following deferred todos
|
||||
| context | description |
|
||||
| @pc | first action |
|
||||
| @laptop | second action |
|
||||
When I go to the tickler page
|
||||
Then I should see "first action" in the context container for "@pc"
|
||||
When I edit the context of "first action" to "@laptop"
|
||||
Then I should not see "first action" in the context container for "@pc"
|
||||
Then I should see "first action" in the context container for "@laptop"
|
||||
|
||||
Scenario: I can edit a todo to move it to another project
|
||||
Given this is a pending scenario
|
||||
|
|
|
|||
|
|
@ -103,6 +103,6 @@ Feature: Edit a project
|
|||
Given I have a project "foo" with 2 todos
|
||||
And I have a project called "bar"
|
||||
When I go to the "foo" project
|
||||
And I change the project_name field of "Todo 1" to "bar"
|
||||
Then I should not see "Todo 1"
|
||||
And I should see "Todo 2"
|
||||
And I change the project_name field of "todo 1" to "bar"
|
||||
Then I should not see "todo 1"
|
||||
And I should see "todo 2"
|
||||
|
|
|
|||
|
|
@ -200,15 +200,21 @@ Feature: Add new next action from every page
|
|||
|
||||
@selenium
|
||||
Scenario: Adding a todo to an empty container hides the empty message # TODO: make outline
|
||||
And I have a context called "visible context"
|
||||
Given I have a context called "visible context"
|
||||
When I go to the tag page for "test"
|
||||
Then I should see "Currently there are no incomplete actions with the tag 'test'"
|
||||
When I submit a new action with description "a new todo" and the tags "test" in the context "visible context"
|
||||
Then I should see "a new todo"
|
||||
And I should not see "Currently there are no incomplete actions with the tag 'bla'"
|
||||
|
||||
@selenium
|
||||
Scenario: Adding a dependency to a todo updated the successor
|
||||
Given this is a pending scenario
|
||||
When I go to the "test project" project
|
||||
Then I should see "todo 1"
|
||||
When I submit a new action with description "a new todo" with a dependency on "todo 1"
|
||||
Then I should not see "a new todo" in the project container of "test project"
|
||||
When I expand the dependencies of "todo 1"
|
||||
Then I should see "a new todo" within the dependencies of "todo 1"
|
||||
|
||||
@selenium
|
||||
Scenario: I can add multiple todos in a new project and a new context
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Then /^I should not see "([^"]*)" in the context container for "([^"]*)"$/ do |t
|
|||
todo.should_not be_nil
|
||||
|
||||
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
|
||||
|
||||
if selenium.is_element_present(xpath)
|
||||
# give jquery some time to finish
|
||||
wait_for :timeout_in_seconds => 5 do
|
||||
|
|
@ -82,6 +82,23 @@ Then /^I should see "([^"]*)" in the action container$/ do |todo_description|
|
|||
end
|
||||
end
|
||||
|
||||
Then /^I should not see "([^"]*)" in the project container of "([^"]*)"$/ do |todo_description, project_name|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
project = @current_user.projects.find_by_name(project_name)
|
||||
project.should_not be_nil
|
||||
|
||||
xpath = "//div[@id='p#{todo.project.id}items']//div[@id='line_todo_#{todo.id}']"
|
||||
|
||||
if selenium.is_element_present(xpath)
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present(xpath)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Then /^I should see "([^"]*)" in the completed container$/ do |todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
|
@ -130,7 +147,7 @@ end
|
|||
|
||||
Then /^I should see "([^"]*)" in the active recurring todos container$/ do |repeat_pattern|
|
||||
repeat = @current_user.recurring_todos.find_by_description(repeat_pattern)
|
||||
|
||||
|
||||
unless repeat.nil?
|
||||
xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
|
||||
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ When /^I edit the dependency of "([^"]*)" to remove "([^"]*)" as predecessor$/ d
|
|||
wait_for :timeout=>5 do
|
||||
!selenium.is_element_present(delete_dep_button)
|
||||
end
|
||||
|
||||
|
||||
submit_edit_todo_form(todo)
|
||||
# note that animations will be running after the ajax is completed
|
||||
end
|
||||
|
|
@ -109,6 +109,7 @@ Then /^I should not see "([^"]*)" within the dependencies of "([^"]*)"$/ do |suc
|
|||
successor.should_not be_nil
|
||||
# let selenium look for the presence of the successor
|
||||
xpath = "xpath=//div[@id='line_todo_#{todo.id}']//div[@id='successor_line_todo_#{successor.id}']//span"
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present(xpath)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
Given /^I have a project "([^\"]*)" with (.*) todos$/ do |project_name, num_todos|
|
||||
context = @current_user.contexts.find_or_create_by_name("Context A")
|
||||
project = @current_user.projects.create!(:name => project_name)
|
||||
@context = @current_user.contexts.find_or_create_by_name("Context A")
|
||||
@project = @current_user.projects.create!(:name => project_name)
|
||||
1.upto num_todos.to_i do |i|
|
||||
@current_user.todos.create!(
|
||||
:project_id => project.id,
|
||||
:context_id => context.id,
|
||||
:description => "Todo #{i}")
|
||||
:project_id => @project.id,
|
||||
:context_id => @context.id,
|
||||
:description => "todo #{i}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ When /^I edit the project name to "([^\"]*)"$/ do |new_title|
|
|||
wait_for do
|
||||
selenium.is_element_present("submit_project_#{@project.id}")
|
||||
end
|
||||
|
||||
|
||||
fill_in "project[name]", :with => new_title
|
||||
|
||||
selenium.click "submit_project_#{@project.id}",
|
||||
|
|
@ -180,7 +180,7 @@ Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bo
|
|||
|
||||
response.should have_xpath(xpath)
|
||||
bold_text = response.selenium.get_text("xpath=#{xpath}")
|
||||
|
||||
|
||||
bold_text.should =~ /#{bold}/
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,30 @@ When /^I submit a new action with description "([^"]*)"$/ do |description|
|
|||
submit_next_action_form
|
||||
end
|
||||
|
||||
When /^I submit a new action with description "([^"]*)" with a dependency on "([^"]*)"$/ do |todo_description, predecessor_description|
|
||||
predecessor = @current_user.todos.find_by_description(predecessor_description)
|
||||
predecessor.should_not be_nil
|
||||
|
||||
fill_in "todo[description]", :with => todo_description
|
||||
|
||||
input = "xpath=//form[@id='todo-form-new-action']//input[@id='predecessor_input']"
|
||||
selenium.focus(input)
|
||||
selenium.type_keys input, predecessor_description
|
||||
|
||||
# wait for auto complete
|
||||
autocomplete = "xpath=//a[@id='ui-active-menuitem']"
|
||||
selenium.wait_for_element(autocomplete, :timeout_in_seconds => 5)
|
||||
|
||||
# click first line
|
||||
first_elem = "xpath=//ul/li[1]/a[@id='ui-active-menuitem']"
|
||||
selenium.click(first_elem)
|
||||
|
||||
new_dependency_line = "xpath=//li[@id='pred_#{predecessor.id}']"
|
||||
selenium.wait_for_element(new_dependency_line, :timeout_in_seconds => 5)
|
||||
|
||||
submit_next_action_form
|
||||
end
|
||||
|
||||
When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name|
|
||||
fill_in "todo[description]", :with => description
|
||||
fill_in "tag_list", :with => tags
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@ When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo
|
|||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
||||
When /^I edit the context of "([^"]*)" to "([^"]*)"$/ do |context_old_name, context_new_name|
|
||||
When "I change the context_name field of \"#{context_old_name}\" to \"#{context_new_name}\""
|
||||
When /^I edit the context of "([^"]*)" to "([^"]*)"$/ do |todo_name, context_new_name|
|
||||
When "I change the context_name field of \"#{todo_name}\" to \"#{context_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the project of "([^"]*)" to "([^"]*)"$/ do |todo_name, project_new_name|
|
||||
When "I change the project_name field of \"#{todo_name}\" to \"#{project_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description|
|
||||
|
|
@ -46,9 +50,9 @@ end
|
|||
When /^I remove the show from date from "([^"]*)"$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
|
||||
open_edit_form_for(todo)
|
||||
selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
|
||||
|
||||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ end
|
|||
|
||||
Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
|
||||
context = @current_user.contexts.find_or_create(:name => context_name)
|
||||
@current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
@todo = @current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" in the context "([^"]*)" which is due tomorrow$/ do |description, context_name|
|
||||
|
|
@ -14,6 +14,22 @@ Given /^I have a todo "([^"]*)" in the context "([^"]*)" which is due tomorrow$/
|
|||
@todo.save!
|
||||
end
|
||||
|
||||
Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |number_of_todos, project_name, context_name, tag_names|
|
||||
@context = @current_user.contexts.find_by_name(context_name)
|
||||
@context.should_not be_nil
|
||||
|
||||
@project = @current_user.projects.find_by_name(project_name)
|
||||
@project.should_not be_nil
|
||||
|
||||
@todos = []
|
||||
number_of_todos.to_i.downto 1 do |i|
|
||||
todo = @current_user.todos.create!(:context_id => @context.id, :description => "todo #{i}", :project_id => @project.id)
|
||||
todo.tag_with(tag_names)
|
||||
todo.save!
|
||||
@todos << todo
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)"$/ do |description|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
end
|
||||
|
|
@ -133,6 +149,26 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
|
|||
end
|
||||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" that has the following deferred todos$/ do |project_name, todos|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
@project.should_not be_nil
|
||||
todos.hashes.each do |todo|
|
||||
context = @current_user.contexts.find_by_name(todo[:context])
|
||||
context.should_not be_nil
|
||||
new_todo = @current_user.todos.create!(
|
||||
:description => todo[:description],
|
||||
:context_id => context.id,
|
||||
:project_id=>@project.id,
|
||||
:show_from=>Time.zone.now+1.week)
|
||||
unless todo[:tags].nil?
|
||||
new_todo.tag_with(todo[:tags])
|
||||
end
|
||||
unless todo[:completed].nil?
|
||||
new_todo.complete! if todo[:completed] == 'yes'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
When /^I mark "([^"]*)" as complete$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ Feature: Show done
|
|||
When I go to the recurring todos page
|
||||
Then I should see "test pattern" in the active recurring todos container
|
||||
|
||||
@selenium @wip
|
||||
@selenium
|
||||
Scenario Outline: I can toggle a todo active from the done pages
|
||||
When I go to the <page>
|
||||
Then I should see "todo 1"
|
||||
|
|
@ -173,7 +173,14 @@ Feature: Show done
|
|||
|
||||
@selenium
|
||||
Scenario: I can edit a project to active from the project done page
|
||||
Given this scenario is pending
|
||||
Given I have a completed project called "completed project"
|
||||
When I go to the done projects page
|
||||
Then I should see "completed project"
|
||||
When I edit the project state of "completed project" to "active"
|
||||
Then I should not see "completed project"
|
||||
When I go to the projects page
|
||||
Then I should see "completed project"
|
||||
|
||||
|
||||
Scenario Outline: All pages are internationalized
|
||||
Given I set the locale to "<locale>"
|
||||
|
|
@ -206,3 +213,20 @@ Feature: Show done
|
|||
| all done actions page for context "@pc" | de |
|
||||
| all done actions page for project "test project"| de |
|
||||
| all done actions page for tag "starred" | de |
|
||||
| done actions page | es |
|
||||
| all done actions page | es |
|
||||
| done actions page for context "@pc" | es |
|
||||
| done actions page for project "test project" | es |
|
||||
| done actions page for tag "starred" | es |
|
||||
| all done actions page for context "@pc" | es |
|
||||
| all done actions page for project "test project"| es |
|
||||
| all done actions page for tag "starred" | es |
|
||||
# fr locale needs changes from preference branch
|
||||
# | done actions page | fr |
|
||||
# | all done actions page | fr |
|
||||
# | done actions page for context "@pc" | fr |
|
||||
# | done actions page for project "test project" | fr |
|
||||
# | done actions page for tag "starred" | fr |
|
||||
# | all done actions page for context "@pc" | fr |
|
||||
# | all done actions page for project "test project"| fr |
|
||||
# | all done actions page for tag "starred" | fr |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue