chore: fix e2e flakyness (#43739)

## Problem

Since the upgrade to NextJS 16.1.6, many e2e tests run fails with
timeout, probably when building or starting the studio

## Solution

- [x] Add dedicated steps for supabase setup and NextJS build to ease
debugging
- [x] Fix flakyness
This commit is contained in:
Gildas Garcia
2026-03-16 15:51:20 +01:00
committed by GitHub
parent cfbb73c60f
commit 43e793f5ad
4 changed files with 27 additions and 7 deletions

View File

@@ -43,11 +43,13 @@ jobs:
- 'e2e/studio/**'
- 'pnpm-lock.yaml'
- '.github/workflows/studio-e2e-test.yml'
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
if: steps.filter.outputs.studio == 'true'
name: Install pnpm
with:
run_install: false
- name: Use Node.js
if: steps.filter.outputs.studio == 'true'
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
@@ -69,7 +71,6 @@ jobs:
with:
# See here for caching with `yarn`, `bun` or other package managers https://github.com/actions/cache/blob/main/examples.md or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
path: |
.turbo/cache
apps/studio/.next/build
apps/studio/.next/cache
# Generate a new cache whenever packages or source files change.
@@ -82,6 +83,14 @@ jobs:
if: steps.filter.outputs.studio == 'true'
run: rm -rf supabase && pnpm exec supabase init && mkdir supabase/functions
- name: Start supabase
if: steps.filter.outputs.studio == 'true'
run: SKIP_ASSET_UPLOAD=1 pnpm run e2e:setup:cli
- name: Build studio
if: steps.filter.outputs.studio == 'true'
run: SKIP_ASSET_UPLOAD=1 NODE_ENV=test NODE_OPTIONS="--max-old-space-size=4096" pnpm run build:studio
- name: 🚀 Run Playwright tests against Vercel Preview
if: steps.filter.outputs.studio == 'true'
id: playwright

View File

@@ -25,8 +25,18 @@ const createWebServerConfig = () => {
return undefined
}
// We have dedicated job steps on CI to start Supabase and Studio
if (!IS_CI) {
return {
command: 'pnpm --workspace-root run e2e:setup:selfhosted',
port: WEB_SERVER_PORT,
timeout: WEB_SERVER_TIMEOUT,
reuseExistingServer: true,
}
}
return {
command: 'pnpm --workspace-root run e2e:setup:selfhosted',
command: 'pnpm --workspace-root run e2e:setup:selfhosted:start-studio',
port: WEB_SERVER_PORT,
timeout: WEB_SERVER_TIMEOUT,
reuseExistingServer: true,

View File

@@ -30,6 +30,7 @@
"test:studio:watch": "turbo run test --filter=studio -- watch",
"e2e:setup:cli": "supabase stop --all --no-backup ; supabase start --exclude studio && if [ -z \"${CI}\" ]; then supabase db reset; fi && supabase status --output json > keys.json && node scripts/generateLocalEnv.js",
"e2e:setup:selfhosted": "SKIP_ASSET_UPLOAD=1 pnpm e2e:setup:cli && NODE_ENV=test NODE_OPTIONS=\"--max-old-space-size=4096\" pnpm run build:studio && NODE_ENV=test pnpm --prefix ./apps/studio start",
"e2e:setup:selfhosted:start-studio": "SKIP_ASSET_UPLOAD=1 NODE_ENV=test pnpm --prefix ./apps/studio start",
"e2e:setup:platform": "SKIP_ASSET_UPLOAD=1 NODE_OPTIONS=\"--max-old-space-size=4096\" pnpm run build:studio && pnpm --prefix ./apps/studio start",
"e2e": "pnpm --prefix e2e/studio run e2e",
"e2e:ui": "pnpm --prefix e2e/studio run e2e:ui",

View File

@@ -4,7 +4,7 @@
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**/*", "!.next/dev/**/*"]
},
"design-system#build": {
"dependsOn": ["^build"],
@@ -20,7 +20,7 @@
"NEXT_PUBLIC_GOTRUE_URL",
"NEXT_PUBLIC_SUPABASE_ANON_KEY"
],
"outputs": [".next/**", "!.next/cache/**", ".contentlayer/**"]
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*", ".contentlayer/**"]
},
"studio#build": {
"dependsOn": ["^build"],
@@ -126,7 +126,7 @@
"SNIPPETS_MANAGEMENT_FOLDER",
"EDGE_FUNCTIONS_MANAGEMENT_FOLDER"
],
"outputs": [".next/**", "!.next/cache/**"]
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*"]
},
"www#build": {
"dependsOn": ["^build"],
@@ -198,7 +198,7 @@
"CUSTOMERIO_API_KEY",
"CUSTOMERIO_APP_API_KEY"
],
"outputs": [".next/**", "!.next/cache/**", ".contentlayer/**"]
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*", ".contentlayer/**"]
},
"ui-library#build": {
"dependsOn": ["^build"],
@@ -223,7 +223,7 @@
"SUPABASE_MANAGEMENT_API_TOKEN",
"OPENAI_API_KEY"
],
"outputs": [".next/**", "!.next/cache/**", ".contentlayer/**"]
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*", ".contentlayer/**"]
},
"lint": {
"outputs": []