From 1b00ab869fec326a64be8c6c34270c1aaa21b36a Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Fri, 31 Jul 2026 17:30:35 -0400 Subject: [PATCH] Harden Home Assistant UI smoke timing --- tools/ha_ui_smoke.mjs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/ha_ui_smoke.mjs b/tools/ha_ui_smoke.mjs index abf6cc6b..53300ad8 100644 --- a/tools/ha_ui_smoke.mjs +++ b/tools/ha_ui_smoke.mjs @@ -174,7 +174,15 @@ async function validateRoute(page, baseUrl, route, outputDir) { if (renderedViews < 1) { failures.push("no rendered hui-view found"); } - const errorCards = await page.locator("hui-error-card").count(); + // Some async custom cards briefly render an error card before their HA + // entity attributes arrive. Re-check after hydration before failing the + // route so the smoke test measures the settled UI rather than the load + // transition. + let errorCards = await page.locator("hui-error-card").count(); + if (errorCards > 0) { + await page.waitForTimeout(4_000); + errorCards = await page.locator("hui-error-card").count(); + } if (errorCards > 0) { failures.push(`${errorCards} hui-error-card element(s) rendered`); }