mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
add tests for toggling visibility of collapsed contexts
This commit is contained in:
parent
30c2fb8b82
commit
cdff38995c
5 changed files with 127 additions and 5 deletions
|
|
@ -42,3 +42,26 @@ Feature: View, add, remove notes
|
||||||
When I go to the notes page
|
When I go to the notes page
|
||||||
And I edit the first note to "edited note"
|
And I edit the first note to "edited note"
|
||||||
Then I should see "edited note"
|
Then I should see "edited note"
|
||||||
|
|
||||||
|
@selenium
|
||||||
|
Scenario: Toggle all notes
|
||||||
|
Given I have a context called "@pc"
|
||||||
|
And I have a project "take notes" that has the following todos
|
||||||
|
| description | context | notes |
|
||||||
|
| test 1 | @pc | note A |
|
||||||
|
| test 2 | @pc | note B |
|
||||||
|
| test 3 | @pc | note C |
|
||||||
|
When I go to the home page
|
||||||
|
Then I should not see "note A"
|
||||||
|
And I should not see "note B"
|
||||||
|
And I should not see "note C"
|
||||||
|
When I toggle the note of "test 1"
|
||||||
|
Then I should see "note A"
|
||||||
|
And I should not see "note B"
|
||||||
|
And I should not see "note C"
|
||||||
|
When I toggle the note of "test 1"
|
||||||
|
Then I should not see "note A"
|
||||||
|
When I toggle all notes
|
||||||
|
Then I should see "note A"
|
||||||
|
And I should see "note B"
|
||||||
|
And I should see "note C"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,17 @@
|
||||||
|
When /^I collapse the context container of "([^"]*)"$/ do |context_name|
|
||||||
|
context = @current_user.contexts.find_by_name(context_name)
|
||||||
|
context.should_not be_nil
|
||||||
|
|
||||||
|
xpath = "//a[@id='toggle_c#{context.id}']"
|
||||||
|
selenium.is_visible(xpath).should be_true
|
||||||
|
|
||||||
|
selenium.click(xpath)
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I toggle all collapsed context containers$/ do
|
||||||
|
click_link 'Toggle collapsed contexts'
|
||||||
|
end
|
||||||
|
|
||||||
####### Context #######
|
####### Context #######
|
||||||
|
|
||||||
Then /^I should not see the context "([^"]*)"$/ do |context_name|
|
Then /^I should not see the context "([^"]*)"$/ do |context_name|
|
||||||
|
|
@ -17,6 +31,10 @@ Then /^I should not see the container for context "([^"]*)"$/ do |context_name|
|
||||||
Then "I should not see the context \"#{context_name}\""
|
Then "I should not see the context \"#{context_name}\""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^I should not see the context container for "([^"]*)"$/ do |context_name|
|
||||||
|
Then "I should not see the context \"#{context_name}\""
|
||||||
|
end
|
||||||
|
|
||||||
Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name|
|
Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name|
|
||||||
Then "I should not see the context \"#{context_name}\""
|
Then "I should not see the context \"#{context_name}\""
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@ Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I click Toggle Notes$/ do
|
|
||||||
click_link 'Toggle notes'
|
|
||||||
end
|
|
||||||
|
|
||||||
When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, project|
|
When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, project|
|
||||||
project = Project.find_by_name(project)
|
project = Project.find_by_name(project)
|
||||||
project.notes.create!(:user_id => @current_user.id, :body => note)
|
project.notes.create!(:user_id => @current_user.id, :body => note)
|
||||||
|
|
@ -44,6 +40,23 @@ When /^I edit the first note to "([^"]*)"$/ do |note_body|
|
||||||
click_button "submit_note_#{id}"
|
click_button "submit_note_#{id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I toggle the note of "([^"]*)"$/ do |todo_description|
|
||||||
|
todo = @current_user.todos.find_by_description(todo_description)
|
||||||
|
todo.should_not be_nil
|
||||||
|
|
||||||
|
xpath = "//div[@id='line_todo_#{todo.id}']/div/a/img"
|
||||||
|
|
||||||
|
selenium.click(xpath)
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I click Toggle Notes$/ do
|
||||||
|
click_link 'Toggle notes'
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I toggle all notes$/ do
|
||||||
|
When "I click Toggle Notes"
|
||||||
|
end
|
||||||
|
|
||||||
Then /^(.*) notes should be visible$/ do |number|
|
Then /^(.*) notes should be visible$/ do |number|
|
||||||
# count number of project_notes
|
# count number of project_notes
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,8 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
|
||||||
new_todo = @current_user.todos.create!(
|
new_todo = @current_user.todos.create!(
|
||||||
:description => todo[:description],
|
:description => todo[:description],
|
||||||
:context_id => context.id,
|
:context_id => context.id,
|
||||||
:project_id=>@project.id)
|
:project_id=>@project.id,
|
||||||
|
:notes => todo[:notes])
|
||||||
unless todo[:tags].nil?
|
unless todo[:tags].nil?
|
||||||
new_todo.tag_with(todo[:tags])
|
new_todo.tag_with(todo[:tags])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
67
features/toggle_context_containers.feature
Normal file
67
features/toggle_context_containers.feature
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
Feature: Toggle the context containers
|
||||||
|
In order to only see the todos relevant on this moment
|
||||||
|
As a Tracks user
|
||||||
|
I want to toggle the contexts so the todos in that context are not shown
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following user record
|
||||||
|
| login | password | is_admin |
|
||||||
|
| testuser | secret | false |
|
||||||
|
And I have logged in as "testuser" with password "secret"
|
||||||
|
|
||||||
|
@selenium
|
||||||
|
Scenario: I can toggle a context container
|
||||||
|
Given I have the following contexts
|
||||||
|
| name | hide |
|
||||||
|
| @ipad | false |
|
||||||
|
| @home | false |
|
||||||
|
| @boss | false |
|
||||||
|
And I have a project "collapse those contexts" that has the following todos
|
||||||
|
| description | context |
|
||||||
|
| test 1 | @ipad |
|
||||||
|
| test 2 | @home |
|
||||||
|
| test 3 | @boss |
|
||||||
|
When I go to the home page
|
||||||
|
Then I should see "test 1" in the context container for "@ipad"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
|
||||||
|
@selenium
|
||||||
|
Scenario: I can hide all collapsed containers
|
||||||
|
Given I have the following contexts
|
||||||
|
| name | hide |
|
||||||
|
| @ipad | false |
|
||||||
|
| @home | false |
|
||||||
|
| @boss | false |
|
||||||
|
And I have a project "collapse those contexts" that has the following todos
|
||||||
|
| description | context |
|
||||||
|
| test 1 | @ipad |
|
||||||
|
| test 2 | @home |
|
||||||
|
| test 3 | @boss |
|
||||||
|
When I go to the home page
|
||||||
|
Then I should see "test 1" in the context container for "@ipad"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
And I should not see the context container for "@ipad"
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue