import {ProjectKeysFixture} from 'sentry-fixture/projectKeys'; import {initializeOrg} from 'sentry-test/initializeOrg'; import {render} from 'sentry-test/reactTestingLibrary'; import {OnboardingLayout} from 'sentry/components/onboarding/gettingStartedDoc/onboardingLayout'; import type { BasePlatformOptions, Docs, SelectedPlatformOptions, } from 'sentry/components/onboarding/gettingStartedDoc/types'; import type {ReleaseRegistrySdk} from 'sentry/components/onboarding/gettingStartedDoc/useSourcePackageRegistries'; import {ProductSolution} from 'sentry/components/onboarding/productSelection'; import type {Organization} from 'sentry/types/organization'; import type {DeepPartial} from 'sentry/types/utils'; interface Options { releaseRegistry?: DeepPartial; selectedOptions?: Partial>; selectedProducts?: ProductSolution[]; } type RenderOptions = { organization?: Organization; }; export function renderWithOnboardingLayout< PlatformOptions extends BasePlatformOptions = BasePlatformOptions, >( docsConfig: Docs, options: Options = {}, renderOptions: RenderOptions = {} ) { const { releaseRegistry = {}, selectedProducts = [ ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING, ProductSolution.SESSION_REPLAY, ], selectedOptions = {}, } = options; const {organization, project, router} = initializeOrg({ organization: renderOptions.organization, router: { location: { query: selectedOptions, }, }, }); const projectKey = 'test-project-key-id'; MockApiClient.addMockResponse({ url: `/organizations/${organization.slug}/sdks/`, body: releaseRegistry, }); MockApiClient.addMockResponse({ url: `/projects/${organization.slug}/${project.slug}/keys/${projectKey}/`, method: 'PUT', body: [ProjectKeysFixture()[0]], }); render( , { organization, router, } ); }