forked from cypress-io/cypress-example-kitchensink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-ci.yml
45 lines (40 loc) · 1.78 KB
/
azure-ci.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
jobs:
# Example job that runs end-to-end tests using Cypress test runner
# https://www.cypress.io/
# Job names can contain alphanumeric characters and '_', cannot start with a number
- job: Cypress_e2e_tests
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: 'Install Node.js'
# npm modules and Cypress binary should be cached
# otherwise the install will be too slow
# https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops
# since the username / user home directory are not available via system variables
# (there is even an open question about it)
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops
# just use "/home/vsts" for now
- task: CacheBeta@1
inputs:
key: npm | $(Agent.OS) | package-lock.json
path: /home/vsts/.npm
restoreKeys: npm | $(Agent.OS) | package-lock.json
displayName: Cache npm packages
- task: CacheBeta@1
inputs:
key: cypress | $(Agent.OS) | package-lock.json
path: /home/vsts/.cache/Cypress
restoreKeys: cypress | $(Agent.OS) | package-lock.json
displayName: Cache Cypress binary
- script: npm ci
displayName: 'Install npm dependencies'
- script: npm run cy:verify
displayName: 'Cypress verify'
# The next command starts the server and runs Cypress end-to-end tests against it.
# The test artifacts (screenshots & test output) will be uploaded to Cypress Cloud
# To record on Cypress Cloud we need to set CYPRESS_RECORD_KEY environment variable
- script: npm run test:ci:record
displayName: 'Run Cypress tests'