Skip to content

Commit fd61e52

Browse files
potiukclaude
andcommitted
Fix flaky DAG calendar tab e2e tests
The createRun helper now retries the PATCH request that sets the DAG run state, waiting for the DagBag to load the DAG before confirming. Previously the PATCH could silently fail, leaving runs in a queued state and causing downstream assertions to fail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a7b8c7f commit fd61e52

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

airflow-core/src/airflow/ui/tests/e2e/specs/dag-calendar-tab.spec.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,26 @@ test.describe("DAG Calendar Tab", () => {
6161
const data = (await response.json()) as { dag_run_id: string };
6262
const dagRunId = data.dag_run_id;
6363

64-
await page.request.patch(`/api/v2/dags/${dagId}/dagRuns/${dagRunId}`, { data: { state } });
64+
// Retry PATCH until the state is confirmed — the DagBag may not have the DAG loaded yet
65+
const maxRetries = 5;
66+
67+
for (let attempt = 0; attempt < maxRetries; attempt++) {
68+
const patchResp = await page.request.patch(`/api/v2/dags/${dagId}/dagRuns/${dagRunId}`, {
69+
data: { state },
70+
});
71+
72+
if (patchResp.ok()) {
73+
const patchData = (await patchResp.json()) as { state: string };
74+
75+
if (patchData.state === state) {
76+
return;
77+
}
78+
}
79+
// Wait before retrying
80+
await page.waitForTimeout(1000);
81+
}
82+
83+
throw new Error(`Failed to set run ${dagRunId} to state "${state}" after ${maxRetries} retries`);
6584
}
6685

6786
await createRun(`cal_success_${Date.now()}`, successIso, "success");

0 commit comments

Comments
 (0)