Skip to content

Commit c66bf18

Browse files
committed
Added additonal test cases
1 parent b020242 commit c66bf18

File tree

6 files changed

+77
-9
lines changed

6 files changed

+77
-9
lines changed

packages/amazonq/test/e2e_new/amazonq/helpers/pinContextHelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function clickPinContextButton(webview: WebviewView): Promise<boole
2222
const label = await button.findElement(By.css('.mynah-button-label'))
2323
const labelText = await label.getText()
2424
console.log('THE BUTTON TEXT LABEL IS:', labelText)
25-
if (labelText === '@Pin Context') {
25+
if (labelText === '@Pin Context' || labelText === '@') {
2626
console.log('Found Pin Context button, clicking...')
2727
await button.click()
2828
return true
@@ -81,6 +81,7 @@ export async function clickPinContextMenuItem(webview: WebviewView, itemName: st
8181
const menuList = await waitForElement(webview, By.css('.mynah-detailed-list-items-block'))
8282
await sleep(3000)
8383
const menuListItems = await menuList.findElements(By.css('.mynah-detailed-list-item.mynah-ui-clickable-item'))
84+
console.log('Searching for context item:', itemName)
8485
for (const item of menuListItems) {
8586
try {
8687
const textWrapper = await item.findElement(By.css('.mynah-detailed-list-item-text'))

packages/amazonq/test/e2e_new/amazonq/tests/chat.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { closeAllTabs } from '../utils/cleanupUtils'
1010

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

1616
before(async function () {

packages/amazonq/test/e2e_new/amazonq/tests/pinContext.test.ts

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import { WebviewView } from 'vscode-extension-tester'
77
import { closeAllTabs, dismissOverlayIfPresent } from '../utils/cleanupUtils'
88
import { testContext } from '../utils/testContext'
99
import { clickPinContextButton, getPinContextMenuItems, clickPinContextMenuItem } from '../helpers/pinContextHelper'
10-
import { clearChat } from '../utils/generalUtils'
10+
import { clearChat, sleep } from '../utils/generalUtils'
1111

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

17-
before(async function () {
17+
beforeEach(async function () {
1818
webviewView = testContext.webviewView
19+
await sleep(5000)
1920
})
2021

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

30-
it('Pin Context Test', async () => {
31+
it('Pin Context Test @workspace', async () => {
3132
await clickPinContextButton(webviewView)
3233
await getPinContextMenuItems(webviewView)
3334
await clickPinContextMenuItem(webviewView, '@workspace')
3435
})
36+
it('Pin Context Test Folders', async () => {
37+
await clickPinContextButton(webviewView)
38+
await getPinContextMenuItems(webviewView)
39+
await clickPinContextMenuItem(webviewView, 'Folders')
40+
})
41+
it('Pin Context Test Files', async () => {
42+
await clickPinContextButton(webviewView)
43+
await getPinContextMenuItems(webviewView)
44+
await clickPinContextMenuItem(webviewView, 'Files')
45+
})
46+
it('Pin Context Test Code', async () => {
47+
await clickPinContextButton(webviewView)
48+
await getPinContextMenuItems(webviewView)
49+
await clickPinContextMenuItem(webviewView, 'Code')
50+
})
51+
it('Pin Context Test Prompts', async () => {
52+
await clickPinContextButton(webviewView)
53+
await getPinContextMenuItems(webviewView)
54+
await clickPinContextMenuItem(webviewView, 'Prompts')
55+
})
56+
it('Pin Context Test Image', async () => {
57+
await clickPinContextButton(webviewView)
58+
await getPinContextMenuItems(webviewView)
59+
await clickPinContextMenuItem(webviewView, 'Image')
60+
})
3561
})

packages/amazonq/test/e2e_new/amazonq/tests/quickActions.test.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { clearChat } from '../utils/generalUtils'
1111

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

1717
before(async function () {
@@ -31,4 +31,32 @@ describe('Amazon Q Chat Quick Actions Functionality', function () {
3131
it('Quick Actions Test', async () => {
3232
await clickQuickActionsCommand(webviewView, 'dev')
3333
})
34+
35+
it('Quick Actions Test', async () => {
36+
await clickQuickActionsCommand(webviewView, 'test')
37+
})
38+
39+
it('Quick Actions Test', async () => {
40+
await clickQuickActionsCommand(webviewView, 'review')
41+
})
42+
43+
it('Quick Actions Test', async () => {
44+
await clickQuickActionsCommand(webviewView, 'doc')
45+
})
46+
47+
it('Quick Actions Test', async () => {
48+
await clickQuickActionsCommand(webviewView, 'transform')
49+
})
50+
51+
it('Quick Actions Test', async () => {
52+
await clickQuickActionsCommand(webviewView, 'help')
53+
})
54+
55+
it('Quick Actions Test', async () => {
56+
await clickQuickActionsCommand(webviewView, 'clear')
57+
})
58+
59+
it('Quick Actions Test', async () => {
60+
await clickQuickActionsCommand(webviewView, 'compact')
61+
})
3462
})

packages/amazonq/test/e2e_new/amazonq/tests/switchModel.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { closeAllTabs } from '../utils/cleanupUtils'
1010

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

1616
before(async function () {
@@ -25,4 +25,9 @@ describe('Amazon Q Switch Model Functionality', function () {
2525
await listModels(webviewView)
2626
await selectModel(webviewView, 'Claude Sonnet 3.7')
2727
})
28+
29+
it('Switch Model Test', async () => {
30+
await listModels(webviewView)
31+
await selectModel(webviewView, 'Claude Sonnet 4')
32+
})
2833
})

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function signInToAmazonQ(): Promise<void> {
4343
await UrlContinue.click()
4444

4545
console.log('Waiting for manual authentication...')
46-
await sleep(12000)
46+
await sleep(20000)
4747
console.log('Manual authentication should be done')
4848
await webviewView.switchBack()
4949

@@ -60,4 +60,12 @@ export async function signInToAmazonQ(): Promise<void> {
6060
you've already logged in before. */
6161
export async function signOutFromAmazonQ(workbench: Workbench): Promise<void> {
6262
await workbench.executeCommand('Amazon Q: Sign Out')
63+
const webviewView = new WebviewView()
64+
await webviewView.switchToFrame()
65+
66+
// const moreOptionButton = await webviewView.findWebElement(By.css('#action-label codicon codicon-toolbar-more'))
67+
// await moreOptionButton.click()
68+
69+
// const moreOptionButton = await webviewView.findWebElement(By.css('#action-label codicon codicon-toolbar-more'))
70+
// await moreOptionButton.click()
6371
}

0 commit comments

Comments
 (0)