22 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33 * SPDX-License-Identifier: Apache-2.0
44 */
5- import { Workbench , By , WebviewView } from 'vscode-extension-tester'
5+ import { Workbench , By , WebviewView , until , ModalDialog } from 'vscode-extension-tester'
66import { findItemByText , sleep , waitForElements } from './generalUtils'
77import { testContext } from './testContext'
88
@@ -14,7 +14,7 @@ Currently, the function will
14143. Inputs the Start URL
15154. IMPORTANT: you must click manually open yourself when the popup window asks to open the browser and complete the authentication in the browser**
1616
17- TO-DO: Currently this signInToAmazonQ is not fully autonomous as we ran into a blocker when the browser window pops up */
17+ IMPORTANT: YOU MUST BE MIDWAY AUTHENTICATED FOR THE LOCAL AUTH TO BE AUTONOMOUS */
1818export async function signInToAmazonQ ( ) : Promise < void > {
1919 const workbench = new Workbench ( )
2020 await workbench . executeCommand ( 'Amazon Q: Open Chat' )
@@ -42,6 +42,13 @@ export async function signInToAmazonQ(): Promise<void> {
4242 const UrlContinue = await webviewView . findWebElement ( By . css ( 'button.continue-button.topMargin' ) )
4343 await UrlContinue . click ( )
4444
45+ await webviewView . switchBack ( )
46+ const driver = workbench . getDriver ( )
47+ const modalWnd = By . className ( 'monaco-dialog-box' )
48+ await driver . wait ( until . elementLocated ( modalWnd ) , 10_000 )
49+ const dialog = new ModalDialog ( )
50+ await dialog . pushButton ( 'Open' )
51+
4552 console . log ( 'Waiting for manual authentication...' )
4653 await sleep ( 12000 )
4754 console . log ( 'Manual authentication should be done' )
0 commit comments