-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (71 loc) · 2.79 KB
/
pr.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
name: pr
on: [pull_request]
jobs:
pr-tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎
uses: actions/checkout@v3
# run tests tagged "@smoke"
# https://github.com/bahmutov/cy-grep
- name: Smoke tests 💨
# https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v5
with:
build: npm run stop-only
start: npm run start:ci
# quote the url to be safe against YML parsing surprises
wait-on: 'http://localhost:8888'
# run only the tests tagged @smoke
env: grepTags=@smoke
# record the results on the Cypress Dashboard
# https://on.cypress.io/dashboard-introduction
record: true
group: '1 - smoke tests'
tag: smoke
# environment variables while running Cypress
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# if smoke tests passed, run all the tests
- name: All E2E tests 🧪
uses: cypress-io/github-action@v5
with:
# we have already installed all dependencies above
install: false
# the server is already running
# record the results on the Cypress Dashboard
# https://on.cypress.io/dashboard-introduction
record: true
group: '2 - all tests'
# environment variables while running Cypress
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/bahmutov/find-cypress-specs
- name: Print test names 🖨
run: npm run print-tests
# confirm the filtering and skipping tests works as expected
# using https://github.com/bahmutov/cypress-expect
- name: Run using grep 🔎
# all specs without the tests are filtered
# and all other tests are skipped
run: |
npx cypress-expect run \
--env grep="update state when items are completed" \
--expect-exactly expected/one.json
- name: Run using grep tags 🔎
run: |
npx cypress-expect run \
--env grepTags='@misc' \
--expect-exactly expected/tag-misc.json
- name: Burn tests 🔥
run: |
npx cypress-expect run \
--env burn=3 \
--spec cypress/e2e/counter-spec.js \
--expect-exactly expected/burn-counter.json