migrate feedlist, user password, loggin in, manage users, mobile_* and notes manage

This commit is contained in:
Reinier Balt 2012-02-21 20:18:26 +01:00
parent d8b5c7d0d2
commit d528a87cee
10 changed files with 88 additions and 63 deletions

View file

@ -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