Skip to content

Commit af77b1f

Browse files
authored
test(amazonq): skip flaky /test tests aws#6497
## Problem - valid language tests are flaky, specifically the "before each" hook is failing in the CI for valid language ## Solution - skip valid language tests for now These changes will be helpful for when we come back to this issue: - use closeAllEditors function in existing testUtils file - retries for setting up and opening text file
1 parent 100eb07 commit af77b1f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { qTestingFramework } from './framework/framework'
99
import sinon from 'sinon'
1010
import { Messenger } from './framework/messenger'
1111
import { FollowUpTypes } from 'aws-core-vscode/amazonq'
12-
import { registerAuthHook, using, TestFolder } from 'aws-core-vscode/test'
12+
import { registerAuthHook, using, TestFolder, closeAllEditors } from 'aws-core-vscode/test'
1313
import { loginToIdC } from './utils/setup'
1414
import { waitUntil, workspaceUtils } from 'aws-core-vscode/shared'
1515

@@ -51,10 +51,12 @@ describe('Amazon Q Test Generation', function () {
5151
assert.fail(`Failed to open ${language} file`)
5252
}
5353

54-
await vscode.window.showTextDocument(document, { preview: false })
54+
await waitUntil(async () => {
55+
await vscode.window.showTextDocument(document, { preview: false })
56+
}, {})
5557

5658
const activeEditor = vscode.window.activeTextEditor
57-
if (!activeEditor || activeEditor.document !== document) {
59+
if (!activeEditor || activeEditor.document.uri.fsPath !== document.uri.fsPath) {
5860
assert.fail(`Failed to make temp file active`)
5961
}
6062
}
@@ -80,7 +82,7 @@ describe('Amazon Q Test Generation', function () {
8082

8183
afterEach(async () => {
8284
// Close all editors to prevent conflicts with subsequent tests trying to open the same file
83-
await vscode.commands.executeCommand('workbench.action.closeAllEditors')
85+
await closeAllEditors()
8486
framework.removeTab(tab.tabID)
8587
framework.dispose()
8688
sinon.restore()
@@ -161,9 +163,11 @@ describe('Amazon Q Test Generation', function () {
161163
})
162164

163165
for (const { language, filePath } of testFiles) {
164-
describe(`${language} file`, () => {
166+
// skipping for now since this test is flaky. passes locally, but only half the time in CI
167+
// have tried retries for setupTestDocument, openTextDocument, and showTextDocument
168+
describe.skip(`${language} file`, () => {
165169
beforeEach(async () => {
166-
await setupTestDocument(filePath, language)
170+
await waitUntil(async () => await setupTestDocument(filePath, language), {})
167171

168172
tab.addChatMessage({ command: '/test' })
169173
await tab.waitForChatFinishesLoading()

0 commit comments

Comments
 (0)