Skip to content

Commit 735785a

Browse files
committed
fix(amazonq): improve feedback experience and min char limit
1 parent 8e870bf commit 735785a

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

packages/core/src/feedback/vue/submitFeedback.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class FeedbackWebview extends VueWebview {
4141
return 'Choose a reaction (smile/frown)'
4242
}
4343

44+
if (message.comment.length < 188) {
45+
return 'Please add atleast 100 characters in the template describing your issue.'
46+
}
47+
4448
if (this.commentData) {
4549
message.comment = `${message.comment}\n\n${this.commentData}`
4650
}

packages/core/src/feedback/vue/submitFeedback.vue

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@
3434
>.</em
3535
>
3636
</div>
37+
<div style="margin-top: 10px">
38+
<em>For helpful feedback, please include:</em>
39+
<ul style="margin-top: 5px; margin-bottom: 5px">
40+
<li>
41+
<em><strong>Issue:</strong> A brief summary of the issue or suggestion</em>
42+
</li>
43+
<li>
44+
<em
45+
><strong>Reproduction Steps:</strong> Clear steps to reproduce the issue (if
46+
applicable)</em
47+
>
48+
</li>
49+
<li>
50+
<em
51+
><strong>Expected vs. Actual:</strong> What you expected and what actually
52+
happened</em
53+
>
54+
</li>
55+
</ul>
56+
</div>
3757
<br />
3858
<div>
3959
<em>
@@ -66,7 +86,16 @@ const client = WebviewClientFactory.create<FeedbackWebview>()
6686
export default defineComponent({
6787
data() {
6888
return {
69-
comment: '',
89+
comment: `Issue:
90+
91+
Reproduction Steps:
92+
1.
93+
2.
94+
3.
95+
96+
Expected Behavior:
97+
98+
Actual Behavior: `,
7099
sentiment: '',
71100
isSubmitting: false,
72101
error: '',

packages/core/src/test/feedback/commands/submitFeedbackListener.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ import { FeedbackWebview } from '../../../feedback/vue/submitFeedback'
1010
import sinon from 'sinon'
1111
import { waitUntil } from '../../../shared'
1212

13-
const comment = 'comment'
13+
const comment =
14+
'This is a detailed feedback comment that meets the minimum length requirement. ' +
15+
'It includes specific information about the issue, steps to reproduce, expected behavior, and actual behavior. ' +
16+
'This comment is long enough to pass the 188 character validation rule.'
1417
const sentiment = 'Positive'
1518
const message = { command: 'submitFeedback', comment: comment, sentiment: sentiment }
19+
const shortComment = 'This is a short comment'
20+
const shortMessage = { command: 'submitFeedback', comment: shortComment, sentiment: sentiment }
1621

1722
describe('submitFeedbackListener', function () {
1823
let mockTelemetry: TelemetryService
@@ -47,5 +52,14 @@ describe('submitFeedbackListener', function () {
4752
const result = await webview.submit(message)
4853
assert.strictEqual(result, expectedError)
4954
})
55+
56+
it(`validates ${productName} feedback comment length is at least 188 characters`, async function () {
57+
const postStub = sinon.stub()
58+
mockTelemetry.postFeedback = postStub
59+
const webview = new FeedbackWebview(mockTelemetry, productName)
60+
const result = await webview.submit(shortMessage)
61+
assert.strictEqual(result, 'Please add atleast 100 characters in the template describing your issue.')
62+
assert.strictEqual(postStub.called, false, 'postFeedback should not be called for short comments')
63+
})
5064
}
5165
})

0 commit comments

Comments
 (0)