cleanup old selenium initializer stuff and migrate edit_a_todo

This commit is contained in:
Reinier Balt 2012-02-15 21:42:06 +01:00
parent d193e21ee0
commit d8b5c7d0d2
19 changed files with 501 additions and 191 deletions

View file

@ -31,6 +31,8 @@ end
# steps to use the XPath syntax.
Capybara.default_selector = :css
Capybara.prefer_visible_elements = true
# If you set this to false, any error raised from within your app will bubble
# up to your step definition and out to cucumber unless you catch it somewhere
# on the way. You can make Rails rescue errors and render error pages on a

View file

@ -93,13 +93,16 @@ module NavigationHelpers
feeds_path(options)
when /the context page for "([^\"]*)" for user "([^\"]*)"/i
@source_view = "context"
context_path(User.find_by_login($2).contexts.find_by_name($1), options)
@context = User.find_by_login($2).contexts.find_by_name($1)
context_path(@context, options)
when /the context page for "([^\"]*)"/i
@source_view = "context"
context_path(@current_user.contexts.find_by_name($1), options)
@context = @current_user.contexts.find_by_name($1)
context_path(@context, options)
when /the "([^\"]*)" project for user "([^\"]*)"/i
@source_view = "project"
project_path(User.find_by_login($2).projects.find_by_name($1), options)
@project = User.find_by_login($2).projects.find_by_name($1)
project_path(@project, options)
when /the "([^\"]*)" project/i
@source_view = "project"
@project = @current_user.projects.find_by_name($1)

View file

@ -0,0 +1,19 @@
if ENV["RAILS_ENV"] == "selenium"
puts "Configuring to use Selenium with Webrat for Cucumber stories"
Webrat.configure do |config|
config.mode = :selenium
config.application_environment = :selenium
# use only if you run a separate rails test server instance and do not
# want webrat to start one for you
# config.application_port = 3001
config.selenium_browser_startup_timeout = 30
# use only if you run a separate selenium server instance and do not
# want webrat to start one for you
# config.selenium_server_address = "localhost"
# config.selenium_server_port = "4444"
end
Cucumber::Rails::World.use_transactional_fixtures = false
end

View file

@ -7,7 +7,8 @@ module TracksStepHelper
within("#todo-form-new-action") do
click_button("todo_new_action_submit")
end
sleep(1)
wait_for_ajax
wait_for_animations_to_end
end
def submit_new_context_form
@ -30,7 +31,6 @@ module TracksStepHelper
click_button "submit_todo_#{todo.id}"
end
wait_for_form_to_go_away(todo)
wait_for_animations_to_end
end
def format_date(date)
@ -85,9 +85,17 @@ module TracksStepHelper
end
def open_submenu_for(todo)
within "div#line_todo_#{todo.id}" do
find("img#todo-submenu").click
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
page.find(submenu_arrow).should be_visible
page.find(submenu_arrow).click
# wait for the submenu to be visible
wait_until do
page.find("div#line_todo_#{todo.id} ul#ultodo_#{todo.id}").visible?
end
wait_for_animations_to_end
end
def context_list_find_index(context_name)