mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-14 16:26:32 +01:00
cleanup old selenium initializer stuff and migrate edit_a_todo
This commit is contained in:
parent
d193e21ee0
commit
d8b5c7d0d2
19 changed files with 501 additions and 191 deletions
|
|
@ -10,7 +10,7 @@ Feature: Edit a next action from every page
|
|||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@pc"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can toggle the star of a todo
|
||||
Given I have a todo "star me" in the context "@home"
|
||||
When I go to the home page
|
||||
|
|
@ -19,7 +19,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the tag page for "starred"
|
||||
Then I should see "star me"
|
||||
|
||||
@selenium
|
||||
@javascript @selenium_only
|
||||
Scenario: I can delete a todo
|
||||
Given I have a todo "delete me" in the context "@home"
|
||||
When I go to the home page
|
||||
|
|
@ -27,8 +27,10 @@ Feature: Edit a next action from every page
|
|||
When I delete the action "delete me"
|
||||
Then I should not see "delete me"
|
||||
|
||||
@selenium
|
||||
@javascript @selenium_only
|
||||
Scenario: Removing the last todo in context will hide context
|
||||
# the go to home page before the last delete was necessary because webkit was not able to
|
||||
# hit the submenu arrow
|
||||
Given I have a todo "delete me" in the context "@home"
|
||||
When I go to the home page
|
||||
Then I should see the container for context "@home"
|
||||
|
|
@ -40,12 +42,15 @@ Feature: Edit a next action from every page
|
|||
Then I should see the container for context "@home"
|
||||
When I edit the context of "delete me" to "@pc"
|
||||
Then I should not see the container for context "@home"
|
||||
When I delete the todo "delete me"
|
||||
And I should see the container for context "@pc"
|
||||
And I should see "delete me" in the context container for "@pc"
|
||||
When I go to the home page
|
||||
And I delete the todo "delete me"
|
||||
Then I should not see "delete me"
|
||||
And I should not see the container for context "@home"
|
||||
And I should not see the container for context "@pc"
|
||||
|
||||
@selenium
|
||||
@javascript @selenium_only
|
||||
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 a project "my project" that has the following todos
|
||||
|
|
@ -53,91 +58,91 @@ Feature: Edit a next action from every page
|
|||
| @home | first action | test, bla |
|
||||
| @home | second action | bla |
|
||||
When I go to the <page>
|
||||
Then I should not see "<empty message>"
|
||||
Then I should not see empty message for <page type> todos
|
||||
And I should see "first action"
|
||||
When I delete the todo "first action"
|
||||
Then I should not see "<empty message>"
|
||||
Then I should not see empty message for <page type> todos
|
||||
When I delete the todo "second action"
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| "my project" project | Currently there are no incomplete actions in this project |
|
||||
| context page for "@home" | Currently there are no incomplete actions in this context |
|
||||
| tag page for "bla" | No actions found |
|
||||
| page | page type |
|
||||
| "my project" project | project |
|
||||
| context page for "@home" | context |
|
||||
| tag page for "bla" | tag |
|
||||
|
||||
@selenium
|
||||
@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"
|
||||
When I go to the <page>
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
When I submit a new action with description "visible todo" to project "visible project" with tags "starred" in the context "visible context"
|
||||
Then I should see "visible todo"
|
||||
And I should not see "<empty message>"
|
||||
And I should not see empty message for <page type> todos
|
||||
When I mark "visible todo" as complete
|
||||
And I should see "<empty message>"
|
||||
And I should see empty message for <page type> todos
|
||||
And I should see "visible todo" in the completed container
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| "visible project" project | Currently there are no incomplete actions in this project |
|
||||
| home page | Currently there are no incomplete actions |
|
||||
| tag page for "starred" | No actions found |
|
||||
| context page for "visible context" | Currently there are no incomplete actions in this context |
|
||||
| page | page type |
|
||||
| "visible project" project | project |
|
||||
| home page | home |
|
||||
| tag page for "starred" | tag |
|
||||
| context page for "visible context" | context |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
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>
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> deferred todos
|
||||
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"
|
||||
And I should not see "<empty message>"
|
||||
And I should not see empty message for <page type> deferred todos
|
||||
When I mark "visible todo" as complete
|
||||
And I should see "<empty message>"
|
||||
And I should see empty message for <page type> deferred todos
|
||||
And I should see "visible todo" in the completed container
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| tag page for "starred" | Currently there are no deferred or pending actions |
|
||||
| "visible project" project | Currently there are no deferred or pending actions |
|
||||
| page | page type |
|
||||
| tag page for "starred" | tag |
|
||||
| "visible project" project | project |
|
||||
|
||||
@selenium
|
||||
@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"
|
||||
When I go to the <page>
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
And I should not see the container for context "visible context"
|
||||
And I should not see "<empty completed message>"
|
||||
And I should not see empty message for <page type> completed todos
|
||||
When I mark the complete todo "visible todo" active
|
||||
Then I should see the container for context "visible context"
|
||||
And I should see "<empty completed message>"
|
||||
And I should see empty message for <page type> completed todos
|
||||
And I should see "visible todo" in the context container for "visible context"
|
||||
And I should not see "<empty message>"
|
||||
And I should not see empty message for <page type> todos
|
||||
|
||||
Scenarios:
|
||||
| page | empty message | empty completed message |
|
||||
| tag page for "starred" | No actions found | Currently there are no completed actions |
|
||||
| home page | No actions found | Currently there are no completed actions |
|
||||
| page | page type |
|
||||
| tag page for "starred" | tag |
|
||||
| home page | home |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without context 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>"
|
||||
And I should not see "<empty completed message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
And I should not see empty message for <page type> completed todos
|
||||
When I mark the complete todo "visible todo" active
|
||||
And I should see "<empty completed message>"
|
||||
And I should not see "<empty message>"
|
||||
And I should see empty message for <page type> completed todos
|
||||
And I should not see empty message for <page type> todos
|
||||
|
||||
Scenarios:
|
||||
| page | empty message | empty completed message |
|
||||
| context page for "visible context" | Currently there are no incomplete actions in this context | Currently there are no completed actions |
|
||||
| "visible project" project | Currently there are no incomplete actions in this project | Currently there are no completed actions |
|
||||
| page | page type |
|
||||
| context page for "visible context" | context |
|
||||
| "visible project" project | project |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can edit a todo to change its description
|
||||
# do for more pages, see #1094
|
||||
Given I have a todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context" that is due next week
|
||||
|
|
@ -154,7 +159,7 @@ Feature: Edit a next action from every page
|
|||
| tag page for "starred" |
|
||||
| calendar page |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can edit a todo to move it to another context
|
||||
Given I have a context called "@laptop"
|
||||
And I have a project "my project" that has the following todos
|
||||
|
|
@ -172,7 +177,7 @@ Feature: Edit a next action from every page
|
|||
| home page |
|
||||
| tag page for "bla" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit a todo to move it to another context in tickler page
|
||||
Given I have a context called "@laptop"
|
||||
And I have a project "my project" that has the following deferred todos
|
||||
|
|
@ -185,7 +190,7 @@ Feature: Edit a next action from every page
|
|||
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"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit a todo to move it to another project
|
||||
Given I have a project called "project one"
|
||||
And I have a project "project two" with 1 todos
|
||||
|
|
@ -195,7 +200,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the "project one" project
|
||||
Then I should see "todo 1"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit a todo to move it to the tickler
|
||||
When I go to the home page
|
||||
And I submit a new action with description "start later" in the context "@pc"
|
||||
|
|
@ -204,7 +209,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the tickler page
|
||||
Then I should see "start later"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can defer a todo
|
||||
When I go to the home page
|
||||
And I submit a new action with description "start later" in the context "@pc"
|
||||
|
|
@ -213,7 +218,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the tickler page
|
||||
Then I should see "start later"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can make a project from a todo
|
||||
When I go to the home page
|
||||
And I submit a new action with description "buy mediacenter" in the context "@pc"
|
||||
|
|
@ -223,16 +228,16 @@ Feature: Edit a next action from every page
|
|||
When I go to the projects page
|
||||
Then I should see "buy mediacenter"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can show the notes of a todo
|
||||
Given I have a todo "read the notes" with notes "several things to read"
|
||||
When I go to the home page
|
||||
Then I should see "read the notes"
|
||||
And I should not see "several things to read"
|
||||
And I should not see the notes of "read the notes"
|
||||
When I open the notes of "read the notes"
|
||||
Then I should see "several things to read"
|
||||
Then I should see the notes of "read the notes"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can tag a todo
|
||||
Given I have a todo "tag me"
|
||||
When I go to the home page
|
||||
|
|
@ -248,7 +253,7 @@ Feature: Edit a next action from every page
|
|||
When I follow "taga"
|
||||
Then I should be on the tag page for "taga"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit the tags of a todo
|
||||
Given I have a todo "tag you are it" in context "@tags" with tags "taga, tagb"
|
||||
When I go to the home page
|
||||
|
|
@ -258,7 +263,7 @@ Feature: Edit a next action from every page
|
|||
And I should see "tagb"
|
||||
And I should see "tagc"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: Editing the context of a todo to a new context will show new context
|
||||
Given I have a todo "moving" in context "@pc" with tags "tag"
|
||||
When I go to the <page>
|
||||
|
|
@ -270,14 +275,14 @@ Feature: Edit a next action from every page
|
|||
| home page |
|
||||
| tag page for "tag" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Editing the context of a todo in the tickler to a new context will show new context
|
||||
Given I have a deferred todo "moving" in context "@pc" with tags "tag"
|
||||
When I go to the tickler page
|
||||
And I edit the context of "moving" to "@new"
|
||||
And I should see the container for context "@new"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Making an error when editing a todo will show error message
|
||||
Given I have a todo "test"
|
||||
When I go to the home page
|
||||
|
|
|
|||
|
|
@ -19,24 +19,19 @@ Then /^I should not see the context "([^"]*)"$/ do |context_name|
|
|||
context.should_not be_nil
|
||||
|
||||
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
|
||||
page.should_not have_xpath(xpath, :visible => true)
|
||||
end
|
||||
|
||||
Then /^I should not see the container for context "([^"]*)"$/ do |context_name|
|
||||
Then "I should not see the context \"#{context_name}\""
|
||||
step "I should not see the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^I should not see the context container for "([^"]*)"$/ do |context_name|
|
||||
Then "I should not see the context \"#{context_name}\""
|
||||
step "I should not see the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name|
|
||||
Then "I should not see the context \"#{context_name}\""
|
||||
step "I should not see the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^I should see the container for context "([^"]*)"$/ do |context_name|
|
||||
|
|
@ -48,7 +43,7 @@ Then /^I should see the container for context "([^"]*)"$/ do |context_name|
|
|||
end
|
||||
|
||||
Then /^the container for the context "([^"]*)" should be visible$/ do |context_name|
|
||||
Then "I should see the container for context \"#{context_name}\""
|
||||
step "I should see the container for context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^I should see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_description, context_name|
|
||||
|
|
@ -57,7 +52,7 @@ Then /^I should see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_
|
|||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
xpath = "//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
page.should have_xpath(xpath)
|
||||
end
|
||||
|
||||
|
|
@ -67,7 +62,7 @@ Then /^I should not see "([^"]*)" in the context container for "([^"]*)"$/ do |t
|
|||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
xpath = "//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
page.should_not have_xpath(xpath)
|
||||
end
|
||||
|
||||
|
|
@ -168,7 +163,7 @@ Then /^I should see "([^"]*)" in the active recurring todos container$/ do |repe
|
|||
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
|
||||
selenium.is_visible(xpath).should be_true
|
||||
else
|
||||
Then "I should not see \"#{repeat_pattern}\""
|
||||
step "I should not see \"#{repeat_pattern}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -180,7 +175,7 @@ Then /^I should not see "([^"]*)" in the completed recurring todos container$/ d
|
|||
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
|
||||
selenium.is_visible(xpath).should be_true
|
||||
else
|
||||
Then "I should not see \"#{repeat_pattern}\""
|
||||
step "I should not see \"#{repeat_pattern}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Given /^there exists an active context called "([^"]*)" for user "([^"]*)"$/ do
|
|||
end
|
||||
|
||||
Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
|
||||
Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
|
||||
step "there exists an active context called \"#{context_name}\" for user \"#{login}\""
|
||||
end
|
||||
|
||||
Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
|
||||
|
|
@ -20,20 +20,20 @@ Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |
|
|||
end
|
||||
|
||||
Given /^I have a context called "([^\"]*)"$/ do |context_name|
|
||||
Given "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have an active context called "([^\"]*)"$/ do |context_name|
|
||||
Given "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have a hidden context called "([^\"]*)"$/ do |context_name|
|
||||
Given "there exists a hidden context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists a hidden context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have the following contexts:$/ do |table|
|
||||
table.hashes.each do |context|
|
||||
Given 'I have a context called "'+context[:context]+'"'
|
||||
step 'I have a context called "'+context[:context]+'"'
|
||||
@context.hide = context[:hide] == "true" unless context[:hide].blank?
|
||||
# acts_as_list puts the last added context at the top, but we want it
|
||||
# at the bottom to be consistent with the table in the scenario
|
||||
|
|
@ -43,7 +43,7 @@ Given /^I have the following contexts:$/ do |table|
|
|||
end
|
||||
|
||||
Given /^I have the following contexts$/ do |table|
|
||||
Given("I have the following contexts:", table)
|
||||
step("I have the following contexts:", table)
|
||||
end
|
||||
|
||||
Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number_of_actions|
|
||||
|
|
@ -60,13 +60,29 @@ When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
|
|||
end
|
||||
|
||||
Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
|
||||
Then "I should see \"#{context_name}\""
|
||||
step "I should see \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^he should see that a context named "([^\"]*)" is present$/ do |context_name|
|
||||
Then "I should see \"#{context_name}\""
|
||||
step "I should see \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
|
||||
Then "I should not see \"#{context_name} (\""
|
||||
end
|
||||
step "I should not see \"#{context_name} (\""
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for context todos/ do
|
||||
find("div#c#{@context.id}empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for context todos/ do
|
||||
find("div#c#{@context.id}empty-nd").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for context completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
When /^I should see empty message for context completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
|
||||
When "I go to the login page"
|
||||
step "I go to the login page"
|
||||
fill_in "Login", :with => username
|
||||
fill_in "Password", :with => password
|
||||
uncheck "Stay logged in:"
|
||||
|
|
@ -28,5 +28,5 @@ When /^my session expires$/ do
|
|||
end
|
||||
|
||||
When /^I log out of Tracks$/ do
|
||||
When "I go to the logout page"
|
||||
step "I go to the logout page"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Given /^I have a project "([^\"]*)" with ([0-9]+) todos$/ do |project_name, num_
|
|||
end
|
||||
|
||||
Given /^I have a project "([^\"]*)" with ([0-9]+) deferred todos$/ do |project_name, num_todos|
|
||||
Given "I have a project \"#{project_name}\" with #{num_todos} todos"
|
||||
step "I have a project \"#{project_name}\" with #{num_todos} todos"
|
||||
@todos.each do |todo|
|
||||
todo.show_from = Time.zone.now + 1.week
|
||||
todo.save!
|
||||
|
|
@ -39,15 +39,15 @@ end
|
|||
|
||||
Given /^there exists a project called "([^"]*)" for user "([^"]*)"$/ do |project_name, login|
|
||||
# TODO: regexp change to integrate this with the previous since only 'called' is different
|
||||
Given "there exists a project \"#{project_name}\" for user \"#{login}\""
|
||||
step "there exists a project \"#{project_name}\" for user \"#{login}\""
|
||||
end
|
||||
|
||||
Given /^I have a project called "([^"]*)"$/ do |project_name|
|
||||
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" with a default context of "([^"]*)"$/ do |project_name, context_name|
|
||||
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
context = @current_user.contexts.create!(:name => context_name)
|
||||
@project.default_context = context
|
||||
@project.save!
|
||||
|
|
@ -55,7 +55,7 @@ end
|
|||
|
||||
Given /^I have the following projects:$/ do |table|
|
||||
table.hashes.each do |project|
|
||||
Given 'I have a project called "'+project[:project_name]+'"'
|
||||
step 'I have a project called "'+project[:project_name]+'"'
|
||||
# acts_as_list puts the last added project at the top, but we want it
|
||||
# at the bottom to be consistent with the table in the scenario
|
||||
@project.move_to_bottom
|
||||
|
|
@ -64,7 +64,7 @@ Given /^I have the following projects:$/ do |table|
|
|||
end
|
||||
|
||||
Given /^I have a completed project called "([^"]*)"$/ do |project_name|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
step "I have a project called \"#{project_name}\""
|
||||
@project.complete!
|
||||
@project.reload
|
||||
assert @project.completed?
|
||||
|
|
@ -72,7 +72,7 @@ end
|
|||
|
||||
Given /^I have (\d+) completed projects$/ do |number_of_projects|
|
||||
1.upto number_of_projects.to_i do |i|
|
||||
Given "I have a completed project called \"Project #{i}\""
|
||||
step "I have a completed project called \"Project #{i}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -166,6 +166,30 @@ When /^I edit the default context to "([^"]*)"$/ do |default_context|
|
|||
end
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for project todos/ do
|
||||
find("div#p#{@project.id}empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for project todos/ do
|
||||
find("div#p#{@project.id}empty-nd").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for project deferred todos/ do
|
||||
find("div#tickler-empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for project deferred todos/ do
|
||||
find("div#tickler-empty-nd").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for project completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
When /^I should see empty message for project completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
||||
Then /^I edit the default tags to "([^"]*)"$/ do |default_tags|
|
||||
click_link "link_edit_project_#{@project.id}"
|
||||
|
||||
|
|
@ -188,13 +212,13 @@ end
|
|||
When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
|
||||
@project = @current_user.projects.find_by_name(project_current_name)
|
||||
@project.should_not be_nil
|
||||
When "I edit the project name to \"#{project_new_name}\""
|
||||
step "I edit the project name to \"#{project_new_name}\""
|
||||
end
|
||||
|
||||
When /^I try to edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
|
||||
@project = @current_user.projects.find_by_name(project_current_name)
|
||||
@project.should_not be_nil
|
||||
When "I try to edit the project name to \"#{project_new_name}\""
|
||||
step "I try to edit the project name to \"#{project_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name|
|
||||
|
|
@ -222,17 +246,17 @@ When /^I edit the project settings$/ do
|
|||
end
|
||||
|
||||
Then /^I should not be able to change the project name in place$/ do
|
||||
When "I click to edit the project name in place"
|
||||
found = selenium.element? "xpath=//div[@id='project_name']/form/input"
|
||||
!found
|
||||
step "I click to edit the project name in place"
|
||||
found = selenium.element? "xpath=//div[@id='project_name']/form/input"
|
||||
!found
|
||||
end
|
||||
|
||||
When /^I close the project settings$/ do
|
||||
@project.should_not be_nil
|
||||
click_link "Cancel"
|
||||
wait_for :wait_for => :effects , :javascript_framework => 'jquery' do
|
||||
true
|
||||
end
|
||||
@project.should_not be_nil
|
||||
click_link "Cancel"
|
||||
wait_for :wait_for => :effects , :javascript_framework => 'jquery' do
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -319,5 +343,5 @@ Then /^the project title should be "(.*)"$/ do |title|
|
|||
end
|
||||
|
||||
Then /^I should see the project name is "([^"]*)"$/ do |project_name|
|
||||
Then "the project title should be \"#{project_name}\""
|
||||
step "the project title should be \"#{project_name}\""
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, cont
|
|||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |description, context_name, tag_names|
|
||||
Given "I have a todo \"#{description}\" in the context \"#{context_name}\""
|
||||
step "I have a todo \"#{description}\" in the context \"#{context_name}\""
|
||||
@todo.tag_with(tag_names)
|
||||
@todo.save!
|
||||
end
|
||||
|
|
@ -37,24 +37,24 @@ Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "
|
|||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)"$/ do |description|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
step "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
end
|
||||
|
||||
Given /^I have the following todos:$/ do |table|
|
||||
table.hashes.each do | todo |
|
||||
Given "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\""
|
||||
step "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\""
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" with notes "([^"]*)"$/ do |description, notes|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
step "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
@todo.notes = notes
|
||||
@todo.save!
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) todos$/ do |count|
|
||||
count.to_i.downto 1 do |i|
|
||||
Given "I have a todo \"todo #{i}\" in the context \"Context A\""
|
||||
step "I have a todo \"todo #{i}\" in the context \"Context A\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags
|
|||
end
|
||||
|
||||
Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)" that is due next week$/ do |action_description, project_name, tags, context_name|
|
||||
Given "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
@todo.due = @current_user.time + 1.week
|
||||
@todo.save!
|
||||
end
|
||||
|
|
@ -91,11 +91,11 @@ Given /^I have a deferred todo "([^"]*)" in the context "([^"]*)"$/ do |descript
|
|||
end
|
||||
|
||||
Given /^I have a deferred todo "([^"]*)"$/ do |description|
|
||||
Given "I have a deferred todo \"#{description}\" in the context \"context B\""
|
||||
step "I have a deferred todo \"#{description}\" in the context \"context B\""
|
||||
end
|
||||
|
||||
Given /^I have a deferred todo "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |action_description, context_name, tag_list|
|
||||
Given "I have a todo \"#{action_description}\" in context \"#{context_name}\" with tags \"#{tag_list}\""
|
||||
step "I have a todo \"#{action_description}\" in context \"#{context_name}\" with tags \"#{tag_list}\""
|
||||
@todo.show_from = @current_user.time + 1.week
|
||||
@todo.save!
|
||||
end
|
||||
|
|
@ -118,13 +118,13 @@ Given /^I have ([0-9]+) completed todos in project "([^"]*)" in context "([^"]*)
|
|||
end
|
||||
|
||||
Given /^I have a completed todo "([^"]*)" in project "([^"]*)" in context "([^"]*)"$/ do |action_description, project_name, context_name|
|
||||
Given "I have 1 completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
step "I have 1 completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
@todos[0].description = action_description
|
||||
@todos[0].save!
|
||||
end
|
||||
|
||||
Given /^I have (\d+) completed todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |count, project_name, context_name, tags|
|
||||
Given "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
step "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
@todos.each { |t| t.tag_with(tags); t.save! }
|
||||
end
|
||||
|
||||
|
|
@ -139,29 +139,29 @@ Given /^I have ([0-9]+) completed todos in context "([^"]*)"$/ do |count, contex
|
|||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos$/ do |count|
|
||||
Given "I have a context called \"context D\""
|
||||
Given "I have #{count} completed todos in context \"context D\""
|
||||
step "I have a context called \"context D\""
|
||||
step "I have #{count} completed todos in context \"context D\""
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos with a note$/ do |count|
|
||||
Given "I have #{count} completed todos"
|
||||
step "I have #{count} completed todos"
|
||||
@todos.each { |t| t.notes = "note #{t.id}"; t.save!}
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos with a note in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |count, project_name, context_name, tags|
|
||||
Given "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\" with tags \"#{tags}\""
|
||||
step "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\" with tags \"#{tags}\""
|
||||
@todos.each { |t| t.notes = "note #{t.id}"; t.save! }
|
||||
end
|
||||
|
||||
Given /^I have a completed todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |action_description, project_name, tags, context_name|
|
||||
Given "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
@todo.complete!
|
||||
end
|
||||
|
||||
####### PROJECT WITH TODOS ######
|
||||
|
||||
Given /^I have a project "([^"]*)" that has the following todos$/ do |project_name, todos|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
step "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])
|
||||
|
|
@ -181,7 +181,7 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
|
|||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" that has the following deferred todos$/ do |project_name, todos|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
step "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])
|
||||
|
|
@ -255,10 +255,9 @@ When /^I submit a new action with description "([^"]*)" to project "([^"]*)" wit
|
|||
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}\""
|
||||
step "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
|
||||
|
||||
|
|
@ -302,7 +301,7 @@ When /^I submit a new deferred action with description "([^"]*)" to project "([^
|
|||
end
|
||||
|
||||
When /^I submit a deferred new action with description "([^"]*)" to project "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, context_name|
|
||||
When "I submit a new deferred action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
|
||||
step "I submit a new deferred action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
####### submitting using sidebar form: MULTIPLE ACTIONS #######
|
||||
|
|
@ -320,7 +319,7 @@ When /^I fill the multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "(
|
|||
end
|
||||
|
||||
When /^I submit the new multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags|
|
||||
When "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\""
|
||||
step "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\""
|
||||
submit_multiple_next_action_form
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ When /^I mark "([^"]*)" as uncompleted$/ do |action_description|
|
|||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
check "mark_complete_#{todo.id}"
|
||||
uncheck "mark_complete_#{todo.id}"
|
||||
|
||||
wait_for_ajax
|
||||
end
|
||||
|
||||
When /^I mark the complete todo "([^"]*)" active$/ do |action_description|
|
||||
When "I mark \"#{action_description}\" as uncompleted"
|
||||
step "I mark \"#{action_description}\" as uncompleted"
|
||||
end
|
||||
|
||||
####### (UN)STARRING #######
|
||||
|
|
@ -31,14 +31,15 @@ When /^I star the action "([^"]*)"$/ do |action_description|
|
|||
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
|
||||
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
|
||||
|
||||
selenium.is_element_present(xpath_unstarred).should be_true
|
||||
page.should have_xpath(xpath_unstarred)
|
||||
|
||||
star_img = "//img[@id='star_img_#{todo.id}']"
|
||||
selenium.click(star_img, :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(xpath_starred)
|
||||
end
|
||||
page.find(:xpath, star_img).click
|
||||
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
|
||||
page.should have_xpath(xpath_starred)
|
||||
end
|
||||
|
||||
When /^I unstar the action "([^"]*)"$/ do |action_description|
|
||||
|
|
@ -72,11 +73,11 @@ When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo
|
|||
end
|
||||
|
||||
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}\""
|
||||
step "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}\""
|
||||
step "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|
|
||||
|
|
@ -92,7 +93,9 @@ When /^I try to edit the description of "([^"]*)" to "([^"]*)"$/ do |action_desc
|
|||
todo.should_not be_nil
|
||||
open_edit_form_for(todo)
|
||||
fill_in "todo_description", :with => new_description
|
||||
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
submit_button_xpath = "//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']"
|
||||
page.find(:xpath, submit_button_xpath).click
|
||||
wait_for_ajax
|
||||
# do not wait for form to disappear to be able to test failures
|
||||
end
|
||||
|
||||
|
|
@ -107,12 +110,12 @@ end
|
|||
|
||||
When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description|
|
||||
date = format_date(Time.zone.now + 1.day)
|
||||
When "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
step "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
end
|
||||
|
||||
When /^I edit the due date of "([^"]*)" to next month$/ do |action_description|
|
||||
date = format_date(Time.zone.now + 1.month)
|
||||
When "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
step "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
end
|
||||
|
||||
When /^I clear the due date of "([^"]*)"$/ do |action_description|
|
||||
|
|
@ -141,23 +144,24 @@ When /^I remove the show from date from "([^"]*)"$/ do |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)
|
||||
page.find("//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img").click
|
||||
|
||||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
||||
When /^I clear the show from date of "([^"]*)"$/ do |action_description|
|
||||
When "I remove the show from date from \"#{action_description}\""
|
||||
step "I remove the show from date from \"#{action_description}\""
|
||||
end
|
||||
|
||||
When /^I defer "([^"]*)" for 1 day$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
defer_todo_1day_button = "xpath=//a[@id='defer_1_todo_#{todo.id}']/img"
|
||||
selenium.click defer_todo_1day_button
|
||||
open_submenu_for(todo)
|
||||
click_link "defer_1_todo_#{todo.id}"
|
||||
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
When /^I edit the tags of "([^"]*)" to "([^"]*)"$/ do |action_description, tags|
|
||||
|
|
@ -173,19 +177,17 @@ When /^I make a project of "([^"]*)"$/ do |action_description|
|
|||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
make_project_button = "xpath=//a[@id='to_project_todo_#{todo.id}']/img"
|
||||
selenium.click make_project_button
|
||||
open_submenu_for(todo)
|
||||
click_link "to_project_todo_#{todo.id}"
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present("//div[@id='line_todo_#{todo.id}']")
|
||||
end
|
||||
page.should have_no_css("div#line_todo_#{todo.id}")
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
####### THEN #######
|
||||
|
||||
Then /^I should see an error message$/ do
|
||||
error_block = "xpath=//form/div[@id='edit_error_status']"
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(error_block)
|
||||
end
|
||||
error_block = "//form/div[@id='edit_error_status']"
|
||||
page.find(:xpath, error_block).should_not be_nil
|
||||
end
|
||||
|
|
@ -6,7 +6,7 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
|
|||
|
||||
handle_js_confirm do
|
||||
open_submenu_for(todo)
|
||||
find("a#delete_todo_#{todo.id}").click
|
||||
click_link "delete_todo_#{todo.id}"
|
||||
end
|
||||
get_confirm_text.should == "Are you sure that you want to delete the action '#{todo.description}'?"
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
|
|||
end
|
||||
|
||||
When /^I delete the todo "([^"]*)"$/ do |action_description|
|
||||
When "I delete the action \"#{action_description}\""
|
||||
step "I delete the action \"#{action_description}\""
|
||||
end
|
||||
|
||||
####### Notes #######
|
||||
|
|
@ -24,11 +24,10 @@ When /^I open the notes of "([^"]*)"$/ do |action_description|
|
|||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
show_notes_img = "xpath=//div[@id='line_todo_#{todo.id}']/div/a/img"
|
||||
selenium.click show_notes_img
|
||||
page.find(:xpath, "//div[@id='line_todo_#{todo.id}']/div/a/img").click
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_visible "//div[@id='notes_todo_#{todo.id}']"
|
||||
wait_until do
|
||||
page.find(:xpath, "//div[@id='notes_todo_#{todo.id}']").visible?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ Then /^I should see a starred "([^"]*)"$/ do |action_description|
|
|||
|
||||
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
|
||||
|
||||
selenium.is_element_present(xpath_starred).should be_true
|
||||
page.should have_xpath(xpath_starred)
|
||||
end
|
||||
|
||||
Then /^I should see an unstarred "([^"]*)"$/ do |action_description|
|
||||
|
|
@ -178,3 +177,36 @@ Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |
|
|||
xpath = "//div[@id='completed_container']//a[@href='/todos/#{todo.id}.m']"
|
||||
response.should have_xpath xpath
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for home todos/ do
|
||||
find("div#no_todos_in_view").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for home todos/ do
|
||||
find("div#no_todos_in_view").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for home completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for home completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see the notes of "([^"]*)"$/ do |todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
page.find("div#notes_todo_#{todo.id}").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see the notes of "([^"]*)"$/ do |todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
page.find("div#notes_todo_#{todo.id}").should be_visible
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
Then /^I should not see empty message for tag todos/ do
|
||||
find("div#no_todos_in_view").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for tag todos/ do
|
||||
find("div#no_todos_in_view").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for tag completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for tag completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for tag deferred todos$/ do
|
||||
find("div#tickler-empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for tag deferred todos$/ do
|
||||
find("div#tickler-empty-nd").should be_visible
|
||||
end
|
||||
|
|
@ -31,6 +31,8 @@ end
|
|||
# steps to use the XPath syntax.
|
||||
Capybara.default_selector = :css
|
||||
|
||||
Capybara.prefer_visible_elements = true
|
||||
|
||||
# If you set this to false, any error raised from within your app will bubble
|
||||
# up to your step definition and out to cucumber unless you catch it somewhere
|
||||
# on the way. You can make Rails rescue errors and render error pages on a
|
||||
|
|
|
|||
|
|
@ -93,13 +93,16 @@ module NavigationHelpers
|
|||
feeds_path(options)
|
||||
when /the context page for "([^\"]*)" for user "([^\"]*)"/i
|
||||
@source_view = "context"
|
||||
context_path(User.find_by_login($2).contexts.find_by_name($1), options)
|
||||
@context = User.find_by_login($2).contexts.find_by_name($1)
|
||||
context_path(@context, options)
|
||||
when /the context page for "([^\"]*)"/i
|
||||
@source_view = "context"
|
||||
context_path(@current_user.contexts.find_by_name($1), options)
|
||||
@context = @current_user.contexts.find_by_name($1)
|
||||
context_path(@context, options)
|
||||
when /the "([^\"]*)" project for user "([^\"]*)"/i
|
||||
@source_view = "project"
|
||||
project_path(User.find_by_login($2).projects.find_by_name($1), options)
|
||||
@project = User.find_by_login($2).projects.find_by_name($1)
|
||||
project_path(@project, options)
|
||||
when /the "([^\"]*)" project/i
|
||||
@source_view = "project"
|
||||
@project = @current_user.projects.find_by_name($1)
|
||||
|
|
|
|||
19
features/support/selenium.rb
Normal file
19
features/support/selenium.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
if ENV["RAILS_ENV"] == "selenium"
|
||||
puts "Configuring to use Selenium with Webrat for Cucumber stories"
|
||||
Webrat.configure do |config|
|
||||
config.mode = :selenium
|
||||
|
||||
config.application_environment = :selenium
|
||||
# use only if you run a separate rails test server instance and do not
|
||||
# want webrat to start one for you
|
||||
# config.application_port = 3001
|
||||
|
||||
config.selenium_browser_startup_timeout = 30
|
||||
# use only if you run a separate selenium server instance and do not
|
||||
# want webrat to start one for you
|
||||
# config.selenium_server_address = "localhost"
|
||||
# config.selenium_server_port = "4444"
|
||||
end
|
||||
|
||||
Cucumber::Rails::World.use_transactional_fixtures = false
|
||||
end
|
||||
|
|
@ -7,7 +7,8 @@ module TracksStepHelper
|
|||
within("#todo-form-new-action") do
|
||||
click_button("todo_new_action_submit")
|
||||
end
|
||||
sleep(1)
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def submit_new_context_form
|
||||
|
|
@ -30,7 +31,6 @@ module TracksStepHelper
|
|||
click_button "submit_todo_#{todo.id}"
|
||||
end
|
||||
wait_for_form_to_go_away(todo)
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def format_date(date)
|
||||
|
|
@ -85,9 +85,17 @@ module TracksStepHelper
|
|||
end
|
||||
|
||||
def open_submenu_for(todo)
|
||||
within "div#line_todo_#{todo.id}" do
|
||||
find("img#todo-submenu").click
|
||||
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
|
||||
page.find(submenu_arrow).should be_visible
|
||||
|
||||
page.find(submenu_arrow).click
|
||||
|
||||
# wait for the submenu to be visible
|
||||
wait_until do
|
||||
page.find("div#line_todo_#{todo.id} ul#ultodo_#{todo.id}").visible?
|
||||
end
|
||||
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def context_list_find_index(context_name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue