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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from playwright.sync_api import sync_playwright
|
||||
from pathlib import Path
|
||||
import json
|
||||
base=Path('/mnt/data/site-engine-admin-stage5')
|
||||
with sync_playwright() as pw:
|
||||
b=pw.chromium.launch(headless=True, executable_path='/usr/bin/chromium',args=['--no-sandbox','--disable-gpu','--disable-dev-shm-usage'])
|
||||
for mode in ('antirion','rose-graphite'):
|
||||
file=f'publication-{mode}.html'
|
||||
page=b.new_page(viewport={'width':1440,'height':900},device_scale_factor=1)
|
||||
logs=[]
|
||||
page.on('pageerror', lambda e: logs.append(str(e)))
|
||||
print('\nTEST',file)
|
||||
try:
|
||||
html=(base/file).read_text();css=(base/'assets/publication.css').read_text();js=(base/'assets/publication.js').read_text();html=html.replace('<link rel="stylesheet" href="assets/publication.css">','<style>'+css+'</style>').replace('<script src="assets/publication.js" defer></script>','<script>'+js+'</script>');page.set_content(html,wait_until='load',timeout=20000)
|
||||
print('title',page.title(),'tabs',page.locator('.tabs .tab').count(),'deltas',page.locator('.table tbody tr').count())
|
||||
page.screenshot(path=str(base/'previews'/f'stage5-{mode}-changes-1440.png'),full_page=True)
|
||||
page.get_by_role('button',name='Проверить',exact=False).first.click()
|
||||
print('checks',page.locator('.check.bad').count(),page.locator('.check.warn').count())
|
||||
page.get_by_role('button',name='Исправить').first.click()
|
||||
page.get_by_role('button',name='Применить').click()
|
||||
page.get_by_role('button',name='Запустить validate').click()
|
||||
print('validation',page.locator('.check.bad').count())
|
||||
page.get_by_role('button',name='Кандидат').first.click()
|
||||
print('candidate tab',page.locator('.tab.active').inner_text())
|
||||
page.get_by_role('button',name='Сформировать кандидата').click()
|
||||
print('after candidate',page.locator('.panel-body .mono').all_inner_texts()[:3])
|
||||
page.get_by_role('button',name='Опубликовать',exact=True).click()
|
||||
print('modal',page.locator('.dialog h2').inner_text())
|
||||
page.get_by_role('button',name='Симулировать публикацию').click()
|
||||
print('newlive',page.locator('.live-indicator').inner_text())
|
||||
page.get_by_role('button',name='Откат',exact=True).first.click()
|
||||
print('rollback dialog',page.locator('.dialog h2').inner_text())
|
||||
page.get_by_role('button',name='Подтвердить демо-откат').click()
|
||||
print('after rollback',page.locator('.live-indicator').inner_text())
|
||||
page.screenshot(path=str(base/'previews'/f'stage5-{mode}-history-1440.png'),full_page=True)
|
||||
print('pageerrors',logs)
|
||||
except Exception as e:
|
||||
print('FAILED',repr(e));page.screenshot(path=str(base/'previews'/f'stage5-{mode}-failed.png'),full_page=True)
|
||||
page.close()
|
||||
b.close()
|
||||
@@ -0,0 +1,31 @@
|
||||
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))
|
||||
Reference in New Issue
Block a user