get selenium scenarios running again and add some scenarios for adding todos started

This commit is contained in:
Reinier Balt 2011-01-08 09:12:37 +01:00
parent 09830d044d
commit ab2e51a51a
17 changed files with 135 additions and 69 deletions

View file

@ -20,16 +20,16 @@ Feature: Edit a context
And he should see that a context named "OutAndAbout" is present
Scenario: Editing the context of a todo will remove the todo
Given this scenario is pending
Given this is a pending scenario
Scenario: Editing the description of a a todo will update that todo
Given this scenario is pending
Given this is a pending scenario
Scenario: Editing the context of the last todo will remove the todo and show empty message
Given this scenario is pending
Given this is a pending scenario
Scenario: Adding a todo to a hidden project will not show the todo
Given this scenario is pending
Given this is a pending scenario
Scenario: Adding a todo to a hidden context will show that todo
Given this scenario is pending
Given this is a pending scenario

View file

@ -37,4 +37,4 @@ Feature: dependencies
Then there should not be an error
Scenario: Deleting a predecessor will activate successors
Given this scenario is pending
Given this is a pending scenario

View file

@ -58,7 +58,7 @@ Feature: Edit a next action from every page
Given this is a pending scenario
Scenario: Editing the context of a todo to a new context will show new context
Given this scenario is pending # for home and tickler and tag
Given this is a pending scenario # for home and tickler and tag
Scenario: Making an error when editing a todo will show error message
Given this scenario is pending
Given this is a pending scenario

View file

@ -83,19 +83,19 @@ Feature: Edit a project
And I should see "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456"
Scenario: Cancelling editing a project will restore project settings
Given this scenario is pending
Given this is a pending scenario
Scenario: Editing the description of a todo will update todo
Given this scenario is pending
Given this is a pending scenario
Scenario: Moving the todo to the tickler will move todo to tickler container
Given this scenario is pending
Given this is a pending scenario
Scenario: Moving the todo out of the tickler will move todo to active container
Given this scenario is pending
Given this is a pending scenario
Scenario: Making all todos inactive will show empty message
Given this scenario is pending # empty message is in separate container
Given this is a pending scenario # empty message is in separate container
# Ticket #1043
@selenium @wip

View file

@ -125,8 +125,21 @@ Feature: Add new next action from every page
Scenario: Adding a todo to a hidden project does not show the todo
Given this is a pending scenario
Scenario: Adding a todo with a new context shows the new context
Given this is a pending scenario
@selenium @wip
Scenario Outline: Adding a todo with a new context shows the new context
When I <action> the <page>
And I submit a new <todo> with description "do at new context" and the tags "starred" in the context "New"
Then a confirmation for adding a new context "New" should be asked
And the container for the context "New" should <visible>
And the badge should show <badge>
Scenarios:
| action | page | todo | badge | visible |
| go to | home page | action | 2 | be visible |
| go to | tickler page | deferred action | 1 | be visible |
| visit | project page for "test project" | action | 2 | not be visible |
| visit | context page for "test context" | action | 1 | not be visible |
| visit | tag page for "starred" | action | 1 | be visible |
Scenario: Adding a todo to a hidden context does not show the todo
Given this is a pending scenario

View file

@ -64,7 +64,7 @@ Feature: Show statistics
And I should see "to show the actions from week 0 and further"
Scenario: I can edit the todos selected from a chart
Given this scenario is pending
Given this is a pending scenario
Scenario: Marking a todo selected from a chart as complete will remove it from the page
Given this scenario is pending
Given this is a pending scenario

View file

@ -2,6 +2,11 @@ Given /^I have no todos$/ do
Todo.delete_all
end
Given /^I have a todo "(.*)"$/ do |description|
context = @current_user.contexts.create!(:name => "context A")
@current_user.todos.create!(:context_id => context.id, :description => description)
end
Given /^I have ([0-9]+) todos$/ do |count|
context = @current_user.contexts.create!(:name => "context A")
count.to_i.downto 1 do |i|
@ -16,6 +21,11 @@ Given /^I have ([0-9]+) deferred todos$/ do |count|
end
end
Given /^I have a deferred todo "(.*)"$/ do |description|
context = @current_user.contexts.create!(:name => "context B")
@current_user.todos.create!(:context_id => context.id, :description => description, :show_from => @current_user.time + 1.week)
end
Given /^I have ([0-9]+) completed todos$/ do |count|
context = @current_user.contexts.create!(:name => "context C")
count.to_i.downto 1 do |i|
@ -66,12 +76,6 @@ When /^I expand the dependencies of "([^\"]*)"$/ do |todo_name|
selenium.click(expand_img_locator)
end
Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i|
match_xpath "div["
end
end
When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field, todo_name, new_value|
todo = @current_user.todos.find_by_description(todo_name)
todo.should_not be_nil
@ -88,6 +92,24 @@ When /^I submit a new action with description "([^"]*)"$/ do |description|
submit_next_action_form
end
When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name|
fill_in "todo[description]", :with => description
fill_in "tag_list", :with => tags
js="$('#todo_context_name').val('');"
selenium.get_eval "(function() {with(this) {#{js}}}).call(selenium.browserbot.getCurrentWindow());"
fill_in "todo_context_name", :with => context_name
submit_next_action_form
end
When /^I submit a new deferred action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name|
fill_in "todo[description]", :with => description
fill_in "context_name", :with => context_name
fill_in "tag_list", :with => tags
fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week)
submit_next_action_form
end
When /^I submit multiple actions with using$/ do |multiple_actions|
fill_in "todo[multiple_todos]", :with => multiple_actions
submit_multiple_next_action_form
@ -120,6 +142,12 @@ When /^I edit the dependency of "([^"]*)" to '([^'']*)'$/ do |todo_name, deps|
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
end
Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i|
match_xpath "div["
end
end
Then /^there should not be an error$/ do
# form should be gone and thus not errors visible
selenium.is_visible("edit_todo_#{@dep_todo.id}").should == false
@ -159,3 +187,23 @@ end
Then /^the number of actions should be (\d+)$/ do |count|
@current_user.todos.count.should == count.to_i
end
Then /^the container for the context "([^"]*)" should be visible$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
xpath = "xpath=//div[@id=\"c#{context.id}\"]"
selenium.wait_for_element(xpath, :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
end
Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
xpath = "xpath=//div[@id=\"c#{context.id}\"]"
selenium.wait_for :wait_for => :ajax, :javascript_framework => :jquery
selenium.is_element_present(xpath).should be_false
end
Then /^a confirmation for adding a new context "([^"]*)" should be asked$/ do |context_name|
selenium.get_confirmation.should == "New context \"#{context_name}\" will be also created. Are you sure?"
end

View file

@ -14,6 +14,13 @@ module TracksStepHelper
def submit_new_project_form
selenium.click("xpath=//form[@id='project_form']//button[@id='project_new_project_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
def format_date(date)
# copy-and-past from ApplicationController::format_date
return date ? date.in_time_zone(@current_user.prefs.time_zone).strftime("#{@current_user.prefs.date_format}") : ''
end
end
World(TracksStepHelper)

View file

@ -11,10 +11,17 @@ Feature: Manage deferred todos
And I have logged in as "testuser" with password "secret"
Scenario: Editing the description of a todo updated the todo
Given this scenario is pending
Given this is a pending scenario
Scenario: Editing the context of a todo moves it to the new context
Given this scenario is pending
Given this is a pending scenario
Scenario: Removing the show from date from a todo removes it from the tickler
Given this scenario is pending
Given this is a pending scenario
Scenario: Opening the tickler page shows me all deferred todos
Given I have a deferred todo "not yet now"
And I have a todo "now is a good time"
When I go to the tickler page
Then I should see "not yet now"
And I should not see "now is a good time"