diff --git a/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json b/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json new file mode 100644 index 00000000000..ed66cf8d22d --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "`/test`: view diffs by clicking files in the file tree, aligning the behavior with the 'View Diff' button." +} diff --git a/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts b/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts index cefc2b8818f..ae179fd6c41 100644 --- a/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts +++ b/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts @@ -13,6 +13,7 @@ import { TabsStorage, TabType } from '../storages/tabsStorage' import { TestMessageType } from '../../../../amazonqTest/chat/views/connector/connector' import { ChatPayload } from '../connector' import { BaseConnector, BaseConnectorProps } from './baseConnector' +import { FollowUpTypes } from '../../../commons/types' export interface ConnectorProps extends BaseConnectorProps { sendMessageToExtension: (message: ExtensionMessage) => void @@ -107,15 +108,43 @@ export class Connector extends BaseConnector { } onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => { - // TODO: add this back once we can advance flow from here - // this.sendMessageToExtension({ - // command: 'open-diff', - // tabID, - // filePath, - // deleted, - // messageId, - // tabType: 'testgen', - // }) + if (this.onChatAnswerReceived === undefined) { + return + } + // Open diff view + this.sendMessageToExtension({ + command: 'open-diff', + tabID, + filePath, + deleted, + messageId, + tabType: 'testgen', + }) + this.onChatAnswerReceived( + tabID, + { + type: ChatItemType.ANSWER, + messageId: messageId, + followUp: { + text: ' ', + options: [ + { + type: FollowUpTypes.AcceptCode, + pillText: 'Accept', + status: 'success', + icon: MynahIcons.OK, + }, + { + type: FollowUpTypes.RejectCode, + pillText: 'Reject', + status: 'error', + icon: MynahIcons.REVERT, + }, + ], + }, + }, + {} + ) } private processChatMessage = async (messageData: any): Promise => {