test: isolate code queue retry trace fixture

This commit is contained in:
Codex
2026-05-20 04:23:05 +00:00
parent 7dd947acce
commit 6e86d3600c
+53 -1
View File
@@ -179,6 +179,11 @@ const FRONTEND_CHECK_NAMES = [
] as const;
const CODE_QUEUE_FIXTURE_CHECK_NAMES = [...CODE_QUEUE_LIVENESS_CHECK_NAMES] as const;
const CODE_QUEUE_RETRY_TRACE_FIXTURE_CHECK_NAMES = [
"frontend:code-queue-retry-attempt-trace-current",
"frontend:code-queue-step-missing-diagnostic",
"frontend:code-queue-judge-feedback-attempt-order",
] as const;
const ALL_E2E_CHECK_NAMES = [
...NETWORK_CHECK_NAMES,
@@ -4118,7 +4123,11 @@ export async function runE2E(
|| wantsPrefix(options, "microservice");
const needDatabase = wantsPrefix(options, "database")
|| wantsCheck(options, "frontend:task-history-diagnostics");
const needFrontend = wantsPrefix(options, "frontend");
const onlyRetryTraceFixture = options.only.length > 0
&& selectedChecks.length > 0
&& selectedChecks.every((name) => (CODE_QUEUE_RETRY_TRACE_FIXTURE_CHECK_NAMES as readonly string[]).includes(name));
const needFrontend = wantsPrefix(options, "frontend") && !onlyRetryTraceFixture;
const needRetryTraceFixture = wantsAnyCheck(options, [...CODE_QUEUE_RETRY_TRACE_FIXTURE_CHECK_NAMES]);
const needCodeQueueFixtures = wantsAnyCheck(options, [...CODE_QUEUE_FIXTURE_CHECK_NAMES]);
const executedSections: string[] = [];
@@ -4146,6 +4155,49 @@ export async function runE2E(
if (needFrontend) {
executedSections.push("frontend");
frontend = await frontendCheck(config, urls, checks, options);
} else if (needRetryTraceFixture) {
executedSections.push("frontend-retry-trace-fixture");
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({ viewport: { width: 1440, height: 920 } });
const auth = {
username: process.env.UNIDESK_E2E_AUTH_USERNAME || config.auth.username,
password: process.env.UNIDESK_E2E_AUTH_PASSWORD || config.auth.password,
};
await page.goto(urls.frontendUrl, { waitUntil: "domcontentloaded", timeout: 15000 });
await page.waitForSelector('[data-testid="login-screen"]', { timeout: 10000 });
await page.fill('input[name="username"]', auth.username);
await page.fill('input[name="password"]', auth.password);
await page.click('button[type="submit"]');
await page.waitForSelector('[data-testid="app-shell"]', { timeout: 10000 });
const codeQueueRetryTraceFixtureMetrics = await runCodeQueueRetryTraceFixture(page, urls.frontendUrl);
addSelectedCheck(checks, options, "frontend:code-queue-retry-attempt-trace-current",
codeQueueRetryTraceFixtureMetrics.checked === true
&& codeQueueRetryTraceFixtureMetrics.ok === true
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.cardAttemptVisible === true
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.currentAttempt === "2"
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.currentRunning === "true"
&& Number(codeQueueRetryTraceFixtureMetrics.currentStepRows || 0) >= 2
&& (codeQueueRetryTraceFixtureMetrics.traceRequests || []).some((search: string) => String(search).includes("attempt=2")),
{ codeQueueRetryTraceFixtureMetrics });
addSelectedCheck(checks, options, "frontend:code-queue-step-missing-diagnostic",
codeQueueRetryTraceFixtureMetrics.checked === true
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.cardStepText !== "STEP --"
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.currentStepText !== "STEP --"
&& ["syncing", "raw-trace"].includes(String(codeQueueRetryTraceFixtureMetrics.beforeExpand?.cardStepState || ""))
&& ["syncing", "raw-trace"].includes(String(codeQueueRetryTraceFixtureMetrics.beforeExpand?.currentStepState || "")),
{ codeQueueRetryTraceFixtureMetrics });
addSelectedCheck(checks, options, "frontend:code-queue-judge-feedback-attempt-order",
codeQueueRetryTraceFixtureMetrics.checked === true
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.currentBeforeJudge === true
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.judgeBeforeFeedback === true
&& codeQueueRetryTraceFixtureMetrics.beforeExpand?.currentJudgeMissing === true
&& String(codeQueueRetryTraceFixtureMetrics.feedbackText || "").includes("Continue with attempt 2")
&& (codeQueueRetryTraceFixtureMetrics.promptRequests || []).some((search: string) => String(search).includes("part=feedback") && String(search).includes("attempt=1")),
{ codeQueueRetryTraceFixtureMetrics });
} finally {
await browser.close();
}
}
const ok = checks.every((check) => check.status === "passed");