0841b1a103
- 前端:Vue3 + TS + Element Plus,24 个页面路由(课件/组题/教案/动画/思维导图/作文批改/命题/课堂/资源/社区等) - 后端:FastAPI + SQLAlchemy + SQLite,17 个路由模块,AI 服务层含降级模板 - AI:glm-5.x 推理模型已禁用思维链,确保输出真实内容 - 修复:ai_service 两处请求体注入 enable_thinking/thinking disabled - 测试账号:13900999999 / test1234
44 lines
2.5 KiB
JavaScript
44 lines
2.5 KiB
JavaScript
const { chromium } = require('playwright-core');
|
|
(async () => {
|
|
const CHROME = String.raw`C:\Program Files\Google\Chrome\Application\chrome.exe`;
|
|
const browser = await chromium.launch({ executablePath: CHROME, headless: true });
|
|
const page = await browser.newPage({ viewport: { width: 1366, height: 850 } });
|
|
const errors = [], warnings = [];
|
|
page.on('pageerror', e => errors.push(e.message));
|
|
page.on('console', m => { if (m.type()==='error') errors.push(m.text()); if (m.type()==='warning' && m.text().includes('resolve component')) warnings.push(m.text()); });
|
|
const base = 'http://127.0.0.1:8010';
|
|
const r = await fetch(base + '/api/auth/login', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({phone:'13943441149',password:'Test1234'}) });
|
|
const j = await r.json();
|
|
const tok = j.access_token;
|
|
await page.goto('http://127.0.0.1:5175/login');
|
|
await page.evaluate(t => { localStorage.setItem('access_token', t); localStorage.setItem('refresh_token','r'); }, tok);
|
|
await page.goto('http://127.0.0.1:5175/animation');
|
|
await page.waitForTimeout(2500);
|
|
await page.locator('.tpl-btn').first().click();
|
|
await page.waitForTimeout(1500);
|
|
const cards = await page.locator('.tg-card').count();
|
|
const ours = ['勾股定理','单位圆','排序算法','DNA','牛顿第二','板块构造'];
|
|
const results = [];
|
|
for (let i = 0; i < cards; i++) {
|
|
await page.locator('.tg-card').nth(i).click();
|
|
await page.waitForTimeout(800);
|
|
const name = (await page.locator('.tg-main-head h3').textContent().catch(()=> '') || '').trim();
|
|
if (ours.some(k => name.includes(k))) {
|
|
const frame = page.frameLocator('.tg-preview-wrap iframe').first();
|
|
let ok = false, iconOk = false;
|
|
try { ok = (await frame.locator('body').innerHTML({ timeout: 3000 }).catch(()=> '')).length > 200; } catch(e) {}
|
|
// check the card icon rendered (svg present)
|
|
try { iconOk = await page.locator('.tg-card').nth(i).locator('svg').count() > 0; } catch(e) {}
|
|
results.push({ name, ok, iconOk });
|
|
}
|
|
}
|
|
await page.screenshot({ path: '../audit_shots/_tpl_final2.png' });
|
|
console.log('TOTAL_CARDS:', cards);
|
|
console.log('CONSOLE_ERRORS:', errors.length, 'ICON_WARNINGS:', warnings.length);
|
|
if (errors.length) console.log('ERROR_SAMPLES:', errors.slice(0,5));
|
|
if (warnings.length) console.log('WARN_SAMPLES:', warnings.slice(0,3));
|
|
console.log('NEW_TEMPLATES:', JSON.stringify(results));
|
|
console.log('ALL_NEW_OK:', results.length === 6 && results.every(r => r.ok && r.iconOk));
|
|
await browser.close();
|
|
})();
|