mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-10 03:08:50 +01:00
migrate search and add new todo scenario's
This commit is contained in:
parent
cbe372cba0
commit
1236b5985c
14 changed files with 88 additions and 79 deletions
2
Gemfile
2
Gemfile
|
|
@ -47,7 +47,7 @@ group :test do
|
|||
gem "thoughtbot-factory_girl"
|
||||
gem 'memory_test_fix', '~>0.1.3'
|
||||
gem "capybara", ">=0.3.5"
|
||||
gem "selenium-webdriver", '2.14.0' # locked to 2.14.0, see https://code.google.com/p/selenium/issues/detail?id=3075
|
||||
gem "selenium-webdriver", "2.14.0" # is locked to 2.14.0 for https://code.google.com/p/selenium/issues/detail?id=3075
|
||||
gem "capybara-webkit"
|
||||
gem "capybara-screenshot"
|
||||
gem "launchy"
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ class TodosController < ApplicationController
|
|||
|
||||
@todo.reload if @saved
|
||||
@todo_was_created_deferred = @todo.deferred?
|
||||
@todo_was_created_blocked = @todo.pending?
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => "index" }
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ module TodosHelper
|
|||
def remote_mobile_checkbox(todo=@todo)
|
||||
form_tag toggle_check_todo_path(@todo, :format => 'm'), :method => :put, :class => "mobile-done", :name => "mobile_complete_#{@todo.id}" do
|
||||
check_box_tag('_source_view', 'todo', @todo && @todo.completed?, "onClick" => "document.mobile_complete_#{@todo.id}.submit()")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def date_span(todo=@todo)
|
||||
|
|
@ -370,7 +370,8 @@ module TodosHelper
|
|||
@todo_was_blocked_from_active_state ||
|
||||
@todo_was_destroyed_from_deferred_state ||
|
||||
@todo_was_created_deferred ||
|
||||
@todo_was_blocked_from_completed_state
|
||||
@todo_was_blocked_from_completed_state ||
|
||||
@todo_was_created_blocked
|
||||
return "p#{todo.project_id}empty-nd"
|
||||
}
|
||||
page.tag {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ Feature: Edit a next action from every page
|
|||
| tag page for "starred" | tag |
|
||||
| "visible project" project | project |
|
||||
|
||||
@javascript
|
||||
@javascript @wip
|
||||
Scenario Outline: I can mark a completed todo active and it will update empty messages and context containers
|
||||
Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context"
|
||||
When I go to the <page>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Feature: Show all due actions in a calendar view
|
|||
Then I should see "tester of stuff"
|
||||
And I should see "unrelated stuff"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit found todos
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
|
|
@ -43,7 +43,7 @@ Feature: Show all due actions in a calendar view
|
|||
Then I should not see "tester of stuff"
|
||||
And I should see "test 1-2-3"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can delete found todos
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
|
|
@ -58,7 +58,7 @@ Feature: Show all due actions in a calendar view
|
|||
And I search for "test"
|
||||
Then I should not see "tester of stuff"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can mark found todos complete and uncomplete
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Feature: Add new next action from every page
|
|||
And I have a context called "test context"
|
||||
And I have a project "test project" with 1 todos
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can hide the input form for single next action on a page
|
||||
When I go to the <page>
|
||||
Then the single action form should be visible
|
||||
|
|
@ -26,7 +26,7 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" |
|
||||
| tag page for "starred" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can hide the input form for multiple next actions
|
||||
When I go to the <page>
|
||||
Then the single action form should be visible
|
||||
|
|
@ -44,7 +44,7 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" |
|
||||
| tag page for "starred" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can hide the input form and then choose both input forms
|
||||
When I go to the <page>
|
||||
Then the single action form should be visible
|
||||
|
|
@ -64,7 +64,7 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" |
|
||||
| tag page for "starred" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can switch forms for single next action to multiple next actions
|
||||
When I go to the <page>
|
||||
Then the single action form should be visible
|
||||
|
|
@ -83,11 +83,11 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" |
|
||||
| tag page for "starred" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can add a todo from several pages
|
||||
When I go to the <page>
|
||||
And I submit a new action with description "a new next action"
|
||||
Then I should <see> "a new next action"
|
||||
Then I should <see> the todo "a new next action"
|
||||
|
||||
Scenarios:
|
||||
| page | see |
|
||||
|
|
@ -97,7 +97,7 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" | see |
|
||||
| tag page for "starred" | see |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can add multiple todos from several pages
|
||||
When I go to the <page>
|
||||
And I follow "Add multiple next actions"
|
||||
|
|
@ -106,8 +106,8 @@ Feature: Add new next action from every page
|
|||
one new next action
|
||||
another new next action
|
||||
"""
|
||||
Then I should <see> "one new next action"
|
||||
And I should <see> "another new next action"
|
||||
Then I should <see> the todo "one new next action"
|
||||
And I should <see> the todo "another new next action"
|
||||
And the badge should show <badge>
|
||||
And the number of actions should be <count>
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" | see | 2 | 3 |
|
||||
| tag page for "starred" | not see | 0 | 3 |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Adding a todo to another project does not show the todo
|
||||
Given I have a project called "another project"
|
||||
When I go to the "test project" project
|
||||
|
|
@ -128,17 +128,17 @@ Feature: Add new next action from every page
|
|||
When I go to the "another project" project
|
||||
Then I should see "can you see me?"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Adding a deferred todo to another project does not show the todo
|
||||
# scenario for #1146
|
||||
Given I have a project called "another project"
|
||||
When I go to the "test project" project
|
||||
And I submit a deferred new action with description "a new next action" to project "another project" in the context "test context"
|
||||
Then I should not see "a new next action"
|
||||
Then I should not see the todo "a new next action"
|
||||
And I submit a deferred new action with description "another new next action" to project "test project" in the context "test context"
|
||||
Then I should see "another new next action"
|
||||
Then I should see the todo "another new next action"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: Adding a todo with a new context shows the new context
|
||||
When I go to the <page>
|
||||
And I submit a new <todo> with description "do at new context" and the tags "starred" in the context "New"
|
||||
|
|
@ -154,7 +154,7 @@ Feature: Add new next action from every page
|
|||
| context page for "test context" | action | 1 | not be visible |
|
||||
| tag page for "starred" | action | 1 | be visible |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: Adding a todo to a hidden project does not show the todo
|
||||
Given I have a hidden project called "hidden project"
|
||||
And I have a project called "visible project"
|
||||
|
|
@ -177,7 +177,7 @@ Feature: Add new next action from every page
|
|||
| tag page for "starred" | not see | not see |
|
||||
| tag page for "test" | see | see |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Adding a todo to a hidden context from home page does not show the todo
|
||||
Given I have a context called "visible context"
|
||||
And I have a hidden context called "hidden context"
|
||||
|
|
@ -187,7 +187,7 @@ Feature: Add new next action from every page
|
|||
When I submit a new action with description "another new todo" in the context "hidden context"
|
||||
Then I should not see "another new todo"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Adding a todo to a context show the todo in that context page
|
||||
Given I have a context called "visible context"
|
||||
And I have a hidden context called "hidden context"
|
||||
|
|
@ -198,7 +198,7 @@ Feature: Add new next action from every page
|
|||
And I submit a new action with description "another new todo" in the context "hidden context"
|
||||
Then I should see "another new todo"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Adding a todo to an empty container hides the empty message # TODO: make outline
|
||||
Given I have a context called "visible context"
|
||||
When I go to the tag page for "test"
|
||||
|
|
@ -207,7 +207,7 @@ Feature: Add new next action from every page
|
|||
Then I should see "a new todo"
|
||||
And I should not see "Currently there are no incomplete actions with the tag 'bla'"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Adding a dependency to a todo updated the successor
|
||||
When I go to the "test project" project
|
||||
Then I should see "todo 1"
|
||||
|
|
@ -215,8 +215,9 @@ Feature: Add new next action from every page
|
|||
Then I should not see "a new todo" in the project container of "test project"
|
||||
When I expand the dependencies of "todo 1"
|
||||
Then I should see "a new todo" within the dependencies of "todo 1"
|
||||
And I should not see empty message for deferred todos of project
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can add multiple todos in a new project and a new context
|
||||
When I go to the home page
|
||||
And I follow "Add multiple next actions"
|
||||
|
|
@ -236,7 +237,7 @@ Feature: Add new next action from every page
|
|||
And I should see "b"
|
||||
And I should see "c"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I need to fill in at least one description and a context
|
||||
When I go to the home page
|
||||
And I follow "Add multiple next actions"
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ Feature: Integrate Tracks in various ways
|
|||
When I go to the integrations page
|
||||
Then I should see scripts
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: The scripts on the page should be prefilled with the first context
|
||||
When I go to the integrations page
|
||||
Then I should see a script "applescript1" for "@pc"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: When I select a different context the example scripts should change accordingly
|
||||
When I go to the integrations page
|
||||
When I select "<context1>" from "<context-list>"
|
||||
|
|
|
|||
|
|
@ -104,15 +104,25 @@ 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
|
||||
|
||||
list_id = @source_view=="review" ? "list-#{state}-projects" : "list-#{state_name}-projects-container"
|
||||
xpath = "//div[@id='#{list_id}']//div[@id='project_#{project.id}']"
|
||||
|
||||
page.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}']"
|
||||
page.has_xpath?(xpath).should be_true
|
||||
|
||||
list_id = @source_view=="review" ? "list-#{state_name}-projects" : "list-#{state_name}-projects-container"
|
||||
xpath = "//div[@id='#{list_id}']//div[@id='project_#{project.id}']"
|
||||
|
||||
page.should have_xpath(xpath)
|
||||
end
|
||||
|
||||
Then /^I see the project "([^"]*)" in the "([^"]*)" list$/ do |project_name, state_name|
|
||||
step "the project \"#{project_name}\" should be in state list \"#{state_name}\""
|
||||
end
|
||||
|
||||
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
|
||||
|
|
@ -120,7 +130,7 @@ Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |sta
|
|||
end
|
||||
|
||||
Then /^the new project form should be visible$/ do
|
||||
page.has_css?("div#project_new", :visible => true).should be_true
|
||||
page.should have_css("div#project_new", :visible => true)
|
||||
end
|
||||
|
||||
Then /^the new project form should not be visible$/ do
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
Then /^I see the project "([^"]*)" in the "([^"]*)" list$/ do |name, state|
|
||||
project = @current_user.projects.find_by_name(name)
|
||||
project.should_not be_nil
|
||||
|
||||
xpath = "//div[@id='list-#{state}-projects']//div[@id='project_#{project.id}']"
|
||||
response.should have_xpath(xpath)
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
Then /^the single action form should be visible$/ do
|
||||
selenium.is_visible("todo_new_action").should == true
|
||||
page.should have_css("#todo_new_action", :visible => true)
|
||||
end
|
||||
|
||||
Then /^the single action form should not be visible$/ do
|
||||
selenium.is_visible("todo_new_action").should == false
|
||||
page.should_not have_css("#todo_new_action", :visible=>true)
|
||||
end
|
||||
|
||||
Then /^the multiple action form should be visible$/ do
|
||||
selenium.is_visible("todo_multi_add").should == true
|
||||
page.should have_css("#todo_multi_add", :visible => true)
|
||||
end
|
||||
|
||||
Then /^the multiple action form should not be visible$/ do
|
||||
selenium.is_visible("todo_multi_add").should == false
|
||||
page.should_not have_css("#todo_multi_add", :visible=>true)
|
||||
end
|
||||
|
|
@ -212,21 +212,21 @@ When /^I submit a new action with description "([^"]*)" with a dependency on "([
|
|||
predecessor.should_not be_nil
|
||||
|
||||
fill_in "todo[description]", :with => todo_description
|
||||
|
||||
input = "xpath=//form[@id='todo-form-new-action']//input[@id='predecessor_input']"
|
||||
selenium.focus(input)
|
||||
selenium.type_keys input, predecessor_description
|
||||
fill_in "predecessor_input", :with => predecessor_description
|
||||
# input = "xpath=//form[@id='todo-form-new-action']//input[@id='predecessor_input']"
|
||||
# selenium.focus(input)
|
||||
# selenium.type_keys input, predecessor_description
|
||||
|
||||
# wait for auto complete
|
||||
autocomplete = "xpath=//a[@id='ui-active-menuitem']"
|
||||
selenium.wait_for_element(autocomplete, :timeout_in_seconds => 5)
|
||||
autocomplete = "//a[@id='ui-active-menuitem']"
|
||||
page.should have_xpath(autocomplete, :visible => true)
|
||||
|
||||
# click first line
|
||||
first_elem = "xpath=//ul/li[1]/a[@id='ui-active-menuitem']"
|
||||
selenium.click(first_elem)
|
||||
first_elem = "//ul/li[1]/a[@id='ui-active-menuitem']"
|
||||
page.find(:xpath, first_elem).click
|
||||
|
||||
new_dependency_line = "xpath=//li[@id='pred_#{predecessor.id}']"
|
||||
selenium.wait_for_element(new_dependency_line, :timeout_in_seconds => 5)
|
||||
new_dependency_line = "//li[@id='pred_#{predecessor.id}']"
|
||||
page.should have_xpath(new_dependency_line, :visible => true)
|
||||
|
||||
submit_next_action_form
|
||||
end
|
||||
|
|
|
|||
|
|
@ -94,16 +94,8 @@ Then /^I should see an active todo "([^"]*)"$/ do |todo_description|
|
|||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
# only active todos have a grip div
|
||||
|
||||
xpath = "//div[@id='line_todo_#{todo.id}']/img[@class='grip']"
|
||||
|
||||
unless selenium.is_element_present(xpath)
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(xpath)
|
||||
end
|
||||
end
|
||||
selenium.is_visible(xpath).should be_true
|
||||
page.should have_xpath(xpath, :visible=>true)
|
||||
end
|
||||
|
||||
Then /^the number of actions should be (\d+)$/ do |count|
|
||||
|
|
@ -111,7 +103,7 @@ Then /^the number of actions should be (\d+)$/ do |count|
|
|||
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?"
|
||||
get_confirm_text.should == "New context '#{context_name}' will be also created. Are you sure?"
|
||||
end
|
||||
|
||||
Then /^the selected project should be "([^"]*)"$/ do |content|
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
Then /^I should not see empty message for todos of tag$/ do
|
||||
find("div#no_todos_in_view").should_not be_visible
|
||||
page.should_not have_css("div#no_todos_in_view", :visible => true)
|
||||
end
|
||||
|
||||
Then /^I should see empty message for todos of tag$/ do
|
||||
find("div#no_todos_in_view").should be_visible
|
||||
page.should have_css("div#no_todos_in_view", :visible => true)
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for completed todos of tag$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
page.should_not have_css("div#empty-d", :visible=>true)
|
||||
end
|
||||
|
||||
Then /^I should see empty message for completed todos of tag$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
page.should have_css("div#empty-d", :visible=>true)
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for deferred todos of tag$/ do
|
||||
find("div#tickler-empty-nd").should_not be_visible
|
||||
page.should_not have_css("div#tickler-empty-nd", :visible=>true)
|
||||
end
|
||||
|
||||
Then /^I should see empty message for deferred todos of tag$/ do
|
||||
find("div#tickler-empty-nd").should be_visible
|
||||
page.should have_css("div#tickler-empty-nd", :visible=>true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,14 +1,23 @@
|
|||
module TracksStepHelper
|
||||
def submit_multiple_next_action_form
|
||||
selenium.click("xpath=//form[@id='todo-form-multi-new-action']//button[@id='todo_multi_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
xpath = "//form[@id='todo-form-multi-new-action']//button[@id='todo_multi_new_action_submit']"
|
||||
handle_js_confirm do
|
||||
within("form#todo-form-multi-new-action") do
|
||||
click_button("todo_multi_new_action_submit")
|
||||
end
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
end
|
||||
|
||||
def submit_next_action_form
|
||||
within("#todo-form-new-action") do
|
||||
click_button("todo_new_action_submit")
|
||||
handle_js_confirm do
|
||||
within("#todo-form-new-action") do
|
||||
click_button("todo_new_action_submit")
|
||||
end
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def submit_new_context_form
|
||||
|
|
@ -135,6 +144,10 @@ module TracksStepHelper
|
|||
open_project_edit_form(project)
|
||||
yield
|
||||
submit_project_edit_form(project)
|
||||
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
|
||||
page.should_not have_css("button#submit_project_#{project.id}", :visible => true)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue