Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: fix e2e flakyness (#43739)

Gildas Garcia43e793f5adaf
diff --git a/.github/workflows/studio-e2e-test.yml b/.github/workflows/studio-e2e-test.yml
index 2cb64abc9aa..cf3ecc38199 100644
--- a/.github/workflows/studio-e2e-test.yml
+++ b/.github/workflows/studio-e2e-test.yml
@@ -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
diff --git a/e2e/studio/playwright.config.ts b/e2e/studio/playwright.config.ts
index 76bf64e735c..9f3544355e0 100644
--- a/e2e/studio/playwright.config.ts
+++ b/e2e/studio/playwright.config.ts
@@ -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,
diff --git a/package.json b/package.json
index e302f96d366..ce4526ea7ef 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/turbo.json b/turbo.json
index 7cd2fef4ecf..050e48bbb24 100644
--- a/turbo.json
+++ b/turbo.json
@@ -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": []