Skip to content

Commit ac6b1b9

Browse files
authored
add e2e test action (supabase#37293)
1 parent c09b0e9 commit ac6b1b9

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Studio E2E Tests
2+
on:
3+
push:
4+
branches: [master]
5+
paths:
6+
- 'packages/pg-meta/**/*'
7+
- 'apps/studio/**'
8+
- 'e2e/studio/**'
9+
- 'pnpm-lock.yaml'
10+
pull_request:
11+
paths:
12+
- 'packages/pg-meta/**/*'
13+
- 'apps/studio/**'
14+
- 'e2e/studio/**'
15+
- 'pnpm-lock.yaml'
16+
- '.github/workflows/studio-e2e-test.yml'
17+
18+
# Cancel old builds on new commit for same workflow + branch/PR
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
21+
cancel-in-progress: true
22+
23+
permissions:
24+
contents: write
25+
26+
jobs:
27+
test:
28+
timeout-minutes: 60
29+
runs-on: ubuntu-latest
30+
# Make the job non-blocking
31+
continue-on-error: true
32+
# Require approval only for external contributors
33+
environment: ${{ github.event.pull_request.author_association != 'MEMBER' && 'Studio E2E Tests' || '' }}
34+
35+
env:
36+
EMAIL: ${{ secrets.CI_EMAIL }}
37+
PASSWORD: ${{ secrets.CI_PASSWORD }}
38+
PROJECT_REF: ${{ secrets.CI_PROJECT_REF }}
39+
NEXT_PUBLIC_IS_PLATFORM: true
40+
NEXT_PUBLIC_API_URL: https://api.supabase.green
41+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
42+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_STUDIO_HOSTED_PROJECT_ID }}
43+
NEXT_PUBLIC_HCAPTCHA_SITE_KEY: 10000000-ffff-ffff-ffff-000000000001
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: pnpm/action-setup@v4
48+
name: Install pnpm
49+
with:
50+
run_install: false
51+
- name: Use Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version-file: '.nvmrc'
55+
cache: 'pnpm'
56+
57+
- name: Install dependencies
58+
run: pnpm i
59+
60+
- name: Install Vercel CLI
61+
run: pnpm add --global vercel@latest
62+
63+
- name: Pull Vercel Environment Information (Preview)
64+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
65+
66+
- name: Build Project Artifacts for Vercel
67+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
68+
69+
- name: Deploy Project to Vercel and Get URL
70+
id: deploy_vercel
71+
run: |
72+
DEPLOY_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
73+
echo "Vercel Preview URL: $DEPLOY_URL"
74+
echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_OUTPUT
75+
76+
- name: Install Playwright Browsers
77+
run: pnpm -C e2e/studio exec playwright install --with-deps
78+
79+
- name: Run Playwright tests
80+
id: playwright
81+
env:
82+
AUTHENTICATION: true
83+
STUDIO_URL: ${{ steps.deploy_vercel.outputs.DEPLOY_URL }}/dashboard
84+
run: pnpm e2e
85+
86+
- uses: actions/upload-artifact@v4
87+
if: always()
88+
with:
89+
name: playwright-artifacts
90+
path: |
91+
e2e/studio/playwright-report/
92+
e2e/studio/test-results/
93+
retention-days: 7

0 commit comments

Comments
 (0)