Skip to content

Isolate the "move editor with arrows" freetext editor integration tests #19706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions test/integration/freetext_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1705,11 +1705,11 @@ describe("FreeText Editor", () => {
describe("Move editor with arrows", () => {
let pages;

beforeAll(async () => {
beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
});

afterAll(async () => {
afterEach(async () => {
await closePages(pages);
});

Expand Down Expand Up @@ -1779,6 +1779,16 @@ describe("FreeText Editor", () => {
it("must check arrow doesn't move an editor when a slider is focused", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await switchToFreeText(page);

const rect = await getRect(page, ".annotationEditorLayer");
const data = "Hello PDF.js World !!";
const editorSelector = getEditorSelector(0);
await page.mouse.click(rect.x + 200, rect.y + 200);
await page.waitForSelector(editorSelector, { visible: true });
await page.type(`${editorSelector} .internal`, data);
await commit(page);

await selectAll(page);
await page.focus("#editorFreeTextFontSize");

Expand All @@ -1788,7 +1798,6 @@ describe("FreeText Editor", () => {
);
const pageWidth = page2X - page1X;

const editorSelector = getEditorSelector(0);
await moveEditor(page, editorSelector, 5, () =>
page.keyboard.press("ArrowRight")
);
Expand All @@ -1808,12 +1817,11 @@ describe("FreeText Editor", () => {
it("must check the position of an empty freetext", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await clearAll(page);
await switchToFreeText(page);

const rect = await getRect(page, ".annotationEditorLayer");

const data = "Hello PDF.js World !!";
let editorSelector = getEditorSelector(1);
let editorSelector = getEditorSelector(0);
await page.mouse.click(rect.x + 100, rect.y + 100);
await page.waitForSelector(editorSelector, { visible: true });
await page.type(`${editorSelector} .internal`, data);
Expand All @@ -1822,7 +1830,7 @@ describe("FreeText Editor", () => {
const [pageX, pageY] = await getFirstSerialized(page, x => x.rect);

await clearAll(page);
editorSelector = getEditorSelector(2);
editorSelector = getEditorSelector(1);
await page.mouse.click(rect.x + 100, rect.y + 100);
await page.waitForSelector(editorSelector, { visible: true });

Expand Down