如何修改Cypress 测试代码中默认的超时时间(timeout)
我使用 Cypress 對 SAP 官網(wǎng)進行自動化操作時,遇到了如下的錯誤消息:
Timed out after waiting 60000ms for your remote page to load.
Your page did not fire its load event within 60000ms.
SAP 官網(wǎng)的首頁,在試圖被 cy.visit 指令加載后,在默認的 1 分鐘 超時時間內(nèi),沒有加載成功。
You can try increasing the pageLoadTimeout value in cypress.json to wait longer.
Browsers will not fire the load event until all stylesheets and scripts are done downloading.
在 SAP 官網(wǎng)沒有結(jié)束加載所有的 stylesheets 即 CSS 文件和腳本文件之前,瀏覽器不會 fire load 事件。
When this load event occurs, Cypress will continue running commands.
如果沒有 load 事件發(fā)生,Cypress 就不會繼續(xù)執(zhí)行 cy.visit 之后的指令。
解決方案
修改 cy.visit 指令默認的超時時間即可:
cy.visit('https://www.sap.com', { timeout: 300000 });總結(jié)
以上是生活随笔為你收集整理的如何修改Cypress 测试代码中默认的超时时间(timeout)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何在 Cypress 测试代码中屏蔽(
- 下一篇: 本地开发好的 SAP Fiori Ele