fix timing issues on failing scenarios. Fix deprecated jquery functions and update jqueryui

Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
Reinier Balt 2013-02-15 20:51:35 +01:00
parent 98fbbccdcb
commit 1b0d08bbb5
39 changed files with 715 additions and 600 deletions

View file

@ -62,7 +62,7 @@ Feature: Manage the list of contexts
Then I should see that a context named "@ipad" is not present
And I should see that the context container for hidden contexts is not present
@javascript
@javascript
Scenario: Delete context from context page right after an edit
Given I have a context called "@computer"
When I go to the contexts page

View file

@ -13,6 +13,8 @@ end
When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
find("a#link_edit_context_#{@context.id}").click
# wait for the form to appear (which included a submit button)
page.should have_css("button#submit_context_#{@context.id}", :visible=>true)
within "div.edit-form" do
@ -21,6 +23,8 @@ When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
end
# wait for the form to go away
page.should_not have_css("button#submit_context_#{@context.id}", :visible => true)
# wait for the changed context to appear
page.should have_css("a#link_edit_context_#{@context.id}", :visible=> true)
end

View file

@ -133,7 +133,9 @@ end
When /^I try to edit the project name to "([^\"]*)"$/ do |new_title|
edit_project_no_wait(@project) do
fill_in "project[name]", :with => new_title
within "form.edit-project-form" do
fill_in "project[name]", :with => new_title
end
end
end
@ -202,15 +204,20 @@ When /^I edit project settings and mark the project as reviewed$/ do
end
When /^I add a note "([^"]*)" to the project$/ do |note_body|
click_link "Add a note"
page.should have_css "div.widgets button#submit_note"
fill_in "note[body]", :with => note_body
click_button "Add note"
submit_button = "div.widgets button#submit_note"
click_link "Add a note"
page.should have_css submit_button
fill_in "note[body]", :with => note_body
elem = find(submit_button)
elem.should_not be_nil # form is hidden
elem.should_not be_visible
elem.should_not be_nil
elem.click
wait_until do
!elem.visible?
end
end
When /^I click on the first note icon$/ do
@ -245,9 +252,10 @@ Then /^I edit the default tags to "([^"]*)"$/ do |default_tags|
end
Then /^I should be able to change the project name in place$/ do
#Note that this is not changing the project name
# Note that this is not changing the project name
page.should have_css("div#project_name>form>input")
page.find("div#project_name > form > button[type=cancel]").click
page.should_not have_css("div#project_name>form>input")
end
Then /^I should not be able to change the project name in place$/ do

View file

@ -7,6 +7,7 @@ When /^I mark "([^"]*)" as complete$/ do |action_description|
check "mark_complete_#{todo.id}"
wait_for_ajax
wait_for_animations_to_end
end
When /^I mark "([^"]*)" as uncompleted$/ do |action_description|
@ -16,6 +17,7 @@ When /^I mark "([^"]*)" as uncompleted$/ do |action_description|
uncheck "mark_complete_#{todo.id}"
wait_for_ajax
wait_for_animations_to_end
end
When /^I mark the completed todo "([^"]*)" active$/ do |action_description|
@ -68,6 +70,8 @@ When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo
open_edit_form_for(todo)
within "form.edit_todo_form" do
fill_in "#{field_name}", :with => new_value
# force blur event
page.execute_script("$('form.edit_todo_form input.#{field_name}_todo_#{todo.id}').blur();")
end
submit_edit_todo_form(todo)
wait_for_ajax

View file

@ -3,6 +3,8 @@
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'simplecov'
SimpleCov.start 'rails'
require 'cucumber/rails'
@ -55,5 +57,4 @@ end
# Possible values are :truncation and :transaction
# The :transaction strategy is faster, but might give you threading problems.
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
Cucumber::Rails::Database.javascript_strategy = :truncation
Cucumber::Rails::Database.javascript_strategy = :truncation

View file

@ -9,7 +9,7 @@ Capybara.default_wait_time = 5
Capybara.javascript_driver = ENV["JS_DRIVER"] ? ENV["JS_DRIVER"].to_sym : :selenium
if Capybara.javascript_driver == :webkit
require 'capybara/webkit'
# require 'capybara/webkit'
end
if Capybara.javascript_driver == :selenium

View file

@ -22,8 +22,13 @@ module TracksStepHelper
end
def open_edit_form_for(todo)
edit_link = "div#line_todo_#{todo.id} a#icon_edit_todo_#{todo.id}"
# make sure we can open the edit form
page.should have_css(edit_link)
# on calendar page there can be more than 1 occurance of a todo, so we select the first here
all(:css, "div#line_todo_#{todo.id} a#icon_edit_todo_#{todo.id}")[0].click
all(:css, edit_link)[0].click
wait_for_ajax
wait_for_animations_to_end
end