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
33 changes: 6 additions & 27 deletions packages/amazonq/test/e2e/amazonq/transformByQ.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Amazon Q Code Transformation', function () {
})

describe('Starting a transformation from chat', () => {
it.skip('Can click through all user input forms for a Java upgrade', async () => {
it('Can click through all user input forms for a Java upgrade', async () => {
sinon.stub(startTransformByQ, 'getValidSQLConversionCandidateProjects').resolves([])
sinon.stub(GumbyController.prototype, 'validateLanguageUpgradeProjects' as keyof GumbyController).resolves([
{
Expand Down Expand Up @@ -168,39 +168,18 @@ describe('Amazon Q Code Transformation', function () {
.getChatMessenger()
?.sendJobFinishedMessage(tab.tabID, CodeWhispererConstants.viewProposedChangesChatMessage)

// wait for download message and feedback form to be sent
await tab.waitForEvent(() => tab.getChatItems().length > 15, {
waitTimeoutInMs: 5000,
waitIntervalInMs: 1000,
})

const submitFeedbackForm = tab.getChatItems().pop()
assert.strictEqual(submitFeedbackForm?.formItems?.[0]?.id ?? undefined, 'TransformFeedbackRerunJob')
assert.strictEqual(submitFeedbackForm?.formItems?.[1]?.id ?? undefined, 'TransformFeedbackViewLogs')

const submitFeedbackFormItemValues = {
TransformFeedbackRerunJob: 'No',
TransformFeedbackViewLogs: 'Yes',
}
const submitFeedbackFormValues: Record<string, string> = { ...submitFeedbackFormItemValues }

const viewSummaryChatItem = tab.getChatItems()[tab.getChatItems().length - 2]
assert.strictEqual(viewSummaryChatItem?.body?.includes('view a summary'), true)

tab.clickCustomFormButton({
id: 'gumbyFeedbackFormConfirm',
text: 'Confirm',
formItemValues: submitFeedbackFormValues,
id: 'gumbyViewSummary',
text: 'View summary',
})

// wait for feedback received message to be sent
await tab.waitForEvent(() => tab.getChatItems().length > 16, {
await tab.waitForEvent(() => tab.getChatItems().length > 14, {
waitTimeoutInMs: 5000,
waitIntervalInMs: 1000,
})

const feedbackReceivedMessage = tab.getChatItems().pop()
assert.strictEqual(feedbackReceivedMessage?.body?.includes('Feedback received') ?? undefined, true)
const viewSummaryChatItem = tab.getChatItems().pop()
assert.strictEqual(viewSummaryChatItem?.body?.includes('view a summary'), true)
})

it('CANNOT do a Java 21 to Java 17 transformation', async () => {
Expand Down
16 changes: 0 additions & 16 deletions packages/core/src/amazonqGumby/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
validateCanCompileProject,
getValidSQLConversionCandidateProjects,
openHilPomFile,
getFeedbackCommentData,
} from '../../../codewhisperer/commands/startTransformByQ'
import { JDKVersion, TransformationCandidateProject, transformByQState } from '../../../codewhisperer/models/model'
import {
Expand Down Expand Up @@ -62,7 +61,6 @@ import {
validateSQLMetadataFile,
} from '../../../codewhisperer/service/transformByQ/transformFileHandler'
import { getAuthType } from '../../../auth/utils'
import globals from '../../../shared/extensionGlobals'

// These events can be interactions within the chat,
// or elsewhere in the IDE
Expand Down Expand Up @@ -372,9 +370,6 @@ export class GumbyController {
case ButtonActions.CONFIRM_SKIP_TESTS_FORM:
await this.handleSkipTestsSelection(message)
break
case ButtonActions.CONFIRM_FEEDBACK_FORM:
await this.handleFeedback(message)
break
case ButtonActions.CONFIRM_SELECTIVE_TRANSFORMATION_FORM:
await this.handleOneOrMultipleDiffs(message)
break
Expand Down Expand Up @@ -639,17 +634,6 @@ export class GumbyController {
}
}

private async handleFeedback(message: any) {
const canRerunJob = message.formSelectedValues['TransformFeedbackRerunJob']
const canViewLogs = message.formSelectedValues['TransformFeedbackViewLogs']
const comment = `Permission to re-run job: ${canRerunJob}\nPermission to view logs: ${canViewLogs}\n${getFeedbackCommentData()}`
this.messenger.sendFeedbackReceivedMessage(canRerunJob, canViewLogs, message.tabID)
if (comment.toLowerCase().includes('yes')) {
// post feedback if user says yes to at least one of the questions
await globals.telemetry.postFeedback({ comment: comment, sentiment: 'Positive' })
}
}

private resetTransformationChatFlow() {
this.sessionStorage.getSession().conversationState = ConversationState.IDLE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,6 @@ export class Messenger {
})
}

if (
transformByQState.isPartiallySucceeded() &&
message === CodeWhispererConstants.viewProposedChangesChatMessage
) {
// get permission to re-run job and view logs after partially successful job is downloaded
// TODO: uncomment this when feature is ready
// this.sendFeedbackFormMessage(tabID)
}

this.dispatcher.sendChatMessage(
new ChatMessage(
{
Expand Down Expand Up @@ -808,64 +799,4 @@ ${codeSnippet}
)
)
}

public sendFeedbackFormMessage(tabID: string) {
const formItems: ChatItemFormItem[] = []
formItems.push({
id: 'TransformFeedbackRerunJob',
type: 'radiogroup',
title: 'To improve our service, do we have permission to re-run your job? (you will *not* be charged)',
mandatory: true,
options: [
{
value: 'Yes',
label: 'Yes',
},
{
value: 'No',
label: 'No',
},
],
})

formItems.push({
id: 'TransformFeedbackViewLogs',
type: 'radiogroup',
title: 'Do we also have permission to view the logs associated with your job?',
mandatory: true,
options: [
{
value: 'Yes',
label: 'Yes',
},
{
value: 'No',
label: 'No',
},
],
})

this.dispatcher.sendChatPrompt(
new ChatPrompt(
{
message: 'Amazon Q Permissions Form',
formItems: formItems,
},
'FeedbackForm',
tabID,
false
)
)
}

public sendFeedbackReceivedMessage(canRerunJob: string, canViewLogs: string, tabID: string) {
const message = `### Response received
-------------
| | |
| :------------------- | -------: |
| **Permission to re-run job** | ${canRerunJob} |
| **Permission to view logs** | ${canViewLogs} |
`
this.dispatcher.sendChatMessage(new ChatMessage({ message, messageType: 'prompt' }, tabID))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export enum ButtonActions {
CONFIRM_SQL_CONVERSION_TRANSFORMATION_FORM = 'gumbySQLConversionTransformFormConfirm',
CANCEL_TRANSFORMATION_FORM = 'gumbyTransformFormCancel', // shared between Language Upgrade & SQL Conversion
CONFIRM_SKIP_TESTS_FORM = 'gumbyTransformSkipTestsFormConfirm',
CONFIRM_FEEDBACK_FORM = 'gumbyFeedbackFormConfirm',
CONFIRM_SELECTIVE_TRANSFORMATION_FORM = 'gumbyTransformOneOrMultipleDiffsFormConfirm',
SELECT_SQL_CONVERSION_METADATA_FILE = 'gumbySQLConversionMetadataTransformFormConfirm',
CONFIRM_DEPENDENCY_FORM = 'gumbyTransformDependencyFormConfirm',
Expand Down
Loading