22 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33 * SPDX-License-Identifier: Apache-2.0
44 */
5- import { Workbench , WebviewView , By } from 'vscode-extension-tester'
5+ import { Workbench , WebviewView , By , ModalDialog , until } from 'vscode-extension-tester'
66import { printElementHTML , sleep } from './generalUtils'
77import { testContext } from './testContext'
88
@@ -90,12 +90,11 @@ export async function signInToAmazonQ(): Promise<void> {
9090 // }
9191
9292 // Normal manual authentication flow for local development
93- const workbench = new Workbench ( )
94- await workbench . executeCommand ( 'Amazon Q: Open Chat' )
9593
96- await sleep ( 5000 )
97- let webviewView = new WebviewView ( )
98- await webviewView . switchToFrame ( )
94+ //UN COMMENT
95+ const workbench = new Workbench ( )
96+ // await sleep(5000)
97+ // await workbench.executeCommand('Amazon Q: Open Chat')
9998
10099 // const selectableItems = await waitForElements(webviewView, By.css('.selectable-item'))
101100 // if (selectableItems.length === 0) {
@@ -115,10 +114,22 @@ export async function signInToAmazonQ(): Promise<void> {
115114
116115 // const UrlContinue = await webviewView.findWebElement(By.css('button.continue-button.topMargin'))
117116 // await UrlContinue.click()
117+
118+ // console.log('Waiting for manual authentication...')
119+ // await sleep(12000)
120+ const driver = workbench . getDriver ( )
121+ const modalWnd = By . className ( 'monaco-dialog-box' )
122+ await driver . wait ( until . elementLocated ( modalWnd ) , 10_000 )
123+ const dialog = new ModalDialog ( )
124+ await dialog . pushButton ( 'Open' )
125+ await sleep ( 5000 )
126+ await workbench . executeCommand ( 'Amazon Q: Open Chat' )
127+ await sleep ( 5000 )
128+ let webviewView = new WebviewView ( )
129+ await webviewView . switchToFrame ( )
118130 const body = webviewView . findElement ( By . css ( '*' ) )
119131 await printElementHTML ( body )
120- console . log ( 'Waiting for manual authentication...' )
121- await sleep ( 12000 )
132+
122133 console . log ( 'Manual authentication should be done' )
123134
124135 await webviewView . switchBack ( )
0 commit comments