Files
cthulhu/tests/browser-ticking.html
hjozwiak 6c10ed0517 Add native coverage for ticking browser pages
Incremental-game style fixture whose AT-SPI leaves recreate every 250 ms, native navigation test, private-session AT-SPI daemon launch in the harness (no systemd, no host session required), and testing notes.
2026-11-03 10:35:00 -05:00

65 lines
2.2 KiB
HTML

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>Cthulhu Browser Probe</title>
<body>
<label>Probe start <input autofocus></label>
<h2>Rebuilt text region</h2>
<p id="rebuilt"></p>
<h2>Rebuilt container region</h2>
<div id="container"></div>
<h2>Renamed controls region</h2>
<div id="renamed">
<button id="churn-one">Churn one cost 0</button>
<button id="churn-two">Churn two cost 0</button>
</div>
<h2>Final region</h2>
<p>Text after ticking regions</p>
<button id="final-action" onclick="document.title = 'Cthulhu Ticking Final Action'">Final action</button>
<p id="final-text">Final paragraph</p>
<script>
"use strict";
// Region A: every text leaf is recreated on each tick (same count and
// order, new nodes), like incremental-game counters rebuilt per frame.
let tickA = 0;
const rebuilt = document.getElementById("rebuilt");
function renderRebuilt() {
tickA++;
const lines = [];
for (let line = 1; line <= 3; line++) {
const span = document.createElement("span");
span.textContent = "Rebuilt line " + line + " value " + (tickA * 10 + line);
lines.push(span, document.createElement("br"));
}
rebuilt.replaceChildren(...lines);
}
renderRebuilt();
setInterval(renderRebuilt, 300);
// Region B: the whole container subtree, including a focusable button, is
// recreated on each tick, destroying native focus anchors.
let tickB = 0;
const container = document.getElementById("container");
function renderContainer() {
tickB++;
container.innerHTML = "";
const text = document.createElement("p");
text.textContent = "Container value " + tickB;
const button = document.createElement("button");
button.textContent = "Container action " + tickB;
button.addEventListener("click", () => {
document.title = "Cthulhu Ticking Container Action";
});
container.append(text, button);
}
renderContainer();
setInterval(renderContainer, 400);
// Region C: structure is stable; only button labels churn rapidly.
let tickC = 0;
setInterval(() => {
tickC++;
document.getElementById("churn-one").textContent = "Churn one cost " + tickC;
document.getElementById("churn-two").textContent = "Churn two cost " + tickC * 2;
}, 50);
</script>
</body></html>