我们如何调用来自.cirlceci / config.yml`文件的package.json中给出的`cy:test-flight`

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

对于在Circleci CI / CD管道中进行赛普拉斯测试,如何从cy:test-flight调用Package.json文件中脚本部分下给出的命令.cirlceci/config.yml。另外,我想将以下参数record true设置为3,并将其并行设置为3。请问有人建议如何使用.cirlceci/config.yml

Package.json

"scripts": {
    "cy:run": "cypress run",
    "get-token-flight": "node get-token.js && mv tokenData.json cypress/fixtures && mv cookies.json cypress/fixtures",
    "cy:open:flight": "npm run get-token-flight && cypress open",
    "cy:test-flight": "set CYPRESS_RETRIES=2 && npm run get-token-flight && cypress run --record --key <key-here> cypress --env configFile=flight-app --browser chrome"
  }

。cirlceci / config.yml

version: 2.1
orbs:
  cypress: cypress-io/cypress@1
workflows:
  build:
    jobs:
      - cypress/install
      - cypress/run
cypress circleci
1个回答
1
投票

这是我的circle.yml的示例:

version: 2.1
jobs:
  test:
    docker:
    - image: cypress/base:10
    steps:
    - checkout
    - restore_cache:
        keys:
        - cache-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
    - run:
        name: Yarn install
        command: yarn install --frozen-lockfile
    - save_cache:
        key: cache-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
        paths:
        - ~/.cache
    - run:
        command: yarn lint
    - run:
        command: yarn test
    - run:
        command: yarn test-e2e
    - run:
        command: yarn run semantic-release
workflows:
  build:
    jobs:
    - test
  version: 2

因此您可以将yarn test-e2e替换为npm run cy:test-flight

另外,这是一堆利用柏树球https://github.com/cypress-io/circleci-orb/blob/master/docs/examples.md#simple的示例

© www.soinside.com 2019 - 2024. All rights reserved.