如何在完成上一次迭代后才使测试运行

时间:2016-06-06 09:59:54

标签: nightwatch.js

我在循环中运行测试但是当运行i = 2时,断言失败。 根据我的理解,它在结束i = 2之前开始i = 3。 我怎样才能首先完成夜班表演i = 2然后在开始i = 3后完成i = 3后才开始i = 4,等等。

     .execute(function () {
           return document.querySelectorAll('.wrap>section:nth-of-type(2)>.tsr-container a').length
                    },
                    function (result) {
                        total_downL = result.value;
                        console.log("Number of download buttons i: " + total_downL);
                        for (i = 1; i <= total_downL; i++) {
                            this.waitForElementVisible('.wrap>section:nth-of-type(2)>.tsr-container a.tsr-module-product:nth-child(' + i + ') button.btnDownload', 2000, true,
                                function (result) {
                                    this.click('.btnDownload')
                                    .pause(3000)
                                    .windowHandles(function (result) {
                                        var handle = result.value[1];
                                        browser.switchWindow(handle);
                                        browser.pause(5000);
                                    })
                                    .assert.elementPresent('.modal-title')
                                    .click('.close');

0 个答案:

没有答案
相关问题