| 474 | |
| 475 | /** Wo jeder scrollbare Bereich steht. Wortgleich aus smoke-w9 (Beweisbilder). */ |
| 476 | const scrollState = (page) => |
| 477 | page.evaluate(() => { |
| 478 | const regions = []; |
| 479 | for (const node of document.body.querySelectorAll('*')) { |
| 480 | if (node.closest('.monaco-editor') !== null) { |
| 481 | continue; |
| 482 | } |
| 483 | const style = globalThis.getComputedStyle(node); |
| 484 | const scrollsY = (style.overflowY === 'auto' || style.overflowY === 'scroll') |
| 485 | && node.scrollHeight > node.clientHeight + 1; |
| 486 | const scrollsX = (style.overflowX === 'auto' || style.overflowX === 'scroll') |
| 487 | && node.scrollWidth > node.clientWidth + 1; |
| 488 | if (!scrollsY && !scrollsX) { |
| 489 | continue; |
| 490 | } |
| 491 | regions.push({ |
| 492 | name: node.getAttribute('data-testid') |
| 493 | ?? (node.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)[0] |
| 494 | ?? node.tagName.toLowerCase(), |
| 495 | top: Math.round(node.scrollTop), |
| 496 | left: Math.round(node.scrollLeft), |
| 497 | hidden: Math.round(node.scrollHeight - node.clientHeight), |
| 498 | }); |
| 499 | } |
| 500 | return { |
| 501 | regions, |
| 502 | atRest: regions.every((region) => region.top <= 1 && region.left <= 1), |
| 503 | }; |
| 504 | }); |
| 505 | |
| 506 | // ------------------------------------------------------------- Klickstrecke - |
| 507 | |