@@ -16,6 +16,7 @@ import { FollowUpTypes } from 'aws-core-vscode/amazonq'
1616import { registerAuthHook , using } from 'aws-core-vscode/test'
1717import { loginToIdC } from './utils/setup'
1818import { globals } from 'aws-core-vscode/shared'
19+ import { openTextDocument } from 'aws-core-vscode/shared'
1920
2021describe ( 'Amazon Q Test Generation' , function ( ) {
2122 let framework : qTestingFramework
@@ -92,13 +93,8 @@ describe('Amazon Q Test Generation', function () {
9293 const { language, filePath } = unsupportedLanguages [ 0 ]
9394
9495 beforeEach ( async ( ) => {
95- const found = await vscode . workspace . findFiles ( filePath )
96- if ( found . length === 0 ) {
97- assert . fail ( `Failed to find ${ language } file` )
98- }
96+ const document = await openTextDocument ( filePath )
9997
100- await vscode . commands . executeCommand ( 'vscode.open' , found [ 0 ] )
101- const document = vscode . workspace . textDocuments . find ( ( o ) => o . uri . fsPath . includes ( found [ 0 ] . fsPath ) )
10298 if ( ! document ) {
10399 assert . fail ( `Failed to open ${ language } file` )
104100 }
@@ -185,13 +181,8 @@ describe('Amazon Q Test Generation', function () {
185181 beforeEach ( async ( ) => {
186182 // retry mechanism as loading active document can be sometimes flaky
187183 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- }
184+ const document = await openTextDocument ( filePath )
192185
193- await vscode . commands . executeCommand ( 'vscode.open' , found [ 0 ] )
194- const document = vscode . workspace . textDocuments . find ( ( o ) => o . uri . fsPath . includes ( found [ 0 ] . fsPath ) )
195186 if ( ! document ) {
196187 if ( attempt === 3 ) {
197188 assert . fail ( `Failed to open ${ language } file` )
0 commit comments