对于在Circleci
CI / CD管道中进行的赛普拉斯测试,如何调用cy:test-flight
的Package.json文件中脚本部分下给出的命令.cirlceci/config.yml
。另外,我想设置以下参数record true
并并行设置为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
答案 0 :(得分: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
的示例