Skip to content

test(studio): add MSW tests for project creation flow - #47790

Merged
awaseem merged 5 commits into
masterfrom
aliwaseem/fe-3883-add-msw-tests-for-project-creation-flow
Jul 10, 2026
Merged

awaseem merged 5 commits into
masterfrom
aliwaseem/fe-3883-add-msw-tests-for-project-creation-flow

Conversation

@awaseem

@awaseem awaseem commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Adds 21 MSW component tests covering the project creation wizard's permutations (plan/region/compute/OrioleDB/security options/GitHub/blocking states/errors). Closes FE-3883; surfaced a real empty-region submit bug tracked in FE-3884.

Summary by CodeRabbit

  • Tests
    • Added a comprehensive UI/request test suite for the Studio project-creation wizard.
    • Validates paid vs. free plan behavior (including compute sizing rules) and that region selection submits the correct payload, including the “Recommended” option.
    • Covers blocking and warning states (project limits, overdue invoices with billing CTA, and feature-flagged disabled creation), plus error handling when regions fail to load.
    • Exercises confirmation modals, database/security option flows, client-side validation, GitHub gating/repo selection, and toast errors on API failures.

@awaseem
awaseem requested a review from a team as a code owner July 9, 2026 17:40
@vercel

vercel Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jul 10, 2026 1:15pm
docs Ready Ready Preview, Comment, Open in v0 Jul 10, 2026 1:15pm
studio-self-hosted Ready Ready Preview, Comment Jul 10, 2026 1:15pm
studio-staging Ready Ready Preview, Comment Jul 10, 2026 1:15pm
ui-library Ready Ready Preview, Comment Jul 10, 2026 1:15pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Jul 10, 2026 1:15pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 10, 2026 1:15pm

Request Review

@supabase

supabase Bot commented Jul 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 Jul 9, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3dbb58e1-b819-4a12-9aff-20f1d49bdba1

📥 Commits

Reviewing files that changed from the base of the PR and between 65750c2 and c40411d.

📒 Files selected for processing (1)
  • apps/studio/tests/pages/new/[slug].test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/studio/tests/pages/new/[slug].test.tsx

📝 Walkthrough

Walkthrough

This PR adds a Vitest and React Testing Library suite for the Studio project-creation wizard. It mocks dependencies and API requests, then tests creation flows, blocking states, configuration, validation, GitHub integration, feature flags, and API errors.

Changes

Project creation wizard tests

Layer / File(s) Summary
Test setup, mocks, and harness
apps/studio/tests/pages/new/[slug].test.tsx
Sets up mocks, fixtures, MSW routes, feature flags, rendering utilities, request capture, and form interaction helpers.
Creation flows and blocking states
apps/studio/tests/pages/new/[slug].test.tsx
Covers paid and free creation payloads, redirects, and blocking states for project limits, overdue invoices, and disabled creation.
Region selection and compute confirmation
apps/studio/tests/pages/new/[slug].test.tsx
Tests recommended-region display, selected-region payloads, region-loading errors, and compute confirmation before submission.
PostgreSQL/orioledb engine selection
apps/studio/tests/pages/new/[slug].test.tsx
Tests orioledb warnings and payloads, invalid HA combinations, and unavailable-engine handling after region changes.
Security options and client validation
apps/studio/tests/pages/new/[slug].test.tsx
Tests security-option payload changes and validation blocking for weak passwords and short project names.
GitHub integration, feature flags, and errors
apps/studio/tests/pages/new/[slug].test.tsx
Tests GitHub entitlement and repository payloads, internal configuration visibility, and create-project API error toasts.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is far too terse and omits the required template sections like change type, current behavior, new behavior, and additional context. Fill in the template sections, confirm reading CONTRIBUTING.md, link the issue, and describe current behavior, new behavior, and any extra context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding MSW tests for the Studio project creation flow.
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.
✨ 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 aliwaseem/fe-3883-add-msw-tests-for-project-creation-flow

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.

@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (next)

passed  236 passed
flaky  2 flaky
skipped  5 skipped

Details

stats  243 tests across 28 suites
duration  4 minutes, 43 seconds
commit  f2d0afa

Flaky tests

Features › database.spec.ts › Database › Schema Visualizer › table actions work as expected
Features › database.spec.ts › Database › Schema Visualizer › columns actions work as expected

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 `@apps/studio/tests/pages/new/`[slug].test.tsx:
- Around line 335-356: The happy-path project creation test relies on an
unreliable smart-region auto-fill, so it should explicitly choose a region
before submitting. Update the test around renderWizard, fillProjectName, and
generateAndWaitForStrongPassword to call selectRegion(/Americas/) before
clicking “Create new project”, so the flow does not depend on the flaky
auto-fill behavior and remains stable if the default changes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8173915e-8af0-4c95-ab6e-184b81d2a5aa

📥 Commits

Reviewing files that changed from the base of the PR and between 72aa214 and f65cbed.

📒 Files selected for processing (1)
  • apps/studio/tests/pages/new/[slug].test.tsx

Comment on lines +335 to +356
test('creates a project on the happy path for a paid-plan organization', async () => {
mockWizardEndpoints()
const onRequest = vi.fn()
mockCreateProject(onRequest)

await renderWizard()

await fillProjectName('My New Project')
await generateAndWaitForStrongPassword()

fireEvent.click(screen.getByRole('button', { name: 'Create new project' }))

await waitFor(() => expect(onRequest).toHaveBeenCalled())
expect(screen.queryByText('Confirm compute costs')).not.toBeInTheDocument()

const body = onRequest.mock.calls[0][0]
expect(body.name).toBe('My New Project')
expect(body.organization_slug).toBe(ORG_SLUG)
expect(body.desired_instance_size).toBe('micro')

await waitFor(() => expect(routerMock.asPath).toBe('/project/new-project-ref'))
})

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Consider calling selectRegion in the happy path test for robustness.

The comment at Line 309 explicitly states the smart-region auto-fill is "unreliable (FE-3884)." Six tests that expect successful project creation (happy path, free plan, Data API, default privileges, auto RLS, GitHub repo) omit selectRegion and rely on this auto-fill. If the auto-fill fails intermittently or FE-3884 is fixed to require explicit region selection, these tests will break. Adding await selectRegion(/Americas/) before submit in at least the happy path test would make it more resilient and forward-compatible.

🤖 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 `@apps/studio/tests/pages/new/`[slug].test.tsx around lines 335 - 356, The
happy-path project creation test relies on an unreliable smart-region auto-fill,
so it should explicitly choose a region before submitting. Update the test
around renderWizard, fillProjectName, and generateAndWaitForStrongPassword to
call selectRegion(/Americas/) before clicking “Create new project”, so the flow
does not depend on the flaky auto-fill behavior and remains stable if the
default changes.

awaseem added 3 commits July 9, 2026 17:42
Replace the expensive findByRole({ name }) accessibility-tree poll for the
GitHub repository button with a cheap findByText, and raise the async-util and
test timeouts so the dependent-query chain has headroom on CPU-starved CI
workers instead of racing the defaults.
@awaseem
awaseem merged commit 7141b0a into master Jul 10, 2026
36 checks passed
@awaseem
awaseem deleted the aliwaseem/fe-3883-add-msw-tests-for-project-creation-flow branch July 10, 2026 13:20
@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1783689790)

Score Average Improvements Regressions
Tool Usage 70.6% (-3pp) - 2 🔴
Knowledge Usage 94.9% (-3pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 95% (-5pp) - 1 🔴
Time_to_first_token 3.17tok (+0.22tok) 11 🟢 18 🔴
Llm_calls 2.93 (-0.01) 11 🟢 10 🔴
Tool_calls 3.05 (-0.15) 10 🟢 12 🔴
Errors 5.25 (-0.14) 11 🟢 1 🔴
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 24300.14tok (-4065.07tok) 17 🟢 8 🔴
Prompt_cached_tokens 6597.15tok (-517.89tok) 7 🟢 16 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 610.48tok (+5.23tok) 16 🟢 13 🔴
Completion_reasoning_tokens 103.48tok (+2.3tok) 10 🟢 16 🔴
Total_tokens 24910.62tok (-4059.84tok) 17 🟢 12 🔴
Estimated_cost 0$ (0$) 14 🟢 12 🔴
Duration 18.72s (+0.96s) 10 🟢 19 🔴
Llm_duration 11.82s (+0.38s) 14 🟢 15 🔴

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