代码之家  ›  专栏  ›  技术社区  ›  grabury

如何运行单个珀西柏树测试

  •  0
  • grabury  · 技术社区  · 2 年前

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

    cypress/e2e/test1 ... test10
    

    如何运行单个Percy Cypress测试。

    下面我有运行所有测试的脚本 test-visual 我正试着设置一个percy测试 test-visual:single 那只是 test1 但它在柏树文件夹中运行所有测试

      "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"
      },
    

    我做错了什么?

    1 回复  |  直到 2 年前
        1
  •  1
  •   K.Kassianides    2 年前

    您应该能够像不通过percy调用时那样传递任何Cypress CLI参数。

    您的CLI脚本中似乎有一个无赖空间

    "percy-cypress-single": "percy exec -- cypress run --spec cypress/e2e/test1.cy.ts",
    -----------------------------------------------------^ No space here
    
    推荐文章