Jasmine错误 - 如何防止超时问题?

时间:2018-02-13 09:12:23

标签: angular jasmine e2e-testing

我正面临着一个问题,已经在SO中发布并讨论了更多时间。关键是,大部分帖子都是最新的。

因为我使用的是Angular 5和实际的Jasmine:

"jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0",

我一直在尝试几乎所有提供的提示和解决方案,但它们都没有真正有用......因此我认为这可能是一个与Jasmine版本或类似内容有关的问题。

尝试运行E2E测试时遇到以下错误:

- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

我测试的背景是我试图从用户收件箱中检索注册过程的确认电子邮件。

我可以连接到emailBox并阅读收件箱中的电子邮件数量等:

`[connection] Connected to host
<= '* OK Gimap ready for requests from 87.128.111.201 t28mb25299495wrb'
=> 'A0 CAPABILITY'
<= '* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH'
<= 'A0 OK Thats all she wrote! t28mb25299495wrb'
=> 'A1 LOGIN "myTestEmail@gmail.com" "myPassword"'
<= '* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- SPECIAL-USE APPENDLIMIT=35651584'
<= 'A1 OK myTestEmail@gmail.com authenticated (Success)'
=> 'A2 NAMESPACE'
<= '* NAMESPACE (("" "/")) NIL NIL'
<= 'A2 OK Success'
=> 'A3 LIST "" ""'
<= '* LIST (\\Noselect) "/" "/"'
<= 'A3 OK Success'
=> 'A4 SELECT "INBOX" (CONDSTORE)'
<= '* FLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen $NotPhishing $Phishing)'
<= '* OK [PERMANENTFLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen $NotPhishing $Phishing \\*)] Flags permitted.'
<= '* OK [UIDVALIDITY 1] UIDs valid.'
<= '* 200 EXISTS'
<= '* 0 RECENT'
<= '* OK [UIDNEXT 291] Predicted next UID.'
<= '* OK [HIGHESTMODSEQ 21808]'
<= 'A4 OK [READ-WRITE] INBOX selected. (Success)'
imapConnected
=> 'IDLE IDLE'
<= '+ idling'
....
....
Still waiting for an email...
<= '* 201 EXISTS'
=> DONE
<= 'IDLE OK IDLE terminated (Success)'
=> 'A5 UID SEARCH UNSEEN FLAGGED'
<= '* SEARCH'
<= 'A5 OK SEARCH completed (Success)'
=> 'IDLE IDLE'
<= '+ idling'`

但我无法得到的是电子邮件内容,包括其中的链接,这是我陷入困境的阶段。为此,我试图调用一个函数getLastEmail()

it("should retrieve email content and login with a registration code sent to an email", function () {
  browser.controlFlow().wait(browser.params.getLastEmail()).then(function (email) {
            expect(email['subject']).toEqual("New Registration Code");
            expect(email['headers']).toEqual("myTestEmail@gmail.com");

            console.log('EMAIL CONTENT: ' + email['text']);

         });
 }); 

这正是无法调用的函数以及进程中断并抛出上述错误的位置。

我实际上following this posting非常有帮助。

知道如何解决这个问题并解决它吗?我的代码可能也有问题...在这种情况下我会在这里发布。

0 个答案:

没有答案