[英]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.js在mailosaurCommands.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.