Automating the DOM test suite

Dom,

after a little investigating I found the culprit: Opera considers it a  
security issue to execute code after the document has been closed. close()  
is hence treated effectively as exit from JavaScript. Simply put  
document.close() at the end of the function.

BTW: You can make the IDs in the form obsolete by removing the  
getElementByID and use the following:

[snip]
    if (resultType == null) {
       buttonToActivate = 0;
       document.writeln("green'><dt>Test: " + testName + "</dt><dd>Status:  
Success</dd>");
    } else {
       if (resultType == "skip") {
       buttonToActivate = 2;
       	document.writeln("blue'><dt>Test: " + testName + "</dt><dd>Status:  
Skipped</dd>");
       } else {
       buttonToActivate = 1;
         document.writeln("red'><dt>Test: " + testName + "</dt><dd>Status:  
" + resultType + "</dd>");
       }
    }
    document.write("</dl>");
    document.write("<form name='testeval' action='http://www.opera.com'  
method='post'><div><input type='hidden' name='undertesturi' value='"  
+ self.location + "' /><input type='submit' name='result' value='Pass [1]'  
accesskey='1' /><input type='submit' name='result' value='Fail [2]'  
accesskey='2' /><input type='submit' name='result' value='Cannot tell [3]'  
accesskey='3' /></div></form>");

    document.write("</body></html>");
    document.testeval.result[ buttonToActivate].click();
    document.close();

This should be DOM-compliant as well.

-- 
Till Halbach
Quality Assurance, Opera Software (www.opera.com)

Received on Wednesday, 25 April 2007 09:26:23 UTC