test(e2e): 书架改「开合翻转」口径,数据板断言更新为 5j 口径
- 书架(方案 C):置顶书默认展开是设计行为,点它=收起。原断言误点已展开的 置顶行断言「变开」→ 必然失败。改为断言开合状态恰好翻转一次 - 数据板断言:5j T2 有意退役 streak/贡献蛇 SVG(信息并入热力图区),原 「数据板渲染」断言过时;改为断言连续贡献统计条 + 更新时间标注 + 第三方 资产零命中(含退役的 /github-assets/) 验证: E2E_BASE=http://127.0.0.1:18925 node tests/e2e.mjs → 56/56 PASS Spec: none (测试口径随 5j 定稿同步) Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
f73a1b3e63
commit
6e343c80dc
1 file changed
+11
-8
+11
-8
@@ -89,16 +89,17 @@ await page.goto(BASE + '/opensource/', { waitUntil: 'networkidle' });
|
|||||||
const osState = await page.evaluate(() => {
|
const osState = await page.evaluate(() => {
|
||||||
const html = document.documentElement.outerHTML;
|
const html = document.documentElement.outerHTML;
|
||||||
return {
|
return {
|
||||||
thirdParty: ['img.shields.io', 'readme-typing-svg', 'github-readme-stats', 'streak-stats', 'komarev']
|
// 5j T2:streak/贡献蛇退役(信息并入热力图区),第三方图仍必须为零
|
||||||
|
thirdParty: ['img.shields.io', 'readme-typing-svg', 'github-readme-stats', 'streak-stats', 'komarev', '/github-assets/']
|
||||||
.some((u) => html.includes(u)),
|
.some((u) => html.includes(u)),
|
||||||
typing: !!document.querySelector('[class*=typing]'),
|
typing: !!document.querySelector('[class*=typing]'),
|
||||||
board: document.querySelectorAll('.pf-card').length,
|
streakLine: /天连续|day streak/.test(html),
|
||||||
localAssets: [...document.querySelectorAll('img')].filter((i) => i.src.includes('/github-assets/')).length,
|
updated: html.includes('数据更新于'),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
ok('5i·开源页零第三方外链图', !osState.thirdParty);
|
ok('5i·开源页零第三方外链图(含退役资产)', !osState.thirdParty);
|
||||||
ok('5i·打字机动效存在', osState.typing);
|
ok('5i·打字机动效存在', osState.typing);
|
||||||
ok('5i·数据板渲染', osState.board > 0 && osState.localAssets > 0, `cards=${osState.board} assets=${osState.localAssets}`);
|
ok('5j·连续贡献同源计算 + 更新时间标注', osState.streakLine && osState.updated);
|
||||||
|
|
||||||
// 1) 明暗切换:按钮 + 状态持久 + t 键
|
// 1) 明暗切换:按钮 + 状态持久 + t 键
|
||||||
const before = await page.getAttribute('html', 'data-theme');
|
const before = await page.getAttribute('html', 'data-theme');
|
||||||
@@ -193,11 +194,13 @@ const books = await page.evaluate(() => {
|
|||||||
return { total: all.length, open: all.filter((d) => d.hasAttribute('open')).length };
|
return { total: all.length, open: all.filter((d) => d.hasAttribute('open')).length };
|
||||||
});
|
});
|
||||||
ok('书架 抽书行渲染', books.total >= 1, JSON.stringify(books));
|
ok('书架 抽书行渲染', books.total >= 1, JSON.stringify(books));
|
||||||
|
// 置顶书默认展开(C 设计):点击已展开的行是"收起",未展开的行是"抽开"——
|
||||||
|
// 断言口径 = 行数不变、开合状态恰好翻转一次(2026-11-04 修:曾误点已展开的置顶行)
|
||||||
|
const openBefore = await page.evaluate(() => document.querySelectorAll('.book[open]').length);
|
||||||
await page.locator('.book').first().locator('summary').click();
|
await page.locator('.book').first().locator('summary').click();
|
||||||
await page.waitForTimeout(250);
|
await page.waitForTimeout(250);
|
||||||
ok('书架 点击可抽开', (await page.locator('.book[open] .body').count()) === 1);
|
const openAfter = await page.evaluate(() => document.querySelectorAll('.book[open]').length);
|
||||||
await page.locator('.book').first().locator('summary').click();
|
ok('书架 抽书开合翻转', Math.abs(openAfter - openBefore) === 1, `${openBefore}→${openAfter}`);
|
||||||
await page.waitForTimeout(200);
|
|
||||||
|
|
||||||
// 4) 命令面板 + 搜索
|
// 4) 命令面板 + 搜索
|
||||||
await page.keyboard.press('Control+k');
|
await page.keyboard.press('Control+k');
|
||||||
|
|||||||
Reference in new issue
Block a user