ae17776be6
用户反馈:关闭 App 重开每次都要登录。根因:会话已持久化(安全存储, 服务端 TTL 30 天),但启动固定落在登录页——无人消费已存会话。 - _StartupGate(home):watch sessionAccount——在场直进 HomePage,离场 LoginPage;状态驱动(401/登出清会话后 gate 自动重建,不依赖导航时序) - onUnauthorized 保留 push 兜底(home 路由被显式导航替换后的 401 场景) - 测试适配(boot 401 两项重写通过;397/397 全绿) Co-Authored-By: Claude Code <noreply@anthropic.com>
37 lines
1.9 KiB
JavaScript
37 lines
1.9 KiB
JavaScript
import { createServer } from 'node:http';
|
|
import { chromium } from '@playwright/test';
|
|
const server = createServer((_q, res) => {
|
|
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
res.end(`<!doctype html><html><head><meta charset="utf-8" /></head><body style="min-height:900px">
|
|
<h1>Host page</h1>
|
|
<script src="http://219.157.255.213:32006/embed/v2/loader.js" data-slot="oqh763sbarka2lw6u1iqefu0" defer></script></body></html>`);
|
|
});
|
|
await new Promise((r) => server.listen(3988, '127.0.0.1', r));
|
|
const browser = await chromium.launch();
|
|
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
|
await page.goto('http://127.0.0.1:3988');
|
|
const frame = page.locator('iframe[src*="/embed/"][src*="v=2"]');
|
|
await frame.waitFor({ timeout: 20000 });
|
|
await page.waitForTimeout(4000);
|
|
const inside = page.frameLocator('iframe[src*="/embed/"][src*="v=2"]');
|
|
const title = await inside.locator('.stream-title').textContent().catch(() => null);
|
|
console.log('[title] =', title?.trim() ?? '(none)');
|
|
|
|
const box = await frame.boundingBox();
|
|
await page.mouse.move((box ? box.x : 0) + 90, (box ? box.y : 0) + 150);
|
|
await page.waitForTimeout(600);
|
|
let popupOpened = false;
|
|
page.once('popup', () => { popupOpened = true; });
|
|
await inside.locator('a.stream-photo').first().click();
|
|
const modalFrame = page.locator('iframe[title="PhotoLive photo detail"]');
|
|
await modalFrame.waitFor({ timeout: 8000 });
|
|
console.log('[modal] appeared; popup =', popupOpened);
|
|
await page.waitForTimeout(2500);
|
|
const detailUrl = page.frames().find((f) => f.url().includes('/p/'))?.url() ?? '';
|
|
console.log('[modal] detail =', detailUrl.slice(0, 90));
|
|
await page.screenshot({ path: '../../docs/designs/ui04-implementation/actual/server/photo-modal-live.png' });
|
|
await page.locator('button[aria-label^="Close photo"], button[aria-label^="关闭照片"]').click();
|
|
await modalFrame.waitFor({ state: 'detached', timeout: 5000 });
|
|
console.log('[modal] closed');
|
|
server.close(); await browser.close();
|