Eerste commit voor Helvoirt Gevelreiniging

This commit is contained in:
Joery Disselhof
2026-08-26 13:57:08 +02:00
commit 276dba07a2
225 changed files with 23121 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
from playwright.sync_api import sync_playwright
import os
OUT = os.path.abspath("shots")
os.makedirs(OUT, exist_ok=True)
SLUGS = ["voegwerk", "dakreiniging-coating", "schoorsteen-voegwerk", "algemeen-reinigen"]
BASE = "http://localhost:4321/diensten/"
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
for slug in SLUGS:
url = BASE + slug
ctx = browser.new_context(viewport={"width": 1440, "height": 900}, device_scale_factor=1)
page = ctx.new_page()
page.goto(url, wait_until="networkidle", timeout=60000)
page.wait_for_timeout(800)
h = page.evaluate("document.body.scrollHeight")
for y in range(0, h, 420):
page.evaluate(f"window.scrollTo(0, {y})")
page.wait_for_timeout(90)
page.evaluate("window.scrollTo(0, 0)")
page.wait_for_timeout(600)
page.screenshot(path=os.path.join(OUT, f"d-{slug}.png"), full_page=True)
# axe
try:
page.add_script_tag(url="https://cdnjs.cloudflare.com/ajax/libs/axe-core/4.10.2/axe.min.js")
page.wait_for_timeout(400)
res = page.evaluate("""async () => {
const r = await axe.run(document, {runOnly:['wcag2a','wcag2aa','wcag21aa']});
return r.violations.map(v=>({id:v.id, impact:v.impact, n:v.nodes.length, sample:(v.nodes[0]&&v.nodes[0].target)||[]}));
}""")
axe_txt = "axe: clean" if not res else "axe: " + "; ".join(f"[{v['impact']}] {v['id']} x{v['n']} {v['sample']}" for v in res)
except Exception as e:
axe_txt = f"axe FAILED: {e}"
# overflow at 3 widths
ov = []
for w in (1440, 768, 390):
c2 = browser.new_context(viewport={"width": w, "height": 900})
pp = c2.new_page(); pp.goto(url, wait_until="networkidle", timeout=60000)
sw = pp.evaluate("document.documentElement.scrollWidth"); cw = pp.evaluate("document.documentElement.clientWidth")
ov.append(f"{w}:{'OVERFLOW' if sw>cw+1 else 'ok'}")
c2.close()
print(f"{slug:24} OK d-{slug}.png {axe_txt} overflow[{', '.join(ov)}]")
ctx.close()
browser.close()