Skip to content

chore - make database e2e tests run in parallel and more stable - #43569

Merged
djhi merged 3 commits into
masterfrom
e2e-database
Mar 9, 2026
Merged

djhi merged 3 commits into
masterfrom
e2e-database

Conversation

@djhi

@djhi djhi commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Problem

  • database e2e tests run in serial mode, which is slower
  • they also are a bit flaky

Solution

  • Ensure they can run in parallel
  • Make them more stable by using UI checks when waiting
  • Use assertions that automatically wait/retry in playwright

@djhi
djhi requested a review from a team as a code owner March 9, 2026 15:57
@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 ↗︎.

@vercel

vercel Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Mar 9, 2026 4:36pm
studio-staging Ready Ready Preview, Comment Mar 9, 2026 4:36pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Mar 9, 2026 4:36pm
6 Skipped Deployments
Project Deployment Actions Updated (UTC)
cms Ignored Ignored Mar 9, 2026 4:36pm
studio Ignored Ignored Mar 9, 2026 4:36pm
design-system Skipped Skipped Mar 9, 2026 4:36pm
docs Skipped Skipped Mar 9, 2026 4:36pm
learn Skipped Skipped Mar 9, 2026 4:36pm
ui-library Skipped Skipped Mar 9, 2026 4:36pm

Request Review

@coderabbitai

coderabbitai Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Enhanced test infrastructure for database schema management with improved setup/cleanup patterns and more reliable asynchronous handling.
    • Minor test ID additions for improved test coverage tracking.

Walkthrough

This pull request includes two changes: (1) adding a data-testid attribute to a Check icon in the SchemaGraph component's "Copy as SQL" button to identify the icon when content is copied, and (2) refactoring the database end-to-end tests from global setup/teardown to per-test resource management, introducing new helper utilities (createTable and withSetupCleanup), replacing arbitrary timeouts with explicit visibility and state checks, and converting test groupings from serial to non-serial execution with localized test data constants.


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.

@github-actions

github-actions Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  154 passed
flaky  1 flaky
skipped  4 skipped

Details

stats  159 tests across 20 suites
duration  8 minutes, 24 seconds
commit  990e52f

Flaky tests

Features › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › broadcast modal validates JSON payload

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

@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.

NICE

Base automatically changed from e2e-optimize-2 to master March 9, 2026 16:29
@djhi
djhi enabled auto-merge (squash) March 9, 2026 16:30

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/studio/features/database.spec.ts`:
- Around line 18-27: The tests use fixed identifiers (e.g., databaseTableName,
databaseColumnName) and helper functions createTable()/dropTable() so parallel
workers collide; generate and append a unique SQL-safe suffix (e.g., short
random hex or worker id sanitized to [a-z0-9_]) per test/worker and use that
suffix when constructing every fixture name (tables, columns, roles, enums,
functions) so createTable(databaseTableName + suffix) and dropTable(...) refer
to the same unique name; ensure the suffix is produced once per test setup and
passed into all setup/cleanup calls and query builders in
e2e/studio/utils/db/queries.ts so creation and teardown operate on the same
unique identifier.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: b6d29e94-04bf-459b-b8f6-103e625b8c01

📥 Commits

Reviewing files that changed from the base of the PR and between bab4e8d and 990e52f.

📒 Files selected for processing (2)
  • apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
  • e2e/studio/features/database.spec.ts

Comment on lines +18 to +27
const databaseTableName = 'pw_database_schema_table'
const databaseColumnName = 'pw_database_schema_column'
await using _ = await withSetupCleanup(
async () => {
await createTable(databaseTableName, databaseColumnName)
},
async () => {
await dropTable(databaseTableName)
}
)

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.

⚠️ Potential issue | 🟠 Major

Fixed fixture names still share database state under parallel runs.

These tests are no longer serialized, but the created objects still use global pw_database_* identifiers. In e2e/studio/utils/db/queries.ts, createTable() uses CREATE TABLE IF NOT EXISTS, so a second worker/project will silently reuse the first worker’s table instead of getting an isolated fixture. The same collision pattern repeats later in this file for the fixed role, enum, and function names, where setup/cleanup can delete another worker’s object. Please add a unique SQL-safe suffix per test/worker to every created identifier.

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

In `@e2e/studio/features/database.spec.ts` around lines 18 - 27, The tests use
fixed identifiers (e.g., databaseTableName, databaseColumnName) and helper
functions createTable()/dropTable() so parallel workers collide; generate and
append a unique SQL-safe suffix (e.g., short random hex or worker id sanitized
to [a-z0-9_]) per test/worker and use that suffix when constructing every
fixture name (tables, columns, roles, enums, functions) so
createTable(databaseTableName + suffix) and dropTable(...) refer to the same
unique name; ensure the suffix is produced once per test setup and passed into
all setup/cleanup calls and query builders in e2e/studio/utils/db/queries.ts so
creation and teardown operate on the same unique identifier.

@djhi
djhi merged commit 950c26d into master Mar 9, 2026
23 checks passed
@djhi
djhi deleted the e2e-database branch March 9, 2026 16:45
@github-actions

github-actions Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1773074824)

Score Average Improvements Regressions
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Tool Usage 100% (+0pp) - -
Completeness 100% (+3pp) 1 🟢 -
Conciseness 0% (+0pp) - -
Goal Completion 95.7% (-2pp) - 1 🔴
Correctness 83.3% (-17pp) - 1 🔴
Docs Faithfulness 58.3% (-6pp) - 2 🔴
URL Validity 73.8% (-26pp) - 1 🔴
Time_to_first_token 0.23tok (-0.07tok) 11 🟢 1 🔴
Llm_calls 8.47 (+0.19) 7 🟢 1 🔴
Tool_calls 3.28 (+0.33) 7 🟢 -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 48055.08tok (+2237.47tok) 4 🟢 8 🔴
Prompt_cached_tokens 29948.44tok (+3349.33tok) 9 🟢 3 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 2944.67tok (+372.78tok) 2 🟢 10 🔴
Completion_reasoning_tokens 2181.33tok (+339.56tok) 2 🟢 10 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 50999.75tok (+2610.25tok) 4 🟢 8 🔴
Estimated_cost 0.01$ (+0$) 2 🟢 10 🔴
Duration 55.06s (+4.69s) 3 🟢 9 🔴
Llm_duration 108.73s (+9.79s) 3 🟢 9 🔴

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