Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
8689ade
[py] inject quiescence polyfill as a BiDi preload on navigation
AutomatedTester Jul 24, 2026
6879e43
[py] register quiescence preload on BiDi navigate instead of get()
AutomatedTester Jul 24, 2026
274b9d1
test: DOM-mutation quiescence oracle — ledger + classification (RED)
AutomatedTester Aug 4, 2026
7b07f51
feat: DOM-mutation quiescence ledger + awaitDomSettled (GREEN)
AutomatedTester Aug 4, 2026
d237729
test: CSS animation activity source for DOM quiescence (RED)
AutomatedTester Aug 4, 2026
7c7b2cd
feat: consult getAnimations() for CSS-animation activity (GREEN)
AutomatedTester Aug 4, 2026
ff4c3bb
test: region scoping, markDomInert, setDomPolicy, awaitQuiet compose …
AutomatedTester Aug 4, 2026
57c4622
feat: region scoping, markDomInert, setDomPolicy, awaitQuiet compose …
AutomatedTester Aug 5, 2026
fa03f86
test: shadow DOM + frame boundary for DOM quiescence (RED)
AutomatedTester Aug 5, 2026
eb07758
feat: observe open shadow roots via attachShadow hook (GREEN)
AutomatedTester Aug 5, 2026
ac3f413
test: driver.wait_for_dom_settled high-level API (RED)
AutomatedTester Aug 5, 2026
cb28840
feat: driver.wait_for_dom_settled high-level API (GREEN)
AutomatedTester Aug 5, 2026
a1c2f4e
test: element-actionability inspector — visible/enabled/editable/chec…
AutomatedTester Aug 5, 2026
e043f75
feat: element-actionability inspector — visible/enabled/editable/chec…
AutomatedTester Aug 5, 2026
37c80b9
test: element `stable` rect-motion detection (RED)
AutomatedTester Aug 5, 2026
944479b
feat: element `stable` rect-motion detection via rAF sampling (GREEN)
AutomatedTester Aug 5, 2026
fb54a61
test: interaction point + obstruction hit-testing (RED)
AutomatedTester Aug 5, 2026
f243c78
feat: interaction point + obstruction hit-testing via elementsFromPoi…
AutomatedTester Aug 5, 2026
e02fd5a
test: waitForInteractionReady with backoff + auto-scroll (RED)
AutomatedTester Aug 5, 2026
b23d5fd
feat: waitForInteractionReady with backoff + auto-scroll (GREEN)
AutomatedTester Aug 5, 2026
ffe3aab
test: waitUntilActionable composition + driver.wait_until_actionable …
AutomatedTester Aug 5, 2026
2da235b
feat: waitUntilActionable composition + driver.wait_until_actionable …
AutomatedTester Aug 5, 2026
1b66840
test: aria-disabled, fieldset/legend exception, drop interaction (RED)
AutomatedTester Aug 5, 2026
371152e
feat: aria-disabled, fieldset/legend exception, drop/screenshot inter…
AutomatedTester Aug 5, 2026
b2cf6c7
test: additional coverage parity with acquiescence's test suite
AutomatedTester Aug 5, 2026
71c7c06
test: subresource-loading quiescence — img/iframe/script/stylesheet/o…
AutomatedTester Aug 6, 2026
8733c7a
feat: subresource-loading quiescence — img/iframe/script/stylesheet/o…
AutomatedTester Aug 6, 2026
ee08e6a
test: interaction path must not require page settledness (RED)
AutomatedTester Aug 13, 2026
4476818
feat: interaction path consults actionability only (GREEN)
AutomatedTester Aug 13, 2026
52c6c27
test: the motion check must halt (RED)
AutomatedTester Aug 13, 2026
c4d80d5
feat: the motion check terminates (GREEN)
AutomatedTester Aug 13, 2026
251f261
test: an injected oracle must report its missing history (RED)
AutomatedTester Aug 13, 2026
bffd4a0
feat: an injected oracle reports its missing history (GREEN)
AutomatedTester Aug 13, 2026
b338448
test: a displaced element is scrolled back into view (RED)
AutomatedTester Aug 13, 2026
49ece3c
feat: a displaced element is scrolled back into view (GREEN)
AutomatedTester Aug 13, 2026
8497868
test: box-less and zero-area elements (RED)
AutomatedTester Aug 13, 2026
04d4d04
fix: a box-less ancestor cannot clip its children (GREEN)
AutomatedTester Aug 13, 2026
fecd5e2
test: actionability must hold across frame boundaries (RED)
AutomatedTester Oct 27, 2026
a36b1ba
feat: actionability holds across frame boundaries (GREEN)
AutomatedTester Oct 27, 2026
eb533ca
[py] move the quiescence suites under bidi/ so they run with BiDi ena…
AutomatedTester Oct 27, 2026
39f3ec3
[js] port the quiescence atom to TypeScript and publish it in @seleni…
AutomatedTester Oct 27, 2026
228e5f0
[js] guard that installQuiescence works from its own source text
AutomatedTester Oct 27, 2026
ee1deed
[js] keep a fetch blocking quiescence until its body has been read
AutomatedTester Nov 22, 2026
7c2296e
[js] read the quiescence clock through a reference captured at install
AutomatedTester Nov 22, 2026
48efb0f
[py] keep the unread-body quiescence test from stalling server shutdown
AutomatedTester Nov 22, 2026
ab83d67
Merge trunk into py-quiescence-bidi-preload
AutomatedTester Nov 22, 2026
a932dfb
[py] send the first body bytes with the headers in /slow?bodyMs=
AutomatedTester Nov 22, 2026
90ec1cc
[js] [py] address review findings in the quiescence atom and its wrap…
AutomatedTester Nov 22, 2026
6a0b29f
[py] rename wait_for_dom_settled's settle_ms to settle_time
AutomatedTester Nov 22, 2026
4d12d81
[py] keep the generated browsingContext.navigate and hook the preload in
AutomatedTester Nov 22, 2026
029b576
[js] [py] keep ShadowRoot scopes working; warn when the script timeou…
AutomatedTester Nov 22, 2026
8f6a061
[py] read and set the script timeout without the Timeouts class
AutomatedTester Nov 22, 2026
0809b26
[py] compare the parser-created image probe's result as a plain value
AutomatedTester Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions common/src/web/quiescence.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Quiescence Oracle — Test Harness</title>
<!-- In Selenium this page is loaded with the quiescence polyfill supplied as a
BiDi preload script (script.addPreloadScript), so window.__quiescence is
already installed before this page's scripts run. The inline script below
guards against its absence so the page also degrades gracefully when opened
without the preload. -->
<style>
body { font-family: system-ui, sans-serif; margin: 2rem; max-width: 60rem; }
button { margin: 0.2rem; padding: 0.4rem 0.8rem; }
#state { font-size: 1.4rem; font-weight: 700; padding: 0.4rem 0.8rem; border-radius: 6px; display: inline-block; }
.quiet { background: #c8f7c5; } .busy { background: #f7c5c5; }
pre { background: #f4f4f4; padding: 0.8rem; border-radius: 6px; min-height: 6rem; white-space: pre-wrap; }
fieldset { margin-top: 1rem; }
</style>
</head>
<body>
<h1>Quiescence oracle test harness</h1>
<p>State: <span id="state" class="quiet">quiet</span> &nbsp; Clock: <span id="clock">–</span></p>

<fieldset><legend>Provably-completing work</legend>
<button id="btn-timeout">setTimeout 3s</button>
<button id="btn-long-timeout">setTimeout 30s (policy-inert)</button>
<button id="btn-fetch-slow">fetch /slow?ms=3000</button>
<button id="btn-xhr-slow">XHR /slow?ms=2000</button>
<button id="btn-fetch-ignored">fetch /slow?ms=5000&beacon=1 (ignored by pattern)</button>
<button id="btn-chain">chained: fetch → timeout → fetch</button>
</fieldset>

<fieldset><legend>Periodic work (the undecidable corner)</legend>
<button id="btn-heartbeat">start no-op heartbeat interval (1s) → should go observed-inert after 3 ticks</button>
<button id="btn-clock">start DOM-mutating clock (1s) → stays a blocker</button>
<button id="btn-clock-inert">markInert(clock) — cooperative annotation</button>
<button id="btn-stop-periodic">stop all periodic</button>
</fieldset>

<fieldset><legend>Controls</legend>
<button id="btn-await">awaitQuiet(8s)</button>
<button id="btn-blockers">dump blockers</button>
</fieldset>

<pre id="log"></pre>

<script>
(function () {
const logEl = document.getElementById('log');
const stateEl = document.getElementById('state');
const log = (m) => { logEl.textContent = new Date().toISOString().slice(11, 23)
+ ' ' + m + '\n' + logEl.textContent; };

const q = window.__quiescence;
if (!q) {
log('window.__quiescence is not installed — load this page with the '
+ 'quiescence preload script (Selenium injects it automatically).');
return;
}

q.setPolicy({ ignoreUrlPatterns: ['beacon=1'] });
q.onStateChanged((p) => {
stateEl.textContent = p.quiet ? 'quiet' : 'busy';
stateEl.className = p.quiet ? 'quiet' : 'busy';
log('stateChanged → ' + (p.quiet ? 'QUIET'
: 'BUSY: ' + p.blockers.map((b) => b.type + (b.url ? '(' + b.url + ')' : '')).join(', ')));
});

const $ = (id) => document.getElementById(id);
let heartbeat = null; let clock = null;

$('btn-timeout').onclick = () => setTimeout(() => log('3s timeout fired'), 3000);
$('btn-long-timeout').onclick = () => setTimeout(() => log('30s timeout fired'), 30000);
$('btn-fetch-slow').onclick = () =>
fetch('/slow?ms=3000').then((r) => r.text()).then((t) => log('fetch done: ' + t));
$('btn-xhr-slow').onclick = () => {
const x = new XMLHttpRequest();
x.open('GET', '/slow?ms=2000');
x.onloadend = () => log('xhr done');
x.send();
};
$('btn-fetch-ignored').onclick = () =>
fetch('/slow?ms=5000&beacon=1').then(() => log('ignored beacon done'));
$('btn-chain').onclick = () =>
fetch('/slow?ms=1000').then(() => new Promise((res) => setTimeout(res, 800)))
.then(() => fetch('/slow?ms=1000')).then(() => log('chain done'));

$('btn-heartbeat').onclick = () => {
if (heartbeat) return;
let n = 0;
heartbeat = setInterval(() => { n++; /* deliberately effect-free */ }, 1000);
log('heartbeat started (watch it become inert after '
+ '3 quiet ticks — state flips to QUIET while it still runs)');
};
$('btn-clock').onclick = () => {
if (clock) return;
clock = setInterval(() => {
document.getElementById('clock').textContent = new Date().toLocaleTimeString();
}, 1000);
log('clock started (DOM-mutating: will never be observed-inert)');
};
$('btn-clock-inert').onclick = () => {
if (!clock) { log('start the clock first'); return; }
log('markInert(clock) → ' + q.markInert(clock));
};
$('btn-stop-periodic').onclick = () => {
if (heartbeat) { clearInterval(heartbeat); heartbeat = null; }
if (clock) { clearInterval(clock); clock = null; }
log('periodic work stopped');
};

$('btn-await').onclick = async () => {
log('awaitQuiet(8000) …');
const r = await q.awaitQuiet({ timeoutMs: 8000 });
log('awaitQuiet → ' + JSON.stringify(r));
};
$('btn-blockers').onclick = () => log('blockers: ' + JSON.stringify(q.getBlockers()));
}());
</script>
</body>
</html>
10 changes: 10 additions & 0 deletions common/src/web/slow_loading_resources.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Slow-loading subresources</title>
</head>
<body>
<p>A parser-created image whose bytes arrive slowly, for resource-quiescence tests.</p>
<img src="/slow?ms=2000&amp;img=1" alt="slow image">
</body>
</html>
12 changes: 12 additions & 0 deletions javascript/atoms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ js_test(
],
)

# npm consumers install quiescence by sending installQuiescence.toString() to
# the browser as a preload, so the function must not reach outside its own body.
js_test(
name = "quiescence-portable",
data = [
"package.json",
":atoms-npm-compiled",
],
entry_point = "typescript/quiescence-portable.mjs",
fixed_args = ["javascript/atoms/dist/typescript/quiescence.js"],
)

# ── test-only bundles ────────────────────────────────────────────────────────

# Shared modules that no atom reaches yet still need a QUnit page. Each entry
Expand Down
35 changes: 35 additions & 0 deletions javascript/atoms/README.npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,41 @@ run in the page rather than in the driver process — for example via
`Runtime.evaluate` over CDP, `script.callFunction` over WebDriver BiDi, or
Selenium's own `executeScript`.

### Quiescence

`installQuiescence` is the odd one out: rather than answering a question when
called, it installs a pending-work ledger and a DOM observer into the page, and
answers questions from then on through `window.__quiescence`. It has to run
before any page script, or work the page started earlier is invisible to it, so
install it as a preload script. The function is self-contained, so its own
source text is the preload:

```js
import installQuiescence from '@selenium/atoms/quiescence'

// WebDriver BiDi
await bidi.send('script.addPreloadScript', { functionDeclaration: installQuiescence.toString() })

// Chrome DevTools Protocol
await cdp.send('Page.addScriptToEvaluateOnNewDocument', { source: `(${installQuiescence})()` })

// Playwright
await page.addInitScript(installQuiescence)
```

Then, from page script:

```js
await window.__quiescence.awaitQuiet({ timeoutMs: 10000 }) // pending timers, network, resources
await window.__quiescence.awaitDomSettled({ settleMs: 150 }) // no meaningful DOM mutation
await window.__quiescence.waitUntilActionable(element, { interaction: 'click' })
```

The query API on `window.__quiescence` is a prototype of a proposed WebDriver
BiDi module and its shape is expected to change; see
[ADR 17886](https://github.com/SeleniumHQ/selenium/pull/17886). The source in
`typescript/quiescence.ts` documents what it cannot observe.

## Versioning

This package is released from the Selenium monorepo and shares its version with
Expand Down
1 change: 1 addition & 0 deletions javascript/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ export { default as accessibilitySnapshot } from './typescript/accessibility-sna
export type { AccessibilityNode, StateValue } from './typescript/accessibility-snapshot.js'
export { default as accessibilitySnapshotWire } from './typescript/accessibility-snapshot-wire.js'
export type { WireError, WireNode, WireSnapshot } from './typescript/accessibility-snapshot-wire.js'
export { default as installQuiescence } from './typescript/quiescence.js'
7 changes: 6 additions & 1 deletion javascript/atoms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@
"./accessibility-snapshot-wire": {
"types": "./dist/typescript/accessibility-snapshot-wire.d.ts",
"default": "./dist/typescript/accessibility-snapshot-wire.js"
},
"./quiescence": {
"types": "./dist/typescript/quiescence.d.ts",
"default": "./dist/typescript/quiescence.js"
}
},
"typesVersions": {
Expand Down Expand Up @@ -237,7 +241,8 @@
"clear": ["./dist/typescript/clear.d.ts"],
"submit": ["./dist/typescript/submit.d.ts"],
"accessibility-snapshot": ["./dist/typescript/accessibility-snapshot.d.ts"],
"accessibility-snapshot-wire": ["./dist/typescript/accessibility-snapshot-wire.d.ts"]
"accessibility-snapshot-wire": ["./dist/typescript/accessibility-snapshot-wire.d.ts"],
"quiescence": ["./dist/typescript/quiescence.d.ts"]
}
},
"engines": {
Expand Down
9 changes: 9 additions & 0 deletions javascript/atoms/typescript/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ ATOMS = [
"global": "bot.accessibility.typescript.snapshotWire",
"aliases": [],
},
# Unlike the other atoms, quiescence is not called per command: it installs
# the pending-work ledger and DOM observer, so it has to run as a preload
# script before any page script, and its queries live on window.__quiescence.
{
"name": "quiescence",
"export": "installQuiescence",
"global": "bot.quiescence.typescript.install",
"aliases": [],
},
]

def typescript_atom(name, global_name, srcs, visibility = None):
Expand Down
47 changes: 47 additions & 0 deletions javascript/atoms/typescript/quiescence-portable.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// npm consumers install quiescence by sending the function's own source to the
// browser: BiDi script.addPreloadScript takes it as a function declaration, CDP
// Page.addScriptToEvaluateOnNewDocument and Playwright's addInitScript take its
// text. That only works while installQuiescence references nothing outside its
// own body, so this evaluates its source text in a bare context, away from the
// module it was compiled into, and checks the ledger it installs works.

import assert from 'node:assert/strict'
import path from 'node:path'
import { pathToFileURL } from 'node:url'
import vm from 'node:vm'

const [modulePath] = process.argv.slice(2)
const { default: installQuiescence } = await import(pathToFileURL(path.resolve(modulePath)).href)

const sandbox = vm.createContext({ setTimeout, clearTimeout, setInterval, clearInterval, console })
const install = vm.runInContext(`(${installQuiescence.toString()})`, sandbox)
install()

const api = vm.runInContext('globalThis.__quiescence', sandbox)
assert.ok(api, 'calling the source text with no arguments installs into its own global')
assert.equal(typeof api.isQuiet, 'function')
assert.equal(typeof api.waitUntilActionable, 'function')

vm.runInContext('setTimeout(() => {}, 50)', sandbox)
assert.equal(api.isQuiet(), false, 'a pending timer in the sandbox blocks quiescence')
assert.equal(api.getBlockers()[0].type, 'timeout')

const result = await api.awaitQuiet({ timeoutMs: 2000, settleMs: 10 })
assert.equal(result.quiet, true, 'the ledger drains once the timer fires')
Loading
Loading