mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-11 19:58:51 +01:00
migrate feedlist, user password, loggin in, manage users, mobile_* and notes manage
This commit is contained in:
parent
d8b5c7d0d2
commit
d528a87cee
10 changed files with 88 additions and 63 deletions
|
|
@ -36,7 +36,7 @@ Feature: Get all sorts of lists from Tracks
|
|||
And I should see feeds for contexts
|
||||
And I should see "@pc" as the selected context
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can select the item for getting feeds for that item
|
||||
When I go to the feeds page
|
||||
And I select "<item>" from "<item-list>"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Feature: Add new next action from mobile page
|
|||
| page | project | context |
|
||||
| home page | | |
|
||||
| tickler page | | |
|
||||
| "test project" project | test project | |
|
||||
| "test project" project | test project | test context |
|
||||
| context page for "test context" | | test context |
|
||||
| tag page for "starred" | | |
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Feature: View, add, remove notes
|
|||
And I click the icon next to the note
|
||||
Then I should see the note text
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Delete note from notes page
|
||||
Given I have a project "Pass Final Exam" with 2 notes
|
||||
When I go to the notes page
|
||||
|
|
@ -36,14 +36,14 @@ Feature: View, add, remove notes
|
|||
Then the first note should disappear
|
||||
And the badge should show 1
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Edit a note
|
||||
Given I have a project "Pass Final Exam" with 2 notes
|
||||
When I go to the notes page
|
||||
And I edit the first note to "edited note"
|
||||
Then I should see "edited note"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Toggle all notes
|
||||
Given I have a context called "@pc"
|
||||
And I have a project "take notes" that has the following todos
|
||||
|
|
@ -52,16 +52,16 @@ Feature: View, add, remove notes
|
|||
| 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"
|
||||
Then I should not see the note "note A"
|
||||
And I should not see the note "note B"
|
||||
And I should not see the note "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"
|
||||
Then I should see the note "note A"
|
||||
And I should not see the note "note B"
|
||||
And I should not see the note "note C"
|
||||
When I toggle the note of "test 1"
|
||||
Then I should not see "note A"
|
||||
Then I should not see the note "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"
|
||||
Then I should see the note "note A"
|
||||
And I should see the note "note B"
|
||||
And I should see the note "note C"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ When /^I add a new context "([^"]*)"$/ do |context_name|
|
|||
end
|
||||
|
||||
When /^I add a new active context "([^"]*)"$/ do |context_name|
|
||||
When "I add a new context \"#{context_name}\""
|
||||
step "I add a new context \"#{context_name}\""
|
||||
end
|
||||
|
||||
When /^I add a new hidden context "([^"]*)"$/ do |context_name|
|
||||
|
|
@ -56,7 +56,7 @@ end
|
|||
|
||||
Then /^I should see that a context named "([^"]*)" is not present$/ do |context_name|
|
||||
within "div#display_box" do
|
||||
Then "I should not see \"#{context_name}\""
|
||||
step "I should not see \"#{context_name}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -94,14 +94,14 @@ Then /^I should see "([^\"]*)" within the dependencies of "([^\"]*)"$/ do |succe
|
|||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
Then "I should see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\""
|
||||
step "I should see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\""
|
||||
end
|
||||
|
||||
Then /^I should not see "([^"]*)" within the dependencies of "([^"]*)"$/ do |successor_description, todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
Then "I should not see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\""
|
||||
step "I should not see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\""
|
||||
end
|
||||
|
||||
Then /^I should see that "([^"]*)" does not have dependencies$/ do |todo_description|
|
||||
|
|
@ -109,5 +109,4 @@ Then /^I should see that "([^"]*)" does not have dependencies$/ do |todo_descrip
|
|||
todo.should_not be_nil
|
||||
dependencies_icon = "//div[@id='line_todo_#{todo.id}']/div/a[@class='show_successors']/img"
|
||||
page.should_not have_xpath(dependencies_icon)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,37 +1,29 @@
|
|||
Then /^I should see a message that you need a context to get feeds for contexts$/ do
|
||||
Then "I should see \"There needs to be at least one context before you can request a feed\""
|
||||
step "I should see \"There needs to be at least one context before you can request a feed\""
|
||||
end
|
||||
|
||||
Then /^I should see a message that you need a project to get feeds for projects$/ do
|
||||
Then "I should see \"There needs to be at least one project before you can request a feed\""
|
||||
step "I should see \"There needs to be at least one project before you can request a feed\""
|
||||
end
|
||||
|
||||
Then /^I should see feeds for projects$/ do
|
||||
within 'select[id="feed-projects"]' do |scope|
|
||||
scope.should have_selector("option[value=\"#{@current_user.projects.first.id}\"]")
|
||||
end
|
||||
page.should have_css("select#feed-projects option[value='#{@current_user.projects.first.id}']")
|
||||
end
|
||||
|
||||
Then /^I should see feeds for contexts$/ do
|
||||
within 'select[id="feed-contexts"]' do |scope|
|
||||
scope.should have_selector("option[value=\"#{@current_user.contexts.first.id}\"]")
|
||||
end
|
||||
page.should have_css("select#feed-contexts option[value='#{@current_user.contexts.first.id}']")
|
||||
end
|
||||
|
||||
Then /^I should see "([^"]*)" as the selected project$/ do |project_name|
|
||||
within 'select[id="feed-projects"]' do |scope|
|
||||
scope.should have_selector("option[selected=\"selected\"]", :content => project_name)
|
||||
end
|
||||
page.should have_css 'select#feed-projects option[selected="selected"]'
|
||||
end
|
||||
|
||||
Then /^I should see "([^"]*)" as the selected context$/ do |context_name|
|
||||
within 'select[id="feed-contexts"]' do |scope|
|
||||
scope.should have_selector("option[selected=\"selected\"]", :content => context_name)
|
||||
end
|
||||
page.should have_css 'select#feed-contexts option[selected="selected"]'
|
||||
end
|
||||
|
||||
Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type|
|
||||
wait_for_ajax
|
||||
xpath= "//div[@id='feeds-for-#{list_type}']//strong"
|
||||
name.should == response.selenium.get_text("xpath=#{xpath}")
|
||||
name.should == find(:xpath, xpath).text
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,10 +22,13 @@ When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, projec
|
|||
end
|
||||
|
||||
When /^I delete the first note$/ do
|
||||
title = selenium.get_text("css=div.container h2")
|
||||
title = page.find("div.container h2").text
|
||||
id = title.split(' ').last
|
||||
click_link "delete_note_#{id}"
|
||||
selenium.get_confirmation.should == "Are you sure that you want to delete the note '#{id}'?"
|
||||
|
||||
handle_js_confirm do
|
||||
click_link "delete_note_#{id}"
|
||||
end
|
||||
get_confirm_text.should == "Are you sure that you want to delete the note '#{id}'?"
|
||||
end
|
||||
|
||||
When /^I click the icon next to the note$/ do
|
||||
|
|
@ -33,8 +36,9 @@ When /^I click the icon next to the note$/ do
|
|||
end
|
||||
|
||||
When /^I edit the first note to "([^"]*)"$/ do |note_body|
|
||||
title = selenium.get_text("css=div.container h2")
|
||||
title = page.find("div.container h2").text
|
||||
id = title.split(' ').last
|
||||
|
||||
click_link "link_edit_note_#{id}"
|
||||
fill_in "note[body]", :with => note_body
|
||||
click_button "submit_note_#{id}"
|
||||
|
|
@ -46,7 +50,7 @@ When /^I toggle the note of "([^"]*)"$/ do |todo_description|
|
|||
|
||||
xpath = "//div[@id='line_todo_#{todo.id}']/div/a/img"
|
||||
|
||||
selenium.click(xpath)
|
||||
page.find(:xpath, xpath).click
|
||||
end
|
||||
|
||||
When /^I click Toggle Notes$/ do
|
||||
|
|
@ -54,35 +58,48 @@ When /^I click Toggle Notes$/ do
|
|||
end
|
||||
|
||||
When /^I toggle all notes$/ do
|
||||
When "I click Toggle Notes"
|
||||
step "I click Toggle Notes"
|
||||
end
|
||||
|
||||
Then /^(.*) notes should be visible$/ do |number|
|
||||
# count number of project_notes
|
||||
count = 0
|
||||
response.should have_xpath("//div[@class='project_notes']") { |nodes| nodes.each { |n| count += 1 }}
|
||||
page.all("div.project_notes").each { |node| count += 1 }
|
||||
count.should == number.to_i
|
||||
end
|
||||
|
||||
Then /^I should see note "([^\"]*)" on the "([^\"]*)" project page$/ do |note, project|
|
||||
project = Project.find_by_name(project)
|
||||
visit project_path(project)
|
||||
Then "I should see \"#{note}\""
|
||||
step "I should see the note \"#{note}\""
|
||||
end
|
||||
|
||||
Then /^I should see note "([^\"]*)" on the notes page$/ do |note|
|
||||
visit notes_path
|
||||
Then "I should see \"#{note}\""
|
||||
step "I should see the note \"#{note}\""
|
||||
end
|
||||
|
||||
Then /^the first note should disappear$/ do
|
||||
title = selenium.get_text("css=div.container h2")
|
||||
title = page.find("div.container h2").text
|
||||
id = title.split(' ').last
|
||||
wait_for :timeout => 15 do
|
||||
!selenium.is_element_present("note_#{id}")
|
||||
note = "div#note_#{id}"
|
||||
|
||||
wait_until do
|
||||
!page.has_selector?(note)
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should see the note text$/ do
|
||||
Then "I should see \"after 50 characters\""
|
||||
end
|
||||
step "I should see the note \"after 50 characters\""
|
||||
end
|
||||
|
||||
Then /^I should not see the note "([^"]*)"$/ do |note_content|
|
||||
if page.has_selector?("div", :text => note_content)
|
||||
page.find("div", :text => note_content).visible?.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should see the note "([^"]*)"$/ do |note_content|
|
||||
page.find("div", :text => note_content).visible?.should be_true
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
Then /^I should be redirected to (.+?)$/ do |page_name|
|
||||
Then "I should be on #{page_name}"
|
||||
step "I should be on #{page_name}"
|
||||
end
|
||||
|
|
@ -121,12 +121,27 @@ end
|
|||
|
||||
Then /^the selected project should be "([^"]*)"$/ do |content|
|
||||
# Works for mobile. TODO: make it work for both mobile and non-mobile
|
||||
field_labeled("Project").element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{content}/
|
||||
if content.blank?
|
||||
if page.has_css?("select#todo_project_id option[selected='selected']")
|
||||
puts "text=#{page.find("select#todo_project_id option[selected='selected']").text}"
|
||||
end
|
||||
page.has_css?("select#todo_project_id option[selected='selected']").should be_false
|
||||
else
|
||||
page.find("select#todo_project_id option[selected='selected']").text.should =~ /#{content}/
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the selected context should be "([^"]*)"$/ do |content|
|
||||
# Works for mobile. TODO: make it work for both mobile and non-mobile
|
||||
field_labeled("Context").element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{content}/
|
||||
if content.blank?
|
||||
if page.has_css?("select#todo_context_id option[selected='selected']")
|
||||
puts "text=#{page.find("select#todo_context_id option[selected='selected']").text}"
|
||||
save_and_open_page
|
||||
end
|
||||
page.has_css?("select#todo_context_id option[selected='selected']").should be_false
|
||||
else
|
||||
page.find("select#todo_context_id option[selected='selected']").text.should =~ /#{content}/
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should see the page selector$/ do
|
||||
|
|
@ -175,7 +190,7 @@ Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |
|
|||
todo.should_not be_nil
|
||||
|
||||
xpath = "//div[@id='completed_container']//a[@href='/todos/#{todo.id}.m']"
|
||||
response.should have_xpath xpath
|
||||
page.should have_xpath(xpath)
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for home todos/ do
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ Given /^the following user records with hash algorithm$/ do |table|
|
|||
end
|
||||
|
||||
When /^I change my password to "([^"]*)"$/ do |password|
|
||||
Then 'I should be on the change password page'
|
||||
step 'I should be on the change password page'
|
||||
%w{password password_confirmation}.each { |name| fill_in "user[#{name}]", :with => password }
|
||||
click_button
|
||||
click_button "Change password"
|
||||
end
|
||||
|
||||
Given "no users exists" do
|
||||
|
|
@ -50,19 +50,21 @@ When /^I delete the user "([^\"]*)"$/ do |username|
|
|||
user = User.find_by_login(username)
|
||||
user.should_not be_nil
|
||||
|
||||
selenium.click "xpath=//tr[@id='user-#{user.id}']//img"
|
||||
selenium.get_confirmation.should == "Warning: this will delete user '#{user.login}', all their actions, contexts, project and notes. Are you sure that you want to continue?"
|
||||
wait_for do
|
||||
!selenium.is_element_present("//tr[@id='user-#{user.id}']//img")
|
||||
handle_js_confirm do
|
||||
page.find(:xpath, "//tr[@id='user-#{user.id}']//img").click
|
||||
end
|
||||
get_confirm_text.should == "Warning: this will delete user '#{user.login}', all their actions, contexts, project and notes. Are you sure that you want to continue?"
|
||||
|
||||
wait_until do
|
||||
!page.has_css?("tr#user-#{user.id}")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Then /^I should see that a user named "([^\"]*)" is not present$/ do |username|
|
||||
Then "I should not see \"#{username} (\""
|
||||
step "I should not see \"#{username} (\""
|
||||
end
|
||||
|
||||
Then "I should be an admin" do
|
||||
# just check on the presence of the menu item for managing users
|
||||
Then "I should see \"Manage users\""
|
||||
step "I should see \"Manage users\""
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue