-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (87 loc) · 3.09 KB
/
e2e-tests.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
86
87
88
89
90
91
92
93
94
95
96
97
98
name: E2E tests
on:
# manual button click from the GitHub UI
workflow_dispatch:
# pushing commit to the main branch
push:
branches:
- main
jobs:
# clone the MagicMirror and custom module repos
magicmirror-setup:
runs-on: ubuntu-22.04
name: Clone MagicMirror and custom module
steps:
# Checkout the MagicMirror repo
- name: Checkout MagicMirror v2.22.0 🛎️
uses: actions/checkout@v4
with:
repository: MichMich/MagicMirror
path: MagicMirror
ref: v2.22.0
# Checkout this module repo
- name: Checkout MMM-Hello-World-Ts 🛎️
uses: actions/checkout@v4
with:
path: MagicMirror/modules/MMM-Hello-World-Ts
ref: main
# show directory contents
- run: ls -la
- run: ls -la MagicMirror
- run: ls -la MagicMirror/modules
# https://glebbahmutov.com/blog/parallel-cypress-tests-gh-action/
- name: Upload magirmirror folder 🆙
uses: actions/upload-artifact@v4
# https://github.com/actions/upload-artifact#upload-an-entire-directory
with:
name: magicmirror
if-no-files-found: error
# upload all files in the "MagicMirror" folder
path: MagicMirror
# this job runs after cloning the MagicMirror repo and adding custom module
cypress-run:
runs-on: ubuntu-22.04
name: Cypress E2E on Node 20
needs: magicmirror-setup
steps:
# Set version of node to use
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.16
# Checkout the e2e tests in this repo
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Download the magicmirror folder ⏬
# https://github.com/actions/download-artifact
uses: actions/download-artifact@v4
with:
name: magicmirror
# download all files into "MagicMirror" folder
path: MagicMirror
# Install MagicMirror dependencies
- name: Install MagicMirror dependencies 📦
run: npm run install-mm
working-directory: MagicMirror
# Install custom module dependencies
- name: Install custom module dependencies 📦
run: npm run install:dep
working-directory: MagicMirror/modules/MMM-Hello-World-Ts
# copy the test magicmirror config file
- name: Copy test config file for MagicMirror
run: cp __tests__/e2e/mm/config.js MagicMirror/config/config.js
# show directory contents
- run: ls -la
- run: ls -la MagicMirror
- run: ls -la MagicMirror/config
- run: ls -la MagicMirror/modules
# Run the Cypress e2e tests
- name: Cypress run 🧪
uses: cypress-io/[email protected]
with:
# use the cypress config file in the tests folder
config-file: __tests__/e2e/cypress.config.ts
# start magicmirror server only
start: npm --prefix MagicMirror run server
# wait for magicmirror endpoint to be ready before running the e2e tests
wait-on: 'http://localhost:8080'