migrate tickler, tagging, toggle context and done. This finishes the first migration pass

This commit is contained in:
Reinier Balt 2012-03-12 22:52:45 +01:00
parent 1236b5985c
commit 41ebd2ec9b
12 changed files with 64 additions and 72 deletions

View file

@ -3,9 +3,9 @@ When /^I collapse the context container of "([^"]*)"$/ do |context_name|
context.should_not be_nil
xpath = "//a[@id='toggle_c#{context.id}']"
selenium.is_visible(xpath).should be_true
selenium.click(xpath)
toggle = page.find(:xpath, xpath)
toggle.should be_visible
toggle.click
end
When /^I toggle all collapsed context containers$/ do
@ -160,10 +160,9 @@ Then /^I should see "([^"]*)" in the active recurring todos container$/ do |repe
unless repeat.nil?
xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
page.should have_xpath(xpath, :visible => true)
else
step "I should not see \"#{repeat_pattern}\""
step "I should see \"#{repeat_pattern}\""
end
end
@ -172,8 +171,7 @@ Then /^I should not see "([^"]*)" in the completed recurring todos container$/ d
unless repeat.nil?
xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{repeat.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
page.should_not have_xpath(xpath, :visible => true)
else
step "I should not see \"#{repeat_pattern}\""
end

View file

@ -22,7 +22,7 @@ Then /^I should see an error flash message saying "([^"]*)"$/ do |message|
end
Then /^I should see "([^"]*)" $/ do |text|
Then "I should see \"#{text}\""
step "I should see \"#{text}\""
end
Then /^I should save and open the page$/ do

View file

@ -1,23 +1,20 @@
Then /^I should see a message that you need a context to see scripts$/ do
Then 'I should see "You do not have any context yet. The script will be available after you add your first context"'
step 'I should see "You do not have any context yet. The script will be available after you add your first context"'
end
Then /^I should see scripts$/ do
# check on a small snippet of the first applescript
Then 'I should see "set returnValue to call xmlrpc"'
step 'I should see "set returnValue to call xmlrpc"'
end
Then /^I should see a script "([^\"]*)" for "([^\"]*)"$/ do |script, context_name|
selenium.is_visible(script)
page.should have_css("##{script}", :visible => true)
context = Context.find_by_name(context_name)
# wait for the script to refresh
wait_for :timeout => 15 do
selenium.is_text_present("#{context.id} (* #{context_name} *)")
end
page.should have_content("#{context.id} (* #{context_name} *)")
# make sure the text is found within the textarea
script_source = selenium.get_text("//textarea[@id='#{script}']")
script_source = page.find(:xpath, "//textarea[@id='#{script}']").text
script_source.should =~ /#{context.id} \(\* #{context_name} \*\)/
end

View file

@ -4,10 +4,15 @@ When /^I click on the chart for actions done in the last 12 months$/ do
end
Then /^I should see a chart$/ do
response.body.should =~ /open-flash-chart/m
page.should have_css("div.open-flash-chart")
end
When /^I click on the chart for running time of all incomplete actions$/ do
# cannot really click the chart which is a swf
visit stats_path + "/show_selected_actions_from_chart/art?index=0"
end
When /^I click on the chart for running time of all incomplete visible actions$/ do
# cannot really click the chart which is a swf
visit stats_path + "/show_selected_actions_from_chart/avrt?index=0"
end

View file

@ -49,14 +49,12 @@ When /^I unstar the action "([^"]*)"$/ do |action_description|
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
selenium.is_element_present(xpath_starred).should be_true
page.should have_xpath(xpath_starred)
star_img = "//img[@id='star_img_#{todo.id}']"
selenium.click(star_img, :wait_for => :ajax, :javascript_framework => :jquery)
wait_for :timeout => 5 do
selenium.is_element_present(xpath_unstarred)
end
page.find(:xpath, star_img).click
page.should have_xpath(xpath_unstarred)
end
####### Editing a todo using Edit Form #######

View file

@ -47,16 +47,12 @@ Then /^I should see an unstarred "([^"]*)"$/ do |action_description|
todo.should_not be_nil
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath_starred)
end
page.should have_xpath(xpath_starred)
end
Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i|
match_xpath "div["
end
total = page.all("div.item-container").inject(0) { |s, e| s+=1 }
total.should == count.to_i
end
Then /^there should not be an error$/ do
@ -132,17 +128,13 @@ Then /^the selected context should be "([^"]*)"$/ do |content|
end
Then /^I should see the page selector$/ do
page_selector_xpath = ".//a[@class='next_page']"
response.body.should have_xpath(page_selector_xpath)
page.should have_xpath(".//a[@class='next_page']")
end
Then /^the page should be "([^"]*)"$/ do |page_number|
page_number_found = -1
page_number_xpath = ".//span[@class='current']"
response.should have_xpath(page_number_xpath) do |node|
page_number_found = node.first.content.to_i
end
page_number_found.should == page_number.to_i
page.find(:xpath, page_number_xpath).text.should == page_number
end
Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name|
@ -196,6 +188,15 @@ Then /^I should see empty message for completed todos of home$/ do
find("div#empty-d").should be_visible
end
Then /^I should (see|not see) the empty tickler message$/ do |see|
elem = find("div#tickler-empty-nd")
if see=="see"
elem.should be_visible
else
elem.should_not be_visible
end
end
Then /^I should not see the notes of "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil