This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (50 loc) · 1.87 KB
/
cypress.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
name: Run Cypress Tests
on:
workflow_dispatch:
pull_request:
permissions: read-all
jobs:
install:
name: cypress-e2e-run
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [chrome, firefox, edge, webkit]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: Install dependencies
run: npm ci
- name: Install WebKit browser dependencies
if: ${{ (matrix.containers == 'webkit') }}
uses: cypress-io/github-action@v5
with:
build: npx playwright install-deps webkit
runTests: false
- name: Set Branch Based Cypress Config file
env:
SITE_PREFIX: ${{ secrets.SITE_PREFIX }}
run: |
if [[ ${{ github.head_ref || github.ref_name }} == "prod" ]]; then sed -i "s#^ baseUrl: .*# baseUrl: 'https://benefits-tool.usa.gov/',#" cypress.config.js; elif [[ ${{ github.head_ref || github.ref_name }} == "release" ]]; then sed -i "s#^ baseUrl: .*# baseUrl: 'https://benefits-tool-demo.usa.gov/',#" cypress.config.js; else sed -i "s#^ baseUrl: .*# baseUrl: '${SITE_PREFIX}${{ github.head_ref || github.ref_name }}',#" cypress.config.js; fi
- name: Test if cypress config file is configured correctly
run: |
pwd
cat cypress.config.js
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: ${{ matrix.containers }}
start: npm run federalist
- uses: actions/upload-artifact@v3
if: failure ()
with:
name: cypress-screenshots
path: cypress/screenshots