【问题标题】:Cypress test not starting and throwing handshake error in console赛普拉斯测试未启动并在控制台中抛出握手错误
【发布时间】:2019-10-25 08:47:40
【问题描述】:

我正在尝试遵循https://docs.cypress.io/guides/getting-started/installing-cypress.html#System-requirements 的入门指南,当我运行以下命令时

npx 柏树打开

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

Websocket 连接到 'ws://localhost:62083/__socket.io/?EIO=3&transport=websocket' 失败: 在收到握手响应之前连接已关闭

我在另一台机器上测试了相同的应用程序,它可以运行,但在我的机器上却无法运行。是不是有什么东西导致了这个问题。我的笔记本电脑是办公室笔记本电脑,位于代理服务器后面。我检查了 cypress 代理设置,发现代理配置正确。

【问题讨论】:

标签: cypress


【解决方案1】:

我在我的 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,一切正常

希望对你也有帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-20
    • 1970-01-01
    • 2019-09-26
    • 2023-02-14
    • 1970-01-01
    • 2021-11-06
    • 1970-01-01
    • 2020-05-16
    相关资源
    最近更新 更多