首页 > 解决方案 > 如何从打开浏览器(非无头)的容器中运行赛普拉斯测试?

问题描述

我正在尝试非无头运行赛普拉斯测试(我知道如何无头运行它们)以使其打开 Firefox 并运行所有测试。在文档中,我需要做的就是运行cypress run --browser firefox,这是在您使用 npm 包管理器安装 cypress 时使用的。我正在使用容器化的赛普拉斯。

容器结构:

cypress
   - integration
   - cypress.json
   - plugins
   - node_modules

显然我可以运行docker run -it -v $PWD:/services/cypress -w / --entrypoint=cypress tdd_cypress --browser firefox run这在我的情况下会引发错误。

编辑:

我再次运行该命令以查看实际发生的情况,它似乎正在运行,但它正在容器内运行测试。当我按下 Ctrl+C 时,我在看到这个后得出了这个结论:

^CThe Test Runner unexpectedly exited via a exit event with signal SIGINT

Please search Cypress documentation for possible solutions:

https://on.cypress.io

Check if there is a GitHub issue describing this crash:

https://github.com/cypress-io/cypress/issues

Consider opening a new issue.

----------

Platform: linux (Debian - 10.3)
Cypress Version: 4.8.0

^ 这让我觉得测试确实在运行我只是看不到它们在运行,因为它们在容器中运行(如果我在 CI 中无头运行测试,这很好)。

如何在打开浏览器并在容器中运行 Cypress 的情况下运行测试?

标签: dockercypress

解决方案


推荐阅读