import { act, configure, fireEvent, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { platformComponents as components } from 'api-types' import { FeatureFlagContext } from 'common' import { mockAnimationsApi } from 'jsdom-testing-mocks' import { http, HttpResponse } from 'msw' import { toast } from 'sonner' import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest' import { AUTO_ENABLE_RLS_EVENT_TRIGGER_SQL } from '@/components/interfaces/Database/Triggers/EventTriggersList/EventTriggers.constants' import customContent from '@/hooks/custom-content/custom-content.json' import { FGA_PERMISSIONS } from '@/hooks/misc/useCheckPermissionsV2' import type { StatusPageResponse } from '@/lib/status-page/status-page.schema' import { Route } from '@/routes/new/$slug' import { createMockOrganizationResponse } from '@/tests/helpers' import { CustomWrapper } from '@/tests/lib/custom-render' import { addAPIMock, mswServer, type APIErrorBody } from '@/tests/lib/msw' import { mockPermissions } from '@/tests/lib/msw-permissions' import type { PermissionsV2Response } from '@/tests/lib/permissions-fixtures' import { createMockProfileContext } from '@/tests/lib/profile-helpers' import { renderRoute } from '@/tests/lib/route-render' type OrganizationResponse = components['schemas']['OrganizationResponse_Output'] type CreateProjectBody = components['schemas']['CreateProjectBody'] type CreateProjectResponse = components['schemas']['CreateProjectResponse_Output'] type RegionsInfo = components['schemas']['RegionsInfoPlatform_Output'] type MemberWithFreeProjectLimit = components['schemas']['MemberWithFreeProjectLimit_Output'] type OverdueInvoiceCount = components['schemas']['OverdueInvoiceCount_Output'] type OrganizationProjectsResponse = components['schemas']['OrganizationProjectsResponse_Output'] type Entitlement = components['schemas']['ListEntitlementsResponse_Output']['entitlements'][number] type AvailableVersion = { postgres_engine: '15' | '17' | '17-oriole' release_channel: 'internal' | 'alpha' | 'beta' | 'ga' | 'withdrawn' | 'preview' version: string } type GitHubRepositoriesResponse = { partial_response_due_to_sso: boolean repositories: { id: number; installation_id: number; name: string; default_branch: string }[] } mockAnimationsApi() // defaultHidden skips RTL's per-element accessibility (getComputedStyle) check, which makes // each *ByRole query on this large form ~3x cheaper. Radix Selects also render hidden native //