Reputation: 101
The Dojo DOH examples and tutorials do not seem to cover this case. I have a server url for which I want to write tests. I want the target page to show in the TestPage tab and then have multiple tests run against it. The closest example I could find is an html file that defines some tests and then a widget in the body, but I can't do that with a url over which I do not have control. I have done it with a page that fires the robot.init function, but I would like to use the test runner page.
Upvotes: 1
Views: 139
Reputation: 101
I finally came up with this:
...
doh.register("login tests", [
{
name: "load",
timeout: 20000,
runTest: function(){
var d = new doh.Deferred();
testPage = dom.byId("testBody");
console.log("in load, testPage: " + testPage);
doh.showTestPage();
testPage.src = path;
robot.sequence(function() {
console.log("in load, sequence: ");
testpageBody = testPage.contentDocument.getElementsByTagName("body")[0];
console.log("in load, testpageBody: " + testpageBody);
var bdy = query(".headerFooterLoaded", testpageBody)[0];
console.log("in load, headerFooterLoaded: " + bdy);
if (!!bdy) {
d.callback(true);
} else {
d.errback(new Error("Node with class 'headerFooterLoaded' not found."));
}
}, 8000);
return d;
}
},
... I tried to catch an iframe onload event, but had no luck.
Hope this helps someone
Upvotes: 0