ALL SELENIUM TESTS PASSING!!

Caught a couple of things that I had to fix plus a handful of broken tests. This is the first time in forever that we have a fully successful selenium suite.
This commit is contained in:
Eric Allen 2009-10-13 22:34:37 -04:00
parent e32b23c615
commit 96f510abd4
10 changed files with 39 additions and 32 deletions

View file

@ -25,7 +25,7 @@ module TodosHelper
def remote_edit_menu_item(parameters, todo)
return link_to_remote(
image_tag("edit_off.png", :mouseover => "edit_on.png", :alt => "", :align => "absmiddle", :id => 'edit_icon_todo_'+todo.id.to_s)+" Edit",
image_tag("edit_off.png", :mouseover => "edit_on.png", :alt => "Edit", :align => "absmiddle", :id => 'edit_icon_todo_'+todo.id.to_s)+" Edit",
:url => {:controller => 'todos', :action => 'edit', :id => todo.id},
:method => 'get',
:with => "'#{parameters}'",
@ -35,12 +35,13 @@ module TodosHelper
def remote_delete_menu_item(parameters, todo)
return link_to_remote(
image_tag("delete_off.png", :mouseover => "delete_on.png", :alt => "", :align => "absmiddle")+" Delete",
image_tag("delete_off.png", :mouseover => "delete_on.png", :alt => "Delete", :align => "absmiddle")+" Delete",
:url => {:controller => 'todos', :action => 'destroy', :id => todo.id},
:method => 'delete',
:with => "'#{parameters}'",
:before => todo_start_waiting_js(todo),
:complete => todo_stop_waiting_js(todo))
:complete => todo_stop_waiting_js(todo),
:confirm => "Are you sure that you want to delete the action '#{todo.description}'?")
end
def remote_defer_menu_item(days, todo)

View file

@ -1,5 +1,5 @@
<div class="container">
<h2>
<h2 id="project_name">
<% if collapsible -%>
<a href="#" class="container_toggle" id="toggle_p<%= project.id %>"><%= image_tag("collapse.png") %></a>
<% end -%>

View file

@ -22,6 +22,7 @@ else
page << "$('#todo_context_name').val('#{@project.default_context.name}');" if @project.default_context
page << "$('input[name=default_context_name]').val('#{@project.default_context.name}');" if @project.default_context
page << "$('#todo_project_name').val('#{@project.name}');"
page << "defaultContexts = #{default_contexts_for_autocomplete};"
page << "defaultTags = #{default_tags_for_autocomplete};"
end

View file

@ -1,10 +1,8 @@
page['project_name_in_place_editor'].replace_html @project.name
page['default_project_name_id'].value = @project.name
page['todo_project_name'].value = @project.name
# renew project auto complete array
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true"
page << "var projectNames = #{project_names_for_autocomplete};"
status_message = "Name of project was changed"
page.notify :notice, status_message, 5.0

View file

@ -378,6 +378,15 @@ $(document).ready(function() {
}, {style: 'padding:0px', submit: "OK"});
/* Projects behavior */
$('h2#project_name').editable(function(value, settings){
project_id = $(this).parents('.container').children('div').get(0).id.split('_')[2];
highlight = function(){
$('h2#project_name').effect('highlight', {}, 500);
};
$.post('/projects/update/'+project_id, {'project[name]': value, 'update_project_name': 'true'}, highlight, 'script');
return(value);
}, {style: 'padding:0px', submit: "OK"});
$('.alphabetize_link').click(function(evt){
evt.preventDefault();
if(confirm('Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order.')){
@ -428,14 +437,7 @@ $(document).ready(function() {
'« Hide form', 'Hide new context form',
'Create a new context »', 'Add a context');
});
$('a.delete_project_button').live('click', function(evt){
evt.preventDefault();
if(confirm("Are you sure that you want to "+this.title+"?")){
$(this).parents('.context').block({message: null});
params = {_method: 'delete'};
$.post(this.href, params, null, 'script');
}
});
$("#list-contexts-active").sortable({handle: '.handle', update: update_order});
$("#list-contexts-hidden").sortable({handle: '.handle', update: update_order});
/*

View file

@ -3,11 +3,11 @@ login :as => 'admin'
open "/projects/1"
# change project name
click "project_name_in_place_editor"
wait_for_element_present "css=#project_name_in_place_editor-inplaceeditor input.editor_field"
type "css=#project_name_in_place_editor-inplaceeditor input.editor_field", "Test Foo"
click "css=#project_name_in_place_editor-inplaceeditor input.editor_ok_button"
wait_for_text "project_name_in_place_editor", "Test Foo"
click "project_name"
wait_for_element_present "css=#project_name form input"
type "css=#project_name form input", "Test Foo"
click "css=#project_name form button"
wait_for_text "project_name", "Test Foo"
# check that the default project name is changed too
assert_value "todo_project_name", "Test Foo"
wait_for_value "todo_project_name", "Test Foo"

View file

@ -2,9 +2,11 @@ setup :fixtures => :all
login :as => 'admin'
open '/projects/1'
assert_text 'badge_count', '2'
click 'css=.project_settings a'
wait_for_visible "project[default_context_name]"
click 'project_state_hidden'
wait_for_attribute 'css=#project_status .active span', 'class', 'inactive_state'
wait_for_attribute 'css=#project_status .hidden span', 'class', 'active_state'
click 'css=.positive'
wait_for_text_present 'marked as hidden'
assert_text 'badge_count', '2'
type "todo_description", "add one to hidden project 1"
@ -20,4 +22,4 @@ assert_text 'badge_count', '4'
open '/projects/1'
assert_text 'badge_count', '4'
assert_checked 'project_state_hidden'
assert_text_present 'marked as hidden'

View file

@ -1,10 +1,13 @@
setup :fixtures => :all
login :as => 'admin'
open "/projects/1"
click "project_name_in_place_editor"
wait_for_element_present "css=#project_name_in_place_editor-inplaceeditor input.editor_field"
type "css=#project_name_in_place_editor-inplaceeditor input.editor_field", "Test Foo"
click "css=#project_name_in_place_editor-inplaceeditor input.editor_ok_button"
wait_for_text "project_name_in_place_editor", "Test Foo"
click "project_name"
wait_for_element_present "css=#project_name form input"
type "css=#project_name form input", "Test Foo"
click "css=#project_name form button"
wait_for_text "project_name", "Test Foo"
open "/projects/1"
wait_for_text "project_name_in_place_editor", "Test Foo"
wait_for_text "project_name", "Test Foo"

View file

@ -3,7 +3,7 @@ login :as => 'admin'
open "/todos/tag/foo"
assert_text 'badge_count', '2'
click "css=#delete_icon_2"
click "css=#ultodo_2 img[alt='Delete']"
assert_confirmation "Are you sure that you want to delete the action 'Call dinosaur exterminator'?"
wait_for_element_not_present "todo_2"

View file

@ -1,6 +1,6 @@
setup :fixtures => [:users, :projects, :contexts, :todos, :notes]
login :as => 'admin'
open "/"
click_and_wait "xpath=//ul[@id='navlist'] //a[@title='See your starred actions']"
click_and_wait "xpath=//a[@title='See your starred actions']"
assert_title "exact:TRACKS::Tagged with 'starred'"
verify_text_present "Currently there are no incomplete actions with the tag 'starred'"