如何修复等待条件错误?

时间:2018-03-02 10:29:19

标签: protractor jasmine2.0

我在E2E测试中有protractor.config.js,它正在调用Failed: Wait condition must be a promise-like object, function, or a Condition object文件中定义的函数。运行测试时,出现以下错误:

protractor.config.js

仅供参考 - deferred.promise 中定义的功能包含 If-condition ,我需要两种情况。当我删除 If-condition 时,测试运行正常。该函数返回: protractor.config.js

这究竟意味着什么以及如何解决?一直在搜索,但遗憾的是无法解决任何问题。

checkMail: function(user, subjectSent) { const deferred = protractor.promise.defer(); var usermail; var mailsubject; var count = 0; mailListener.on("mail", function(mail, seqno, attributes) { var mailuid = attributes.uid; var toMailbox = '[Gmail]/All Mail'; var i = ++count; user = mail.to[0].address; mailsubject = mail.subject; if (i > 2) { mailListener.stop(); return; } deferred.fulfill(mail); }); if ((user === usermail) && (subjectSent === mailsubject)) { return deferred.promise; } } 中的功能:

it("It should do xxxxxxx", (done) => {
    browser.wait(browser.params.checkMail('user_email@yyyyy.com', 'Email subject'))
     .then((email) => {
        expect(email['subject']).toEqual("Email subject");
        expect(email['headers'].to).toEqual( 'user_email@yyyyy.com' );
    });
    done();
});

E2E it-function

DISPLAY QMGR CONNAUTH

DISPLAY AUTHINFO(<name-from-CONNAUTH>) ALL

0 个答案:

没有答案