Skip to content

chore: e2e general improvements - #43547

Merged
djhi merged 5 commits into
masterfrom
e2e-general-improvements
Mar 9, 2026
Merged

djhi merged 5 commits into
masterfrom
e2e-general-improvements

Conversation

@djhi

@djhi djhi commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Problem

e2e tests are still flaky and not as fast as they could be

Solution

  • Reset supabase instance: this makes the database visualiser tests faster as there are less tables to screenshot
  • Improve the single file setup utilities so that they never block local tests by cleaning them up before starting
  • Disable animations while running the tests (less time waiting for animations to complete
  • Add utility functions that help reproducing flaky tests locally

@vercel

vercel Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

9 Skipped Deployments
Project Deployment Actions Updated (UTC)
cms Ignored Ignored Mar 9, 2026 11:28am
studio Ignored Ignored Mar 9, 2026 11:28am
design-system Skipped Skipped Mar 9, 2026 11:28am
docs Skipped Skipped Mar 9, 2026 11:28am
learn Skipped Skipped Mar 9, 2026 11:28am
studio-self-hosted Skipped Skipped Mar 9, 2026 11:28am
studio-staging Skipped Skipped Mar 9, 2026 11:28am
ui-library Skipped Skipped Mar 9, 2026 11:28am
zone-www-dot-com Skipped Skipped Mar 9, 2026 11:28am

Request Review

@supabase

supabase Bot commented Mar 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: fa4f127f-1a94-412c-9dd3-08d175cc74b4

📥 Commits

Reviewing files that changed from the base of the PR and between 0aca75a and 4af636d.

📒 Files selected for processing (3)
  • e2e/studio/features/table-editor.spec.ts
  • e2e/studio/utils/db/queries.ts
  • e2e/studio/utils/test.ts

📝 Walkthrough

Summary by CodeRabbit

  • Tests

    • Enhanced E2E test infrastructure with CPU and network throttling simulation for more realistic test scenarios.
    • Improved test isolation and cleanup mechanisms to reduce flakiness between test runs.
    • Added accessibility-focused test configuration with reduced motion settings.
    • Refactored test setup/teardown patterns for improved test organization and reliability.
  • Chores

    • Updated test workflow to reset environment before running test suites.

Walkthrough

The change set updates the studio E2E test infrastructure: a GitHub Actions step resets the Supabase directory and re-initializes Supabase before Playwright tests run; global setup now uses native Node.js fs/path/os imports and removes a temporary Playwright locks directory; Playwright config adds contextOptions with reducedMotion: 'reduce'; a new debug utility exports NETWORK_PRESETS and useTestThrottling to apply CPU and network throttling via CDP; test utilities add withSetupCleanup and createTableWithRLS, plus related test adjustments and DB query refactors.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Code
    participant Playwright as Playwright Runner
    participant CDP as CDP Session
    participant Browser as Browser Target

    Test->>Playwright: call useTestThrottling(page, {cpu?, network?})
    Playwright->>CDP: create CDP session for page
    alt cpu provided
        CDP->>Browser: Emulation.setCPUThrottlingRate(cpuRate)
    end
    alt network provided
        CDP->>Browser: Network.emulateNetworkConditions(preset)
    end
    Playwright-->>Test: throttling applied
Loading
sequenceDiagram
    participant GH as GitHub Actions Runner
    participant FS as Workspace Filesystem
    participant SupabaseCLI as pnpm exec supabase
    participant Vercel as Vercel Preview

    GH->>FS: remove existing supabase directory (if any)
    GH->>SupabaseCLI: supabase init
    SupabaseCLI->>FS: create supabase/functions directory
    GH->>Vercel: run Playwright tests against Preview
Loading

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
e2e/studio/features/_global.setup.ts (1)

84-132: ⚠️ Potential issue | 🟠 Major

The stale-lock cleanup is skipped on the successful setup paths.

Lines 86, 99, and 118 all return before the new cleanup block runs, so the playwright-locks directory is left behind precisely when setup/auth succeeds. That also means the cleanup happens too late to unblock a run that is already stuck on stale locks before setupProjectForTests() / login work starts. Move this cleanup before the setup flow begins, or wrap the body in try/finally if you also need post-run cleanup.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/studio/features/_global.setup.ts` around lines 84 - 132, The cleanup for
the stale playwright-locks directory (locksDirPath + fs.access/fs.rm block) runs
after early returns from successful auth flows (loginWithEmail,
loginWithGithubWithRetry) so it is skipped; move that cleanup block to run
before the authentication/setup flow begins (i.e., place the locksDirPath check
and fs.rm call before the doAuthentication check and before calling
loginWithEmail/loginWithGithubWithRetry) or wrap the entire authentication/setup
sequence in a try/finally and perform the locksDirPath cleanup in the finally so
it always runs regardless of returns or thrown errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@e2e/studio/features/_global.setup.ts`:
- Around line 84-132: The cleanup for the stale playwright-locks directory
(locksDirPath + fs.access/fs.rm block) runs after early returns from successful
auth flows (loginWithEmail, loginWithGithubWithRetry) so it is skipped; move
that cleanup block to run before the authentication/setup flow begins (i.e.,
place the locksDirPath check and fs.rm call before the doAuthentication check
and before calling loginWithEmail/loginWithGithubWithRetry) or wrap the entire
authentication/setup sequence in a try/finally and perform the locksDirPath
cleanup in the finally so it always runs regardless of returns or thrown errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 68bb6a1f-ab93-4f74-a0da-a66c15f1d87d

📥 Commits

Reviewing files that changed from the base of the PR and between 3885265 and 0aca75a.

📒 Files selected for processing (4)
  • .github/workflows/studio-e2e-test.yml
  • e2e/studio/features/_global.setup.ts
  • e2e/studio/playwright.config.ts
  • e2e/studio/utils/debug.ts

@github-actions

github-actions Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  153 passed
flaky  2 flaky
skipped  4 skipped

Details

stats  159 tests across 20 suites
duration  13 minutes, 14 seconds
commit  4af636d

Flaky tests

Features › cron-jobs.spec.ts › Cron Jobs Integration › Cron Jobs CRUD Operations › can view cron jobs page
Features › filter-bar.spec.ts › Filter Bar › Keyboard Navigation - Freeform Input › Enter selects column from dropdown

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@blacksmith-sh

This comment has been minimized.

@djhi
djhi marked this pull request as draft March 9, 2026 11:10
@djhi
djhi marked this pull request as ready for review March 9, 2026 12:19

@awaseem awaseem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@djhi
djhi merged commit 13bfc45 into master Mar 9, 2026
23 checks passed
@djhi
djhi deleted the e2e-general-improvements branch March 9, 2026 14:38
djhi added a commit that referenced this pull request Mar 9, 2026
## Problem

- Some tests don't always cleanup after themselves or don't do it
consistently which make it hard to work on them locally
- Some test suites don't allow parallel execution of their tests
- Some tests are flaky

This a follow up of #43547
djhi added a commit that referenced this pull request Mar 9, 2026
…able (#43566)

Follow up of #43547 and #43560

## Problem

The cron job tests run in serial mode and can be flaky.

## Solution

- Use simple query to install the `pg_cron` extension (way faster than
using UI)
- Make sure all tests can run in parallel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants