You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haoliang-net/_test_pages.js

24 lines
1.2 KiB
JavaScript

async (page) => {
const results = [];
const urls = [
{name: 'C3.9 device detail', url: 'http://127.0.0.1/admin/machine/1'},
{name: 'C4 brand', url: 'http://127.0.0.1/admin/brand'},
{name: 'C5 collect-address', url: 'http://127.0.0.1/admin/collect-address'},
{name: 'C6 worker', url: 'http://127.0.0.1/admin/worker'},
{name: 'C7 production', url: 'http://127.0.0.1/admin/production'},
{name: 'C8 alert', url: 'http://127.0.0.1/admin/alert'},
{name: 'C9 settings', url: 'http://127.0.0.1/admin/settings'},
{name: 'C10 log', url: 'http://127.0.0.1/admin/log'},
{name: 'C11 screen-config', url: 'http://127.0.0.1/admin/screen-config'},
];
for (const u of urls) {
await page.goto(u.url, {waitUntil: 'networkidle', timeout: 10000}).catch(() => {});
const title = await page.title();
const bodyText = await page.evaluate(() => document.body.innerText.substring(0, 200));
const hasTable = await page.locator('table').count();
const hasChart = await page.locator('canvas, svg').count();
results.push(u.name + ': title=' + title + ', table=' + hasTable + ', chart=' + hasChart + ', bodyLen=' + bodyText.length);
}
return results.join('\n');
}