mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: unflake contextmenu recorder test (#31749)
This commit is contained in:
parent
b214941a01
commit
6988194c97
@ -230,6 +230,9 @@ class RecordActionTool implements RecorderTool {
|
|||||||
// So we check the hovered element instead, and if it is a range input, we skip click handling
|
// So we check the hovered element instead, and if it is a range input, we skip click handling
|
||||||
if (isRangeInput(this._hoveredElement))
|
if (isRangeInput(this._hoveredElement))
|
||||||
return;
|
return;
|
||||||
|
// Right clicks are handled by 'contextmenu' event if its auxclick
|
||||||
|
if (event.button === 2 && event.type === 'auxclick')
|
||||||
|
return;
|
||||||
if (this._shouldIgnoreMouseEvent(event))
|
if (this._shouldIgnoreMouseEvent(event))
|
||||||
return;
|
return;
|
||||||
if (this._actionInProgress(event))
|
if (this._actionInProgress(event))
|
||||||
|
|||||||
@ -559,7 +559,7 @@ await page.GetByLabel("Coun\\"try").ClickAsync();`);
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should consume contextmenu events, despite a custom context menu', async ({ page, openRecorder }) => {
|
test('should consume contextmenu events, despite a custom context menu', async ({ page, openRecorder, browserName, platform }) => {
|
||||||
const recorder = await openRecorder();
|
const recorder = await openRecorder();
|
||||||
|
|
||||||
await recorder.setContentAndWait(`
|
await recorder.setContentAndWait(`
|
||||||
@ -597,6 +597,21 @@ await page.GetByLabel("Coun\\"try").ClickAsync();`);
|
|||||||
recorder.trustedClick({ button: 'right' }),
|
recorder.trustedClick({ button: 'right' }),
|
||||||
]);
|
]);
|
||||||
expect(message.text()).toBe('right-clicked');
|
expect(message.text()).toBe('right-clicked');
|
||||||
|
if (browserName === 'chromium' && platform === 'win32') {
|
||||||
|
expect(await page.evaluate('log')).toEqual([
|
||||||
|
// hover
|
||||||
|
'button: pointermove',
|
||||||
|
'button: mousemove',
|
||||||
|
// trusted right click
|
||||||
|
'button: pointermove',
|
||||||
|
'button: mousemove',
|
||||||
|
'button: pointerdown',
|
||||||
|
'button: mousedown',
|
||||||
|
'button: pointerup',
|
||||||
|
'button: mouseup',
|
||||||
|
'button: contextmenu',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
expect(await page.evaluate('log')).toEqual([
|
expect(await page.evaluate('log')).toEqual([
|
||||||
// hover
|
// hover
|
||||||
'button: pointermove',
|
'button: pointermove',
|
||||||
@ -609,8 +624,9 @@ await page.GetByLabel("Coun\\"try").ClickAsync();`);
|
|||||||
'button: mousedown',
|
'button: mousedown',
|
||||||
'button: contextmenu',
|
'button: contextmenu',
|
||||||
'menu: pointerup',
|
'menu: pointerup',
|
||||||
'menu: mouseup'
|
'menu: mouseup',
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should assert value', async ({ openRecorder }) => {
|
test('should assert value', async ({ openRecorder }) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user