Skip to content

Commit f33ef4c

Browse files
authored
feat(amazonq): E2E UI Tests Local Autonomous Auth Fix (#7964)
## Change Added logic in the auth flow to make the auth autonomous LOCALLY only if you are already mid-way authenticated. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 8987bf5 commit f33ef4c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/amazonq/test/e2e_new/amazonq/utils/authUtils.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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'
66
import { findItemByText, sleep, waitForElements } from './generalUtils'
77
import { testContext } from './testContext'
88

@@ -14,7 +14,7 @@ Currently, the function will
1414
3. Inputs the Start URL
1515
4. 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 */
1818
export 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

Comments
 (0)