Cypress 网::ERR_EMPTY_RESPONSE 6.8.0

标签 cypress

当我加载页面时,它会调用我的 API https://<apiurl>/products .在 Cypress ,这个请求失败了:

GET https://<apiurl>/products net::ERR_EMPTY_RESPONSE

如果我复制 cURL 请求,响应会正常返回。我仔细检查了从 api 返回的 header ,没有 cors 问题。没有任何问题这是整个测试:

describe('Plans page', () => {
  it('should load', () => {
    cy.visit('http://localhost:8001/plans')
    expect(1).to.eq(1)
  })
})
"cypress": "6.8.0",

最佳答案

在我的案例中,问题是由公司代理引起的。我必须添加 proxy configuration . (我有完全相同的错误:net::ERR_EMPTY_RESPONSE)

Linux:

export http_proxy=http://...
export https_proxy=http://...
export NO_PROXY=...

cypress open

关于 Cypress 网::ERR_EMPTY_RESPONSE 6.8.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66961734/

相关文章:

javascript - Cypress 从窗口获取全局变量

javascript - 参数类型字符串不能分配给 Cypress 中的参数类型 keyof Chainable...

javascript - 如何在返回值之前等待 Cypress then() 命令完成?

Cypress 期望仅适用于 cy.wait 或不使用 cypress-testing-library

javascript - Cypress - 拖放在基于 react 的网站上不起作用

javascript - 是否可以在 Cypress 提示中显示的文本框中键入内容,然后单击“确定”按钮

puppeteer - 仅针对最新浏览器版本进行 E2E 测试有什么好处

javascript - cy.wrap() 在 mailosaur 中等待 4000 毫秒超时

cypress - 如何在 Cypress 中查询 HTML 标签值?

Cypress Auth0 租户设置 - 什么是 "default audience"