Skip to content

Commit d810ea8

Browse files
authored
test: fix more tests (microsoft#38597)
1 parent 425a616 commit d810ea8

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

tests/mcp/autowait.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { test, expect } from './fixtures';
1818

19-
test('racy navigation destroys context', async ({ client, server, mcpBrowser }) => {
19+
test('racy navigation destroys context', async ({ client, server }) => {
2020
server.setContent('/', `
2121
<button onclick='setTimeout(() => window.location = "about:blank", 100)'>Submit</button>
2222
`, 'text/html');

tests/mcp/fixtures.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export type StartClient = (options?: {
5656
roots?: { name: string, uri: string }[],
5757
rootsResponseDelay?: number,
5858
env?: NodeJS.ProcessEnv,
59+
noTimeoutForTest?: boolean,
5960
}) => Promise<{ client: Client, stderr: () => string }>;
6061

6162

@@ -107,6 +108,8 @@ export const test = serverTest.extend<TestFixtures & TestOptions, WorkerFixtures
107108
await fs.promises.writeFile(configFile, JSON.stringify(options.config, null, 2));
108109
args.push(`--config=${path.relative(configDir, configFile)}`);
109110
}
111+
if (!options?.noTimeoutForTest)
112+
args.push('--timeout-action=10000');
110113
}
111114

112115
if (options?.args)

tests/mcp/timeouts.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
import { test, expect } from './fixtures';
1818

19-
test('action timeout (default)', async ({ client, server }) => {
19+
test('action timeout (default)', async ({ server, startClient }) => {
20+
const { client } = await startClient({ noTimeoutForTest: true });
2021
server.setContent('/', `
2122
<!DOCTYPE html>
2223
<html>

tests/playwright-test/playwright.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ test('page.pause() should disable test timeout', async ({ runInlineTest }) => {
890890
console.log('success!');
891891
});
892892
`,
893-
}, { headed: true });
893+
}, { headed: true }); // This needs to be headed otherwise entire worker is gone.
894894
expect(result.exitCode).toBe(0);
895895
expect(result.passed).toBe(1);
896896
expect(result.output).toContain('success!');

0 commit comments

Comments
 (0)