Got one Selenium test working

This commit is contained in:
Eric Allen 2009-10-02 18:55:23 -04:00
parent d0e6ebd41e
commit eac798d0bf
2 changed files with 15 additions and 10 deletions

View file

@ -115,9 +115,14 @@ $.fn.clearForm = function() {
/* Set up authenticity token proplery */
$(document).ajaxSend(function(event, request, settings) {
if ( settings.type == 'POST' ) {
settings.data = (settings.data ? settings.data + "&" : "")
+ "authenticity_token=" + encodeURIComponent( AUTH_TOKEN ) + "&"
+ "_source_view=" + encodeURIComponent( SOURCE_VIEW );
if(typeof(AUTH_TOKEN) != 'undefined'){
settings.data = (settings.data ? settings.data + "&" : "")
+ "authenticity_token=" + encodeURIComponent( AUTH_TOKEN ) + "&"
+ "_source_view=" + encodeURIComponent( SOURCE_VIEW );
} else {
settings.data = (settings.data ? settings.data + "&" : "")
+ "_source_view=" + encodeURIComponent( SOURCE_VIEW );
}
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
request.setRequestHeader("Accept", "text/javascript");
@ -370,7 +375,7 @@ $(document).ready(function() {
};
$.post('/contexts/update/'+context_id, {'context[name]': value}, highlight);
return(value);
}, {style: 'padding:0px'});
}, {style: 'padding:0px', submit: "OK"});
/* Projects behavior */
$('.alphabetize_link').click(function(evt){

View file

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