Skip to content

Commit

Permalink
test(amazonq): skip flaky /test tests #6497
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
chungjac authored Feb 5, 2025
1 parent 100eb07 commit af77b1f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/amazonq/test/e2e/amazonq/testGen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { qTestingFramework } from './framework/framework'
import sinon from 'sinon'
import { Messenger } from './framework/messenger'
import { FollowUpTypes } from 'aws-core-vscode/amazonq'
import { registerAuthHook, using, TestFolder } from 'aws-core-vscode/test'
import { registerAuthHook, using, TestFolder, closeAllEditors } from 'aws-core-vscode/test'
import { loginToIdC } from './utils/setup'
import { waitUntil, workspaceUtils } from 'aws-core-vscode/shared'

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

await vscode.window.showTextDocument(document, { preview: false })
await waitUntil(async () => {
await vscode.window.showTextDocument(document, { preview: false })
}, {})

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

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

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

tab.addChatMessage({ command: '/test' })
await tab.waitForChatFinishesLoading()
Expand Down

0 comments on commit af77b1f

Please sign in to comment.