简体   繁体   English

cy.wrap() 在 mailosaur 中超时等待 4000 毫秒才能完成

[英]cy.wrap() timed out waiting 4000ms to complete in mailosaur

I'm running into a CypressError when calling cy.mailosaurGetMessage: cy.wrap() timed out waiting 4000ms to complete.我在调用 cy.mailosaurGetMessage 时遇到了 CypressError:cy.wrap() 超时等待 4000 毫秒才能完成。

Please find the attached image for error.请查找所附图像是否有错误。 在此处输入图像描述

Please find the code snippet below:`请在下面找到代码片段:`

describe('Password reset', () => {
    const serverId = 'u7ob3rfc1'; 
    const testEmail = 'uma@u7ob3rfc1.mailosaur.net'

    it('Gets a link blocked email', () => {
        console.log("inside")
        cy.mailosaurGetMessage(serverId, {
            sentTo: testEmail,
        }).then(email => {
            receivedAfter: new Date('2020-03-06T00:00:00Z')
            console.log(email.subject)
            expect(email.subject).to.equal('Click Blocked');
        })
    })
})

` `

Take a look at the top of the screenshot, there's a timeout: 100010000 - which is really weird for a timeout number看一下屏幕截图的顶部,有一个timeout: 100010000 - 这对于一个超时数字来说真的很奇怪

See this bit of code from the mailosaur library, in mailosaurCommands.jsmailosaurCommands.js中查看 mailosaur 库中的这段代码

cy.wrap(new Cypress.Promise((resolve, reject) => {
  fn(resolve, reject)();
}), {
  log: false,
  timeout: options.timeout + 10000
});

The timeout the user gives is being increased by 10 seconds, except that for your test setup options.timeout is a string instead of a number giving that super large and weird timeout in the screen shot above.用户给出的超时时间增加了 10 秒,除了您的测试设置options.timeout超时是一个字符串,而不是一个数字,在上面的屏幕截图中给出了超大和奇怪的超时。

So somewhere you have used所以你用过的地方

timeout: '1000' 

but instead you should use但你应该使用

timeout: 1000

Why is this a problem?为什么这是个问题?

The cy.wrap() above contains a Promise, which must either resolve or reject before Cypress continues.上面的cy.wrap()包含一个 Promise,它必须在赛普拉斯继续之前解决或拒绝。 But it neither resolves or rejects which is why you get但它既不解决也不拒绝,这就是你得到的原因

cy.wrap() timed out waiting 4000ms to complete . cy.wrap() 超时等待 4000 毫秒才能完成

I think this might also be due to the incorrect timeout, it is hard to tell without debugging it, but at least one place where the Promise resolves is affected by it.我认为这也可能是由于超时不正确造成的,不调试它很难判断,但至少 Promise 解析的地方受到它的影响。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 赛普拉斯 - 4000 毫秒后重试超时:预计会找到元素 - 仅在 Jenkins - Cypress - Timed out retrying after 4000ms: Expected to find element - only in Jenkins cy.wait() 等待 5000 毫秒以等待对路由的第一个请求 - cy.wait() timed out waiting 5000ms for the 1st request to the route cy.wrap(JQueryObject).click() 与 JQueryObject.click() - cy.wrap(JQueryObject).click() vs JQueryObject.click() 如何提取和使用从 cy.wrap() 返回的字符串值 - How to extract and use a string value returned from cy.wrap() CypressIO 使用 cy.wrap() 从 cy.task() 返回字符串值给出错误“cy is not defined” - CypressIO Returning string value from cy.task() using cy.wrap() gives error "cy is not defined" cy.wrap().its()... 当值 in.its() 包含句点时不起作用 - cy.wrap().its()... doesn't work when the value in .its() contains a period 单元测试失败并出现错误“超过 '4000ms' 的赛普拉斯命令超时”。 - Unit tests fail with error “Cypress command timeout of '4000ms' exceeded.” 错误:在11001ms之后等待Protractor与页面同步超时。“当用户browser.getCurrentUrl()时 - Error: Timed out waiting for Protractor to synchronize with the page after 11001ms." when user browser.getCurrentUrl() 使用 cypress 和 firestore 测试反应应用程序显示超时重试:cy.wait() - Testing react app with cypress and firestore shows Timed out retrying: cy.wait() 错误:脚本执行在 30000 毫秒后超时 - Error: Script execution timed out after 30000ms
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM