Skip to content

Commit 6f1540d

Browse files
fix: Playwright flaky keyboard handler test (#1704)
1 parent 838a52d commit 6f1540d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { test } from "../../setup/setupScript.js";
22
import {
33
BASE_URL,
44
H_ONE_BLOCK_SELECTOR,
5-
H_TWO_BLOCK_SELECTOR,
65
ITALIC_BUTTON_SELECTOR,
76
} from "../../utils/const.js";
87
import { insertHeading, insertParagraph } from "../../utils/copypaste.js";
@@ -21,17 +20,16 @@ test.describe("Check Keyboard Handlers' Behaviour", () => {
2120
await insertHeading(page, 2);
2221

2322
await page.waitForTimeout(500);
24-
const startElement = await page.locator(H_ONE_BLOCK_SELECTOR);
25-
let boundingBox = (await startElement.boundingBox())!;
26-
let { x, y, height } = boundingBox;
27-
await page.mouse.move(x + 35, y + height / 2, { steps: 5 });
28-
await page.mouse.down();
29-
30-
const endElement = await page.locator(H_TWO_BLOCK_SELECTOR);
31-
boundingBox = (await endElement.boundingBox())!;
32-
({ x, y, height } = boundingBox);
33-
await page.mouse.move(x + 105, y + height / 2, { steps: 5 });
34-
await page.mouse.up();
23+
24+
await page.keyboard.press("ArrowUp");
25+
await page.keyboard.press("ArrowUp");
26+
await page.keyboard.press("ControlOrMeta+ArrowLeft");
27+
await page.keyboard.press("ArrowRight");
28+
await page.keyboard.down("Shift");
29+
await page.keyboard.press("ArrowDown");
30+
await page.keyboard.press("ControlOrMeta+ArrowRight");
31+
await page.keyboard.press("ArrowLeft");
32+
await page.keyboard.up("Shift");
3533

3634
await page.keyboard.press("Enter");
3735

0 commit comments

Comments
 (0)