Automatic testing of your web pages with JavaScript
July 28th, 2005Yes, this is possible.
A proof of concept (currently Firefox only) is included with the test file for the new AJAX in-place editor
(coming in the next script.aculo.us version).
Excerpt from the test case:
new Test.Unit.Runner({
test_InPlaceEditor: function() { with(this) {
inPlaceEditor = new Ajax.InPlaceEditor($('tobeedited'),
'inplaceeditor_result.html');
Event.simulateEvent('tobeedited','mouseover');
assertEqual("rgb(238, 238, 238)",
Element.getStyle('tobeedited','background-color'));
Event.simulateEvent('tobeedited','mouseout');
assertEqual("transparent",
Element.getStyle('tobeedited','background-color'));
Event.simulateEvent('tobeedited','mouseover');
Event.simulateEvent('tobeedited','click');
assertHidden($('tobeedited'));
(...)
Kudos to Jon Tirsen to coming up with most of this!
What’s needed now is way to automatically record events and make a test case skeleton out of it. That would allow for complete automatic browser based tests. How cool is that?
Tweet



