Repository navigation
chore: e2e tests reliability - #46496
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 7 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds 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. ChangesTable Actions Accessibility and E2E Test Hardening
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🎭 Playwright Test ResultsDetails
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
e2e/studio/features/realtime-inspector.spec.tse2e/studio/features/rls-policies.spec.ts
| await navigateToRealtimeInspector(page, ref) | ||
| await page.waitForResponse(new RegExp(`/platform/projects/${ref}/settings`)) | ||
| }) |
There was a problem hiding this comment.
🧩 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.
| 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.
There was a problem hiding this comment.
Nope, the button is rendered even while waiting for the settings API call
There was a problem hiding this comment.
@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.
Braintrust eval reportAssistant (bt::sp::custom::GitHub Actions-e1f8e343-7ee3-4763-ae7f-62d4550a6e7c-1780301994)
|
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
Tests