gpt4 book ai didi

Cypress 测试未启动并在控制台中抛出握手错误

转载 作者:行者123 更新时间:2023-12-04 01:43:11 25 4
gpt4 key购买 nike

我正在尝试按照 https://docs.cypress.io/guides/getting-started/installing-cypress.html#System-requirements 上的入门指南进行操作当我运行以下命令时

npx cypress open

它会打开一个弹出窗口并列出所有示例规范。现在我只是运行示例规范,但这是我面临的问题。它打开了一个浏览器,但页面是空白的,我在控制台中看到以下错误,

Websocket connection to 'ws://localhost:62083/__socket.io/?EIO=3&transport=websocket' failed: Connection closed before receiving a handshake response

我在另一台机器上测试了同一个应用程序,它可以工作,但在我的机器上不工作。是否有导致问题的原因。我的笔记本电脑是代理服务器后面的办公室笔记本电脑。我检查了 cypress 代理设置,发现代理配置正确。

最佳答案

我在我的 mac 上遇到了同样的问题,filiphric 的评论解决了这个问题:https://github.com/cypress-io/cypress/issues/1239#issuecomment-419657694

  1. 打开终端,输入:sudo nano/etc/hosts
  2. 如果什么都不存在,输入默认值:
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
  1. 保存并关闭。 (ctrl + X 然后 y 然后 enter)
  2. 重新打开cypress,一切正常

希望对您也有帮助!

关于 Cypress 测试未启动并在控制台中抛出握手错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56535069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com