test: update context menu tests (#21126)

It turns out these new contextmenu-based tests do not work on
Chromium-based browsers on Windows.

We consider context menu support a best-effort, so we skip them
for now.
This commit is contained in:
Andrey Lushnikov 2023-02-22 17:22:56 -08:00 committed by GitHub
parent 2bb6bc7ad0
commit 3ff3567c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -664,7 +664,8 @@ async function captureLastKeydown(page) {
return lastEvent;
}
it('should dispatch insertText after context menu was opened', async ({ server, page, browserName }) => {
it('should dispatch insertText after context menu was opened', async ({ server, page, browserName, isWindows }) => {
it.skip(browserName === 'chromium' && isWindows, 'context menu support is best-effort for Linux and MacOS');
await page.goto(server.PREFIX + '/input/textarea.html');
await page.evaluate(() => {
window['contextMenuPromise'] = new Promise(x => {
@ -682,7 +683,8 @@ it('should dispatch insertText after context menu was opened', async ({ server,
await expect.poll(() => page.locator('textarea').inputValue()).toBe('嗨');
});
it('should type after context menu was opened', async ({ server, page, browserName }) => {
it('should type after context menu was opened', async ({ server, page, browserName, isWindows }) => {
it.skip(browserName === 'chromium' && isWindows, 'context menu support is best-effort for Linux and MacOS');
await page.evaluate(() => {
window['keys'] = [];
window.addEventListener('keydown', event => window['keys'].push(event.key));

View File

@ -253,6 +253,10 @@ it('should always round down', async ({ page }) => {
it('should not crash on mouse drag with any button', async ({ page }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16609' });
await page.evaluate(() => {
// Do not show contextmenu on right click since it is poorly supported.
window.addEventListener('contextmenu', e => e.preventDefault(), false);
});
for (const button of ['left', 'middle', 'right'] as const) {
await page.mouse.move(50, 50);
await page.mouse.down({ button });
@ -260,9 +264,10 @@ it('should not crash on mouse drag with any button', async ({ page }) => {
}
});
it('should dispatch mouse move after context menu was opened', async ({ page, browserName }) => {
it('should dispatch mouse move after context menu was opened', async ({ page, browserName, isWindows }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20823' });
it.fixme(browserName === 'firefox');
it.skip(browserName === 'chromium' && isWindows, 'context menu support is best-effort for Linux and MacOS');
await page.evaluate(() => {
window['contextMenuPromise'] = new Promise(x => {
window.addEventListener('contextmenu', x, false);

View File

@ -67,9 +67,10 @@ it('should dispatch wheel events @smoke', async ({ page, server }) => {
});
});
it('should dispatch wheel events after context menu was opened', async ({ page, browserName }) => {
it('should dispatch wheel events after context menu was opened', async ({ page, browserName, isWindows }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20823' });
it.fixme(browserName === 'firefox');
it.skip(browserName === 'chromium' && isWindows, 'context menu support is best-effort for Linux and MacOS');
await page.setContent(`<div style="width: 5000px; height: 5000px;"></div>`);
await page.mouse.move(50, 60);