mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-02 23:38:50 +01:00
add a few cucumber scenario's for editing a todo
This commit is contained in:
parent
f544c80fbc
commit
b40998e0bc
4 changed files with 80 additions and 8 deletions
|
|
@ -30,7 +30,7 @@ module TodosHelper
|
|||
:_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
|
||||
url[:_tag_name] = @tag_name if @source_view == 'tag'
|
||||
|
||||
options = {:x_defer_alert => false, :class => "icon_defer_item" }
|
||||
options = {:x_defer_alert => false, :class => "icon_defer_item", :id => "defer_#{days}_#{dom_id(todo)}" }
|
||||
if todo.due
|
||||
futuredate = (todo.show_from || todo.user.date) + days.days
|
||||
if futuredate > todo.due
|
||||
|
|
@ -55,7 +55,7 @@ module TodosHelper
|
|||
:_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
|
||||
url[:_tag_name] = @tag_name if @source_view == 'tag'
|
||||
|
||||
return link_to(image_tag("to_project_off.png", :align => "absmiddle")+" " + t('todos.convert_to_project'), url)
|
||||
return link_to(image_tag("to_project_off.png", :align => "absmiddle")+" " + t('todos.convert_to_project'), url, {:id => "to_project_#{dom_id(todo)}"})
|
||||
end
|
||||
|
||||
def image_tag_for_defer(days)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Feature: Edit a next action from every page
|
|||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@pc"
|
||||
|
||||
@selenium
|
||||
Scenario: I can toggle the star of a todo
|
||||
|
|
@ -186,17 +187,43 @@ 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
|
||||
Scenario: I can edit a todo to move it to another project
|
||||
Given this is a pending scenario
|
||||
Given I have a project called "project one"
|
||||
And I have a project "project two" with 1 todos
|
||||
When I go to the "project two" project
|
||||
And I edit the project of "todo 1" to "project one"
|
||||
Then I should not see "todo 1"
|
||||
When I go to the "project one" project
|
||||
Then I should see "todo 1"
|
||||
|
||||
@selenium
|
||||
Scenario: I can edit a todo to move it to the tickler
|
||||
Given this is a pending scenario
|
||||
When I go to the home page
|
||||
And I submit a new action with description "start later" in the context "@pc"
|
||||
And I edit the show from date of "start later" to next month
|
||||
Then I should not see "start later"
|
||||
When I go to the tickler page
|
||||
Then I should see "start later"
|
||||
|
||||
@selenium
|
||||
Scenario: I can defer a todo
|
||||
Given this is a pending scenario
|
||||
When I go to the home page
|
||||
And I submit a new action with description "start later" in the context "@pc"
|
||||
And I defer "start later" for 1 day
|
||||
Then I should not see "start later"
|
||||
When I go to the tickler page
|
||||
Then I should see "start later"
|
||||
|
||||
@selenium
|
||||
Scenario: I can make a project from a todo
|
||||
Given this is a pending scenario
|
||||
When I go to the home page
|
||||
And I submit a new action with description "buy mediacenter" in the context "@pc"
|
||||
And I make a project of "buy mediacenter"
|
||||
#sidebar does not update
|
||||
Then I should be on the "buy mediacenter" project
|
||||
When I go to the projects page
|
||||
Then I should see "buy mediacenter"
|
||||
|
||||
Scenario: I can show the notes of a todo
|
||||
Given this is a pending scenario
|
||||
|
|
@ -205,13 +232,19 @@ Feature: Edit a next action from every page
|
|||
Given this is a pending scenario
|
||||
|
||||
Scenario: Clicking a tag of a todo will go to that tag page
|
||||
Given this is a pending scenario
|
||||
Given I have a todo "tag you are it" in context "@tags" with tags "taga, tagb"
|
||||
When I go to the home page
|
||||
Then I should see "tag you are it"
|
||||
And I should see "taga"
|
||||
When I follow "taga"
|
||||
Then I should be on the tag page for "taga"
|
||||
|
||||
Scenario: I can edit the tags of a todo
|
||||
Given this is a pending scenario
|
||||
|
||||
Scenario: Editing the context of a todo to a new context will show new context
|
||||
Given this is a pending scenario # for home and tickler and tag
|
||||
# for home and tickler and tag
|
||||
Given this is a pending scenario
|
||||
|
||||
Scenario: Making an error when editing a todo will show error message
|
||||
Given this is a pending scenario
|
||||
|
|
|
|||
|
|
@ -39,6 +39,14 @@ When /^I edit the due date of "([^"]*)" to next month$/ do |action_description|
|
|||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
||||
When /^I edit the show from date of "([^"]*)" to next month$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
open_edit_form_for(todo)
|
||||
fill_in "show_from_todo_#{todo.id}", :with => format_date(todo.created_at + 1.month)
|
||||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
||||
When /^I clear the due date of "([^"]*)"$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
|
@ -56,3 +64,28 @@ When /^I remove the show from date from "([^"]*)"$/ do |action_description|
|
|||
|
||||
submit_edit_todo_form(todo)
|
||||
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
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present("//div[@id='line_todo_#{todo.id}']")
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present("//div[@id='line_todo_#{todo.id}']")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@ Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, cont
|
|||
@todo = @current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
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}\""
|
||||
@todo.tag_with(tag_names)
|
||||
@todo.save!
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" in the context "([^"]*)" which is due tomorrow$/ do |description, context_name|
|
||||
context = @current_user.contexts.find_or_create(:name => context_name)
|
||||
@todo = @current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue