mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-10 19:28:51 +01:00
add some more cucumber scenarios
This commit is contained in:
parent
64069ba52a
commit
b68fa2a6ae
5 changed files with 122 additions and 23 deletions
|
|
@ -65,6 +65,9 @@ function add_todo_to_context(next_steps) {
|
|||
$("#<%= empty_container_msg_div_id(@todo) %>").slideUp(100);
|
||||
highlight_updated_todo(next_steps);
|
||||
<% end -%>
|
||||
<% if @completed_count == 0 -%>
|
||||
$("#empty-d").slideDown(100);
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
function add_new_recurring_todo(next_steps) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,14 @@ Feature: Edit a next action from every page
|
|||
| testuser | secret | false |
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
|
||||
@selenium
|
||||
Scenario: I can toggle the star of a todo
|
||||
Given this is a pending scenario
|
||||
Given I have a todo "star me" in the context "@home"
|
||||
When I go to the home page
|
||||
And I star the action "star me"
|
||||
Then I should see a starred "star me"
|
||||
When I go to the tag page for "starred"
|
||||
Then I should see "star me"
|
||||
|
||||
@selenium
|
||||
Scenario: I can delete a todo
|
||||
|
|
@ -83,7 +89,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>
|
||||
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"
|
||||
|
|
@ -93,34 +99,62 @@ Feature: Edit a next action from every page
|
|||
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 | 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 |
|
||||
|
||||
@selenium @wip
|
||||
Scenario Outline: I can mark a completed todo active and it will update empty messages
|
||||
Given I have a completed todo with description "visible todo" to project "visible project" with tags "test" in the context "visible context"
|
||||
@selenium
|
||||
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>"
|
||||
And I should not see "visible context"
|
||||
And I should see "<empty completed message>"
|
||||
And I should not see the container for context "visible context"
|
||||
And I should not see "<empty completed message>"
|
||||
When I mark the complete todo "visible todo" active
|
||||
Then I should see "visible context"
|
||||
Then I should see the container for context "visible context"
|
||||
And I should see "<empty completed message>"
|
||||
And I should see "visible todo" in the context container for "visible context"
|
||||
And I should not see "<empty message>"
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| tag page for "starred" | No actions found |
|
||||
| home page | No actions found |
|
||||
| context page for "visible context" | Currently there are no deferred or pending actions |
|
||||
| project page for "visible project" | Currently there are no deferred or pending actions |
|
||||
| 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 |
|
||||
|
||||
Scenario: I can edit a todo to change its description # do for more pages, see #1094
|
||||
Given this is a pending scenario
|
||||
@selenium
|
||||
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>"
|
||||
When I mark the complete todo "visible todo" active
|
||||
And I should see "<empty completed message>"
|
||||
And I should not see "<empty message>"
|
||||
|
||||
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 |
|
||||
|
||||
@selenium
|
||||
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
|
||||
When I go to the <page>
|
||||
And I edit the description of "visible todo" to "changed todo"
|
||||
Then I should not see "visible todo"
|
||||
And I should see "changed todo"
|
||||
|
||||
Scenarios:
|
||||
| page |
|
||||
| home page |
|
||||
| context page for "visible context" |
|
||||
| "visible project" project |
|
||||
| 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
|
||||
|
||||
Scenario: I can edit a todo to move it to another project
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ When /^I edit the context of "([^"]*)" to "([^"]*)"$/ do |context_old_name, cont
|
|||
When "I change the context_name field of \"#{context_old_name}\" to \"#{context_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
open_edit_form_for(todo)
|
||||
fill_in "todo_description", :with => new_description
|
||||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
||||
When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
|
|
|||
|
|
@ -52,6 +52,25 @@ Given /^I have ([0-9]+) completed todos with a note$/ do |count|
|
|||
end
|
||||
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.find_or_create(:name => context_name)
|
||||
project = @current_user.projects.find_or_create(:name => project_name)
|
||||
@todo = @current_user.todos.create!(:context_id => context.id, :project_id => project.id, :description => action_description)
|
||||
@todo.tag_with(tags)
|
||||
@todo.save
|
||||
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}\""
|
||||
@todo.due = @current_user.time + 1.week
|
||||
@todo.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}\""
|
||||
@todo.complete!
|
||||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" that has the following todos$/ do |project_name, todos|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
@project.should_not be_nil
|
||||
|
|
@ -87,21 +106,54 @@ When /^I mark "([^"]*)" as complete$/ do |action_description|
|
|||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present("//div[@id='#{todo_container}']//div[@id='line_todo_#{todo.id}']")
|
||||
end
|
||||
# note that animations could be running after finishing this
|
||||
end
|
||||
|
||||
When /^I mark "([^"]*)" as uncompleted$/ do |action_description|
|
||||
# TODO: generalize. this currently only works for context wrt xpath
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
check "mark_complete_#{todo.id}"
|
||||
|
||||
xpath="//div[@id='c#{todo.context_id}items']//div[@id='line_todo_#{todo.id}']"
|
||||
todo_container = "fail" # fail this test if @source_view is wrong
|
||||
todo_container = "p#{todo.project_id}items" if @source_view=="project"
|
||||
todo_container = "c#{todo.context_id}items" if @source_view=="context" || @source_view=="todos" || @source_view=="tag"
|
||||
|
||||
todo_container.should_not == "fail"
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(xpath)
|
||||
selenium.is_element_present("//div[@id='#{todo_container}']//div[@id='line_todo_#{todo.id}']")
|
||||
end
|
||||
# note that animations could be running after finishing this
|
||||
end
|
||||
|
||||
When /^I mark the complete todo "([^"]*)" active$/ do |action_description|
|
||||
When "I mark \"#{action_description}\" as uncompleted"
|
||||
end
|
||||
|
||||
|
||||
When /^I star the action "([^"]*)"$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='unstarred_todo']"
|
||||
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='starred_todo']"
|
||||
|
||||
selenium.is_element_present(xpath_unstarred).should be_true
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
Then /^I should see a starred "([^"]*)"$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='starred_todo']"
|
||||
|
||||
selenium.is_element_present(xpath_starred).should be_true
|
||||
end
|
||||
|
||||
When /^I delete the action "([^"]*)"$/ do |action_description|
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ module NavigationHelpers
|
|||
login_path(options)
|
||||
when /the notes page/
|
||||
notes_path(options)
|
||||
when /the calendar page/
|
||||
calendar_path(options)
|
||||
when /the contexts page/
|
||||
@source_view = "contexts"
|
||||
contexts_path(options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue