【问题标题】:Unable to load localhost URL in Cypress.io无法在 Cypress.io 中加载 localhost URL
【发布时间】:2021-03-08 19:36:10
【问题描述】:

我在 Cypress.io 中遇到一个问题,当我加载本地 URL 时,它每次都会出错。我什至在官方文档中提到的 cypress.json 文件中添加了 { "baseUrl": "http://localhost:4200" }。

以下是我的几个测试脚本:

it('successfully loads', () => {
  cy.visit('http://localhost:4200/') // change URL to match your dev URL
})
it('successfully load', () => {
    cy.visit('/') // change URL to match your dev URL
})

【问题讨论】:

    标签: javascript automation automated-tests localhost cypress


    【解决方案1】:

    我不确定为什么会在这种情况下发生错误,但如果您只需要关闭它 - 您可以在 cy.visit 调用下添加此行。该错误不应再次发生。

    Cypress.on('uncaught:exception', (err, runnable) => { return false; })
    

    【讨论】:

    猜你喜欢
    • 2018-03-22
    • 1970-01-01
    • 2016-05-06
    • 2013-12-11
    • 2023-02-22
    • 2014-05-09
    • 2013-09-29
    • 2021-08-13
    • 2011-01-31
    相关资源
    最近更新 更多