Skip to content

Commit 2a38bb2

Browse files
committed
remove helper
1 parent fc92d9a commit 2a38bb2

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

packages/amazonq/test/e2e/amazonq/testGen.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { Messenger } from './framework/messenger'
1515
import { FollowUpTypes } from 'aws-core-vscode/amazonq'
1616
import { registerAuthHook, using } from 'aws-core-vscode/test'
1717
import { loginToIdC } from './utils/setup'
18-
import { openDocument } from './utils/workspaceUtils'
1918
import { globals } from 'aws-core-vscode/shared'
2019

2120
describe('Amazon Q Test Generation', function () {
@@ -93,7 +92,13 @@ describe('Amazon Q Test Generation', function () {
9392
const { language, filePath } = unsupportedLanguages[0]
9493

9594
beforeEach(async () => {
96-
const document = await openDocument(filePath)
95+
const found = await vscode.workspace.findFiles(filePath)
96+
if (found.length === 0) {
97+
assert.fail(`Failed to find ${language} file`)
98+
}
99+
100+
await vscode.commands.executeCommand('vscode.open', found[0])
101+
const document = vscode.workspace.textDocuments.find((o) => o.uri.fsPath.includes(found[0].fsPath))
97102
if (!document) {
98103
assert.fail(`Failed to open ${language} file`)
99104
}
@@ -179,8 +184,14 @@ describe('Amazon Q Test Generation', function () {
179184
describe(`Test Generation for ${language}`, () => {
180185
beforeEach(async () => {
181186
// retry mechanism as loading active document can be sometimes flaky
182-
for (let attempt = 1; attempt < 3; attempt++) {
183-
const document = await openDocument(filePath)
187+
for (let attempt = 1; attempt <= 3; attempt++) {
188+
const found = await vscode.workspace.findFiles(filePath)
189+
if (found.length === 0) {
190+
assert.fail(`Failed to find ${language} file`)
191+
}
192+
193+
await vscode.commands.executeCommand('vscode.open', found[0])
194+
const document = vscode.workspace.textDocuments.find((o) => o.uri.fsPath.includes(found[0].fsPath))
184195
if (!document) {
185196
if (attempt === 3) {
186197
assert.fail(`Failed to open ${language} file`)

0 commit comments

Comments
 (0)