我想让柏树等到我的网络应用程序全部打开。有些元素彼此独立加载,我必须等待全屏加载,因为在此之后我想用 percy 拍摄快照。我该如何处理?是否可以使其依赖于某些例如 html 类?
问问题
474 次
1 回答
1
这个问题的柏树黑客将是cy.get('button', {timeout: 2000})
但是,我建议使用像cypress-wait-until这样的库。这将为您提供类似的语法
cy.waitUntil(() =>
cy.get("input[type=hidden]#recaptchatoken")
.then($el => $el.val()))
// ... then, check that it's valid string asserting about it
.then(token => expect(token).to.be.a("string").to.have.length.within(1,1000));
于 2020-08-12T22:19:23.353 回答