@@ -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} )
0 commit comments