33 * SPDX-License-Identifier: Apache-2.0
44 */
55import '../utils/setup'
6- import { WebviewView } from 'vscode-extension-tester'
6+ import { WebviewView , By } from 'vscode-extension-tester'
77import { testContext } from '../utils/testContext'
8- import { clearChat , waitForChatResponse , writeToChat } from '../utils/generalUtils'
8+ import { waitForChatResponse , writeToChat , waitForElement } from '../utils/generalUtils'
99import { closeAllTabs } from '../utils/cleanupUtils'
1010
1111describe ( 'Amazon Q Chat Basic Functionality' , function ( ) {
@@ -17,20 +17,32 @@ describe('Amazon Q Chat Basic Functionality', function () {
1717 webviewView = testContext . webviewView
1818 } )
1919
20- after ( async function ( ) {
20+ afterEach ( async function ( ) {
2121 await closeAllTabs ( webviewView )
2222 } )
2323
24- afterEach ( async ( ) => {
25- await clearChat ( webviewView )
26- } )
27-
28- it ( 'Chat Prompt Test' , async ( ) => {
24+ it ( 'Allows User to Chat with AmazonQ' , async ( ) => {
2925 await writeToChat ( 'Hello, Amazon Q!' , webviewView )
3026 const responseReceived = await waitForChatResponse ( webviewView )
3127 if ( ! responseReceived ) {
3228 throw new Error ( 'Chat response not received within timeout' )
3329 }
3430 console . log ( 'Chat response detected successfully' )
3531 } )
32+ it ( 'Allows User to Add Multiple Chat Tabs' , async ( ) => {
33+ console . log ( 'Starting Multiple Chat Test' )
34+ for ( let i = 0 ; i < 3 ; i ++ ) {
35+ const addChat = await webviewView . findWebElement ( By . css ( '.mynah-ui-icon.mynah-ui-icon-plus' ) )
36+ await addChat . click ( )
37+ }
38+ } )
39+ it ( 'Allows User to View Chat History' , async ( ) => {
40+ console . log ( 'Starting View History Test' )
41+ const viewHistory = await webviewView . findWebElement ( By . css ( '.mynah-ui-icon.mynah-ui-icon-history' ) )
42+ await viewHistory . click ( )
43+ await waitForElement ( webviewView , By . css ( '.mynah-detailed-list-item-groups-wrapper' ) )
44+ console . log ( 'History wrapper found successfully' )
45+ const closeHistory = await waitForElement ( webviewView , By . css ( '.mynah-ui-icon.mynah-ui-icon-cancel' ) )
46+ await closeHistory . click ( )
47+ } )
3648} )
0 commit comments