Skip to content

Commit 6d0fbf6

Browse files
committed
update tsts
1 parent e176610 commit 6d0fbf6

File tree

12 files changed

+71
-51
lines changed

12 files changed

+71
-51
lines changed

static/app/components/events/autofix/autofixChanges.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('AutofixChanges', () => {
9191
);
9292

9393
expect(
94-
screen.getByText('Autofix had trouble applying its code changes.')
94+
screen.getByText('Seer had trouble applying its code changes.')
9595
).toBeInTheDocument();
9696
});
9797

static/app/components/events/autofix/autofixChanges.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function AutofixChanges({
230230
<MarkdownAlert
231231
text={
232232
step.termination_reason ||
233-
t('Autofix had trouble applying its code changes.')
233+
t('Seer had trouble applying its code changes.')
234234
}
235235
/>
236236
</Alert.Container>

static/app/components/events/autofix/autofixInsightCards.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe('AutofixInsightCards', () => {
181181

182182
await waitFor(() => {
183183
expect(addErrorMessage).toHaveBeenCalledWith(
184-
'Something went wrong when sending Autofix your message.'
184+
'Something went wrong when sending Seer your message.'
185185
);
186186
});
187187
});

static/app/components/events/autofix/autofixInsightCards.tsx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -507,33 +507,37 @@ function useUpdateInsightCard({groupId, runId}: {groupId: string; runId: string}
507507
const orgSlug = useOrganization().slug;
508508

509509
return useMutation({
510-
mutationFn: (params: {
510+
mutationFn: async (params: {
511511
message: string;
512512
retain_insight_card_index: number | null;
513513
step_index: number;
514514
}) => {
515-
return api.requestPromise(
516-
`/organizations/${orgSlug}/issues/${groupId}/autofix/update/`,
517-
{
518-
method: 'POST',
519-
data: {
520-
run_id: runId,
521-
payload: {
522-
type: 'restart_from_point_with_feedback',
523-
message: params.message.trim(),
524-
step_index: params.step_index,
525-
retain_insight_card_index: params.retain_insight_card_index,
515+
try {
516+
const response = await api.requestPromise(
517+
`/organizations/${orgSlug}/issues/${groupId}/autofix/update/`,
518+
{
519+
method: 'POST',
520+
data: {
521+
run_id: runId,
522+
payload: {
523+
type: 'restart_from_point_with_feedback',
524+
message: params.message.trim(),
525+
step_index: params.step_index,
526+
retain_insight_card_index: params.retain_insight_card_index,
527+
},
526528
},
527-
},
528-
}
529-
);
530-
},
531-
onSuccess: _ => {
532-
queryClient.invalidateQueries({queryKey: makeAutofixQueryKey(orgSlug, groupId)});
533-
addSuccessMessage(t('Rethinking this...'));
529+
}
530+
);
531+
queryClient.invalidateQueries({queryKey: makeAutofixQueryKey(orgSlug, groupId)});
532+
addSuccessMessage(t('Rethinking this...'));
533+
return response;
534+
} catch (e) {
535+
addErrorMessage(t('Something went wrong when sending Seer your message.'));
536+
throw e;
537+
}
534538
},
535539
onError: () => {
536-
addErrorMessage(t('Something went wrong when sending Autofix your message.'));
540+
addErrorMessage(t('Something went wrong when sending Seer your message.'));
537541
},
538542
});
539543
}

static/app/components/events/autofix/autofixOutputStream.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('AutofixOutputStream', () => {
120120

121121
await waitFor(() => {
122122
expect(addErrorMessage).toHaveBeenCalledWith(
123-
'Something went wrong when sending Autofix your message.'
123+
'Something went wrong when sending Seer your message.'
124124
);
125125
});
126126
});

static/app/components/events/autofix/autofixOutputStream.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function AutofixOutputStream({
148148
addSuccessMessage('Thanks for the input.');
149149
},
150150
onError: () => {
151-
addErrorMessage(t('Something went wrong when sending Autofix your message.'));
151+
addErrorMessage(t('Something went wrong when sending Seer your message.'));
152152
},
153153
});
154154

static/app/components/events/autofix/autofixSteps.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('AutofixSteps', () => {
126126
render(<AutofixSteps {...propsWithErroredStep} />);
127127
expect(
128128
await screen.findByText(
129-
'Autofix encountered an error. Restarting step from scratch...'
129+
'Seer encountered an error. Restarting step from scratch...'
130130
)
131131
).toBeInTheDocument();
132132
});

static/app/components/events/autofix/autofixSteps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Step({
7979
<Fragment>
8080
{hasErroredStepBefore && hasStepAbove && (
8181
<StepMessage>
82-
{t('Autofix encountered an error. Restarting step from scratch...')}
82+
{t('Seer encountered an error. Restarting step from scratch...')}
8383
</StepMessage>
8484
)}
8585
{step.type === AutofixStepType.DEFAULT && (

static/app/views/issueDetails/streamline/sidebar/seerDrawer.spec.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ describe('SeerDrawer', () => {
318318
);
319319

320320
// The feedback button should be visible, but not the Start Over button
321-
expect(screen.getByTestId('autofix-button-bar')).toBeInTheDocument();
321+
expect(screen.getByTestId('seer-button-bar')).toBeInTheDocument();
322322
expect(screen.queryByRole('button', {name: 'Start Over'})).not.toBeInTheDocument();
323323

324324
// Restore the original implementation
@@ -352,7 +352,7 @@ describe('SeerDrawer', () => {
352352
);
353353

354354
// Both buttons should be visible, but Start Over should be disabled
355-
expect(screen.getByTestId('autofix-button-bar')).toBeInTheDocument();
355+
expect(screen.getByTestId('seer-button-bar')).toBeInTheDocument();
356356
const startOverButton = screen.getByRole('button', {name: 'Start Over'});
357357
expect(startOverButton).toBeInTheDocument();
358358
expect(startOverButton).toBeDisabled();
@@ -385,7 +385,7 @@ describe('SeerDrawer', () => {
385385
);
386386

387387
// Both buttons should be visible, and Start Over should be enabled
388-
expect(screen.getByTestId('autofix-button-bar')).toBeInTheDocument();
388+
expect(screen.getByTestId('seer-button-bar')).toBeInTheDocument();
389389
const startOverButton = screen.getByRole('button', {name: 'Start Over'});
390390
expect(startOverButton).toBeInTheDocument();
391391
expect(startOverButton).toBeEnabled();
@@ -401,6 +401,10 @@ describe('SeerDrawer', () => {
401401
organization,
402402
});
403403

404+
await waitForElementToBeRemoved(() =>
405+
screen.queryByTestId('ai-setup-loading-indicator')
406+
);
407+
404408
expect(await screen.findByRole('button', {name: 'Start Over'})).toBeInTheDocument();
405409
});
406410

@@ -414,6 +418,10 @@ describe('SeerDrawer', () => {
414418
organization,
415419
});
416420

421+
await waitForElementToBeRemoved(() =>
422+
screen.queryByTestId('ai-setup-loading-indicator')
423+
);
424+
417425
expect(await screen.findByRole('button', {name: 'Start Over'})).toBeInTheDocument();
418426
expect(await screen.findByRole('button', {name: 'Start Seer'})).toBeInTheDocument();
419427
expect(screen.getByRole('button', {name: 'Start Over'})).toBeDisabled();
@@ -429,6 +437,10 @@ describe('SeerDrawer', () => {
429437
organization,
430438
});
431439

440+
await waitForElementToBeRemoved(() =>
441+
screen.queryByTestId('ai-setup-loading-indicator')
442+
);
443+
432444
const startOverButton = await screen.findByRole('button', {name: 'Start Over'});
433445
expect(startOverButton).toBeInTheDocument();
434446
await userEvent.click(startOverButton);

static/app/views/issueDetails/streamline/sidebar/seerDrawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export function SeerDrawer({group, project, event}: SeerDrawerProps) {
228228
/>
229229
</Flex>
230230
{!aiConfig.needsGenAiAcknowledgement && (
231-
<ButtonBarWrapper data-test-id="autofix-button-bar">
231+
<ButtonBarWrapper data-test-id="seer-button-bar">
232232
<ButtonBar gap={1}>
233233
<Feature features={['organizations:autofix-seer-preferences']}>
234234
<LinkButton

static/app/views/issueDetails/streamline/sidebar/seerNotices.spec.tsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('SeerNotices', function () {
6060
expect(screen.getByText('Set Up the GitHub Integration')).toBeInTheDocument();
6161

6262
// Test for text fragments with formatting
63-
expect(screen.getByText(/Autofix is/, {exact: false})).toBeInTheDocument();
63+
expect(screen.getByText(/Seer is/, {exact: false})).toBeInTheDocument();
6464
expect(screen.getByText('a lot better')).toBeInTheDocument();
6565
expect(
6666
screen.getByText(/when it has your codebase as context/, {exact: false})
@@ -70,7 +70,7 @@ describe('SeerNotices', function () {
7070
expect(screen.getByText(/Set up the/, {exact: false})).toBeInTheDocument();
7171
expect(screen.getByText('GitHub Integration', {selector: 'a'})).toBeInTheDocument();
7272
expect(
73-
screen.getByText(/to allow Autofix to go deeper/, {exact: false})
73+
screen.getByText(/to allow Seer to go deeper/, {exact: false})
7474
).toBeInTheDocument();
7575

7676
expect(screen.getByText('Set Up Now')).toBeInTheDocument();
@@ -86,7 +86,7 @@ describe('SeerNotices', function () {
8686

8787
render(<SeerNotices groupId="123" hasGithubIntegration project={project} />);
8888

89-
expect(screen.getByText(/Autofix can't access the/)).toBeInTheDocument();
89+
expect(screen.getByText(/Seer can't access the/)).toBeInTheDocument();
9090
expect(screen.getByText('org/repo')).toBeInTheDocument();
9191
expect(screen.getByText(/GitHub integration/)).toBeInTheDocument();
9292
});
@@ -102,7 +102,7 @@ describe('SeerNotices', function () {
102102

103103
render(<SeerNotices groupId="123" hasGithubIntegration project={project} />);
104104

105-
expect(screen.getByText(/Autofix can't access the/)).toBeInTheDocument();
105+
expect(screen.getByText(/Seer can't access the/)).toBeInTheDocument();
106106
expect(screen.getByText('org/gitlab-repo')).toBeInTheDocument();
107107
expect(
108108
screen.getByText(/It currently only supports GitHub repositories/)
@@ -121,9 +121,7 @@ describe('SeerNotices', function () {
121121

122122
render(<SeerNotices groupId="123" hasGithubIntegration project={project} />);
123123

124-
expect(
125-
screen.getByText(/Autofix can't access these repositories:/)
126-
).toBeInTheDocument();
124+
expect(screen.getByText(/Seer can't access these repositories:/)).toBeInTheDocument();
127125
expect(screen.getByText('org/repo1, org/repo2')).toBeInTheDocument();
128126
expect(screen.getByText(/For best performance, enable the/)).toBeInTheDocument();
129127
expect(screen.getByText(/GitHub integration/)).toBeInTheDocument();
@@ -149,12 +147,10 @@ describe('SeerNotices', function () {
149147

150148
render(<SeerNotices groupId="123" hasGithubIntegration project={project} />);
151149

152-
expect(
153-
screen.getByText(/Autofix can't access these repositories:/)
154-
).toBeInTheDocument();
150+
expect(screen.getByText(/Seer can't access these repositories:/)).toBeInTheDocument();
155151
expect(screen.getByText('org/gitlab-repo1, org/bitbucket-repo2')).toBeInTheDocument();
156152
expect(
157-
screen.getByText(/Autofix currently only supports GitHub repositories/)
153+
screen.getByText(/Seer currently only supports GitHub repositories/)
158154
).toBeInTheDocument();
159155
});
160156

@@ -170,14 +166,12 @@ describe('SeerNotices', function () {
170166

171167
render(<SeerNotices groupId="123" hasGithubIntegration project={project} />);
172168

173-
expect(
174-
screen.getByText(/Autofix can't access these repositories:/)
175-
).toBeInTheDocument();
169+
expect(screen.getByText(/Seer can't access these repositories:/)).toBeInTheDocument();
176170
expect(screen.getByText('org/github-repo, org/gitlab-repo')).toBeInTheDocument();
177171
expect(screen.getByText(/For best performance, enable the/)).toBeInTheDocument();
178172
expect(screen.getByText(/GitHub integration/)).toBeInTheDocument();
179173
expect(
180-
screen.getByText(/Autofix currently only supports GitHub repositories/)
174+
screen.getByText(/Seer currently only supports GitHub repositories/)
181175
).toBeInTheDocument();
182176
});
183177

@@ -198,9 +192,7 @@ describe('SeerNotices', function () {
198192
expect(screen.getByText('Set Up Now')).toBeInTheDocument();
199193

200194
// Unreadable repos warning
201-
expect(
202-
screen.getByText(/Autofix can't access these repositories:/)
203-
).toBeInTheDocument();
195+
expect(screen.getByText(/Seer can't access these repositories:/)).toBeInTheDocument();
204196
expect(screen.getByText('org/repo1, org/repo2')).toBeInTheDocument();
205197
});
206198

@@ -235,7 +227,7 @@ describe('SeerNotices', function () {
235227
// Should have both the GitHub setup card and the unreadable repos warning
236228
const setupCard = screen.getByText('Set Up the GitHub Integration').closest('div');
237229
const warningAlert = screen
238-
.getByText(/Autofix can't access these repositories:/)
230+
.getByText(/Seer can't access these repositories:/)
239231
.closest('div');
240232

241233
expect(setupCard).toBeInTheDocument();
@@ -262,5 +254,17 @@ describe('SeerNotices', function () {
262254
await waitFor(() => {
263255
expect(screen.getByText('Pick Repositories to Work In')).toBeInTheDocument();
264256
});
257+
258+
const titleElement = screen.getByText('Pick Repositories to Work In');
259+
const cardDescriptionElement = titleElement.nextElementSibling;
260+
const firstSpanInDescription =
261+
cardDescriptionElement?.querySelector('span:first-child');
262+
expect(firstSpanInDescription?.textContent?.replace(/\s+/g, ' ').trim()).toBe(
263+
'Seer is a lot better when it has your codebase as context.'
264+
);
265+
266+
expect(
267+
screen.getByText(/Open the Project Settings menu in the top right/)
268+
).toBeInTheDocument();
265269
});
266270
});

static/app/views/settings/projectSeer/index.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ describe('ProjectSeer', function () {
184184
// Find input fields
185185
const branchInput = screen.getByPlaceholderText('Default branch');
186186
const instructionsInput = screen.getByPlaceholderText(
187-
'Any special instructions for Autofix in this repository...'
187+
'Any special instructions for Seer in this repository...'
188188
);
189189

190190
await userEvent.type(branchInput, 'develop');

0 commit comments

Comments
 (0)