test: stabilize opening distance smoke

Issue: #281
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-08-24 11:04:17 +03:00
parent ed606c0f4a
commit d8696315eb
+12 -1
View File
@@ -10,10 +10,16 @@ const result = await page.evaluate(async () => {
const card = window.__card; const card = window.__card;
const root = () => card.renderRoot; const root = () => card.renderRoot;
const space = () => card._serverCfg.spaces.find((item) => item.id === 'f1'); const space = () => card._serverCfg.spaces.find((item) => item.id === 'f1');
const frame = () => new Promise((resolve) =>
requestAnimationFrame(() => requestAnimationFrame(resolve)));
const settle = async () => { const settle = async () => {
card.requestUpdate(); card.requestUpdate();
await card.updateComplete; await card.updateComplete;
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))); const started = performance.now();
while (card._modeTransitionBusy && performance.now() - started < 1800) await frame();
card.requestUpdate();
await card.updateComplete;
await frame();
}; };
const fixtureWallKey = (a, b) => { const fixtureWallKey = (a, b) => {
const pitch = 1 / 240; const pitch = 1 / 240;
@@ -53,6 +59,11 @@ const result = await page.evaluate(async () => {
}); });
const activate = async (point) => { const activate = async (point) => {
card._setMode('plan'); card._setMode('plan');
// Entering Plan owns an asynchronous editor-chrome transition which may
// clear transient hover state at completion. Arm the placement tool only
// after that transition settles so slower CI runners exercise the same
// state sequence as a user and as fast local runs.
await settle();
card._activateOpeningPlacement('door'); card._activateOpeningPlacement('door');
card._cursorPt = point; card._cursorPt = point;
await settle(); await settle();