mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-01 02:20:16 +01:00
make todos editable on the search page. Fix #716.
This commit is contained in:
parent
83133e3cdc
commit
bed46847b3
7 changed files with 153 additions and 17 deletions
81
features/search.feature
Normal file
81
features/search.feature
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
Feature: Show all due actions in a calendar view
|
||||
As a Tracks user
|
||||
In order to keep overview of my due todos
|
||||
I want to manage due todos in a calendar view
|
||||
|
||||
Background:
|
||||
Given the following user record
|
||||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
|
||||
Scenario: I can search for todos by partial description
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
| tester of stuff | @home |
|
||||
| testing search | @work |
|
||||
| unrelated stuff | @home |
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should see "tester"
|
||||
And I should see "testing search"
|
||||
When I go to the search page
|
||||
And I search for "stuff"
|
||||
Then I should see "tester of stuff"
|
||||
And I should see "unrelated stuff"
|
||||
|
||||
@selenium
|
||||
Scenario: I can edit found todos
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
| tester of stuff | @home |
|
||||
| testing search | @work |
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should see "tester of stuff"
|
||||
When I star the action "tester of stuff"
|
||||
Then I should see a starred "tester of stuff"
|
||||
When I edit the description of "tester of stuff" to "test 1-2-3"
|
||||
Then I should not see "tester of stuff"
|
||||
And I should see "test 1-2-3"
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should not see "tester of stuff"
|
||||
And I should see "test 1-2-3"
|
||||
|
||||
@selenium
|
||||
Scenario: I can delete found todos
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
| tester of stuff | @home |
|
||||
| testing search | @work |
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should see "tester of stuff"
|
||||
When I delete the action "tester of stuff"
|
||||
Then I should not see "tester of stuff"
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should not see "tester of stuff"
|
||||
|
||||
@selenium @wip
|
||||
Scenario: I can mark found todos complete and uncomplete
|
||||
Given I have the following todos:
|
||||
| description | context |
|
||||
| tester of stuff | @home |
|
||||
| testing search | @work |
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should see an active todo "tester of stuff"
|
||||
When I mark "tester of stuff" as complete
|
||||
Then I should see a completed todo "tester of stuff"
|
||||
# the completed todo should show up on the next search too
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should see a completed todo "tester of stuff"
|
||||
When I mark "tester of stuff" as uncompleted
|
||||
Then I should see an active todo "tester of stuff"
|
||||
# the active todo should show up on the next search too
|
||||
When I go to the search page
|
||||
And I search for "test"
|
||||
Then I should see an active todo "tester of stuff"
|
||||
4
features/step_definitions/search_steps.rb
Normal file
4
features/step_definitions/search_steps.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
When /^I search for "([^"]*)"$/ do |search_arg|
|
||||
fill_in "search", :with => search_arg
|
||||
click_button "Search"
|
||||
end
|
||||
|
|
@ -40,6 +40,12 @@ Given /^I have a todo "([^"]*)"$/ do |description|
|
|||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
end
|
||||
|
||||
Given /^I have the following todos:$/ do |table|
|
||||
table.hashes.each do | todo |
|
||||
Given "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\""
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" with notes "([^"]*)"$/ do |description, notes|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
@todo.notes = notes
|
||||
|
|
|
|||
|
|
@ -71,13 +71,46 @@ Then /^I should see the todo "([^\"]*)"$/ do |todo_description|
|
|||
end
|
||||
|
||||
Then /^I should not see the todo "([^\"]*)"$/ do |todo_description|
|
||||
if selenium.is_element_present("//span[.=\"#{todo_description}\"]")
|
||||
xpath = "//span[.=\"#{todo_description}\"]"
|
||||
if selenium.is_element_present(xpath)
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present("//span[.=\"#{todo_description}\"]")
|
||||
!selenium.is_element_present(xpath)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should see a completed todo "([^"]*)"$/ do |todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
# only completed todos have a grey span with the completed_at date
|
||||
xpath = "//div[@id='line_todo_#{todo.id}']/div/span[@class='grey']"
|
||||
|
||||
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
|
||||
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
Then /^the number of actions should be (\d+)$/ do |count|
|
||||
@current_user.todos.count.should == count.to_i
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue