-
Notifications
You must be signed in to change notification settings - Fork 27
/
config.yml
85 lines (82 loc) · 3.34 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
version: 2.1
orbs:
# https://github.com/cypress-io/circleci-orb
cypress: cypress-io/cypress@2.2.0
# setting environment variables on CircleCI
# https://circleci.com/docs/2.0/env-vars/
workflows:
# runs through all the specs
test-all:
jobs:
# every testing job needs to install dependencies and Cypress
- cypress/install:
executor: cypress/base-16-14-2-slim
# instead of building the application
# or in addition to it, start a new TestRail run
# and save the run ID in a text file - it will be passed
# to other CircleCI jobs via workspace together with the other files
build: |
runId=$(node ./bin/testrail-start-run.js \
"Testing on Circle workflow ${CIRCLE_WORKFLOW_ID}" \
"Cypress tests on CircleCI ${CIRCLE_BUILD_URL}")
echo "TestRail run id ${runId}"
echo ${runId} > runId.txt
echo "Saved file runId.txt"
cat runId.txt
# cypress-testrail-simple automatically tries to read
# the TestRail run ID from the file runId.txt
- cypress/run:
requires:
- cypress/install
executor: cypress/base-16-14-2-slim
# install-command: echo 'Nothing to install in this job'
# print the file with the TestRail run ID
install-command: ls -la && cat runId.txt
record: true
parallel: true
parallelism: 2
group: CircleCI
# Try to close the TestRail run using job's post-steps
# https://circleci.com/docs/2.0/configuration-reference/
# Note that the close script first checks if there are any
# remaining untested cases. Only when the untested count is 0
# then the TestRail run is closed.
post-steps:
- run:
name: Close TestRail Run
when: always
command: node ./bin/testrail-close-run.js
# only tests some of the specs
# finds all case IDs in the spec files first
# before opening a TestRail run
test-some-specs:
jobs:
- cypress/run:
name: Test some specs
executor: cypress/base-16-14-2-slim
# instead of building the application
# or in addition to it, start a new TestRail run
build: |
runId=$(node ./bin/testrail-start-run.js \
--spec "cypress/e2e/spec-a.js" \
"Testing on Circle workflow ${CIRCLE_WORKFLOW_ID}" \
"Cypress tests on CircleCI ${CIRCLE_BUILD_URL}")
echo "TestRail run id ${runId}"
echo ${runId} > runId.txt
echo "Saved file runId.txt"
cat runId.txt
record: true
group: CircleCI Some Specs
spec: 'cypress/e2e/spec-a.js'
# this is the only job in the workflow, no need to save the files
no-workspace: true
# Try to close the TestRail run using job's post-steps
# https://circleci.com/docs/2.0/configuration-reference/
# Note that the close script first checks if there are any
# remaining untested cases. Only when the untested count is 0
# then the TestRail run is closed.
post-steps:
- run:
name: Close TestRail Run
when: always
command: node ./bin/testrail-close-run.js