-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest_index_runner.js
More file actions
32 lines (25 loc) · 1020 Bytes
/
Copy pathtest_index_runner.js
File metadata and controls
32 lines (25 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({
headless: false,
args: ['--disable-gpu', '--no-sandbox', '--enable-webgl', '--use-gl=swiftshader']
});
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
page.on('console', msg => {
console.log(`[${msg.type()}] ${msg.text()}`);
});
page.on('pageerror', err => {
console.error(`[PAGE ERROR] ${err.message}`);
});
await page.goto('http://localhost:8080/live2d/index.html', { waitUntil: 'networkidle', timeout: 30000 });
await page.waitForTimeout(8000);
await page.screenshot({ path: './index_test.png', fullPage: true });
console.log('Screenshot saved');
const canvasCount = await page.locator('canvas').count();
console.log(`Canvas count: ${canvasCount}`);
if (canvasCount > 0) {
const bbox = await page.locator('canvas').first().boundingBox();
console.log(`Canvas size: ${JSON.stringify(bbox)}`);
}
await browser.close();
})();