-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (135 loc) · 4.42 KB
/
cypress-testing.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# keep name short as it is displayed in readme badge
name: Cypress CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
NODE_ENV: "test" # see: https://github.com/vercel/next.js/issues/55804#issuecomment-1735124191.
NEXT_PUBLIC_APP_ENV: "test"
DEBUG: "cypress:server:args"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TURSO_DATABASE_URL: "file:./prisma/dev.db"
NEXTAUTH_SECRET: ${{secrets.NEXTAUTH_SECRET}}
NEXTAUTH_URL: ${{vars.NEXTAUTH_URL}}
AUTH0_CLIENT_ID: ${{secrets.AUTH0_CLIENT_ID}}
AUTH0_CLIENT_SECRET: ${{secrets.AUTH0_CLIENT_SECRET}}
AUTH0_ISSUER: ${{vars.AUTH0_ISSUER}}
AUTH0_BASE_URL: ${{vars.AUTH0_BASE_URL}}
CYPRESS_ADMIN_FORO_MAIL: ${{secrets.CYPRESS_ADMIN_FORO_MAIL}}
CYPRESS_ADMIN_FORO_PWD: ${{secrets.CYPRESS_ADMIN_FORO_PWD}}
CYPRESS_ADMIN_ALLENGLAND_MAIL: ${{secrets.CYPRESS_ADMIN_ALLENGLAND_MAIL}}
CYPRESS_ADMIN_ALLENGLAND_PWD: ${{secrets.CYPRESS_ADMIN_ALLENGLAND_PWD}}
CYPRESS_USER1_MAIL: ${{secrets.CYPRESS_USER1_MAIL}}
CYPRESS_USER1_PWD: ${{secrets.CYPRESS_USER1_PWD}}
CYPRESS_USER2_MAIL: ${{secrets.CYPRESS_USER2_MAIL}}
CYPRESS_USER2_PWD: ${{secrets.CYPRESS_USER2_PWD}}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
NEXT_PUBLIC_LOGFLARE_API_KEY: ${{ secrets.NEXT_PUBLIC_LOGFLARE_API_KEY }}
NEXT_PUBLIC_LOGFLARE_SOURCE_ID: ${{ secrets.NEXT_PUBLIC_LOGFLARE_SOURCE_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
NEXT_PUBLIC_R2_BUCKET_NAME: ${{ vars.NEXT_PUBLIC_R2_BUCKET_NAME }}
NEXT_PUBLIC_R2_BUCKET_URL: ${{ vars.NEXT_PUBLIC_R2_BUCKET_URL }}
jobs:
install:
runs-on: ubuntu-latest
container:
image: cypress/browsers:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Cypress install
uses: cypress-io/github-action@v5
with:
build: pnpm build:test
runTests: false
- name: Save build folder
uses: actions/upload-artifact@v4
with:
name: build
if-no-files-found: error
path: .next
include-hidden-files: true
ui-chrome-tests:
needs: install
runs-on: ubuntu-latest
container:
image: cypress/browsers:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Download the build folders
uses: actions/download-artifact@v4
with:
name: build
path: .next
- name: "UI Tests - Chrome"
uses: cypress-io/github-action@v5
with:
# use build step to seed the database, build is already done in install job
build: npm run db:seed
start: npm start
wait-on: "http://localhost:3000"
wait-on-timeout: 120
browser: chrome
config-file: cypress.config.ts
ui-chrome-mobile-tests:
needs: install
runs-on: ubuntu-latest
container:
image: cypress/browsers:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Download the build folders
uses: actions/download-artifact@v4
with:
name: build
path: .next
- name: "UI Tests - Chrome - Mobile"
uses: cypress-io/github-action@v5
with:
config: "viewportWidth=375,viewportHeight=667"
#use build step to seed the database, build is already done in install job
build: pnpm run db:seed
start: pnpm start
wait-on: "http://localhost:3000"
wait-on-timeout: 120
browser: chrome
config-file: cypress.config.ts
component-testing:
needs: install
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Download the build folders
uses: actions/download-artifact@v4
with:
name: build
path: .next
- name: Run Component Testing
uses: cypress-io/github-action@v5
with:
component: true
config-file: cypress.config.ts