nomadro/scripts/check-live-uiux-com.py
Eric 499f2d3e26 Ship coffeechat scheduling, notify PB access, and social/admin UI polish for .com.
Document the 2026-11-05 UI/UX upgrade and keep roster/live gates aligned with face-check and presence.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-05 18:19:37 +08:00

39 lines
2.2 KiB
Python

"""Read-only browser check of real service responses on the deployed US portal."""
import json
from pathlib import Path
import sys
from playwright.sync_api import sync_playwright
sys.stdout.reconfigure(encoding='utf-8', line_buffering=True)
OUT = Path(__file__).resolve().parents[1] / 'artifacts/uiux-upgrade'
report = {'checks': [], 'pageErrors': [], 'apiErrors': []}
with sync_playwright() as playwright:
browser = playwright.chromium.launch()
context = browser.new_context(viewport={'width': 390, 'height': 844}, locale='en-US')
page = context.new_page()
page.on('pageerror', lambda error: report['pageErrors'].append(str(error)))
page.on('response', lambda response: report['apiErrors'].append({'path': response.url.split('?')[0], 'status': response.status})
if response.status >= 500 and '/api/' in response.url else None)
for path, selector in [
('/notifications', '.ntf-empty'),
('/notifications/settings', '.ntf-quiet-fields input'),
('/social/coffeechat', '.cf-empty'),
('/social/coffeechat/manage', '.cf-form input'),
]:
try:
response = page.goto('https://nomadro.com' + path, wait_until='domcontentloaded', timeout=45000)
page.locator(selector).first.wait_for(timeout=30000)
errors = page.locator('.ntf-error,.cf-error').all_text_contents()
report['checks'].append({'path': path, 'status': response.status, 'errors': errors,
'overflow': page.evaluate('document.documentElement.scrollWidth > innerWidth + 1')})
except Exception as error:
report['checks'].append({'path': path, 'errors': [str(error)]})
page.evaluate('window.scrollTo(0, 0)')
page.screenshot(path=str(OUT / ('live' + path.replace('/', '-') + '.png')), full_page=True)
browser.close()
(OUT / 'live-services-browser.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf-8')
print(json.dumps(report, ensure_ascii=False))
assert not report['pageErrors'] and not report['apiErrors'] and all(
item.get('status') == 200 and not item['errors'] and not item.get('overflow') for item in report['checks']
)