Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions static/app/views/projectInstall/scmCreateProject.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<ScmCreateProject />, {
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'}),
Expand Down
17 changes: 13 additions & 4 deletions static/app/views/projectInstall/scmCreateProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Comment thread
sentry[bot] marked this conversation as resolved.
: undefined,
});
},
[wizardState, navigate, organization]
);
Expand Down
Loading