完成 mocha 脚本完成返回分辨率方法被过度指定 [英] finishing the mocha script done returns Resolution method is overspecified

查看:41
本文介绍了完成 mocha 脚本完成返回分辨率方法被过度指定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

访问两个链接,然后当它完成返回我时调用它完成解决方法被过度指定.指定回调返回一个承诺;不能同时"

Access to two links and then call it done when its finished returns me "Resolution method is overspecified. Specify a callback or return a Promise; not both"

describe("youtube", function(){
    this.timeout(8000);
    it("test successful login",function(done){
        var driver = new webdriver.Builder().forBrowser("chrome").build();
        driver.get("http://www.google.com");

        const pageLoad = By.id('lga')
        return driver.wait(until.elementLocated(pageLoad)).then(()=>{

            return setTimeout(function(){
                driver.get("http://www.facebook.com");

                const signedPageLoad = By.id('pagelet_bluebar')

                return driver.wait(until.elementLocated(signedPageLoad)).then(()=>{
                      //assert.strictEqual(, message);


                                                    done(); // call this function to tell mocha that you are done. 
                })
            },1000)
        })
    })
})

这是怎么回事?

推荐答案

Returning a promisedone 不兼容.

Returning a promise and done are incompatible.

我认为您应该从代码中删除所有 return 语句

I think you should remove all return statements from the code

这篇关于完成 mocha 脚本完成返回分辨率方法被过度指定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆