feat(工作台): 视频详情首行改「查看视频」可点击链接,不显示具体视频地址
This commit is contained in:
1 parent
adebcc135b
commit
419242dd41
3 files changed
+9
-8
No files matched your search
@@ -49,7 +49,7 @@ async function main() {
|
||||
let pass = 0, fail = 0;
|
||||
const check = (name, cond, extra = '') => { cond ? pass++ : fail++; console.log((cond ? 'PASS' : 'FAIL') + ' | ' + name + (cond ? '' : ' ← ' + extra)); };
|
||||
|
||||
await cdp(ws, 'Page.navigate', { url: 'http://localhost:8900/?v=titlebar#/video/680' });
|
||||
await cdp(ws, 'Page.navigate', { url: 'http://localhost:8900/?v=tb' + Date.now() + '#/video/680' });
|
||||
await waitFor(ws, `!!document.querySelector('.video-info')`, 15000, '视频详情渲染');
|
||||
|
||||
const r = await evalJs(ws, `(() => {
|
||||
@@ -57,15 +57,13 @@ async function main() {
|
||||
const rows = card ? [...card.querySelectorAll('.info-row')] : [];
|
||||
const toolbarTitle = document.querySelector('.page-toolbar .page-title');
|
||||
const r0 = rows[0];
|
||||
const firstLabel = r0 ? r0.querySelector('.info-label').textContent.trim() : '';
|
||||
const firstLink = r0 ? r0.querySelector('a') : null;
|
||||
const rowLabels = rows.slice(1).map((row) => [...row.querySelectorAll('.info-label')].map((l) => l.textContent.trim()));
|
||||
return {
|
||||
toolbarTitle: toolbarTitle ? toolbarTitle.textContent.trim() : '',
|
||||
rowCount: rows.length,
|
||||
firstLabel,
|
||||
firstText: r0 ? r0.textContent.trim() : '',
|
||||
firstHref: firstLink ? (firstLink.getAttribute('data-ext') || firstLink.getAttribute('href')) : null,
|
||||
firstText: r0 ? r0.textContent.trim().slice(0, 60) : '',
|
||||
rowLabels,
|
||||
hasRenderErr: document.body.textContent.includes('渲染失败') || document.body.textContent.includes('not defined')
|
||||
};
|
||||
@@ -73,8 +71,9 @@ async function main() {
|
||||
|
||||
check('toolbar 显示视频标题名称(非静态"视频详情"): ' + r.toolbarTitle, !!r.toolbarTitle && r.toolbarTitle !== '视频详情' && r.toolbarTitle.length > 2, r.toolbarTitle);
|
||||
check('信息卡共 4 组行', r.rowCount === 4);
|
||||
check('首行标签=「视频地址」: ' + r.firstLabel, r.firstLabel === '视频地址', r.firstLabel);
|
||||
check('首行含可点击链接(https): ' + (r.firstHref || '').slice(0, 40), !!r.firstHref && /^https?:/.test(r.firstHref), r.firstHref || '');
|
||||
check('首行显示「查看视频」字样: ' + r.firstText, r.firstText.includes('查看视频'), r.firstText);
|
||||
check('首行不含具体 URL 明文', !/https?:\/\//.test(r.firstText), r.firstText);
|
||||
check('首行链接可点击(https): ' + (r.firstHref || '').slice(0, 40), !!r.firstHref && /^https?:/.test(r.firstHref), r.firstHref || '');
|
||||
check('第2行=账号/视频ID/时长/发布时间', JSON.stringify(r.rowLabels[0]) === JSON.stringify(['账号', '视频ID', '时长', '发布时间']), JSON.stringify(r.rowLabels[0]));
|
||||
check('第3行=点赞/评论/分享/收藏', JSON.stringify(r.rowLabels[1]) === JSON.stringify(['点赞', '评论', '分享', '收藏']), JSON.stringify(r.rowLabels[1]));
|
||||
check('第4行=标签', JSON.stringify(r.rowLabels[2]) === JSON.stringify(['标签']), JSON.stringify(r.rowLabels[2]));
|
||||
|
||||
Reference in new issue
Block a user