【问题标题】:Running Cypress tests on localhost with semaphoreCI使用 semaphoreCI 在 localhost 上运行 Cypress 测试
【发布时间】:2020-08-17 19:11:39
【问题描述】:

在我的 cypress.json 中,我将 baseUrl 配置为

{
  "baseUrl": "http://localhost:3000"
}

package.json 包含

"scripts": {
    "cy:version": "cypress version",
    "cy:verify": "cypress verify",
    "cy:run": "CYPRESS_baseUrl=http://localhost:3000 cypress run --record --browser chrome",
    "start": "serve --listen ${PORT:-3000}"
  }

在semaphore.yml 我有这些行

jobs:
  -name: Execute E2E
   commands:
     - npm start & wait-on http://localhost:3000
     - npm run cy:run

但由于某种原因,应用程序没有在 localhost:3000 上获得服务,而是我看到了这个

如何解决此问题并在localhost:3000 上提供应用程序?谢谢。

【问题讨论】:

    标签: integration-testing ui-automation cypress semaphore-ci


    【解决方案1】:

    您可以做几件事来调试问题:

    1. 您是否在某处使用代理,可能作为环境变量..?
    2. 检查赛普拉斯代理设置,看看是否有问题。
    3. 尝试将端口更改为其他端口。使用您确定没有被其他任何东西使用的端口。您可以使用 netstat 命令进行检查。
    4. 您的 localhost 是在 http 上运行还是在 https 上运行?

    如果我想到别的东西,我会更新答案。

    【讨论】:

      猜你喜欢
      • 2018-12-12
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 2023-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多