diff --git a/static/app/views/projectInstall/scmCreateProject.spec.tsx b/static/app/views/projectInstall/scmCreateProject.spec.tsx index a84a057453f300..ec4db4c1d9e1f5 100644 --- a/static/app/views/projectInstall/scmCreateProject.spec.tsx +++ b/static/app/views/projectInstall/scmCreateProject.spec.tsx @@ -239,6 +239,46 @@ describe('ScmCreateProject', () => { }); }); + it('forwards the selected products to getting-started as the product query', async () => { + persistWizardSession({ + selectedFeatures: ['performance-monitoring', 'session-replay'], + }); + + MockApiClient.addMockResponse({ + url: `/teams/${organization.slug}/${adminTeam.slug}/projects/`, + method: 'POST', + body: ProjectFixture({slug: 'python', name: 'python'}), + }); + MockApiClient.addMockResponse({ + url: `/organizations/${organization.slug}/`, + body: organization, + }); + MockApiClient.addMockResponse({ + url: `/organizations/${organization.slug}/projects/`, + body: [], + }); + MockApiClient.addMockResponse({ + url: `/organizations/${organization.slug}/teams/`, + body: [adminTeam], + }); + + const {router} = render(, { + organization, + initialRouterConfig: returningRouterConfig, + }); + + await userEvent.click(await screen.findByRole('button', {name: 'Create project'})); + + await waitFor(() => { + expect(router.location.pathname).toContain('/python/getting-started/'); + }); + // The upfront product selection seeds the setup docs via the product query. + expect(router.location.query.product).toEqual([ + 'performance-monitoring', + 'session-replay', + ]); + }); + it('reuses the existing project on an unchanged return instead of duplicating', async () => { ProjectsStore.loadInitialData([ ProjectFixture({slug: 'python', name: 'python', platform: 'python'}), diff --git a/static/app/views/projectInstall/scmCreateProject.tsx b/static/app/views/projectInstall/scmCreateProject.tsx index aab3f6fbbc7d5c..c5fae91a506ad3 100644 --- a/static/app/views/projectInstall/scmCreateProject.tsx +++ b/static/app/views/projectInstall/scmCreateProject.tsx @@ -232,12 +232,21 @@ function ScmCreateProjectWizard({initialState}: {initialState: WizardState}) { createdProjectSlug: project.slug, projectDetailsForm: submittedForm, }); - navigate( - makeProjectsPathname({ + navigate({ + pathname: makeProjectsPathname({ path: `/${project.slug}/getting-started/`, organization, - }) - ); + }), + // Carry the upfront product selection into the setup docs so the + // instructions match what was chosen here; the getting-started page + // seeds its selection from the `product` query. Mirrors the SCM + // onboarding flow (ScmProjectDetails -> goNextStep). Classic + // createProject selects products on that page instead, so it forwards + // nothing. + query: wizardState.selectedFeatures + ? {product: wizardState.selectedFeatures} + : undefined, + }); }, [wizardState, navigate, organization] );