Skip to content

Commit 6085881

Browse files
committed
adding the patch after it presses open
1 parent b72611f commit 6085881

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

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

Lines changed: 19 additions & 8 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, WebviewView, By } from 'vscode-extension-tester'
5+
import { Workbench, WebviewView, By, ModalDialog, until } from 'vscode-extension-tester'
66
import { printElementHTML, sleep } from './generalUtils'
77
import { 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

Comments
 (0)