Skip to content

Commit cd4b1cf

Browse files
committed
test
1 parent 013e645 commit cd4b1cf

File tree

2 files changed

+8
-42
lines changed

2 files changed

+8
-42
lines changed

packages/amazonq/test/e2e/amazonq/chat.test.ts

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,7 @@ describe('Amazon Q Chat', function () {
3636
// Make sure you're logged in before every test
3737
registerAuthHook('amazonq-test-account')
3838
framework = new qTestingFramework('cwc', true, [])
39-
console.log(document.body)
4039
tab = framework.getTabs()[0] // use the default tab that gets created
41-
42-
/**
43-
* Since sending messages to the UI is asynchronous, race conditions can occur
44-
* where the event is set but not fully loaded. Instead of checking the store directly,
45-
* we now use the tab title as a proxy to determine when the tab is fully ready
46-
*/
47-
const ok = await waitUntil(
48-
async () => {
49-
return tab.getStore().tabTitle === 'Chat'
50-
},
51-
{
52-
interval: 50,
53-
timeout: 5000,
54-
}
55-
)
56-
if (!ok) {
57-
assert.fail('Chat tab failed to load')
58-
}
5940
store = tab.getStore()
6041
})
6142

@@ -94,6 +75,14 @@ describe('Amazon Q Chat', function () {
9475
assert.deepStrictEqual(store.promptInputPlaceholder, 'Ask a question or enter "/" for quick actions')
9576
})
9677

78+
it('Clicks help', async () => {
79+
tab.clickButton('help')
80+
await tab.waitForText(webviewConstants.helpMessage)
81+
const chatItems = tab.getChatItems()
82+
assert.deepStrictEqual(chatItems[4].type, 'answer')
83+
assert.deepStrictEqual(chatItems[4].body, webviewConstants.helpMessage)
84+
})
85+
9786
it('Sends message', async () => {
9887
tab.addChatMessage({
9988
prompt: 'What is a lambda',
@@ -103,12 +92,4 @@ describe('Amazon Q Chat', function () {
10392
// the last item should be an answer
10493
assert.deepStrictEqual(chatItems[4].type, 'answer')
10594
})
106-
107-
it('Clicks help', async () => {
108-
tab.clickButton('help')
109-
await tab.waitForText(webviewConstants.helpMessage)
110-
const chatItems = tab.getChatItems()
111-
assert.deepStrictEqual(chatItems[4].type, 'answer')
112-
assert.deepStrictEqual(chatItems[4].body, webviewConstants.helpMessage)
113-
})
11495
})

packages/amazonq/test/e2e/inline/inline.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,6 @@ describe('Amazon Q Inline', async function () {
144144
**/
145145
await sleep(1000)
146146

147-
/**
148-
* It seems like there are instances (race condition?) where amazon q starts generating when you open up
149-
* the file. Wait for that initial request to settle before doing anything
150-
*/
151-
const ok = await waitUntil(async () => {
152-
console.table({
153-
'recommendation status': RecommendationService.instance.isRunning,
154-
'session id': session.sessionId,
155-
})
156-
return !RecommendationService.instance.isRunning && session.sessionId === ''
157-
}, waitOptions)
158-
if (!ok) {
159-
throw new Error('Recommendation service did not settle')
160-
}
161-
162147
await invokeCompletion()
163148
originalEditorContents = vscode.window.activeTextEditor?.document.getText()
164149

0 commit comments

Comments
 (0)