test: add SVG clicking test (#4432)

Someone had concerns that pptr's clicking doesn't work with SVG.

Make sure Puppeteer's clicking does.
This commit is contained in:
Andrey Lushnikov 2019-05-18 12:49:55 +03:00 committed by GitHub
parent f7bac6ea1d
commit 8a1c2495c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,15 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
await page.click('button');
expect(await page.evaluate(() => result)).toBe('Clicked');
});
it('should click svg', async({page, server}) => {
await page.setContent(`
<svg height="100" width="100">
<circle onclick="javascript:window.__CLICKED=42" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
`);
await page.click('circle');
expect(await page.evaluate(() => window.__CLICKED)).toBe(42);
});
it_fails_ffox('should click the button if window.Node is removed', async({page, server}) => {
await page.goto(server.PREFIX + '/input/button.html');
await page.evaluate(() => delete window.Node);