1

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.

Al B
  • 101
  • 2
  • 4
  • I don't think DOH allows you to do this as I think it relies on the test runner and the page under test to be served from the same domain. Maybe look at webdriver and theintern.io. – Paul Grime Sep 16 '13 at 21:47
  • Thanks for the reply. I can put the tests under the same domain, just not the same url. – Al B Sep 17 '13 at 12:43

1 Answers1

0

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

Al B
  • 101
  • 2
  • 4