migrate tickler, tagging, toggle context and done. This finishes the first migration pass

This commit is contained in:
Reinier Balt 2012-03-12 22:52:45 +01:00
parent 1236b5985c
commit 41ebd2ec9b
12 changed files with 64 additions and 72 deletions

View file

@ -52,14 +52,14 @@ Feature: Show statistics
Given I have 5 todos Given I have 5 todos
And I have 3 deferred todos And I have 3 deferred todos
When I go to the statistics page When I go to the statistics page
And I click on the chart for running time of all incomplete actions And I click on the chart for running time of all incomplete visible actions
Then I should see a chart Then I should see a chart
And I should see "Actions selected from week" And I should see "Actions selected from week"
And I should see 5 todos And I should see 5 todos
And I should see "to return to the statistics page" And I should see "to return to the statistics page"
And I should see "to show the actions from week 0 and further" And I should see "to show the actions from week 0 and further"
@selenium @javascript
Scenario: I can edit the todos selected from a chart Scenario: I can edit the todos selected from a chart
Given I have 5 todos Given I have 5 todos
When I go to the statistics page When I go to the statistics page
@ -70,7 +70,7 @@ Feature: Show statistics
Then I should not see the todo "todo 1" Then I should not see the todo "todo 1"
And I should see the todo "foo bar" And I should see the todo "foo bar"
@selenium @javascript
Scenario: Marking a todo selected from a chart as complete will remove it from the page Scenario: Marking a todo selected from a chart as complete will remove it from the page
Given I have 5 todos Given I have 5 todos
When I go to the statistics page When I go to the statistics page

View file

@ -3,9 +3,9 @@ When /^I collapse the context container of "([^"]*)"$/ do |context_name|
context.should_not be_nil context.should_not be_nil
xpath = "//a[@id='toggle_c#{context.id}']" xpath = "//a[@id='toggle_c#{context.id}']"
selenium.is_visible(xpath).should be_true toggle = page.find(:xpath, xpath)
toggle.should be_visible
selenium.click(xpath) toggle.click
end end
When /^I toggle all collapsed context containers$/ do When /^I toggle all collapsed context containers$/ do
@ -160,10 +160,9 @@ Then /^I should see "([^"]*)" in the active recurring todos container$/ do |repe
unless repeat.nil? unless repeat.nil?
xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']" xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5) page.should have_xpath(xpath, :visible => true)
selenium.is_visible(xpath).should be_true
else else
step "I should not see \"#{repeat_pattern}\"" step "I should see \"#{repeat_pattern}\""
end end
end end
@ -172,8 +171,7 @@ Then /^I should not see "([^"]*)" in the completed recurring todos container$/ d
unless repeat.nil? unless repeat.nil?
xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']" xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5) page.should_not have_xpath(xpath, :visible => true)
selenium.is_visible(xpath).should be_true
else else
step "I should not see \"#{repeat_pattern}\"" step "I should not see \"#{repeat_pattern}\""
end end

View file

@ -22,7 +22,7 @@ Then /^I should see an error flash message saying "([^"]*)"$/ do |message|
end end
Then /^I should see "([^"]*)" $/ do |text| Then /^I should see "([^"]*)" $/ do |text|
Then "I should see \"#{text}\"" step "I should see \"#{text}\""
end end
Then /^I should save and open the page$/ do Then /^I should save and open the page$/ do

View file

@ -1,23 +1,20 @@
Then /^I should see a message that you need a context to see scripts$/ do Then /^I should see a message that you need a context to see scripts$/ do
Then 'I should see "You do not have any context yet. The script will be available after you add your first context"' step 'I should see "You do not have any context yet. The script will be available after you add your first context"'
end end
Then /^I should see scripts$/ do Then /^I should see scripts$/ do
# check on a small snippet of the first applescript # check on a small snippet of the first applescript
Then 'I should see "set returnValue to call xmlrpc"' step 'I should see "set returnValue to call xmlrpc"'
end end
Then /^I should see a script "([^\"]*)" for "([^\"]*)"$/ do |script, context_name| Then /^I should see a script "([^\"]*)" for "([^\"]*)"$/ do |script, context_name|
selenium.is_visible(script) page.should have_css("##{script}", :visible => true)
context = Context.find_by_name(context_name) context = Context.find_by_name(context_name)
# wait for the script to refresh page.should have_content("#{context.id} (* #{context_name} *)")
wait_for :timeout => 15 do
selenium.is_text_present("#{context.id} (* #{context_name} *)")
end
# make sure the text is found within the textarea # make sure the text is found within the textarea
script_source = selenium.get_text("//textarea[@id='#{script}']") script_source = page.find(:xpath, "//textarea[@id='#{script}']").text
script_source.should =~ /#{context.id} \(\* #{context_name} \*\)/ script_source.should =~ /#{context.id} \(\* #{context_name} \*\)/
end end

View file

@ -4,10 +4,15 @@ When /^I click on the chart for actions done in the last 12 months$/ do
end end
Then /^I should see a chart$/ do Then /^I should see a chart$/ do
response.body.should =~ /open-flash-chart/m page.should have_css("div.open-flash-chart")
end end
When /^I click on the chart for running time of all incomplete actions$/ do When /^I click on the chart for running time of all incomplete actions$/ do
# cannot really click the chart which is a swf # cannot really click the chart which is a swf
visit stats_path + "/show_selected_actions_from_chart/art?index=0" visit stats_path + "/show_selected_actions_from_chart/art?index=0"
end end
When /^I click on the chart for running time of all incomplete visible actions$/ do
# cannot really click the chart which is a swf
visit stats_path + "/show_selected_actions_from_chart/avrt?index=0"
end

View file

@ -49,14 +49,12 @@ When /^I unstar the action "([^"]*)"$/ do |action_description|
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']" 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']" 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)
star_img = "//img[@id='star_img_#{todo.id}']" star_img = "//img[@id='star_img_#{todo.id}']"
selenium.click(star_img, :wait_for => :ajax, :javascript_framework => :jquery) page.find(:xpath, star_img).click
wait_for :timeout => 5 do page.should have_xpath(xpath_unstarred)
selenium.is_element_present(xpath_unstarred)
end
end end
####### Editing a todo using Edit Form ####### ####### Editing a todo using Edit Form #######

View file

@ -47,16 +47,12 @@ Then /^I should see an unstarred "([^"]*)"$/ do |action_description|
todo.should_not be_nil todo.should_not be_nil
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']" xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
page.should have_xpath(xpath_starred)
wait_for :timeout => 5 do
selenium.is_element_present(xpath_starred)
end
end end
Then /^I should see ([0-9]+) todos$/ do |count| Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i| total = page.all("div.item-container").inject(0) { |s, e| s+=1 }
match_xpath "div[" total.should == count.to_i
end
end end
Then /^there should not be an error$/ do Then /^there should not be an error$/ do
@ -132,17 +128,13 @@ Then /^the selected context should be "([^"]*)"$/ do |content|
end end
Then /^I should see the page selector$/ do Then /^I should see the page selector$/ do
page_selector_xpath = ".//a[@class='next_page']" page.should have_xpath(".//a[@class='next_page']")
response.body.should have_xpath(page_selector_xpath)
end end
Then /^the page should be "([^"]*)"$/ do |page_number| Then /^the page should be "([^"]*)"$/ do |page_number|
page_number_found = -1 page_number_found = -1
page_number_xpath = ".//span[@class='current']" page_number_xpath = ".//span[@class='current']"
response.should have_xpath(page_number_xpath) do |node| page.find(:xpath, page_number_xpath).text.should == page_number
page_number_found = node.first.content.to_i
end
page_number_found.should == page_number.to_i
end end
Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name| Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name|
@ -196,6 +188,15 @@ Then /^I should see empty message for completed todos of home$/ do
find("div#empty-d").should be_visible find("div#empty-d").should be_visible
end end
Then /^I should (see|not see) the empty tickler message$/ do |see|
elem = find("div#tickler-empty-nd")
if see=="see"
elem.should be_visible
else
elem.should_not be_visible
end
end
Then /^I should not see the notes of "([^"]*)"$/ do |todo_description| Then /^I should not see the notes of "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description) todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil todo.should_not be_nil

View file

@ -2,10 +2,3 @@ AfterStep('@pause') do
print "Press Return to continue..." print "Press Return to continue..."
STDIN.getc STDIN.getc
end end
Before('@clear_cookies') do
cookies = selenium.cookies
cookies.split(';').each do | cookie |
selenium.delete_cookie(cookie)
end
end

View file

@ -15,7 +15,7 @@ Feature: Tagging todos
When I go to the tag page for "starred" When I go to the tag page for "starred"
Then I should see "Currently there are no incomplete actions with the tag 'starred'" Then I should see "Currently there are no incomplete actions with the tag 'starred'"
@selenium @javascript
Scenario: I can remove a tag from a todo from the tag view and the todo will be removed Scenario: I can remove a tag from a todo from the tag view and the todo will be removed
Given I have a todo "fix tests" in context "@pc" with tags "now" Given I have a todo "fix tests" in context "@pc" with tags "now"
When I go to the tag page for "now" When I go to the tag page for "now"
@ -23,19 +23,19 @@ Feature: Tagging todos
When I edit the tags of "fix tests" to "later" When I edit the tags of "fix tests" to "later"
Then I should not see "fix tests" Then I should not see "fix tests"
@selenium @javascript
Scenario: I can add a new todo from tag view with that tag and it will be added to the page Scenario: I can add a new todo from tag view with that tag and it will be added to the page
When I go to the tag page for "tracks" When I go to the tag page for "tracks"
And I submit a new action with description "prepare release" and the tags "tracks, release" in the context "@pc" And I submit a new action with description "prepare release" and the tags "tracks, release" in the context "@pc"
Then I should see "prepare release" in the context container for "@pc" Then I should see "prepare release" in the context container for "@pc"
@selenium @javascript
Scenario: I can add a new todo from tag view with a different tag and it will not be added to the page Scenario: I can add a new todo from tag view with a different tag and it will not be added to the page
When I go to the tag page for "tracks" When I go to the tag page for "tracks"
And I submit a new action with description "prepare release" and the tags "release, next" in the context "@pc" And I submit a new action with description "prepare release" and the tags "release, next" in the context "@pc"
Then I should not see "prepare release" Then I should not see "prepare release"
@selenium @javascript
Scenario: I can move a tagged todo in tag view to a hidden project and it will move the todo on the page to the hidden container Scenario: I can move a tagged todo in tag view to a hidden project and it will move the todo on the page to the hidden container
Given I have a hidden project called "secret" Given I have a hidden project called "secret"
When I go to the tag page for "tracks" When I go to the tag page for "tracks"
@ -45,7 +45,7 @@ Feature: Tagging todos
Then I should not see "prepare release" in the context container for "@pc" Then I should not see "prepare release" in the context container for "@pc"
And I should see "prepare release" in the hidden container And I should see "prepare release" in the hidden container
@selenium @javascript
Scenario: I can move a tagged todo in tag view to a hidden context and it will move the todo on the page to the hidden container Scenario: I can move a tagged todo in tag view to a hidden context and it will move the todo on the page to the hidden container
Given I have a hidden context called "@secret" Given I have a hidden context called "@secret"
When I go to the tag page for "tracks" When I go to the tag page for "tracks"
@ -55,7 +55,7 @@ Feature: Tagging todos
Then I should not see "prepare release" in the context container for "@pc" Then I should not see "prepare release" in the context container for "@pc"
Then I should see "prepare release" in the hidden container Then I should see "prepare release" in the hidden container
@selenium @javascript
Scenario: Completing the last todo from the tag view will show the empty message Scenario: Completing the last todo from the tag view will show the empty message
Given I have a todo "migrate old scripts" in context "@pc" with tags "starred" Given I have a todo "migrate old scripts" in context "@pc" with tags "starred"
When I go to the tag page for "starred" When I go to the tag page for "starred"
@ -64,7 +64,7 @@ Feature: Tagging todos
Then I should not see the context container for "@pc" Then I should not see the context container for "@pc"
And I should see "Currently there are no incomplete actions with the tag 'starred'" And I should see "Currently there are no incomplete actions with the tag 'starred'"
@selenium @javascript
Scenario: Setting default tags for a project will prefill new todo form for that project Scenario: Setting default tags for a project will prefill new todo form for that project
When I go to the "hacking tracks" project When I go to the "hacking tracks" project
Then the tag field in the new todo form should be empty Then the tag field in the new todo form should be empty
@ -77,7 +77,7 @@ Feature: Tagging todos
When I submit a new action with description "are my tags prefilled" When I submit a new action with description "are my tags prefilled"
Then the tags of "are my tags prefilled" should be "tests" Then the tags of "are my tags prefilled" should be "tests"
@selenium @javascript
Scenario: If there are todos for a tag, when viewing the tag's page, the Tags field for new todos should be defaulted to that tag Scenario: If there are todos for a tag, when viewing the tag's page, the Tags field for new todos should be defaulted to that tag
Given I have a todo "migrate old scripts" in context "@pc" with tags "starred" Given I have a todo "migrate old scripts" in context "@pc" with tags "starred"
When I go to the tag page for "starred" When I go to the tag page for "starred"

View file

@ -10,7 +10,7 @@ Feature: Manage deferred todos
And there exists a project "manage me" for user "testuser" And there exists a project "manage me" for user "testuser"
And I have logged in as "testuser" with password "secret" And I have logged in as "testuser" with password "secret"
@selenium @javascript
Scenario: I can add a deferred todo and it will show in the tickler Scenario: I can add a deferred todo and it will show in the tickler
# also adding the first deferred todo will hide the empty message # also adding the first deferred todo will hide the empty message
Given I have a context called "test" Given I have a context called "test"
@ -20,7 +20,7 @@ Feature: Manage deferred todos
Then I should see "a new next action" Then I should see "a new next action"
And I should not see the empty tickler message And I should not see the empty tickler message
@selenium @javascript
Scenario: Editing the description of a todo in the tickler updated the todo Scenario: Editing the description of a todo in the tickler updated the todo
Given I have a deferred todo "not yet now" Given I have a deferred todo "not yet now"
When I go to the tickler page When I go to the tickler page
@ -29,7 +29,7 @@ Feature: Manage deferred todos
Then I should not see "not yet now" Then I should not see "not yet now"
And I should see "almost" And I should see "almost"
@selenium @javascript
Scenario: Editing the context of a todo moves it to the new context Scenario: Editing the context of a todo moves it to the new context
Given I have a context called "A" Given I have a context called "A"
And I have a context called "B" And I have a context called "B"
@ -40,7 +40,7 @@ Feature: Manage deferred todos
Then I should see "not yet now" in the context container for "B" Then I should see "not yet now" in the context container for "B"
And I should not see "not yet now" in the context container for "A" And I should not see "not yet now" in the context container for "A"
@selenium @javascript
Scenario: Removing the show from date from a todo removes it from the tickler Scenario: Removing the show from date from a todo removes it from the tickler
Given I have a deferred todo "not yet now" Given I have a deferred todo "not yet now"
When I go to the tickler page When I go to the tickler page
@ -58,7 +58,7 @@ Feature: Manage deferred todos
Then I should see "not yet now" Then I should see "not yet now"
And I should not see "now is a good time" And I should not see "now is a good time"
@selenium @javascript
Scenario: I can mark an action complete from the tickler Scenario: I can mark an action complete from the tickler
Given I have a deferred todo "not yet now" Given I have a deferred todo "not yet now"
When I go to the tickler page When I go to the tickler page

View file

@ -9,7 +9,7 @@ Feature: Toggle the context containers
| testuser | secret | false | | testuser | secret | false |
And I have logged in as "testuser" with password "secret" And I have logged in as "testuser" with password "secret"
@selenium @clear_cookies @javascript
Scenario: I can toggle a context container Scenario: I can toggle a context container
Given I have the following contexts Given I have the following contexts
| context | hide | | context | hide |
@ -26,19 +26,19 @@ Feature: Toggle the context containers
And I should see "test 2" in the context container for "@home" And I should see "test 2" in the context container for "@home"
And I should see "test 3" in the context container for "@boss" And I should see "test 3" in the context container for "@boss"
When I collapse the context container of "@ipad" When I collapse the context container of "@ipad"
Then I should not see "test 1" Then I should not see the todo "test 1"
And I should see "test 2" in the context container for "@home" And I should see "test 2" in the context container for "@home"
And I should see "test 3" in the context container for "@boss" And I should see "test 3" in the context container for "@boss"
When I collapse the context container of "@home" When I collapse the context container of "@home"
Then I should not see "test 1" Then I should not see the todo "test 1"
And I should not see "test 2" And I should not see the todo "test 2"
And I should see "test 3" in the context container for "@boss" And I should see "test 3" in the context container for "@boss"
When I collapse the context container of "@boss" When I collapse the context container of "@boss"
Then I should not see "test 1" Then I should not see the todo "test 1"
And I should not see "test 2" And I should not see the todo "test 2"
And I should not see "test 3" And I should not see the todo "test 3"
@selenium @clear_cookies @javascript
Scenario: I can hide all collapsed containers Scenario: I can hide all collapsed containers
Given I have the following contexts Given I have the following contexts
| context | hide | | context | hide |
@ -57,9 +57,9 @@ Feature: Toggle the context containers
When I collapse the context container of "@home" When I collapse the context container of "@home"
And I collapse the context container of "@boss" And I collapse the context container of "@boss"
And I collapse the context container of "@ipad" And I collapse the context container of "@ipad"
Then I should not see "test 1" Then I should not see the todo "test 1"
And I should not see "test 2" And I should not see the todo "test 2"
And I should not see "test 3" And I should not see the todo "test 3"
When I toggle all collapsed context containers When I toggle all collapsed context containers
Then I should not see the context container for "@home" Then I should not see the context container for "@home"
And I should not see the context container for "@boss" And I should not see the context container for "@boss"

View file

@ -71,7 +71,7 @@ Feature: Show done
| page | | page |
| all done actions page | | all done actions page |
| all done actions page for project "test project" | | all done actions page for project "test project" |
| all done actions page for context "@pc" | | all done actions page for context "@pc" |
| all done actions page for tag "starred" | | all done actions page for tag "starred" |
Scenario: The projects page shows a link to all completed projects Scenario: The projects page shows a link to all completed projects