fix(qa): de-flake the Esri fallback check's fixed 50ms DOM settle

The last fixed sleep in this harness: after the controller commits
`activeId = 'osm'`, the fallback callback re-syncs the chips and Cesium
drops the "Powered by Esri" credit on a later render frame again. A flat
50ms covered that most runs and not a slow one — observed failing once in
12 runs on Windows with `creditVisible: true` after the fallback.

Same root cause and same remedy as the tray timers above: poll the
observable truth (credit gone AND the pressed chip is osm), bounded at 3s,
instead of guessing a duration.

0 failures in 15 consecutive runs after this, against 1-in-12 before.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01C3eGYgDYBo2BCUeDGwGvrp
This commit is contained in:
Tom-NeverwinterandClaude Opus 5 committed 2026-09-10 15:10:05 -05:00
1 parent 56d52e284f
commit 6c49c2aa22
1 file changed
+12 -3
+12 -3
View File
@@ -158,9 +158,18 @@ try {
await new Promise((resolve) => setTimeout(resolve, 25));
}
// The controller commits `activeId` before its fallback promise callback
// emits the terminal error state that re-syncs the chips. Give that
// callback one turn so the DOM assertion observes the completed contract.
await new Promise((resolve) => setTimeout(resolve, 50));
// emits the terminal error state that re-syncs the chips, and Cesium drops
// the Esri credit on a later render frame again. A fixed delay races both:
// 50ms was enough most runs and not enough on a slow one, which is the same
// flake as the tray timers above (#54). Poll the observable truth instead.
const domDeadline = performance.now() + 3000;
const settled = () => !document.body.innerText.includes('Powered by Esri')
&& [...document.querySelectorAll('.map-stack-chip')]
.filter((chip) => chip.getAttribute('aria-pressed') === 'true')
.every((chip) => chip.dataset.stackId === 'osm');
while (!settled() && performance.now() < domDeadline) {
await new Promise((resolve) => setTimeout(resolve, 25));
}
const afterTwo = {
activeId: controller.getActiveId(),
lastError: controller.getState().lastError,