Skip to content
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
98688bf
initial VET commit with baseline setup + dependencies
laura-codess Jul 2, 2025
5959a38
deleting unnecessary dependencies and refactoring some of VET.test.ts
laura-codess Jul 2, 2025
4540f16
added back the buffer dependency because it failed the tests without it
laura-codess Jul 3, 2025
f1afe95
it was not any of the dependencies that was causing it to break, it w…
laura-codess Jul 3, 2025
4fa90ec
added back some more node: protocol imports to see if it passes all t…
laura-codess Jul 3, 2025
e1c33d8
forgot to save a webpack change. hoping it will fix the one failing t…
laura-codess Jul 3, 2025
ea46464
added back basically all the dependencies because 1 test keeps failing
laura-codess Jul 3, 2025
66f198d
Adding a simple test to send a chat prompt and check if theres a resp…
laura-codess Jul 11, 2025
dd62e27
Adding the wait to improve the robustness
laura-codess Jul 11, 2025
866478a
added logic to the after function to close all the chat tabs after th…
laura-codess Jul 11, 2025
35c656f
fixed the merge conflicts
laura-codess Jul 14, 2025
ed3c220
tested the timeouts, implemented a general wait function
laura-codess Jul 14, 2025
824635e
Merge branch 'feature/ui-e2e-tests' of https://github.com/aws/aws-too…
laura-codess Jul 15, 2025
b30f7f4
checked out master version
laura-codess Jul 15, 2025
5da6336
fix: ignore scripts change
laura-codess Jul 15, 2025
c8ccbae
implementing the initial setup for the framework
laura-codess Jul 16, 2025
74011d2
added setup.ts and testContext so that auth can be shared across tests
laura-codess Jul 17, 2025
b66da8c
implemented the backslash abstraction, required implementing function…
laura-codess Jul 17, 2025
3723e0d
Removed VET.test.ts
laura-codess Jul 17, 2025
8c3a109
implementing a pin context test suite with all the abstractions in pi…
laura-codess Jul 17, 2025
a4d6b32
Removed VET.test.ts
laura-codess Jul 17, 2025
d2bc9dd
small . fix
laura-codess Jul 17, 2025
693404d
fixed the PR based on the comments
laura-codess Jul 17, 2025
2990971
removing comments
laura-codess Jul 18, 2025
bebb6f1
Merge branch 'initializing_framework' into implement_pin_context_test
laura-codess Jul 18, 2025
5fc2de5
fixing the comments and adding the signout functionality
laura-codess Jul 18, 2025
1f830e2
implemented the switchModel test
laura-codess Jul 18, 2025
869c5a4
abstracted the functions in backslash.test.ts
laura-codess Jul 18, 2025
dd78bc2
Merge branch 'implement_backslash' into implement_switch_model
laura-codess Jul 18, 2025
d167c80
small . fix
laura-codess Jul 21, 2025
489712a
added clearChat
laura-codess Jul 21, 2025
c0e319d
changes to the after function
laura-codess Jul 21, 2025
645845f
reverting changes
laura-codess Jul 21, 2025
390f69f
Huge PR
laura-codess Jul 22, 2025
60b136f
small fixes to the waitForElements
laura-codess Jul 22, 2025
098c829
change all the backslash words to quick actions
laura-codess Jul 22, 2025
15bd216
undo change
laura-codess Jul 22, 2025
ad480bc
fixed small nit
laura-codess Jul 22, 2025
8efb913
restructured the files
laura-codess Jul 22, 2025
4dce964
adding some spaces to make auth more readable
laura-codess Jul 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 0 additions & 166 deletions packages/amazonq/test/e2e/amazonq/VET.test.ts

This file was deleted.

58 changes: 58 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/auth/authHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { Workbench, By, WebviewView } from 'vscode-extension-tester'
import { findItemByText, sleep, waitForElements } from '../utils/generalHelper'
import { testContext } from '../utils/testContext'

/* Completes the entire Amazon Q login flow

Currently, the function will
1. Open AmazonQ
2. Clicks Company Account
3. Inputs the Start URL
4. IMPORTANT: you must click manually open yourself when the popup window asks to open the browser and complete the authentication in the browser**

TO-DO: Currently this signInToAmazonQ is not fully autonomous as we ran into a blocker when the browser window pops up */
export async function signInToAmazonQ(): Promise<void> {
const workbench = new Workbench()
await workbench.executeCommand('Amazon Q: Open Chat')

await sleep(5000)
let webviewView = new WebviewView()
await webviewView.switchToFrame()

const selectableItems = await waitForElements(webviewView, By.css('.selectable-item'))
if (selectableItems.length === 0) {
throw new Error('No selectable login options found')
}

const companyItem = await findItemByText(selectableItems, 'Company account')
await companyItem.click()
const signInContinue = await webviewView.findWebElement(By.css('#connection-selection-continue-button'))
await signInContinue.click()
const startUrlInput = await webviewView.findWebElement(By.id('startUrl'))
await startUrlInput.clear()
await startUrlInput.sendKeys('https://amzn.awsapps.com/start')
const UrlContinue = await webviewView.findWebElement(By.css('button.continue-button.topMargin'))
await UrlContinue.click()
console.log('Waiting for manual authentication...')
await sleep(12000)
console.log('Manual authentication should be done')
await webviewView.switchBack()

const editorView = workbench.getEditorView()
await editorView.closeAllEditors()
webviewView = new WebviewView()
await webviewView.switchToFrame()

testContext.workbench = workbench
testContext.webviewView = webviewView
}

/* NOTE: The workbench and webviewView is grabbed directly from testContext because we are under the assumption that if you want to log out
you've already logged in before. */
export async function signOutFromAmazonQ(workbench: Workbench): Promise<void> {
await workbench.executeCommand('Amazon Q: Sign Out')
}
36 changes: 36 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/chat/chat.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import '../utils/setup'
import { WebviewView } from 'vscode-extension-tester'
import { testContext } from '../utils/testContext'
import { clearChat, waitForChatResponse, writeToChat } from './chatHelper'
import { closeAllTabs } from '../utils/cleanupHelper'

describe('Amazon Q Chat Basic Functionality', function () {
// this timeout is the general timeout for the entire test suite
this.timeout(150000)
let webviewView: WebviewView

before(async function () {
webviewView = testContext.webviewView
})

after(async function () {
await closeAllTabs(webviewView)
})

afterEach(async () => {
await clearChat(webviewView)
})

it('Chat Prompt Test', async () => {
await writeToChat('Hello, Amazon Q!', webviewView)
const responseReceived = await waitForChatResponse(webviewView)
if (!responseReceived) {
throw new Error('Chat response not received within timeout')
}
console.log('Chat response detected successfully')
})
})
71 changes: 71 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/chat/chatHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { By, WebviewView } from 'vscode-extension-tester'
import { sleep, waitForElement } from '../utils/generalHelper'

/**
* Writes text to the chat input and optionally sends it
* @param prompt The text to write in the chat input
* @param webview The WebviewView instance
* @param send Whether to click the send button (defaults to true)
* @returns Promise<boolean> True if successful
*/
export async function writeToChat(prompt: string, webview: WebviewView, send = true): Promise<boolean> {
const chatInput = await waitForElement(webview, By.css('.mynah-chat-prompt-input'))
await chatInput.sendKeys(prompt)
if (send === true) {
const sendButton = await waitForElement(webview, By.css('.mynah-chat-prompt-button'))
await sendButton.click()
}
return true
}

/**
* Waits for a chat response to be generated
* @param webview The WebviewView instance
* @param timeout The timeout in milliseconds
* @returns Promise<boolean> True if a response was detected, false if timeout occurred
*/
export async function waitForChatResponse(webview: WebviewView, timeout = 15000): Promise<boolean> {
const startTime = Date.now()

while (Date.now() - startTime < timeout) {
const conversationContainers = await webview.findWebElements(By.css('.mynah-chat-items-conversation-container'))

if (conversationContainers.length > 0) {
const latestContainer = conversationContainers[conversationContainers.length - 1]

const chatItems = await latestContainer.findElements(By.css('*'))

if (chatItems.length >= 2) {
return true
}
}
await sleep(500)
}

return false
}

/**
* Clears the text in the chat input field
* @param webview The WebviewView instance
* @returns Promise<boolean> True if successful, false if an error occurred
*/
export async function clearChat(webview: WebviewView): Promise<boolean> {
try {
const chatInput = await waitForElement(webview, By.css('.mynah-chat-prompt-input'))
await chatInput.sendKeys(
process.platform === 'darwin'
? '\uE03D\u0061' // Command+A on macOS
: '\uE009\u0061' // Ctrl+A on Windows/Linux
)
await chatInput.sendKeys('\uE003') // Backspace
return true
} catch (e) {
console.error('Error clearing chat input:', e)
return false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import '../utils/setup'
import { WebviewView } from 'vscode-extension-tester'
import { closeAllTabs, dismissOverlayIfPresent } from '../utils/cleanupHelper'
import { testContext } from '../utils/testContext'
import { clickPinContextButton, getPinContextMenuItems, clickPinContextMenuItem } from './pinContextHelper'
import { clearChat } from '../chat/chatHelper'

describe('Amazon Q Pin Context Functionality', function () {
// this timeout is the general timeout for the entire test suite
this.timeout(150000)
let webviewView: WebviewView

before(async function () {
webviewView = testContext.webviewView
})

after(async function () {
await closeAllTabs(webviewView)
})

afterEach(async () => {
await dismissOverlayIfPresent(webviewView)
await clearChat(webviewView)
})

it('Pin Context Test', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, '@workspace')
})
})
Loading
Loading