Keep reliable E2E worker count and retry browser startup

This commit is contained in:
Oleg Isonen committed 2026-11-13 18:43:24 +00:00
1 parent bdc20960d0
commit 6eb4626eea
3 files changed
+38 -3

No files matched your search

+1 -1
View File
@@ -45,7 +45,7 @@ runs:
E2E_TEST_SHARD: ${{ inputs.shard }}
E2E_TEST_PARTITION: ${{ inputs.partition }}
run: |
workers=4
workers=2
if [ "$E2E_TEST_SHARD" = "shard-5" ]; then
workers=1
fi
+1 -1
View File
@@ -92,7 +92,7 @@ each invocation.
declaration order by default.
CI discovers isolated Playwright shards from filename tags. Each shard uses
four workers, except shard 5 uses one to avoid overlapping MCP browser launches.
two workers, except shard 5 uses one to avoid overlapping MCP browser launches.
Files are assigned by measured CI duration to keep the slowest job short:
```txt
@@ -13,6 +13,41 @@ const screenshotModuleUrl = new URL(
const { createMcpPreviewHandlers } = await import(previewModuleUrl);
const { createScreenshotCaptureSession } = await import(screenshotModuleUrl);
const createE2eCaptureSession = () => {
let session = createScreenshotCaptureSession();
return {
capture: (...args: Parameters<typeof session.capture>) =>
session.capture(...args),
capturePage: (...args: Parameters<typeof session.capturePage>) =>
session.capturePage(...args),
close: () => session.close(),
async submitForm(input: Parameters<typeof session.submitForm>[0]) {
const browserPath = process.env.WEBSTUDIO_BROWSER_PATH;
const options = Object.assign(
{},
input,
browserPath === undefined ? {} : { browserPath }
);
try {
return await session.submitForm(options);
} catch (error) {
// A startup failure happens before the form is dispatched.
if (
!(error instanceof Error) ||
!("code" in error) ||
error.code !== "BROWSER_STARTUP_FAILED"
) {
throw error;
}
await session.close();
await new Promise((resolve) => setTimeout(resolve, 500));
session = createScreenshotCaptureSession();
return await session.submitForm(options);
}
},
};
};
let payload = "";
for await (const chunk of process.stdin) {
payload += String(chunk);
@@ -45,7 +80,7 @@ const previewHandlers = createMcpPreviewHandlers({
stop: async () => ({ running: false, url, mode: "iterative" as const }),
},
isStale: () => false,
createCaptureSession: createScreenshotCaptureSession,
createCaptureSession: createE2eCaptureSession,
});
const server = await createProjectSessionMcpServer({
operations: [],