migrate calendar feature

This commit is contained in:
Reinier Balt 2012-01-30 03:42:47 +01:00
parent 75f2afc2e1
commit de309c8ee8
14 changed files with 87 additions and 224 deletions

View file

@ -193,10 +193,8 @@ Then /^I should see "([^"]*)" in the due next month container$/ do |todo_descrip
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "//div[@id='due_after_this_month']//div[@id='line_todo_#{todo.id}']"
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
within "div#due_after_this_month" do
find("div#line_todo_#{todo.id}").should_not be_nil
end
end

View file

@ -11,18 +11,7 @@ Given /^I am working on the mobile interface$/ do
end
Then /the badge should show (.*)/ do |number|
badge = -1
xpath= "//span[@id='badge_count']"
if response.respond_to? :selenium
response.should have_xpath(xpath)
badge = response.selenium.get_text("xpath=#{xpath}").to_i
else
response.should have_xpath(xpath) do |node|
badge = node.first.content.to_i
end
end
badge = find("span#badge_count").text.to_i
badge.should == number.to_i
end

View file

@ -6,7 +6,7 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password
click_button "Sign in »"
logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)"
response.should contain(logout_regexp)
page.should have_content(logout_regexp)
@current_user = User.find_by_login(username)
end

View file

@ -117,7 +117,12 @@ When /^I clear the due date of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
open_edit_form_for(todo)
selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='due_x_todo_#{todo.id}']/img", :wait_for => :ajax, :javascript_framework => :jquery)
within "div#edit_todo_#{todo.id}" do
find("a#due_x_todo_#{todo.id}").click
wait_until do
find("input#due_todo_#{todo.id}").value == ""
end
end
submit_edit_todo_form(todo)
end

View file

@ -4,13 +4,11 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
delete_todo_button = "xpath=//a[@id='delete_todo_#{todo.id}']/img"
selenium.click delete_todo_button
selenium.get_confirmation.should == "Are you sure that you want to delete the action '#{todo.description}'?"
wait_for :timeout => 5 do
!selenium.is_element_present("//div[@id='line_todo_#{todo.id}']")
handle_js_confirm do
open_submenu_for(todo)
find("a#delete_todo_#{todo.id}").click
end
get_confirm_text.should == "Are you sure that you want to delete the action '#{todo.description}'?"
end
When /^I delete the todo "([^"]*)"$/ do |action_description|