Skip to content

chore: e2e tests reliability - #46496

Merged
djhi merged 6 commits into
masterfrom
chore-e2e-reliability
Jun 1, 2026
Merged

djhi merged 6 commits into
masterfrom
chore-e2e-reliability

Conversation

@djhi

@djhi djhi commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

I have read the CONTRIBUTING.md file.

YES/NO

What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

Summary by CodeRabbit

  • Accessibility

    • Improved screen-reader label for table row action menus so table controls are clearer for assistive‑technology users.
  • Tests

    • Enhanced end-to-end test reliability: tightened selectors, added dialog/toast visibility and API-wait synchronization, scoped lookup fixes, removed redundant cleanup helper, and updated test setup to mark a terms-of-service dismissal to reduce flakiness.

@djhi
djhi requested a review from a team as a code owner May 29, 2026 09:29
@vercel

vercel Bot commented May 29, 2026 •

Copy link
Copy Markdown

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

7 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jun 1, 2026 7:39am
design-system Skipped Skipped Jun 1, 2026 7:39am
docs Skipped Skipped Jun 1, 2026 7:39am
studio-self-hosted Skipped Skipped Jun 1, 2026 7:39am
studio-staging Skipped Skipped Jun 1, 2026 7:39am
ui-library Skipped Skipped Jun 1, 2026 7:39am
zone-www-dot-com Skipped Skipped Jun 1, 2026 7:39am

Request Review

@supabase

supabase Bot commented May 29, 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 May 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 4cb3287a-9ff9-4f58-926f-0c0a8307f54e

📥 Commits

Reviewing files that changed from the base of the PR and between c65b8f9 and 8a81421.

📒 Files selected for processing (1)
  • e2e/studio/utils/test.ts

📝 Walkthrough

Walkthrough

Adds an aria-label to per-row table "more" buttons and hardens Playwright e2e tests by scoping selectors and adding explicit UI waits/assertions across cron-jobs, database CRUD flows, realtime-inspector, rls-policies, and test init scripts.

Changes

Table Actions Accessibility and E2E Test Hardening

Layer / File(s) Summary
Table actions button accessibility
apps/studio/components/interfaces/Database/Tables/TableList.tsx
Table row "more" actions dropdown trigger now includes an aria-label attribute identifying it as Table [name] actions.
Cron jobs alert interaction selectors
e2e/studio/features/cron-jobs.spec.ts
Three cron-job tests scope the "Learn more" button to the alert container instead of matching the button globally by role and accessible name.
Database CRUD flow test synchronization
e2e/studio/features/database.spec.ts
Tables CRUD test adds explicit "Table [name] actions" button locators, asserts create dialog visibility, validates and dismisses create/update/duplicate success toasts, fixes row/action targeting for deletion after duplication, and adds column dialog visibility assertions.
Realtime inspector setup wait
e2e/studio/features/realtime-inspector.spec.ts
beforeEach adds a page.waitForResponse for the project settings endpoint to ensure page initialization.
RLSPolicies test import cleanup
e2e/studio/features/rls-policies.spec.ts
Removes waitForApiResponse from imports while retaining createApiResponseWaiter; deletes helper that removed preexisting policy and related deletion logic.
Test init: localStorage TOS flag
e2e/studio/utils/test.ts
Adds terms-of-service-update-2026-06-06 localStorage key (set to true) in Playwright page.addInitScript initialization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • supabase/supabase#45961: Updates RLS confirmation dialog assertions and "Learn more" link handling in rls-policies tests.

Suggested reviewers

  • joshenlim
  • kemaldotearth

Poem

🐰 I named the buttons so voices can sing,
And tests now wait for the right little thing.
Dialogs open and close in their time,
Selectors scoped—no flakiness crime.
Hoppity fixes, tidy and prime.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template structure with placeholder text and no actual content—all fields are unfilled, lacking information about changes, behavior, issues, or context. Fill in all required template sections: explain the change type, link relevant issues, describe the new behavior and why tests were modified, and add context about the improvements.
Title check ❓ Inconclusive The title 'chore: e2e tests reliability' is vague and generic, using a broad term that doesn't specify what reliability improvements were made or which tests were modified. Provide a more specific title that indicates the actual changes, such as 'chore: improve e2e test stability by fixing selectors and adding waits' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore-e2e-reliability

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 May 29, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  218 passed
skipped  5 skipped

Details

stats  223 tests across 24 suites
duration  3 minutes, 2 seconds
commit  8a81421

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
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

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/studio/features/realtime-inspector.spec.ts`:
- Around line 17-19: The test attaches
page.waitForResponse(/\/platform\/projects\/${ref}\/settings/) only after
calling navigateToRealtimeInspector(page, ref), which can miss the request; move
or add the waitForResponse registration before calling
navigateToRealtimeInspector so the listener is active prior to page.goto()/Join
a channel logic. Specifically, create the RegExp waiter via
page.waitForResponse(new RegExp(`/platform/projects/${ref}/settings`)) (or store
the Promise) before invoking navigateToRealtimeInspector(page, ref), then await
that waiter after navigation completes to avoid flakiness.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 974cfeff-12a8-4da9-9f7b-5e125f7112fa

📥 Commits

Reviewing files that changed from the base of the PR and between 1ff28ef and 19c868a.

📒 Files selected for processing (2)
  • e2e/studio/features/realtime-inspector.spec.ts
  • e2e/studio/features/rls-policies.spec.ts

Comment on lines 17 to 19
await navigateToRealtimeInspector(page, ref)
await page.waitForResponse(new RegExp(`/platform/projects/${ref}/settings`))
})

@coderabbitai coderabbitai Bot May 29, 2026 •

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 | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify navigate helper behavior and current wait ordering (read-only).
rg -n -C3 "test\\.beforeEach|waitForResponse|navigateToRealtimeInspector" e2e/studio/features/realtime-inspector.spec.ts
fd -i "realtime-helpers.ts" e2e/studio --exec rg -n -C4 "export async function navigateToRealtimeInspector|navigateToRealtimeInspector"

Repository: supabase/supabase

Length of output: 884


Fix flaky Playwright setup: register /settings waiter before navigation

waitForResponse() is attached only after navigateToRealtimeInspector(page, ref) resolves (which includes page.goto() + waiting for Join a channel), so the /platform/projects/${ref}/settings request can complete before the listener starts, causing intermittent timeouts.

Suggested fix
 test.beforeEach(async ({ page, ref }) => {
-  await navigateToRealtimeInspector(page, ref)
-  await page.waitForResponse(new RegExp(`/platform/projects/${ref}/settings`))
+  await Promise.all([
+    page.waitForResponse((response) =>
+      response.url().includes(`/platform/projects/${ref}/settings`) && response.ok()
+    ),
+    navigateToRealtimeInspector(page, ref),
+  ])
 })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await navigateToRealtimeInspector(page, ref)
await page.waitForResponse(new RegExp(`/platform/projects/${ref}/settings`))
})
await Promise.all([
page.waitForResponse((response) =>
response.url().includes(`/platform/projects/${ref}/settings`) && response.ok()
),
navigateToRealtimeInspector(page, ref),
])
})
🧰 Tools
🪛 ast-grep (0.42.3)

[warning] 17-17: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(/platform/projects/${ref}/settings)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/studio/features/realtime-inspector.spec.ts` around lines 17 - 19, The
test attaches page.waitForResponse(/\/platform\/projects\/${ref}\/settings/)
only after calling navigateToRealtimeInspector(page, ref), which can miss the
request; move or add the waitForResponse registration before calling
navigateToRealtimeInspector so the listener is active prior to page.goto()/Join
a channel logic. Specifically, create the RegExp waiter via
page.waitForResponse(new RegExp(`/platform/projects/${ref}/settings`)) (or store
the Promise) before invoking navigateToRealtimeInspector(page, ref), then await
that waiter after navigation completes to avoid flakiness.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, the button is rendered even while waiting for the settings API call

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.

@djhi, thanks for the clarification — that makes sense. If the button renders while the settings request is still in-flight, the waitForResponse placed after navigateToRealtimeInspector will correctly catch the pending response. The current ordering is fine.


✏️ Learnings added
Learnt from: djhi
Repo: supabase/supabase PR: 46496
File: e2e/studio/features/realtime-inspector.spec.ts:17-19
Timestamp: 2026-05-29T16:05:14.460Z
Learning: In the Supabase e2e realtime inspector tests (`e2e/studio/features/realtime-inspector.spec.ts`), `navigateToRealtimeInspector` waits for the "Join a channel" button to be visible, but the `/platform/projects/${ref}/settings` API response has not yet arrived at that point. Therefore, placing `page.waitForResponse(new RegExp(...settings...))` *after* `navigateToRealtimeInspector` is intentional and correct — the response is still in-flight when the helper resolves, so the listener will not miss it.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.

Learnt from: charislam
Repo: supabase/supabase PR: 42478
File: apps/studio/data/privileges/function-api-access-mutation.ts:19-74
Timestamp: 2026-02-05T20:31:45.776Z
Learning: Do not duplicate projectRef validation in callers of executeSql. If executeSql already validates that projectRef is required and throws when missing, avoid adding extra guards in any function that calls executeSql. This applies to all TypeScript files in the repository.

Learnt from: charislam
Repo: supabase/supabase PR: 45336
File: apps/studio/data/database/table-index-advisor-query.ts:17-17
Timestamp: 2026-05-04T14:54:55.341Z
Learning: When reviewing uses/casts of `SafeSqlFragment`/`UntrustedSqlFragment` (Supabase repo trust model), do not treat casts to `SafeSqlFragment` as unsafe provenance escalation if the SQL originates from the database itself (e.g., SQL/query text sourced from DB query results such as `pg_stat_statements` or the index advisor). Only flag SQL fragments typed as `UntrustedSqlFragment` when they come from externally-supplied or user-input SQL. In short: DB-sourced SQL may be treated as `SafeSqlFragment`; externally-supplied SQL must remain `UntrustedSqlFragment`.

Learnt from: awaseem
Repo: supabase/supabase PR: 46113
File: e2e/studio/features/filter-bar.spec.ts:86-86
Timestamp: 2026-05-19T16:21:23.708Z
Learning: In Playwright e2e specs, `page.waitForTimeout(...)` is an acceptable exception (and should not be automatically flagged) when the test specifically needs to let a debounce window elapse to prove *absence* of network requests (e.g., asserting that no request like `table-rows` fires before a filter value is entered). In these cases, `waitForLoadState('networkidle')` can be misleading because it may return immediately when nothing is in flight, defeating the debounce check. Ensure the code/comments clearly explain that the timeout is intentionally used to cover the debounce period for the “no network requests” assertion.

@alaister alaister left a comment

Copy link
Copy Markdown
Member

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 ac59de1 into master Jun 1, 2026
37 checks passed
@djhi
djhi deleted the chore-e2e-reliability branch June 1, 2026 08:18
@github-actions

github-actions Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (bt::sp::custom::GitHub Actions-e1f8e343-7ee3-4763-ae7f-62d4550a6e7c-1780301994)

Score Average Improvements Regressions
Completeness 100% (+2pp) 2 🟢 -
Conciseness 41.3% (0pp) 6 🟢 5 🔴
Correctness 70% (-1pp) 3 🟢 3 🔴
Docs Faithfulness 61.7% (-8pp) 4 🟢 7 🔴
Goal Completion 82.8% (+3pp) 7 🟢 3 🔴
Tool Usage 74.5% (+0pp) - -
Knowledge Usage 97.4% (+8pp) 1 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+6pp) 2 🟢 -
Safety 90.5% (+0pp) - -
Time_to_first_token 0tok (0tok) 14 🟢 14 🔴
Llm_calls 7.02 (-0.2) 7 🟢 14 🔴
Tool_calls 3.23 (-0.09) 11 🟢 10 🔴
Errors 0 (-0.02) 1 🟢 -
Llm_errors 0 (-0.01) 1 🟢 -
Tool_errors 0 (+0) - -
Prompt_tokens 23024.8tok (-2929.69tok) 14 🟢 12 🔴
Prompt_cached_tokens 6979.68tok (+170.67tok) 16 🟢 9 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 630.33tok (+10.87tok) 15 🟢 14 🔴
Completion_reasoning_tokens 112.34tok (+7.53tok) 12 🟢 15 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 23655.14tok (-2918.82tok) 15 🟢 14 🔴
Estimated_cost 0$ (0$) 17 🟢 11 🔴
Duration 14.47s (-1.68s) 21 🟢 8 🔴
Llm_duration 9.96s (-0.09s) 16 🟢 13 🔴

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