forked from OWASP/NodeGoat
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.78 KB
/
e2e-test.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
name: E2E Test
on: [push, pull_request]
jobs:
e2e-test:
name: Node.js
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["10.x", "12.x", "14.x"]
steps:
- name: Checkout https://github.com/${{ github.repository }}@${{ github.ref }}
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Use cache
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node${{ matrix.node-version }}-E2E-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: |
npm ci
npm run cy:verify
- name: Start MongoDB
run: |
docker run -d -p 27017:27017 mongo:4.0
timeout 60s bash -c 'until nc -z -w 2 localhost 27017 && echo MongoDB ready; do sleep 2; done'
- name: Run E2E test suite
id: test-suite
run: |
NODE_ENV=test npm start -- --silent &
npm run test:ci -- --config video=true
- name: Prepare cypress artifacts
if: failure() && (steps.test-suite.outcome == 'failure')
working-directory: ./test/e2e
run: >
mkdir -p "screenshots" && find "screenshots" -mindepth 1 -maxdepth 1 -type d
-exec sh -c 'mv -- "videos/$(basename "$1").mp4" "$1"' _ {} \;
- name: Upload cypress artifacts
if: failure() && (steps.test-suite.outcome == 'failure')
uses: actions/upload-artifact@v2
with:
name: cypress-artifacts-node${{ matrix.node-version }}
path: test/e2e/screenshots