Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function clickPinContextButton(webview: WebviewView): Promise<boole
const label = await button.findElement(By.css('.mynah-button-label'))
const labelText = await label.getText()
console.log('THE BUTTON TEXT LABEL IS:', labelText)
if (labelText === '@Pin Context') {
if (labelText === '@Pin Context' || labelText === '@') {
console.log('Found Pin Context button, clicking...')
await button.click()
return true
Expand Down Expand Up @@ -81,6 +81,7 @@ export async function clickPinContextMenuItem(webview: WebviewView, itemName: st
const menuList = await waitForElement(webview, By.css('.mynah-detailed-list-items-block'))
await sleep(3000)
const menuListItems = await menuList.findElements(By.css('.mynah-detailed-list-item.mynah-ui-clickable-item'))
console.log('Searching for context item:', itemName)
for (const item of menuListItems) {
try {
const textWrapper = await item.findElement(By.css('.mynah-detailed-list-item-text'))
Expand Down
2 changes: 1 addition & 1 deletion packages/amazonq/test/e2e_new/amazonq/tests/chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { closeAllTabs } from '../utils/cleanupUtils'

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

before(async function () {
Expand Down
34 changes: 30 additions & 4 deletions packages/amazonq/test/e2e_new/amazonq/tests/pinContext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import { WebviewView } from 'vscode-extension-tester'
import { closeAllTabs, dismissOverlayIfPresent } from '../utils/cleanupUtils'
import { testContext } from '../utils/testContext'
import { clickPinContextButton, getPinContextMenuItems, clickPinContextMenuItem } from '../helpers/pinContextHelper'
import { clearChat } from '../utils/generalUtils'
import { clearChat, sleep } from '../utils/generalUtils'

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

before(async function () {
beforeEach(async function () {
webviewView = testContext.webviewView
await sleep(5000)
})

after(async function () {
Expand All @@ -27,9 +28,34 @@ describe('Amazon Q Pin Context Functionality', function () {
await clearChat(webviewView)
})

it('Pin Context Test', async () => {
it('Pin Context Test @workspace', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, '@workspace')
})
it('Pin Context Test Folders', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, 'Folders')
})
it('Pin Context Test Files', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, 'Files')
})
it('Pin Context Test Code', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, 'Code')
})
it('Pin Context Test Prompts', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, 'Prompts')
})
it('Pin Context Test Image', async () => {
await clickPinContextButton(webviewView)
await getPinContextMenuItems(webviewView)
await clickPinContextMenuItem(webviewView, 'Image')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { clearChat } from '../utils/generalUtils'

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

before(async function () {
Expand All @@ -31,4 +31,32 @@ describe('Amazon Q Chat Quick Actions Functionality', function () {
it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'dev')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'test')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'review')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'doc')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'transform')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'help')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'clear')
})

it('Quick Actions Test', async () => {
await clickQuickActionsCommand(webviewView, 'compact')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { closeAllTabs } from '../utils/cleanupUtils'

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

before(async function () {
Expand All @@ -25,4 +25,9 @@ describe('Amazon Q Switch Model Functionality', function () {
await listModels(webviewView)
await selectModel(webviewView, 'Claude Sonnet 3.7')
})

it('Switch Model Test', async () => {
await listModels(webviewView)
await selectModel(webviewView, 'Claude Sonnet 4')
})
})
10 changes: 9 additions & 1 deletion packages/amazonq/test/e2e_new/amazonq/utils/authUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function signInToAmazonQ(): Promise<void> {
await UrlContinue.click()

console.log('Waiting for manual authentication...')
await sleep(12000)
await sleep(20000)
console.log('Manual authentication should be done')
await webviewView.switchBack()

Expand All @@ -60,4 +60,12 @@ export async function signInToAmazonQ(): Promise<void> {
you've already logged in before. */
export async function signOutFromAmazonQ(workbench: Workbench): Promise<void> {
await workbench.executeCommand('Amazon Q: Sign Out')
const webviewView = new WebviewView()
await webviewView.switchToFrame()

// const moreOptionButton = await webviewView.findWebElement(By.css('#action-label codicon codicon-toolbar-more'))
// await moreOptionButton.click()

// const moreOptionButton = await webviewView.findWebElement(By.css('#action-label codicon codicon-toolbar-more'))
// await moreOptionButton.click()
}