Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 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
869c5a4
abstracted the functions in backslash.test.ts
laura-codess Jul 18, 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
1 change: 1 addition & 0 deletions P261194666.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ Based on our investigation of the language-server-runtimes repository and the pr
```

5. **Ensure Auto-login Happens Early** (`packages/amazonq/src/lsp/activation.ts`):

```typescript
export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
try {
Expand Down
166 changes: 0 additions & 166 deletions packages/amazonq/test/e2e/amazonq/VET.test.ts

This file was deleted.

32 changes: 32 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/backslash.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*!
* 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 './framework/cleanupHelper'
import { testContext } from './utils/testContext'
import { clickBackslashCommand } from './framework/backslashHelper'

describe('Amazon Q Chat Backslash 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 () => {
await closeAllTabs(webviewView)
})

afterEach(async () => {
// before closing the tabs, make sure that any overlays have been dismissed
await dismissOverlayIfPresent(webviewView)
})

it('Backslash Test', async () => {
await clickBackslashCommand(webviewView, 'dev')
})
})
32 changes: 32 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/chat.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*!
* 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 } from './framework/cleanupHelper'
import { testContext } from './utils/testContext'
import { waitForChatResponse, writeToChat } from './framework/chatHelper'

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!
})

afterEach(async () => {
await closeAllTabs(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')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

import { By, WebElement, WebviewView } from 'vscode-extension-tester'
import { writeToChat } from './chatHelper'
import { waitForElement } from './generalHelper'

/**
* Gets all backslash command menu items
* @param webview The WebviewView instance
* @returns Promise<{items: WebElement[], texts: string[]}> Array of menu items and their text labels
*/
export async function getBackslashCommands(webview: WebviewView): Promise<{ items: WebElement[]; texts: string[] }> {
try {
await writeToChat('/', webview, false)
await new Promise((resolve) => setTimeout(resolve, 2000))

const menuItems = await waitForElement(
webview,
By.css('.mynah-detailed-list-item.mynah-ui-clickable-item.target-command'),
true,
10000
)

const menuTexts = []
for (let i = 0; i < menuItems.length; i++) {
try {
const text = await menuItems[i].getText()
menuTexts.push(text)
console.log(`Command ${i + 1}: ${text}`)
} catch (e) {
menuTexts.push('')
console.log(`Could not get text for command ${i + 1}`)
}
}

console.log(`Found ${menuItems.length} backslash command items`)
return { items: menuItems, texts: menuTexts }
} catch (e) {
console.error('Error getting backslash commands:', e)
return { items: [], texts: [] }
}
}

/**
* Clicks a specific backslash command by name
* @param webview The WebviewView instance
* @param commandName The name of the command to click
* @returns Promise<boolean> True if command was found and clicked, false otherwise
*/
export async function clickBackslashCommand(webview: WebviewView, commandName: string): Promise<boolean> {
try {
const { items, texts } = await getBackslashCommands(webview)

if (items.length === 0) {
console.log('No backslash commands found to click')
return false
}

const indexToClick = texts.findIndex((text) => text === commandName)

if (indexToClick === -1) {
console.log(`Command "${commandName}" not found`)
return false
}

console.log(`Clicking on command: ${commandName}`)
await items[indexToClick].click()

await new Promise((resolve) => setTimeout(resolve, 3000))
console.log('Command clicked successfully')
return true
} catch (e) {
console.error('Error clicking backslash command:', e)
return false
}
}
52 changes: 52 additions & 0 deletions packages/amazonq/test/e2e_new/amazonq/framework/chatHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { By, WebviewView } from 'vscode-extension-tester'
import { waitForElement } from './generalHelper'

/* Writes a prompt to the chat input and waits for a response

Logic:
Finds the chat input element using the .mynah-chat-prompt-input CSS selector,
sends the provided prompt test, clicks the send button, and waits for a chat
response. Returns true if successful, throws an error if the response times out */

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 and outputs whether the response is "correct"

Logic:
The overall conversation container's css is .mynah-chat-items-conversation-container.
Within that container we can check how many elements exist. If there is 2 elements,
we can assume that the chat response has been generated. However, we must grab the
latest conversation container, as there can be multiple conversations in the webview. */

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 new Promise((resolve) => setTimeout(resolve, 500))
}

return false
}
Loading
Loading