-
Notifications
You must be signed in to change notification settings - Fork 2
180 lines (147 loc) · 6.09 KB
/
e2e-tests.yml
File metadata and controls
180 lines (147 loc) · 6.09 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: E2E Tests
permissions:
contents: read
on:
pull_request:
workflow_dispatch:
concurrency:
group: e2e-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
e2e:
name: E2E Tests (shard ${{ matrix.shard }}/2)
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
shard: [1, 2]
env:
# Tiptap Pro registry authentication
TIPTAP_PRO_TOKEN: ${{ secrets.TIPTAP_PRO_TOKEN }}
# E2E Supabase instance environment variables (port 56xxx)
NEXT_PUBLIC_SUPABASE_URL: http://127.0.0.1:56321
NEXT_PUBLIC_SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_URL: http://127.0.0.1:56321
SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_SERVICE_ROLE: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:56322/postgres
S3_ASSET_ROOT: http://127.0.0.1:56321/storage/v1/object/public/assets
NEXT_PUBLIC_POSTHOG_KEY: phc_test_key_for_ci
# SSR secrets for cookie encryption (CI-specific key)
SSR_SECRETS_KEY: '{"alg":"A256CBC","ext":true,"k":"ClrCwvDCjk5wvgqFbotuW5PU4z35GL_nz5U7wXUrqTA","key_ops":["encrypt","decrypt"],"kty":"oct"}'
# Resend (email - stub)
RESEND_PASSWORD: re_test_key_for_ci
# Google OAuth (stub values - not used in E2E tests)
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID: test-client-id.apps.googleusercontent.com
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_SECRET: test-client-secret
# TipTap Cloud (collaborative editing - stub for tests)
NEXT_PUBLIC_TIPTAP_APP_ID: test-tiptap-app-id
# Centrifugo (realtime - stub values for tests)
CENTRIFUGO_API_URL: http://localhost:8000/api
CENTRIFUGO_API_KEY: test_api_key
CENTRIFUGO_TOKEN_SECRET: test_token_secret
NEXT_PUBLIC_CENTRIFUGO_WS_URL: ws://localhost:8000/connection/websocket
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Enable Corepack
run: corepack enable
- name: Install pnpm
run: corepack prepare pnpm@latest --activate
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Get Playwright version
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(pnpm -C ./tests/e2e exec playwright --version | head -n1 | awk '{print $2}')
echo "version=${PLAYWRIGHT_VERSION}" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm -C ./tests/e2e exec playwright install --with-deps chromium
- name: Install Playwright system dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: pnpm -C ./tests/e2e exec playwright install-deps chromium
- name: Setup Supabase CLI
uses: supabase/setup-cli@v1
with:
version: 2.71.0 # Pinned: v2.71.1+ breaks auth.admin.deleteUser() in test cleanup
- name: Use E2E Supabase config
run: cp supabase/supabase-e2e.toml supabase/config.toml
- name: Start Supabase (E2E instance)
run: |
echo "Starting Supabase with E2E config (ports 56xxx)..."
supabase start
echo "Supabase E2E instance started successfully"
- name: Check Supabase status
run: supabase status
- name: Run database migrations
run: pnpm w:db migrate:e2e
- name: Seed test database
run: pnpm w:db seed:e2e
- name: Run E2E tests
run: pnpm -C ./tests/e2e exec playwright test --shard=${{ matrix.shard }}/2 --reporter=blob
- name: Upload Playwright blob report
uses: actions/upload-artifact@v4
if: ${{ always() && !cancelled() }}
with:
name: blob-report-${{ matrix.shard }}
path: tests/e2e/blob-report/
retention-days: 7
merge-reports:
name: Merge Playwright Reports
runs-on: ubuntu-latest
needs: e2e
if: ${{ always() && !cancelled() }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Enable Corepack
run: corepack enable
- name: Install pnpm
run: corepack prepare pnpm@latest --activate
- name: Download blob reports
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge into HTML report
working-directory: tests/e2e
run: pnpm dlx playwright@1.58.0 merge-reports --reporter html ../../all-blob-reports
- name: Upload Playwright report
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: tests/e2e/playwright-report/
retention-days: 30