1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Implement a helper function for selecting an editor in the integration tests

This has multiple advantages:

- it improves consistency between the various editor integration tests;
- it makes the code easier to read/understand;
- it reduces code duplication;
- it reduces the number of `getEditorSelector` calls that contained
  hardcoded IDs, which helps to isolate the tests and to simplify
  follow-up patches.
This commit is contained in:
Tim van der Meij 2025-01-18 19:21:55 +01:00
parent 5026af107f
commit c051dd78cf
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
4 changed files with 37 additions and 150 deletions

View file

@ -38,6 +38,7 @@ import {
paste,
pasteFromClipboard,
scrollIntoView,
selectEditor,
serializeBitmapDimensions,
switchToEditor,
waitForAnnotationEditorLayer,
@ -524,9 +525,7 @@ describe("Stamp Editor", () => {
await copyImage(page, "../images/firefox_logo.png", 0);
const editorSelector = getEditorSelector(0);
await page.click(editorSelector);
await waitForSelectedEditor(page, editorSelector);
await selectEditor(page, editorSelector);
await page.waitForSelector(
`${editorSelector} .resizer.topLeft[tabindex="-1"]`
@ -1494,11 +1493,8 @@ describe("Stamp Editor", () => {
const serialized = await getSerialized(page);
expect(serialized).withContext(`In ${browserName}`).toEqual([]);
const editorRect = await getRect(page, editorSelector);
// Select the annotation we want to move.
await page.mouse.click(editorRect.x + 2, editorRect.y + 2);
await waitForSelectedEditor(page, editorSelector);
await selectEditor(page, editorSelector);
await dragAndDrop(page, editorSelector, [[100, 100]]);
await waitForSerialized(page, 1);