Files
phelex 88ac95dd19 Integrate Antirion admin with FastAPI and htmx
Add the shared document API, constructor and expert editors, isolated preview, and fragment catalog metadata with typed block IDs.

Include design references, specification 001, QA scripts, project guidance, and cached Docker dependency installation. Leave example sites for a separate commit.
2026-11-12 21:55:36 +03:00

32 lines
2.0 KiB
Python

from pathlib import Path
from playwright.sync_api import sync_playwright
import json
base=Path('/mnt/data/site-engine-admin-stage5')
def inline(file):
html=(base/file).read_text();css=(base/'assets/publication.css').read_text();js=(base/'assets/publication.js').read_text();return html.replace('<link rel="stylesheet" href="assets/publication.css">','<style>'+css+'</style>').replace('<script src="assets/publication.js" defer></script>','<script>'+js+'</script>')
checks=[]
with sync_playwright() as pw:
br=pw.chromium.launch(headless=True,executable_path='/usr/bin/chromium',args=['--no-sandbox','--disable-gpu','--disable-dev-shm-usage'])
for kind in ('antirion','rose-graphite'):
for w,h in [(1440,900),(1280,800),(1024,768),(768,1024),(390,844),(360,740)]:
pg=br.new_page(viewport={'width':w,'height':h},device_scale_factor=1)
errors=[];pg.on('pageerror',lambda ex:errors.append(str(ex)))
pg.set_content(inline(f'publication-{kind}.html'),wait_until='load')
overflow=pg.evaluate('document.documentElement.scrollWidth > window.innerWidth')
menu=pg.locator('.mobile-menu').is_visible()
checks.append({'theme':kind,'width':w,'height':h,'overflow':overflow,'errors':errors,'mobile-menu':menu})
if w==390:
pg.locator('.mobile-menu').click();assert 'menu-open' in pg.locator('.layout').get_attribute('class')
pg.locator('.mobile-cover').click();assert 'menu-open' not in pg.locator('.layout').get_attribute('class')
pg.screenshot(path=str(base/'previews'/f'stage5-{kind}-390.png'),full_page=True)
if w==1440:
pg.locator('[data-tab="checks"]').click()
pg.screenshot(path=str(base/'previews'/f'stage5-{kind}-checks-1440.png'),full_page=True)
pg.locator('[data-tab="history"]').click()
pg.screenshot(path=str(base/'previews'/f'stage5-{kind}-history-initial.png'),full_page=True)
pg.close()
br.close()
print(json.dumps(checks,ensure_ascii=False,indent=2))
assert all(not x['overflow'] and not x['errors'] for x in checks)
(base/'docs'/'STAGE5_QA.json').write_text(json.dumps(checks,ensure_ascii=False,indent=2))