在用doh的robot做自动化测试时,看到http://dojotoolkit.org/2008/10/31/doh-robot-part-2-automating-acceptance-tests-and-user-stories这个文章里写了waitForPageToLoad方法,有知道是怎么用的么?最好给个例子
另外上面写到它是在dijit里,而实际上我看代码怎么在dojo里呢?

解决方案 »

  1.   

    [Quote=引用 5 楼 kingya2008 的回复:]
    王菊??打官司的?
    什么是打官司的?
      

  2.   

    把这段给我解析一下也可以
    waitForPageToLoad: function(/*Function*/ submitActions){
            // summary:
            //           Notifies DOH that the doh.robot is about to make a page change in the application it is driving,
            //            returning a doh.Deferred object the user should return in their runTest function as part of a DOH test.
            //
            // description:
            //           Notifies DOH that the doh.robot is about to make a page change in the application it is driving,
            //            returning a doh.Deferred object the user should return in their runTest function as part of a DOH test.
            //            Example:
            //                  runTest:function(){
            //                        return waitForPageToLoad(function(){ doh.robot.keyPress(dojo.keys.ENTER, 500); });
            //                  }
            //
            // submitActions:
            //            The doh.robot will execute the actions the test passes into the submitActions argument (like clicking the submit button),
            //            expecting these actions to create a page change (like a form submit).
            //            After these actions execute and the resulting page loads, the next test will start.
            //
    }
    waitForPageToLoad takes a function called submitActions. The robot expects submit
      

  3.   

    关于Doh robot本人最近正在研究,打算近期写一篇博文,呵呵,应为这方面几乎没有中文资料,你说的函数参照如下例子
    关于doh建议直接阅读作者 的英文blog
    doh.robot: Automating Web UI Unit Tests with Real User Events
    doh.robot, part 2: Automating Web UI Unit Tests with Real User Eventsdoh.register('user_story1',{
                    name: 'login_pagechange',
                    timeout: 60000,
                    runTest: function(){
                            return doh.robot.waitForPageToLoad(function(){
                                    // click login
                                    doh.robot.mouseMoveAt(function(){ return dojo.doc.getElementsByTagName('input')[2]; }, 1623, 801);//移动鼠标到指定节点
                                    doh.robot.mouseClick({left:true, middle:false, right:false}, 992);//点击鼠标链接,加载页面
                            });
                    }
            });