import test, { before, after } from 'node:test'; import assert from 'node:assert/strict'; import { chromium } from 'playwright'; import { existsSync } from 'node:fs'; import { isUiAssetRequest, assertExpectedUiPage, uiLayoutMetrics } from './lib/ui-review-isolation.mjs'; let browser; before(async () => { const executablePath = ['C:/Program Files/Google/Chrome/Application/chrome.exe','C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'].find(existsSync); browser = await chromium.launch({ headless: true, ...(executablePath ? { executablePath } : {}) }); }); after(async () => { await browser?.close(); }); test('local business proxy endpoints and remote origins are blocked', () => { const origin = 'http://127.0.0.1:4400'; for (const url of [origin + '/api/functions', origin + '/api-platform/functions', origin + '/parse/classes/Agent', 'https://server.fmode.cn/a.js']) { assert.equal(isUiAssetRequest({ url: () => url }, origin), false); } assert.equal(isUiAssetRequest({ url: () => origin + '/chunk-ABC.js' }, origin), true); }); test('mobile layout overflow is detected even when innerWidth expands', async () => { const context = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true }); try { const page = await context.newPage(); await page.setContent('