Skip to content

Commit b1ffcb2

Browse files
authored
🧪 Windows adaptations (konveyor#804)
Part of konveyor#669 Adapts some tests so they work properly on windows <!-- ## PR Title Prefix Every **PR Title** should be prefixed with :text: to indicate its type. - Breaking change: ⚠️ (`⚠️`) - Non-breaking feature: ✨ (`✨`) - Patch fix: 🐛 (`🐛`) - Docs: 📖 (`📖`) - Infra/Tests/Other: 🌱 (`🌱`) - No release note: 👻 (`👻`) For example, a pull request containing breaking changes might look like `⚠️ My pull request contains breaking changes`. Since GitHub supports emoji aliases (ie. `👻`), there is no need to include the emoji directly in the PR title -- **please use the alias**. It used to be the case that projects using emojis for PR typing had to include the emoji directly because GitHub didn't render the alias. Given that `⚠️` is easy enough to read as text, easy to parse in release tooling, and rendered in GitHub well, we prefer to standardize on the alias. For more information, please see the Konveyor [Versioning Doc](https://github.com/konveyor/release-tools/blob/main/VERSIONING.md). --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Improved e2e stability: reveal filters when toggles are hidden; use a more reliable click for Delete Profile; added loading guard and cap when accepting all solutions. * Added a loading indicator check to determine completion. * Extended timeouts for setup and key analysis tests to reduce flakiness. * Simplified solution confirmation calls; removed automatic per-test screenshots. * Adjusted evaluation gating to run on CI when all tests pass, regardless of OS. * **Chores** * Minor structural locator addition for loading state checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
1 parent 6331929 commit b1ffcb2

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

tests/e2e/pages/vscode.page.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const COMMAND_CATEGORY = process.env.TEST_CATEGORY || 'Konveyor';
2424

2525
type SortOrder = 'ascending' | 'descending';
2626
type ListKind = 'issues' | 'files';
27+
2728
export class VSCode extends BasePage {
2829
constructor(
2930
app: ElectronApplication,
@@ -265,6 +266,11 @@ export class VSCode extends BasePage {
265266
const kindButton = analysisView.getByRole('button', {
266267
name: kind === 'issues' ? 'Issues' : 'Files',
267268
});
269+
const toggleFilterButton = analysisView.locator('button[aria-label="Show Filters"]');
270+
271+
if (!(await kindButton.isVisible()) && (await toggleFilterButton.isVisible())) {
272+
await toggleFilterButton.click();
273+
}
268274

269275
await expect(kindButton).toBeVisible({ timeout: 5_000 });
270276
await expect(kindButton).toBeEnabled({ timeout: 3_000 });
@@ -469,7 +475,8 @@ export class VSCode extends BasePage {
469475

470476
const deleteButton = manageProfileView.getByRole('button', { name: 'Delete Profile' });
471477
await deleteButton.waitFor({ state: 'visible', timeout: 10000 });
472-
await deleteButton.click();
478+
// Ensures the button is clicked even if there are notifications overlaying it due to screen size
479+
await deleteButton.first().dispatchEvent('click');
473480

474481
const confirmButton = manageProfileView
475482
.getByRole('dialog', { name: 'Delete profile?' })
@@ -586,19 +593,24 @@ export class VSCode extends BasePage {
586593
public async acceptAllSolutions() {
587594
const resolutionView = await this.getView(KAIViews.resolutionDetails);
588595
const fixLocator = resolutionView.locator('button[aria-label="Accept all changes"]');
596+
const loadingIndicator = resolutionView.locator('.loading-indicator');
589597

590598
await this.waitDefault();
591-
await expect(fixLocator.first()).toBeVisible({ timeout: 3600000 });
599+
// Avoid fixing issues forever
600+
const MAX_FIXES = 500;
592601

593-
const fixesNumber = await fixLocator.count();
594-
let fixesCounter = await fixLocator.count();
595-
for (let i = 0; i < fixesNumber; i++) {
602+
for (let i = 0; i < MAX_FIXES; i++) {
596603
await expect(fixLocator.first()).toBeVisible({ timeout: 30000 });
597604
// Ensures the button is clicked even if there are notifications overlaying it due to screen size
598605
await fixLocator.first().dispatchEvent('click');
599606
await this.waitDefault();
600-
expect(await fixLocator.count()).toEqual(--fixesCounter);
607+
608+
if (!(await loadingIndicator.isVisible())) {
609+
return;
610+
}
601611
}
612+
613+
throw new Error('MAX_FIXES limit reached while requesting solutions');
602614
}
603615

604616
public async searchViolationAndAcceptAllSolutions(violation: string) {

tests/e2e/tests/analyze_coolstore.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ providers.forEach((config) => {
9191

9292
test.afterAll(async () => {
9393
await vscodeApp.closeVSCode();
94-
// Evaluation should be performed just on Linux, on CI by default and only if all tests under this suite passed
95-
if (getOSInfo() === 'linux' && allOk && process.env.CI) {
94+
// Evaluation should be performed just on CI by default and only if all tests under this suite passed
95+
if (allOk && process.env.CI) {
9696
await prepareEvaluationData(config.model);
9797
await runEvaluation(
9898
path.join(TEST_OUTPUT_FOLDER, 'incidents-map.json'),

tests/e2e/tests/base/configure-and-run-analysis.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test.describe(`Configure extension and run analysis`, () => {
1212
const profileName = `automation-${randomString}`;
1313

1414
test.beforeAll(async ({ testRepoData }) => {
15-
test.setTimeout(600000);
15+
test.setTimeout(900000);
1616
const repoInfo = testRepoData['coolstore'];
1717
vscodeApp = await VSCode.open(repoInfo.repoUrl, repoInfo.repoName);
1818
});
@@ -32,6 +32,7 @@ test.describe(`Configure extension and run analysis`, () => {
3232
});
3333

3434
test('Analyze coolstore app', async () => {
35+
test.setTimeout(300000);
3536
await vscodeApp.waitDefault();
3637
await vscodeApp.runAnalysis();
3738
await vscodeApp.waitDefault();

tests/e2e/tests/base/custom-binary-analysis.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test.describe.serial(`@tier2 Override the analyzer binary and run analysis`, ()
1919
const profileName = `custom-binary-analysis-${randomString}`;
2020
let binaryPath: string | undefined;
2121
test.beforeAll(async ({ testRepoData }) => {
22-
test.setTimeout(600000);
22+
test.setTimeout(900000);
2323
const kaiFolderPath = pathlib.join(__dirname, '../../../../downloaded_assets/kai');
2424
if (!process.env.ANALYZER_BINARY_PATH && !fs.existsSync(kaiFolderPath)) {
2525
throw new Error(
@@ -71,6 +71,7 @@ test.describe.serial(`@tier2 Override the analyzer binary and run analysis`, ()
7171
});
7272

7373
test('Analyze coolstore app', async () => {
74+
test.setTimeout(600000);
7475
const configPage = await Configuration.open(vscodeApp);
7576
await configPage.setInputConfiguration(analyzerPath, binaryPath!);
7677
await vscodeApp.startServer();

tests/e2e/tests/base/llm-revert-check_jboss-eap-quickstarts.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ getAvailableProviders().forEach((provider) => {
6565
await vscodeApp.openAnalysisView();
6666
await vscodeApp.searchViolationAndAcceptAllSolutions(violation);
6767
await vscodeApp.openAnalysisView();
68-
const analysisView = await vscodeApp.getView(KAIViews.analysisView);
69-
await vscodeApp.waitForSolutionConfirmation(analysisView);
68+
await vscodeApp.waitForSolutionConfirmation();
7069

7170
afterFirstFixMemberFileImports = getFileImports(memberFileUri);
7271
});
@@ -79,8 +78,7 @@ getAvailableProviders().forEach((provider) => {
7978
await vscodeApp.openAnalysisView();
8079
await vscodeApp.searchViolationAndAcceptAllSolutions(violation);
8180
await vscodeApp.openAnalysisView();
82-
const analysisView = await vscodeApp.getView(KAIViews.analysisView);
83-
await vscodeApp.waitForSolutionConfirmation(analysisView);
81+
await vscodeApp.waitForSolutionConfirmation();
8482

8583
afterSecondFixMemberFileImports = getFileImports(memberFileUri);
8684
});
@@ -98,9 +96,6 @@ getAvailableProviders().forEach((provider) => {
9896
test.afterEach(async () => {
9997
const testName = test.info().title.replace(' ', '-');
10098
console.log(`Finished ${testName} at ${new Date()}`);
101-
await vscodeApp.getWindow().screenshot({
102-
path: `${SCREENSHOTS_FOLDER}/after-${testName}-${provider.model.replace(/[.:]/g, '-')}.png`,
103-
});
10499
});
105100

106101
test.afterAll(async () => {

0 commit comments

Comments
 (0)