mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 13:24:24 +08:00
Align sanity test extension install timeouts (#336239)
build: align sanity extension install timeouts Limit Install clicks to 30 seconds and each completion wait to one minute so the three attempts leave room for cleanup before Mocha's default ten-minute timeout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
parent
29d5c1ecf1
commit
c6e501760f
@@ -56,6 +56,14 @@ explicit error rather than falling back to the update service, so runs must be s
|
||||
to the artifacts that were actually downloaded. The SHA-256 check is skipped in this mode because
|
||||
there is no update service metadata to compare against.
|
||||
|
||||
### Timeouts
|
||||
|
||||
Extension installation makes at most three attempts, each allowing 30 seconds to click Install,
|
||||
30 seconds for installation to start, and one minute to wait for completion, with a five-second delay
|
||||
between attempts. These waits total at most 6 minutes 10 seconds, leaving room for setup and cleanup
|
||||
within the default ten-minute test timeout. Mocha does not cancel timed-out async tests, so
|
||||
increasing these waits can cause a retry to start before the previous attempt has cleaned up.
|
||||
|
||||
## Scripts
|
||||
|
||||
Platform-specific scripts are provided in the `scripts/` directory to set up the environment and run tests:
|
||||
|
||||
@@ -198,20 +198,21 @@ export class UITest {
|
||||
|
||||
await extensionItem.waitFor();
|
||||
|
||||
// Leave time for cleanup before Mocha's 10-minute timeout, which does not cancel async work.
|
||||
let lastFailure: string | undefined;
|
||||
for (let attempt = 0; attempt < 3; attempt++) {
|
||||
try {
|
||||
this.context.log(`Clicking Install for GitHub Pull Requests (attempt ${attempt + 1}/3)`);
|
||||
const installButton = extensionListItem.locator('.extension-action.install:not(.disabled):not(.hide)').first();
|
||||
await installButton.click();
|
||||
await installButton.click({ timeout: 30_000 });
|
||||
await installButton.waitFor({ state: 'hidden', timeout: 30_000 });
|
||||
|
||||
this.context.log('Waiting for extension to be installed');
|
||||
const uninstallButton = page.getByRole('button', { name: 'Uninstall' }).first();
|
||||
const result = await Promise.race([
|
||||
uninstallButton.waitFor({ timeout: 5 * 60_000 }).then(() => 'installed' as const),
|
||||
installButton.waitFor({ state: 'visible', timeout: 5 * 60_000 }).then(() => 'retry' as const),
|
||||
messageContainer.waitFor({ state: 'visible', timeout: 5 * 60_000 }).then(() => 'message' as const),
|
||||
uninstallButton.waitFor({ timeout: 60_000 }).then(() => 'installed' as const),
|
||||
installButton.waitFor({ state: 'visible', timeout: 60_000 }).then(() => 'retry' as const),
|
||||
messageContainer.waitFor({ state: 'visible', timeout: 60_000 }).then(() => 'message' as const),
|
||||
]);
|
||||
if (result === 'installed') {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user