test: add a test for ctrlKey on wheel (#12547)

This commit is contained in:
Alex Rudenko 2024-06-07 12:46:00 +02:00 committed by GitHub
parent ee1074559d
commit 1c4b96816a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View File

@ -2183,6 +2183,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[mouse.spec] Mouse should set ctrlKey on the wheel event",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"],
"comment": "Wheel event is not supported"
},
{
"testIdPattern": "[mouse.spec] Mouse should trigger hover state with removed window.Node",
"platforms": ["darwin", "linux", "win32"],

View File

@ -222,6 +222,30 @@ describe('Mouse', function () {
height: 230,
});
});
it('should set ctrlKey on the wheel event', async () => {
const {page, server} = await getTestState();
await page.goto(server.EMPTY_PAGE);
const ctrlKey = page.evaluate(() => {
return new Promise(resolve => {
window.addEventListener(
'wheel',
event => {
resolve(event.ctrlKey);
},
{
once: true,
}
);
});
});
await page.keyboard.down('Control');
await page.mouse.wheel({deltaY: -100});
// Scroll back to work around
// https://bugzilla.mozilla.org/show_bug.cgi?id=1901211.
await page.mouse.wheel({deltaY: 100});
await page.keyboard.up('Control');
expect(await ctrlKey).toBeTruthy();
});
it('should tween mouse movement', async () => {
const {page} = await getTestState();