Skip to content

Commit 986822a

Browse files
committed
fix(chrome-ext): use page.press('body') for key events in shared test utilities
1 parent 016a103 commit 986822a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/chrome-plugin/tests/testUtils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ export async function testBasicSuggestionRichText(
225225
await expect(editor).toContainText('This is a test');
226226

227227
// Cursor should be right after "a" (pos 9). ArrowRight×3 + Backspace deletes 'e'.
228-
await editor.press('ArrowRight');
229-
await editor.press('ArrowRight');
230-
await editor.press('ArrowRight');
231-
await editor.press('Backspace');
228+
await page.press('body', 'ArrowRight');
229+
await page.press('body', 'ArrowRight');
230+
await page.press('body', 'ArrowRight');
231+
await page.press('body', 'Backspace');
232232
await expect(editor).toContainText('This is a tst');
233233

234234
// Verify typing still works.
@@ -297,7 +297,7 @@ export async function testMultipleSuggestionsAndUndo(
297297
await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
298298

299299
// Move cursor away to test whether it handles race condition
300-
await editor.press('End');
300+
await page.press('body', 'End');
301301

302302
await page.getByTitle('Replace with "test"').click();
303303
await page.waitForTimeout(500);
@@ -308,7 +308,7 @@ export async function testMultipleSuggestionsAndUndo(
308308
await expect(editor).toContainText('third tset');
309309

310310
// Undo
311-
await editor.press('Control+z');
311+
await page.press('body', 'Control+z');
312312
await page.waitForTimeout(300);
313313
await expect(editor).toContainText('The second tset');
314314
});

0 commit comments

Comments
 (0)