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
And I have 3 deferred todos
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
And I should see "Actions selected from week"
And I should see 5 todos
And I should see "to return to the statistics page"
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
Given I have 5 todos
When I go to the statistics page
@ -70,7 +70,7 @@ Feature: Show statistics
Then I should not see the todo "todo 1"
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
Given I have 5 todos
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
xpath = "//a[@id='toggle_c#{context.id}']"
selenium.is_visible(xpath).should be_true
selenium.click(xpath)
toggle = page.find(:xpath, xpath)
toggle.should be_visible
toggle.click
end
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?
xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
page.should have_xpath(xpath, :visible => true)
else
step "I should not see \"#{repeat_pattern}\""
step "I should see \"#{repeat_pattern}\""
end
end
@ -172,8 +171,7 @@ Then /^I should not see "([^"]*)" in the completed recurring todos container$/ d
unless repeat.nil?
xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
page.should_not have_xpath(xpath, :visible => true)
else
step "I should not see \"#{repeat_pattern}\""
end

View file

@ -22,7 +22,7 @@ Then /^I should see an error flash message saying "([^"]*)"$/ do |message|
end
Then /^I should see "([^"]*)" $/ do |text|
Then "I should see \"#{text}\""
step "I should see \"#{text}\""
end
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 "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
Then /^I should see scripts$/ do
# 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
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)
# wait for the script to refresh
wait_for :timeout => 15 do
selenium.is_text_present("#{context.id} (* #{context_name} *)")
end
page.should have_content("#{context.id} (* #{context_name} *)")
# 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} \*\)/
end

View file

@ -4,10 +4,15 @@ When /^I click on the chart for actions done in the last 12 months$/ do
end
Then /^I should see a chart$/ do
response.body.should =~ /open-flash-chart/m
page.should have_css("div.open-flash-chart")
end
When /^I click on the chart for running time of all incomplete actions$/ do
# cannot really click the chart which is a swf
visit stats_path + "/show_selected_actions_from_chart/art?index=0"
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_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}']"
selenium.click(star_img, :wait_for => :ajax, :javascript_framework => :jquery)
wait_for :timeout => 5 do
selenium.is_element_present(xpath_unstarred)
end
page.find(:xpath, star_img).click
page.should have_xpath(xpath_unstarred)
end
####### 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
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath_starred)
end
page.should have_xpath(xpath_starred)
end
Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i|
match_xpath "div["
end
total = page.all("div.item-container").inject(0) { |s, e| s+=1 }
total.should == count.to_i
end
Then /^there should not be an error$/ do
@ -132,17 +128,13 @@ Then /^the selected context should be "([^"]*)"$/ do |content|
end
Then /^I should see the page selector$/ do
page_selector_xpath = ".//a[@class='next_page']"
response.body.should have_xpath(page_selector_xpath)
page.should have_xpath(".//a[@class='next_page']")
end
Then /^the page should be "([^"]*)"$/ do |page_number|
page_number_found = -1
page_number_xpath = ".//span[@class='current']"
response.should have_xpath(page_number_xpath) do |node|
page_number_found = node.first.content.to_i
end
page_number_found.should == page_number.to_i
page.find(:xpath, page_number_xpath).text.should == page_number
end
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
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|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil

View file

@ -2,10 +2,3 @@ AfterStep('@pause') do
print "Press Return to continue..."
STDIN.getc
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"
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
Given I have a todo "fix tests" in context "@pc" with tags "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"
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
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"
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
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"
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
Given I have a hidden project called "secret"
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"
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
Given I have a hidden context called "@secret"
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 see "prepare release" in the hidden container
@selenium
@javascript
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"
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"
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
When I go to the "hacking tracks" project
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"
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
Given I have a todo "migrate old scripts" in context "@pc" with tags "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 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
# also adding the first deferred todo will hide the empty message
Given I have a context called "test"
@ -20,7 +20,7 @@ Feature: Manage deferred todos
Then I should see "a new next action"
And I should not see the empty tickler message
@selenium
@javascript
Scenario: Editing the description of a todo in the tickler updated the todo
Given I have a deferred todo "not yet now"
When I go to the tickler page
@ -29,7 +29,7 @@ Feature: Manage deferred todos
Then I should not see "not yet now"
And I should see "almost"
@selenium
@javascript
Scenario: Editing the context of a todo moves it to the new context
Given I have a context called "A"
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"
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
Given I have a deferred todo "not yet now"
When I go to the tickler page
@ -58,7 +58,7 @@ Feature: Manage deferred todos
Then I should see "not yet now"
And I should not see "now is a good time"
@selenium
@javascript
Scenario: I can mark an action complete from the tickler
Given I have a deferred todo "not yet now"
When I go to the tickler page

View file

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

View file

@ -71,7 +71,7 @@ Feature: Show done
| page |
| all done actions page |
| 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" |
Scenario: The projects page shows a link to all completed projects