-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathverify.js
More file actions
28 lines (20 loc) · 825 Bytes
/
verify.js
File metadata and controls
28 lines (20 loc) · 825 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
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
// Handle dialogs by accepting them
page.on('dialog', dialog => dialog.accept());
await page.goto('http://localhost:8000/map.html');
// Wait for the SVG map to be loaded
await page.waitForSelector('#map-container svg');
// Verify hover effect on a state (e.g., 'ac')
await page.hover('#ac');
const acState = await page.$('#ac');
const acColor = await acState.evaluate(node => getComputedStyle(node).getPropertyValue('fill'));
console.log(`Hover color for AC: ${acColor}`);
// Verify click event on a state (e.g., 'sp')
await page.click('#sp');
// Take a screenshot
await page.screenshot({ path: 'screenshot.png' });
await browser.close();
})();