another attempt at #1150 and fix some failing cucumber scenarios

This commit is contained in:
Reinier Balt 2011-04-19 16:40:55 +02:00
parent 539e18d87e
commit cb58318858
11 changed files with 82 additions and 86 deletions

View file

@ -405,7 +405,7 @@ module TodosHelper
html += step + "({ go: function() {\r\n"
end
end
html += "}}) " * animation.length
html += "}}) " * animation.size
return html + ";"
end

View file

@ -12,7 +12,7 @@ Feature: Edit a context
@selenium
Scenario: In place edit of context name
Given I have a context called "Errands"
When I visit the context page for "Errands"
When I go to the context page for "Errands"
And I edit the context name in place to be "OutAndAbout"
Then I should see the context name is "OutAndAbout"
When I go to the contexts page

View file

@ -13,7 +13,7 @@ Feature: dependencies
Scenario: Adding dependency to dependency by drag and drop
Given I have a project "dependencies" with 3 todos
And "Todo 2" depends on "Todo 1"
When I visit the "dependencies" project
When I go to the "dependencies" project
And I drag "Todo 3" to "Todo 2"
Then the successors of "Todo 1" should include "Todo 2"
And the successors of "Todo 2" should include "Todo 3"
@ -31,7 +31,7 @@ Feature: dependencies
| test 1 | @pc |
| test 2 | @pc |
| test 3 | @pc |
When I visit the "dependencies" project
When I go to the "dependencies" project
When I edit the dependency of "test 1" to add "test 2" as predecessor
Then I should see "test 1" within the dependencies of "test 2"
And I should see "test 1" in the deferred container
@ -51,7 +51,7 @@ Feature: dependencies
| test 1 | @pc |
| test 2 | @pc |
And "test 1" depends on "test 2"
When I visit the "dependencies" project
When I go to the "dependencies" project
Then I should see "test 1" in the deferred container
When I edit the dependency of "test 1" to remove "test 2" as predecessor
Then I should not see "test 1" within the dependencies of "test 2"
@ -66,7 +66,7 @@ Feature: dependencies
| test 2 | @pc |
| test 3 | @pc |
And "test 2" depends on "test 1"
When I visit the "dependencies" project
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
When I mark "test 1" as complete
@ -84,7 +84,7 @@ Feature: dependencies
| test 2 | @pc |
| test 3 | @pc |
And "test 2" depends on "test 1"
When I visit the "dependencies" project
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
When I delete the action "test 1"
@ -95,7 +95,7 @@ Feature: dependencies
Scenario: Deleting a successor will update predecessor
Given this is a pending scenario
@selenium @wip
@selenium
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
@ -103,7 +103,7 @@ Feature: dependencies
| test 1 | @pc | no |
| test 2 | @pc | no |
| test 3 | @pc | yes |
When I visit the "dependencies" project
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 project container for "dependencies"

View file

@ -83,7 +83,7 @@ Feature: Edit a next action from every page
Scenario Outline: I can mark a deferred todo complete and it will update empty messages
Given I have a context called "visible context"
And I have a project called "visible project"
When I go to the <page> # not for home page or context because it does not show deferred todos
When I go to the <page>
Then I should see "<empty message>"
When I submit a new deferred action with description "visible todo" to project "visible project" with tags "starred" in the context "visible context"
Then I should see "visible todo"

View file

@ -24,7 +24,7 @@ Feature: View, add, remove notes
Scenario: Link to note
Given I have a project "Pass Final Exam" with 1 note
When I visit the "Pass Final Exam" project
When I go to the "Pass Final Exam" project
And I click the icon next to the note
Then I should see the note text

View file

@ -47,7 +47,7 @@ Feature: Edit a project
Given I have a project "test" with 1 todos
When I go to the projects page
Then the badge should show 2 # "manage me" and "test"
When I visit the "manage me" project
When I go to the "manage me" project
And I try to edit the project name to "test"
Then I should see "Name already exists"

View file

@ -13,22 +13,22 @@ Feature: Add new next action from every page
@selenium
Scenario Outline: I can hide the input form for single next action on a page
When I <action> the <page>
When I go to the <page>
Then the single action form should be visible
When I follow "Hide form"
Then the single action form should not be visible
Scenarios:
| action | page |
| go to | home page |
| go to | tickler page |
| visit | project page for "test project" |
| visit | context page for "test context" |
| go to | tag page for "starred" |
| page |
| home page |
| tickler page |
| "test project" project |
| context page for "test context" |
| tag page for "starred" |
@selenium
Scenario Outline: I can hide the input form for multiple next actions
When I <action> the <page>
When I go to the <page>
Then the single action form should be visible
When I follow "Add multiple next actions"
Then the multiple action form should be visible
@ -37,16 +37,16 @@ Feature: Add new next action from every page
And the multiple action form should not be visible
Scenarios:
| action | page |
| go to | home page |
| go to | tickler page |
| visit | project page for "test project" |
| visit | context page for "test context" |
| go to | tag page for "starred" |
| page |
| home page |
| tickler page |
| "test project" project |
| context page for "test context" |
| tag page for "starred" |
@selenium
Scenario Outline: I can hide the input form and then choose both input forms
When I <action> the <page>
When I go to the <page>
Then the single action form should be visible
When I follow "Hide form"
Then the single action form should not be visible
@ -57,16 +57,16 @@ Feature: Add new next action from every page
And the multiple action form should not be visible
Scenarios:
| action | page |
| go to | home page |
| go to | tickler page |
| visit | project page for "test project" |
| visit | context page for "test context" |
| go to | tag page for "starred" |
| page |
| home page |
| tickler page |
| "test project" project |
| context page for "test context" |
| tag page for "starred" |
@selenium
Scenario Outline: I can switch forms for single next action to multiple next actions
When I <action> the <page>
When I go to the <page>
Then the single action form should be visible
When I follow "Add multiple next actions"
Then the single action form should not be visible
@ -76,30 +76,30 @@ Feature: Add new next action from every page
And the multiple action form should not be visible
Scenarios:
| action | page |
| go to | home page |
| go to | tickler page |
| visit | project page for "test project" |
| visit | context page for "test context" |
| go to | tag page for "starred" |
| page |
| home page |
| tickler page |
| "test project" project |
| context page for "test context" |
| tag page for "starred" |
@selenium
Scenario Outline: I can add a todo from several pages
When I <action> the <page>
When I go to the <page>
And I submit a new action with description "a new next action"
Then I should <see> "a new next action"
Scenarios:
| action | page | see |
| go to | home page | see |
| go to | tickler page | not see |
| visit | project page for "test project" | see |
| visit | context page for "test context" | see |
| go to | tag page for "starred" | not see |
| page | see |
| home page | see |
| tickler page | not see |
| "test project" project | see |
| context page for "test context" | see |
| tag page for "starred" | not see |
@selenium
Scenario Outline: I can add multiple todos from several pages
When I <action> the <page>
When I go to the <page>
And I follow "Add multiple next actions"
And I submit multiple actions with using
"""
@ -112,36 +112,39 @@ Feature: Add new next action from every page
And the number of actions should be <count>
Scenarios:
| action | page | see | badge | count |
| go to | home page | see | 3 | 3 |
| go to | tickler page | not see | 0 | 3 |
| visit | project page for "test project" | see | 3 | 3 |
| visit | context page for "test context" | see | 2 | 3 |
| go to | tag page for "starred" | not see | 0 | 3 |
| page | see | badge | count |
| home page | see | 3 | 3 |
| tickler page | not see | 0 | 3 |
| "test project" project | see | 3 | 3 |
| context page for "test context" | see | 2 | 3 |
| tag page for "starred" | not see | 0 | 3 |
@selenium
Scenario: Adding a todo to another project does not show the todo
Given this is a pending scenario
Scenario: Adding a todo to a hidden project does not show the todo
Given this is a pending scenario
Given I have a project called "another project"
When I go to the "test project" project
And I submit a new action with description "can you see me?" to project "another project" in the context "test context"
Then I should not see "can you see me?"
When I go to the "another project" project
Then I should see "can you see me?"
@selenium
Scenario Outline: Adding a todo with a new context shows the new context
When I <action> the <page>
When I go to the <page>
And I submit a new <todo> with description "do at new context" and the tags "starred" in the context "New"
Then a confirmation for adding a new context "New" should be asked
And the container for the context "New" should <visible>
And the badge should show <badge>
Scenarios:
| action | page | todo | badge | visible |
| go to | home page | action | 2 | be visible |
| go to | tickler page | deferred action | 1 | be visible |
| visit | project page for "test project" | action | 2 | not be visible |
| visit | context page for "test context" | action | 1 | not be visible |
| go to | tag page for "starred" | action | 1 | be visible |
| page | todo | badge | visible |
| home page | action | 2 | be visible |
| tickler page | deferred action | 1 | be visible |
| "test project" project | action | 2 | not be visible |
| context page for "test context" | action | 1 | not be visible |
| tag page for "starred" | action | 1 | be visible |
@selenium
@selenium
Scenario Outline: Adding a todo to a hidden project does not show the todo
Given I have a hidden project called "hidden project"
And I have a project called "visible project"
@ -174,7 +177,7 @@ Feature: Add new next action from every page
When I submit a new action with description "another new todo" in the context "hidden context"
Then I should not see "another new todo"
@selenium
@selenium
Scenario: Adding a todo to a context show the todo in that context page
Given I have a context called "visible context"
And I have a hidden context called "hidden context"

View file

@ -1,8 +1,13 @@
Then /^I should not see the context "([^"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
wait_for :timeout => 5 do
!selenium.is_visible("xpath=//div[@id='c#{context.id}']")
xpath = "//div[@id='c#{context.id}']"
if selenium.is_element_present(xpath) # only check visibility if it is present
wait_for :timeout => 5 do
!selenium.is_visible("xpath=#{xpath}")
end
end
end

View file

@ -55,13 +55,6 @@ Given /^I have the following contexts$/ do |table|
end
end
# TODO: refactor this to paths.rb
When /^I visit the context page for "([^\"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
visit "/contexts/#{context.id}"
end
When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
selenium.click "context_name"
fill_in "value", :with => new_context_name

View file

@ -46,16 +46,6 @@ Given /^I have a hidden project called "([^"]*)"$/ do |project_name|
@project.hide!
end
When /^I visit the "([^\"]*)" project$/ do |project_name|
@project = Project.find_by_name(project_name)
@project.should_not be_nil
visit project_path(@project)
end
When /^I visit the project page for "([^"]*)"$/ do |project_name|
When "I visit the \"#{project_name}\" project"
end
When /^I edit the project description to "([^\"]*)"$/ do |new_description|
click_link "link_edit_project_#{@project.id}"
fill_in "project[description]", :with => new_description

View file

@ -51,6 +51,11 @@ When /^I submit a new action with description "([^"]*)" to project "([^"]*)" wit
submit_next_action_form
end
When /^I submit a new action with description "([^"]*)" to project "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, context_name|
When "I submit a new action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
end
When /^I submit a new action with description "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
fill_in "todo[description]", :with => description