如何在 Cypress 中将默认无头浏览器更改为 chrome

How to change the default headless browser to chrome in Cypress

我正在使用 cypress typescript 测试框架 当我调用“npx cypress 运行”时,它 运行 以 Electron 作为默认浏览器在无头模式下进行了所有测试。 但我想在 chrome 或任何其他浏览器中 运行 它。我该如何实现?

1.If 你想 运行 测试例如。 chrome。你可以使用:

npx cypress run --browser chrome

2.If 你想 运行 你的无头测试 chrome 你可以使用:

npx cypress run --headless --browser chrome

您可以从 here

获取 cypress 支持的浏览器列表