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
38 changes: 20 additions & 18 deletions static/app/views/settings/projectSeer/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,8 @@ describe('ProjectSeer', () => {
const option = await screen.findByText('Code Changes');
await userEvent.click(option);

// Form has saveOnBlur=true, so wait for the PUT request
await waitFor(() => {
expect(projectPutRequest).toHaveBeenCalledTimes(1);
});
await waitFor(() => {
expect(projectPutRequest).toHaveBeenCalledWith(
expect.any(String),
expect.objectContaining({data: {automated_run_stopping_point: 'code_changes'}})
);
});

// Also check that the seer preferences POST was called with the new stopping point
// The field uses getData: () => ({}) to exclude itself from the form submission
// Only the seer preferences POST should be called with the actual data
await waitFor(() => {
expect(seerPreferencesPostRequest).toHaveBeenCalledWith(
expect.anything(),
Expand All @@ -430,6 +420,14 @@ describe('ProjectSeer', () => {
})
);
});

// The project PUT may be called but with empty data (no automated_run_stopping_point)
if (projectPutRequest.mock.calls.length > 0) {
expect(projectPutRequest).toHaveBeenCalledWith(
expect.any(String),
expect.objectContaining({data: {}})
);
}
});

it('can enable automation handoff to Cursor when Cursor integration is available', async () => {
Expand Down Expand Up @@ -526,12 +524,8 @@ describe('ProjectSeer', () => {
const cursorOption = await screen.findByText('Hand off to Cursor Cloud Agent');
await userEvent.click(cursorOption);

// Form has saveOnBlur=true, so wait for the PUT request
await waitFor(() => {
expect(projectPutRequest).toHaveBeenCalledTimes(1);
});

// Wait for the seer preferences POST to be called with automation_handoff
// The field uses getData: () => ({}) to exclude itself from the form submission
// Only the seer preferences POST should be called with the actual data
await waitFor(() => {
expect(seerPreferencesPostRequest).toHaveBeenCalledWith(
expect.anything(),
Expand All @@ -548,6 +542,14 @@ describe('ProjectSeer', () => {
})
);
});

// The project PUT may be called but with empty data (no automated_run_stopping_point)
if (projectPutRequest.mock.calls.length > 0) {
expect(projectPutRequest).toHaveBeenCalledWith(
expect.any(String),
expect.objectContaining({data: {}})
);
}
});

it('hides Scan Issues toggle when triage-signals-v0 feature flag is enabled', async () => {
Expand Down
1 change: 1 addition & 0 deletions static/app/views/settings/projectSeer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ function ProjectSeerGeneralForm({project}: {project: Project}) {
saveOnBlur: true,
saveMessage: t('Stopping point updated'),
onChange: handleStoppingPointChange,
getData: () => ({}),
visible: ({model}) => {
const tuningValue = model?.getValue('autofixAutomationTuning');
// Handle both boolean (toggle) and string (dropdown) values
Expand Down
Loading