Skip to content

Commit 2293204

Browse files
committed
Adding ui_click event for fixing tests
1 parent 208b74c commit 2293204

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

packages/core/src/amazonqTest/chat/controller/controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ export class TestController {
384384
this.messenger.sendChatInputEnabled(data.tabID, true)
385385
await this.sessionCleanUp()
386386
break
387+
case ButtonActions.STOP_FIXING_TEST:
388+
testGenState.setToCancelling()
389+
void this.handleUpdatePromptProgress({ status: 'cancel', tabID: data.tabID })
390+
telemetry.ui_click.emit({ elementId: 'unitTestGeneration_cancelFixingTest' })
391+
this.messenger.sendChatInputEnabled(data.tabID, true)
392+
await this.sessionCleanUp()
393+
break
387394
}
388395
}
389396
// This function handles actions if user gives any input from the chatInput box

packages/core/src/amazonqTest/chat/controller/messenger/messengerUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export enum ButtonActions {
1212
VIEW_DIFF = 'View-Diff',
1313
STOP_TEST_GEN = 'Stop-Test-Generation',
1414
STOP_BUILD = 'Stop-Build-Process',
15+
STOP_FIXING_TEST = 'Stop-Fixing-Test',
1516
}
1617

1718
// TODO: Refactor the common functionality between Transform, FeatureDev, CWSPRChat, Scan and UTG to a new Folder.

packages/core/src/amazonqTest/models/constants.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ export const testChat = 'testChat'
1313

1414
export const maxUserPromptLength = 4096 // user prompt character limit from MPS and API model.
1515

16+
const baseProgressField: Partial<ProgressField> = {
17+
status: 'default',
18+
value: -1,
19+
}
20+
1621
export const cancelTestGenButton: ChatItemButton = {
1722
id: ButtonActions.STOP_TEST_GEN,
1823
text: 'Cancel',
1924
icon: 'cancel' as MynahIcons,
2025
}
2126

2227
export const testGenProgressField: ProgressField = {
23-
status: 'default',
24-
value: -1,
28+
...baseProgressField,
2529
text: 'Generating unit tests...',
2630
actions: [cancelTestGenButton],
2731
}
@@ -46,25 +50,29 @@ export const cancelBuildProgressButton: ChatItemButton = {
4650
icon: 'cancel' as MynahIcons,
4751
}
4852

53+
export const cancelFixingTestButton: ChatItemButton = {
54+
id: ButtonActions.STOP_FIXING_TEST,
55+
text: 'Cancel',
56+
icon: 'cancel' as MynahIcons,
57+
}
58+
4959
export const buildProgressField: ProgressField = {
50-
status: 'default',
51-
value: -1,
60+
...baseProgressField,
5261
text: 'Compiling project...',
5362
actions: [cancelBuildProgressButton],
5463
}
5564

5665
export const fixingTestProgressField: ProgressField = {
57-
status: 'default',
58-
value: -1,
66+
...baseProgressField,
5967
text: 'Fixing test failures...',
60-
actions: [cancelBuildProgressButton],
68+
actions: [cancelFixingTestButton],
6169
}
6270

6371
export const errorProgressField: ProgressField = {
6472
status: 'error',
6573
text: 'Error...Input needed',
6674
value: -1,
67-
actions: [cancelBuildProgressButton],
75+
actions: [cancelTestGenButton],
6876
}
6977

7078
export const testGenSummaryMessage = (

0 commit comments

Comments
 (0)