mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
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:
1 parent
56d52e284f
commit
6c49c2aa22
1 file changed
+12
-3
@@ -158,9 +158,18 @@ try {
|
|||||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||||
}
|
}
|
||||||
// The controller commits `activeId` before its fallback promise callback
|
// The controller commits `activeId` before its fallback promise callback
|
||||||
// emits the terminal error state that re-syncs the chips. Give that
|
// emits the terminal error state that re-syncs the chips, and Cesium drops
|
||||||
// callback one turn so the DOM assertion observes the completed contract.
|
// the Esri credit on a later render frame again. A fixed delay races both:
|
||||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
// 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 = {
|
const afterTwo = {
|
||||||
activeId: controller.getActiveId(),
|
activeId: controller.getActiveId(),
|
||||||
lastError: controller.getState().lastError,
|
lastError: controller.getState().lastError,
|
||||||
|
|||||||
Reference in new issue
Block a user