migrate preferences, project_* and recurring todo features

This commit is contained in:
Reinier Balt 2012-03-01 20:31:16 +01:00
parent d528a87cee
commit cbe372cba0
17 changed files with 334 additions and 384 deletions

View file

@ -6,7 +6,10 @@ When /^I delete the context "([^\"]*)"$/ do |context_name|
click_link "delete_context_#{context.id}"
end
get_confirm_text.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!"
wait_for_animations_to_end
wait_until do
!page.has_css?("a#delete_context_#{context.id}")
end
end
When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|

View file

@ -71,18 +71,18 @@ Then /^he should see that a context named "([^\"]*)" is not present$/ do |contex
step "I should not see \"#{context_name} (\""
end
Then /^I should not see empty message for context todos/ do
Then /^I should not see empty message for todos of context/ do
find("div#c#{@context.id}empty-nd").should_not be_visible
end
Then /^I should see empty message for context todos/ do
Then /^I should see empty message for todos of context/ do
find("div#c#{@context.id}empty-nd").should be_visible
end
Then /^I should not see empty message for context completed todos$/ do
Then /^I should not see empty message for completed todos of context$/ do
find("div#empty-d").should_not be_visible
end
When /^I should see empty message for context completed todos$/ do
When /^I should see empty message for completed todos of context$/ do
find("div#empty-d").should be_visible
end

View file

@ -15,22 +15,6 @@ Then /the badge should show (.*)/ do |number|
badge.should == number.to_i
end
Then /^I should see the empty message in the deferred container$/ do
page.should have_xpath("//div[@id='tickler']//div[@id='tickler-empty-nd']")
end
Then /^I should see the empty tickler message$/ do
wait_for :timeout => 5 do
selenium.is_visible("xpath=//div[@id='tickler-empty-nd']")
end
end
Then /^I should not see the empty tickler message$/ do
wait_for :timeout => 5 do
!selenium.is_visible("xpath=//div[@id='tickler-empty-nd']")
end
end
Then /^I should see an error flash message saying "([^"]*)"$/ do |message|
xpath = "//div[@id='message_holder']/h4[@id='flash']"
text = page.find(:xpath, xpath).text
@ -41,3 +25,6 @@ Then /^I should see "([^"]*)" $/ do |text|
Then "I should see \"#{text}\""
end
Then /^I should save and open the page$/ do
save_and_open_page
end

View file

@ -4,7 +4,7 @@ When /^I edit my last name to "([^"]*)"$/ do |last_name|
end
When /^I set the password and confirmation to "([^"]*)"$/ do |new_password|
When "I set the password to \"#{new_password}\" and confirmation to \"#{new_password}\""
step "I set the password to \"#{new_password}\" and confirmation to \"#{new_password}\""
end
When /^I set the password to "([^"]*)" and confirmation to "([^"]*)"$/ do |new_password, new_password_confirmation|

View file

@ -1,97 +1,3 @@
When /^I delete project "([^"]*)"$/ do |project_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
click_link "delete_project_#{project.id}"
selenium.get_confirmation.should == "Are you sure that you want to delete the project '#{project_name}'?"
wait_for do
!selenium.is_element_present("delete_project_#{project.id}")
end
end
When /^I drag the project "([^"]*)" below "([^"]*)"$/ do |project_drag, project_drop|
drag_id = @current_user.projects.find_by_name(project_drag).id
drop_id = @current_user.projects.find_by_name(project_drop).id
container_height = selenium.get_element_height("//div[@id='container_project_#{drag_id}']").to_i
vertical_offset = container_height*2
coord_string = "10,#{vertical_offset}"
drag_project_handle_xpath = "//div[@id='project_#{drag_id}']//span[@class='handle']"
drop_project_container_xpath = "//div[@id='container_project_#{drop_id}']"
selenium.mouse_down_at(drag_project_handle_xpath,"2,2")
selenium.mouse_move_at(drop_project_container_xpath,coord_string)
# no need to simulate mouse_over for this test
selenium.mouse_up_at(drop_project_container_xpath,coord_string)
end
When /^I submit a new project with name "([^"]*)"$/ do |project_name|
fill_in "project[name]", :with => project_name
submit_new_project_form
end
When /^I submit a new project with name "([^"]*)" and select take me to the project$/ do |project_name|
fill_in "project[name]", :with => project_name
check "go_to_project"
submit_new_project_form
selenium.wait_for_page_to_load(5000) # follow the redirect
end
When /^I sort the active list alphabetically$/ do
click_link "Alphabetically"
wait_for_ajax
selenium.get_confirmation.should == "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order."
end
When /^I sort the list by number of tasks$/ do
click_link "By number of tasks"
wait_for_ajax
selenium.get_confirmation.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order."
end
Then /^I should see that a project named "([^"]*)" is not present$/ do |project_name|
Then "I should not see \"#{project_name}\""
end
Then /^I should see that a project named "([^"]*)" is present$/ do |project_name|
Then "I should see \"#{project_name}\""
end
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
high_id = @current_user.projects.find_by_name(project_high).id
low_id = @current_user.projects.find_by_name(project_low).id
high_pos = selenium.get_element_position_top("//div[@id='project_#{high_id}']").to_i
low_pos = selenium.get_element_position_top("//div[@id='project_#{low_id}']").to_i
(high_pos < low_pos).should be_true
end
Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
xpath = "//div[@id='list-#{state_name}-projects-container']//div[@id='project_#{project.id}']"
response.should_not have_xpath(xpath)
end
Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
xpath = "//div[@id='list-#{state_name}-projects-container']//div[@id='project_#{project.id}']"
response.should have_xpath(xpath)
end
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
selenium.get_text("xpath=//span[@id='#{state_name}-projects-count']").should == count
end
Then /^the new project form should be visible$/ do
selenium.is_visible("project_new").should == true
end
Then /^the new project form should not be visible$/ do
selenium.is_visible("project_new").should == false
end
Given /^I have a project "([^"]*)" with (\d+) active todos$/ do |name, count|
@context = @current_user.contexts.find_or_create_by_name("Context A")
@project = @current_user.projects.find_or_create_by_name(name)
@ -106,36 +12,131 @@ Given /^I have a project "([^"]*)" with (\d+) active todos$/ do |name, count|
end
end
Given /^I have a project "([^"]*)" with (\d+) deferred actions$/ do |name, deferred|
step "I have a project \"#{name}\" with #{deferred} active todos"
@todos.each do |t|
t.show_from = Time.zone.now + 1.week
t.description = "deferred " + t.description
t.save!
end
end
Given /^I have a project "([^"]*)" with (\d+) active actions and (\d+) deferred actions$/ do |name, active_count, deferred_count|
step "I have a project \"#{name}\" with #{active_count} active todos"
step "I have a project \"#{name}\" with #{deferred_count} deferred actions"
end
When /^I delete project "([^"]*)"$/ do |project_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
handle_js_confirm do
click_link "delete_project_#{project.id}"
end
get_confirm_text.should == "Are you sure that you want to delete the project '#{project_name}'?"
wait_until do
!page.has_css?("a#delete_project_#{project.id}")
end
end
When /^I drag the project "([^"]*)" below "([^"]*)"$/ do |project_drag, project_drop|
drag_id = @current_user.projects.find_by_name(project_drag).id
sortable_css = "div.ui-sortable div#container_project_#{drag_id}"
drag_index = project_list_find_index(project_drag)
drop_index = project_list_find_index(project_drop)
page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.grip'});"
end
When /^I submit a new project with name "([^"]*)"$/ do |project_name|
fill_in "project[name]", :with => project_name
submit_new_project_form
end
When /^I submit a new project with name "([^"]*)" and select take me to the project$/ do |project_name|
fill_in "project[name]", :with => project_name
check "go_to_project"
submit_new_project_form
end
When /^I sort the active list alphabetically$/ do
handle_js_confirm do
click_link "Alphabetically"
wait_for_ajax
end
get_confirm_text.should == "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order."
end
When /^I sort the list by number of tasks$/ do
handle_js_confirm do
click_link "By number of tasks"
wait_for_ajax
end
get_confirm_text.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order."
end
Then /^I should see that a project named "([^"]*)" is not present$/ do |project_name|
within "div#display_box" do
step "I should not see \"#{project_name}\""
end
end
Then /^I should see that a project named "([^"]*)" is present$/ do |project_name|
within "div#display_box" do
step "I should see \"#{project_name}\""
end
end
Then /^I should see a project named "([^"]*)"$/ do |project_name|
step "I should see that a project named \"#{project_name}\" is present"
end
Then /^I should not see a project named "([^"]*)"$/ do |project_name|
step "I should see that a project named \"#{project_name}\" is not present"
end
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
project_list_find_index(project_high).should < project_list_find_index(project_low)
end
Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
xpath = "//div[@id='list-#{state_name}-projects-container']//div[@id='project_#{project.id}']"
page.has_xpath?(xpath).should_not be_true
end
Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
xpath = "//div[@id='list-#{state_name}-projects-container']//div[@id='project_#{project.id}']"
page.has_xpath?(xpath).should be_true
end
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
page.find(:xpath, "//span[@id='#{state_name}-projects-count']").text.should == count
end
Then /^the new project form should be visible$/ do
page.has_css?("div#project_new", :visible => true).should be_true
end
Then /^the new project form should not be visible$/ do
page.has_css?("div#project_new", :visible => true).should be_false
end
Then /^the project "([^"]*)" should have (\d+) actions listed$/ do |name, count|
project = @current_user.projects.find_by_name(name)
project.should_not be_nil
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
selenium.get_text("xpath=#{xpath}").should == "#{project.name} (#{count} actions)"
end
Given /^I have a project "([^"]*)" with (\d+) active actions and (\d+) deferred actions$/ do |name, active_count, deferred_count|
Given "I have a project \"#{name}\" with #{active_count} active todos"
Given "I have a project \"#{name}\" with #{deferred_count} deferred actions"
end
Given /^I have a project "([^"]*)" with (\d+) deferred actions$/ do |name, deferred|
@context = @current_user.contexts.find_or_create_by_name("Context A")
@project = @current_user.projects.find_or_create_by_name(name)
1.upto deferred.to_i do |i|
todo = @current_user.todos.create!(
:project_id => @project.id,
:context_id => @context.id,
:description => "deferred todo #{i}")
todo.show_from = Time.zone.now + 1.week
todo.save!
end
page.find(:xpath, xpath).text.should == "#{project.name} (#{count} actions)"
end
Then /^the project "([^"]*)" should have (\d+) deferred actions listed$/ do |name, deferred|
project = @current_user.projects.find_by_name(name)
project.should_not be_nil
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
selenium.get_text("xpath=#{xpath}").should == "#{project.name} (#{deferred} deferred actions)"
end
page.find(:xpath, xpath).text.should == "#{project.name} (#{deferred} deferred actions)"
end

View file

@ -1,5 +1,5 @@
Given /^I have an outdated project "([^"]*)" with (\d+) 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"
@project = @current_user.projects.find_by_name(project_name)
@project.last_reviewed = @current_user.time - @current_user.prefs.review_period.days-1
@project.save
@ -87,125 +87,61 @@ end
When /^I open the project edit form$/ do
click_link "link_edit_project_#{@project.id}"
wait_for do
selenium.is_element_present("submit_project_#{@project.id}")
end
page.should have_css("button#submit_project_#{@project.id}", :visible => true)
end
When /^I cancel the project edit form$/ do
click_link "cancel_project_#{@project.id}"
if selenium.is_visible("submit_project_#{@project.id}")
wait_for do
!selenium.is_visible("submit_project_#{@project.id}")
end
wait_until do
!page.has_css?("submit_project_#{@project.id}")
end
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
click_button "submit_project_#{@project.id}"
wait_for do
!selenium.is_element_present("submit_project_#{@project.id}")
edit_project(@project) do
fill_in "project[description]", :with => new_description
end
end
When /^I edit the project name to "([^\"]*)"$/ do |new_title|
click_link "link_edit_project_#{@project.id}"
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}",
:wait_for => :text,
:text => "Project saved",
:timeout => 5
wait_for do
!selenium.is_element_present("submit_project_#{@project.id}")
edit_project(@project) do
fill_in "project[name]", :with => new_title
end
end
When /^I try to edit the project name to "([^\"]*)"$/ do |new_title|
click_link "link_edit_project_#{@project.id}"
wait_for do
selenium.is_element_present("submit_project_#{@project.id}")
edit_project_no_wait(@project) do
fill_in "project[name]", :with => new_title
end
fill_in "project[name]", :with => new_title
selenium.click "submit_project_#{@project.id}",
:wait_for => :text,
:text => "There were problems with the following fields:",
:timeout => 5
end
When /^I edit the default context to "([^"]*)"$/ do |default_context|
click_link "link_edit_project_#{@project.id}"
wait_for do
selenium.is_element_present("submit_project_#{@project.id}")
end
fill_in "project[default_context_name]", :with => default_context
selenium.click "submit_project_#{@project.id}",
:wait_for => :text,
:text => "Project saved",
:timeout => 5
wait_for :timeout => 5 do
!selenium.is_element_present("submit_project_#{@project.id}")
edit_project(@project) do
fill_in "project[default_context_name]", :with => 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
Then /^I should (see|not see) empty message for (todos|deferred todos|completed todos) of project/ do |visible, state|
case state
when "todos"
css = "div#p#{@project.id}empty-nd"
when "deferred todos"
css = "div#tickler-empty-nd"
when "completed todos"
css = "div#empty-d"
else
css = "wrong state"
end
elem = find(css)
elem.nil?.should be_false
elem.visible?.should(visible=="see" ? be_true : be_false)
end
Then /^I edit the default tags to "([^"]*)"$/ do |default_tags|
click_link "link_edit_project_#{@project.id}"
wait_for do
selenium.is_element_present("submit_project_#{@project.id}")
end
fill_in "project[default_tags]", :with => default_tags
selenium.click "submit_project_#{@project.id}",
:wait_for => :text,
:text => "Project saved",
:timeout => 5
wait_for :timeout => 5 do
!selenium.is_element_present("submit_project_#{@project.id}")
edit_project(@project) do
fill_in "project[default_tags]", :with => default_tags
end
end
@ -222,41 +158,40 @@ When /^I try to edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_cu
end
When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name|
selenium.click "project_name"
page.find("div#project_name").click
fill_in "value", :with => new_project_name
click_button "Ok"
end
When /^I click to edit the project name in place$/ do
selenium.click "css=div#project_name"
page.find("div#project_name").click
end
Then /^I should be able to change the project name in place$/ do
#Note that this is not changing the project name
selenium.wait_for_element "css=div#project_name>form>input"
selenium.click "css=div#project_name > form > button[type=cancel]"
wait_until do
page.has_css? "div#project_name>form>input"
end
page.find("div#project_name > form > button[type=cancel]").click
end
When /^I edit the project settings$/ do
@project.should_not be_nil
click_link "link_edit_project_#{@project.id}"
selenium.wait_for_element("xpath=//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']")
page.has_xpath?("//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']").should be_true
end
Then /^I should not be able to change the project name in place$/ do
step "I click to edit the project name in place"
found = selenium.element? "xpath=//div[@id='project_name']/form/input"
!found
page.has_xpath?("//div[@id='project_name']/form/input").should be_false
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
wait_for_ajax
wait_for_animations_to_end
end
@ -264,21 +199,8 @@ When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, st
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
click_link "link_edit_project_#{project.id}"
selenium.wait_for_element("xpath=//div[@id='edit_project_#{project.id}']/form//button[@id='submit_project_#{project.id}']")
choose "project_state_#{state_name}"
# changed to make sure selenium waits until the saving has a result either
# positive or negative. Was: :element=>"flash", :text=>"Project saved"
# we may need to change it back if you really need a positive outcome, i.e.
# this step needs to fail if the project was not saved successfully
selenium.click "submit_project_#{project.id}",
:wait_for => :text,
:text => /(Project saved|1 error prohibited this project from being saved)/
wait_for do # wait for the form to go away
!selenium.is_element_present("submit_project_#{project.id}")
edit_project_settings(project) do
choose "project_state_#{state_name}"
end
end
@ -303,9 +225,7 @@ When /^I cancel adding a note to the project$/ do
end
Then /^the form for adding a note should not be visible$/ do
wait_for do # wait for the form to go away
!selenium.is_visible("edit_form_note")
end
page.should_not have_css("edit_form_note")
end
Then /^I should go to that note page$/ do
@ -315,33 +235,45 @@ Then /^I should go to that note page$/ do
end
Then /^I should see one note in the project$/ do
selenium.wait_for_element("xpath=//div[@class='note_wrapper']")
page.should have_xpath("//div[@class='note_wrapper']")
end
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bold|
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |text_in_bold|
xpath="//div[@class='project_description']/p/strong"
response.should have_xpath(xpath)
bold_text = response.selenium.get_text("xpath=#{xpath}")
page.should have_xpath(xpath)
bold_text = page.find(:xpath, xpath).text
bold_text.should =~ /#{bold}/
bold_text.should =~ /#{text_in_bold}/
end
Then /^I should see the italic text "([^\"]*)" in the project description$/ do |italic|
Then /^I should see the italic text "([^\"]*)" in the project description$/ do |text_in_italic|
xpath="//div[@class='project_description']/p/em"
response.should have_xpath(xpath)
italic_text = response.selenium.get_text("xpath=#{xpath}")
page.should have_xpath(xpath)
italic_text = page.find(:xpath, xpath).text
italic_text.should =~ /#{italic}/
italic_text.should =~ /#{text_in_italic}/
end
Then /^the project title should be "(.*)"$/ do |title|
wait_for :timeout => 2 do
selenium.get_text("css=h2#project_name_container div#project_name") == title
wait_until do
page.find("h2#project_name_container div#project_name").text == title
end
end
Then /^I should see the project name is "([^"]*)"$/ do |project_name|
step "the project title should be \"#{project_name}\""
end
Then /^I should (see|not see) the default project settings$/ do |visible|
default_settings = "This project is active with no default context and with no default tags"
if visible == "see"
elem = page.find("div.project_settings")
elem.visible?.should be_true
elem.text.should =~ /#{default_settings}/
else
elem = page.find("div.project_settings")
elem.visible?.should be_false
end
end

View file

@ -22,19 +22,19 @@ Given /^I have a repeat pattern called "([^"]*)"$/ do |pattern_name|
end
Given /^I have a completed repeat pattern "([^"]*)"$/ do |pattern_name|
Given "I have a repeat pattern called \"#{pattern_name}\""
step "I have a repeat pattern called \"#{pattern_name}\""
@recurring_todo.toggle_completion!
@recurring_todo.completed?.should be_true
end
Given /^I have (\d+) completed repeat patterns$/ do |number_of_patterns|
1.upto number_of_patterns.to_i do |i|
Given "I have a completed repeat pattern \"Repeating Todo #{i}\""
step "I have a completed repeat pattern \"Repeating Todo #{i}\""
end
end
When /^I select "([^\"]*)" recurrence pattern$/ do |recurrence_period|
selenium.click("recurring_todo_recurring_period_#{recurrence_period.downcase}")
page.find("#recurring_todo_recurring_period_#{recurrence_period.downcase}").click
end
When /^I edit the name of the pattern "([^\"]*)" to "([^\"]*)"$/ do |pattern_name, new_name|
@ -45,75 +45,69 @@ When /^I edit the name of the pattern "([^\"]*)" to "([^\"]*)"$/ do |pattern_nam
wait_for_ajax
fill_in "edit_recurring_todo_description", :with => new_name
selenium.click "recurring_todo_edit_update_button"
page.find("button#recurring_todo_edit_update_button").click
wait_for do
!selenium.is_visible("edit-recurring-todo")
end
page.should_not have_css("div#edit-recurring-todo", :visible => true)
end
When /^I star the pattern "([^\"]*)"$/ do |pattern_name|
pattern = @current_user.recurring_todos.find_by_description(pattern_name)
pattern.should_not be_nil
click_link "star_icon_#{pattern.id}"
wait_for_ajax
end
When /^I delete the pattern "([^"]*)"$/ do |pattern_name|
pattern = @current_user.recurring_todos.find_by_description(pattern_name)
pattern.should_not be_nil
click_link "delete_icon_#{pattern.id}"
selenium.get_confirmation.should == "Are you sure that you want to delete the recurring action '#{pattern_name}'?"
wait_for do
!selenium.is_element_present("delete_icon_#{pattern.id}")
handle_js_confirm do
click_link "delete_icon_#{pattern.id}"
end
get_confirm_text.should == "Are you sure that you want to delete the recurring action '#{pattern_name}'?"
page.should_not have_css("#delete_icon_#{pattern.id}")
end
When /^I mark the pattern "([^"]*)" as complete$/ do |pattern_name|
pattern = @current_user.recurring_todos.find_by_description(pattern_name)
pattern.should_not be_nil
pattern.completed?.should be_false
selenium.click "check_#{pattern.id}"
wait_for_ajax
page.find("#check_#{pattern.id}").click
end
When /^I mark the pattern "([^"]*)" as active$/ do |pattern_name|
pattern = @current_user.recurring_todos.find_by_description(pattern_name)
pattern.should_not be_nil
pattern.completed?.should be_true
selenium.click "check_#{pattern.id}"
wait_for_ajax
page.find("#check_#{pattern.id}").click
end
When /^I follow the recurring todo link of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
recurring_todo_link = "xpath=//div[@id='todo_#{todo.id}']//a[@class='recurring_icon']/img"
selenium.click( recurring_todo_link )
selenium.wait_for_page_to_load(5000)
page.find(:xpath, "//div[@id='todo_#{todo.id}']//a[@class='recurring_icon']/img").click
end
Then /^the state list "([^"]*)" should be empty$/ do |state|
empty_id = "recurring-todos-empty-nd" if state.downcase == "active"
empty_id = "completed-empty-nd" if state.downcase == "completed"
selenium.is_visible( empty_id )
empty_msg = page.find("div##{empty_id}")
empty_msg.visible?.should be_true
end
Then /^the pattern "([^\"]*)" should be starred$/ do |pattern_name|
pattern = @current_user.recurring_todos.find_by_description(pattern_name)
pattern.should_not be_nil
xpath = "//div[@id='recurring_todo_#{pattern.id}']//img[@class='todo_star starred']"
response.should have_xpath(xpath)
page.should have_xpath("//div[@id='recurring_todo_#{pattern.id}']//img[@class='todo_star starred']")
end
Then /^I should see the form for "([^\"]*)" recurrence pattern$/ do |recurrence_period|
selenium.is_visible("recurring_#{recurrence_period.downcase}")
page.should have_css("#recurring_#{recurrence_period.downcase}", :visible => true)
end
Then /^the pattern "([^"]*)" should be in the state list "([^"]*)"$/ do |pattern_name, state_name|
pattern = @current_user.recurring_todos.find_by_description(pattern_name)
pattern.should_not be_nil
xpath = "//div[@id='#{state_name}_recurring_todos_container']//div[@id='recurring_todo_#{pattern.id}']"
response.should have_xpath(xpath)
page.should have_xpath("//div[@id='#{state_name}_recurring_todos_container']//div[@id='recurring_todo_#{pattern.id}']")
end

View file

@ -144,7 +144,7 @@ When /^I remove the show from date from "([^"]*)"$/ do |action_description|
todo.should_not be_nil
open_edit_form_for(todo)
page.find("//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img").click
page.find(:xpath, "//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img").click
submit_edit_todo_form(todo)
end

View file

@ -67,16 +67,11 @@ Then /^there should not be an error$/ do
end
Then /^I should see the todo "([^\"]*)"$/ do |todo_description|
selenium.is_element_present("//span[.=\"#{todo_description}\"]").should be_true
page.should have_xpath("//span[.=\"#{todo_description}\"]", :visible => true)
end
Then /^I should not see the todo "([^\"]*)"$/ do |todo_description|
xpath = "//span[.=\"#{todo_description}\"]"
if selenium.is_element_present(xpath)
wait_for :timeout => 5 do
!selenium.is_element_present(xpath)
end
end
page.should_not have_xpath("//span[.=\"#{todo_description}\"]", :visible => true)
end
Then /^I should see a completed todo "([^"]*)"$/ do |todo_description|
@ -160,22 +155,22 @@ end
Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_project_name']"
project_name.should == response.selenium.get_value("xpath=#{xpath}")
project_name.should == page.find(:xpath, xpath).value
end
Then /^the default context of the new todo form should be "([^"]*)"$/ do |context_name|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']"
context_name.should == response.selenium.get_value("xpath=#{xpath}")
context_name.should == page.find(:xpath, xpath).value
end
Then /^the tag field in the new todo form should be empty$/ do
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_tag_list']"
assert response.selenium.get_value("xpath=#{xpath}").blank?
page.find(:xpath, xpath).value.blank?.should be_true
end
Then /^the tag field in the new todo form should be "([^"]*)"$/ do |tag_list|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_tag_list']"
tag_list.should == response.selenium.get_value("xpath=#{xpath}")
tag_list.should == page.find(:xpath, xpath).value
end
Then /^the tags of "([^"]*)" should be "([^"]*)"$/ do |todo_description, tag_list|
@ -193,19 +188,19 @@ Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |
page.should have_xpath(xpath)
end
Then /^I should not see empty message for home todos/ do
Then /^I should not see empty message for todos of home/ do
find("div#no_todos_in_view").should_not be_visible
end
Then /^I should see empty message for home todos/ do
Then /^I should see empty message for todos of home/ do
find("div#no_todos_in_view").should be_visible
end
Then /^I should not see empty message for home completed todos$/ do
Then /^I should not see empty message for completed todos of home$/ do
find("div#empty-d").should_not be_visible
end
Then /^I should see empty message for home completed todos$/ do
Then /^I should see empty message for completed todos of home$/ do
find("div#empty-d").should be_visible
end
@ -221,7 +216,4 @@ Then /^I should see the notes of "([^"]*)"$/ do |todo_description|
todo.should_not be_nil
page.find("div#notes_todo_#{todo.id}").should be_visible
end
end

View file

@ -1,23 +1,23 @@
Then /^I should not see empty message for tag todos/ do
Then /^I should not see empty message for todos of tag$/ do
find("div#no_todos_in_view").should_not be_visible
end
Then /^I should see empty message for tag todos/ do
Then /^I should see empty message for todos of tag$/ do
find("div#no_todos_in_view").should be_visible
end
Then /^I should not see empty message for tag completed todos$/ do
Then /^I should not see empty message for completed todos of tag$/ do
find("div#empty-d").should_not be_visible
end
Then /^I should see empty message for tag completed todos$/ do
Then /^I should see empty message for completed todos of tag$/ do
find("div#empty-d").should be_visible
end
Then /^I should not see empty message for tag deferred todos$/ do
Then /^I should not see empty message for deferred todos of tag$/ do
find("div#tickler-empty-nd").should_not be_visible
end
Then /^I should see empty message for tag deferred todos$/ do
Then /^I should see empty message for deferred todos of tag$/ do
find("div#tickler-empty-nd").should be_visible
end