如何运行单个 Percy cypress 测试

问题描述 投票:0回答:1

我有一个 Nextjs 项目。我的 cypress 文件夹有一些端到端测试:

cypress/e2e/test1 ... test10

如何运行单个 Percy Cypress 测试。

下面我有运行所有测试的脚本

test-visual
,我正在尝试设置一个仅运行
test-visual:single
的percy测试
test1
,但它运行cypress文件夹中的所有测试

  "scripts": {
    "cypress:run": "cypress run",
    "percy:cypress": "percy exec -- cypress run",
    "test-visual": "start-server-and-test 'npm run dev' http://localhost:3000 percy:cypress",
    "percy-cypress-single": "percy exec -- cypress run -- spec cypress/e2e/test1.cy.ts",
    "test-visual:single": "start-server-and-test 'npm run dev' http://localhost:3000 percy-cypress-single"
  },

我做错了什么?

cypress package.json percy
1个回答
0
投票

您应该能够以与不通过 percy 调用时相同的方式传递任何 Cypress CLI 参数。

您的 CLI 脚本中似乎有一个流氓空间

"percy-cypress-single": "percy exec -- cypress run --spec cypress/e2e/test1.cy.ts",
-----------------------------------------------------^ No space here
© www.soinside.com 2019 - 2024. All rights reserved.