我的before()挂钩中有以下代码行。
before(() ==> {
cy.get(this.testPopup).then(($el) => {
if ($el.length) {
cy.get(this.testPopupCloseButton).click();
cy.get(this.testPopup).should("not.exist");
}
});
});
Run Code Online (Sandbox Code Playgroud)
会有一个弹出窗口,有时会显示,有时不会。我尝试编写一个逻辑来关闭该弹出窗口,并检查仅当弹出窗口存在时它是否在关闭时消失。
但我收到以下错误。
30000 毫秒后超时重试:期望找到元素:#test-popup-element,但从未找到。
由于此错误发生在 before all 挂钩期间,我们将跳过当前套件中的其余测试`
我基本上期望这里有一个软断言,即使该断言失败,它将继续运行其余的测试。
请指教。