Skip to content

Commit b6ad08e

Browse files
prushforthAliyanH
authored andcommitted
Attempt to de-flake layerContextMenuKeyboard.test.js and
popupTabNavigation.test.js. Playwright docs say page.click('body') is discouraged...
1 parent b9f9571 commit b6ad08e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/e2e/core/layerContextMenuKeyboard.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ test.describe('Playwright Layer Context Menu Tests', () => {
3535
await page.locator('[aria-label="Zoom in"]').press('Tab');
3636
await page.locator('[aria-label="Zoom out"]').press('Tab');
3737
await page.locator('[aria-label="Reload"]').press('Tab');
38-
// no fullscreen button on this page
39-
// features are next tab stop
40-
await page.locator('a[role="button"]').nth(2).press('Tab');
38+
4139
// layer control is next tab stop, opened by hover or Enter key
4240
await page.locator('a[role="button"]').nth(3).press('Enter');
4341
// Shift+F10 generates contextmenu event

test/e2e/core/popupTabNavigation.test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ test.describe('Playwright Keyboard Navigation + Query Layer Tests', () => {
2323
await page.evaluateHandle(() =>
2424
document.getElementById('query').removeAttribute('checked')
2525
);
26-
await page.click('body');
26+
const body = page.locator('body');
27+
await body.click();
2728
await page.keyboard.press('Tab'); // focus map
2829

2930
await page.keyboard.press('Tab'); // focus feature
@@ -301,7 +302,8 @@ test.describe('Playwright Keyboard Navigation + Query Layer Tests', () => {
301302

302303
test('Focus Controls focuses the first <button> child in control div', async () => {
303304
await page.waitForTimeout(1000);
304-
await page.click('body > mapml-viewer');
305+
const viewer = page.locator('mapml-viewer');
306+
await viewer.click();
305307
await page.keyboard.press('Tab');
306308
await page.keyboard.press('Tab');
307309
await page.keyboard.press('Tab');
@@ -328,7 +330,8 @@ test.describe('Playwright Keyboard Navigation + Query Layer Tests', () => {
328330
});
329331

330332
test('Zoom link zooms to the zoom level = zoom attribute', async () => {
331-
await page.click('body');
333+
const body = page.locator('body');
334+
await body.click();
332335
await page.keyboard.press('Tab'); // focus map
333336
await page.keyboard.press('Tab'); // focus feature
334337
await page.keyboard.press('Enter'); // display popup with link in it
@@ -344,14 +347,15 @@ test.describe('Playwright Keyboard Navigation + Query Layer Tests', () => {
344347
});
345348

346349
test('Zoom link zooms to the maximum zoom level that can show the feature completely when zoom attribute does not present', async () => {
347-
await page.click('body');
350+
const body = page.locator('body');
351+
await body.click();
348352
await page.keyboard.press('Tab'); // focus map
349353
await page.keyboard.press('Tab'); // focus feature
350354
await page.keyboard.press('Tab');
351355
await page.keyboard.press('Tab');
352356
await page.keyboard.press('Enter'); // zoom out
353357
await page.waitForTimeout(200);
354-
await page.click('body');
358+
await body.click();
355359
await page.keyboard.press('Tab'); // focus map
356360
await page.keyboard.press('Tab');
357361
await page.keyboard.press('ArrowLeft'); // focus targeted feature

0 commit comments

Comments
 (0)