Skip to content

Commit 2277e87

Browse files
mshanemcclaude
andcommitted
test(lwc): replace waitForTimeout with tree-item state wait in Test Explorer helper - W-22972995
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8a015ea commit 2277e87

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/salesforcedx-vscode-lwc/test/playwright/specs/lwcRunTests.desktop.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import * as fs from 'node:fs/promises';
1717
import * as path from 'node:path';
18-
import { type Page } from '@playwright/test';
18+
import { expect, type Page } from '@playwright/test';
1919
import {
2020
closeWelcomeTabs,
2121
ensureSecondarySideBarHidden,
@@ -73,9 +73,10 @@ const waitForJestResults = async (workspaceDir: string, afterMs: number, timeout
7373
/** Focus the Test Explorer view and refresh test items. */
7474
const openAndRefreshTestExplorer = async (page: Page): Promise<void> => {
7575
await executeCommandWithCommandPalette(page, 'Testing: Focus on Test Explorer View');
76-
await page.waitForTimeout(2000);
7776
await executeCommandWithCommandPalette(page, 'Test: Refresh Tests');
78-
await page.waitForTimeout(3000);
77+
// Tree populated with the lwc1 item = discovery done (all callers create lwc1 first).
78+
// toBeVisible polls internally, so no waitForTimeout / toPass wrapper is needed.
79+
await expect(testItem(page, 'lwc1')).toBeVisible({ timeout: 30_000 });
7980
};
8081

8182
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)