| 249 | |
| 250 | /** Wo jeder scrollbare Bereich steht. Wortgleich mit smoke-w8 und smoke-w8b. */ |
| 251 | const scrollState = (page) => |
| 252 | page.evaluate(() => { |
| 253 | const regions = []; |
| 254 | for (const node of document.body.querySelectorAll('*')) { |
| 255 | if (node.closest('.monaco-editor') !== null) { |
| 256 | continue; |
| 257 | } |
| 258 | const style = globalThis.getComputedStyle(node); |
| 259 | const scrollsY = (style.overflowY === 'auto' || style.overflowY === 'scroll') |
| 260 | && node.scrollHeight > node.clientHeight + 1; |
| 261 | const scrollsX = (style.overflowX === 'auto' || style.overflowX === 'scroll') |
| 262 | && node.scrollWidth > node.clientWidth + 1; |
| 263 | if (!scrollsY && !scrollsX) { |
| 264 | continue; |
| 265 | } |
| 266 | regions.push({ |
| 267 | name: node.getAttribute('data-testid') |
| 268 | ?? (node.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)[0] |
| 269 | ?? node.tagName.toLowerCase(), |
| 270 | top: Math.round(node.scrollTop), |
| 271 | left: Math.round(node.scrollLeft), |
| 272 | hidden: Math.round(node.scrollHeight - node.clientHeight), |
| 273 | }); |
| 274 | } |
| 275 | return { regions, atRest: regions.every((region) => region.top <= 1 && region.left <= 1) }; |
| 276 | }); |
| 277 | |
| 278 | /** Ein Beweisbild im Ruhezustand. Wortgleich mit smoke-w8b. */ |
| 279 | async function shootAtRest(page, file, name) { |