Skip to content

Commit

Permalink
Merge pull request #19351 from timvandermeij/integration-tests-ink
Browse files Browse the repository at this point in the history
Centralize the editor selector definitions in the ink editor integration tests
  • Loading branch information
Snuffleupagus authored Jan 20, 2025
2 parents b950c51 + bd67156 commit 01d542e
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions test/integration/ink_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,17 @@ describe("Ink Editor", () => {
await awaitPromise(clickHandle);
await commit(page);

await page.waitForSelector(getEditorSelector(0));
const editorSelector = getEditorSelector(0);
await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1);

await page.waitForSelector(`${getEditorSelector(0)} button.delete`);
await page.click(`${getEditorSelector(0)} button.delete`);
await page.waitForSelector(`${editorSelector} button.delete`);
await page.click(`${editorSelector} button.delete`);
await waitForSerialized(page, 0);

await kbUndo(page);
await waitForSerialized(page, 1);
await page.waitForSelector(getEditorSelector(0));
await page.waitForSelector(editorSelector);
})
);
});
Expand Down Expand Up @@ -348,11 +349,12 @@ describe("Ink Editor", () => {
await awaitPromise(clickHandle);
await commit(page);

await page.waitForSelector(getEditorSelector(0));
const editorSelector = getEditorSelector(0);
await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1);

await page.waitForSelector(`${getEditorSelector(0)} button.delete`);
await page.click(`${getEditorSelector(0)} button.delete`);
await page.waitForSelector(`${editorSelector} button.delete`);
await page.click(`${editorSelector} button.delete`);
await waitForSerialized(page, 0);

const twoToFourteen = Array.from(new Array(13).keys(), n => n + 2);
Expand All @@ -370,7 +372,7 @@ describe("Ink Editor", () => {
await scrollIntoView(page, pageSelector);
}

await page.waitForSelector(getEditorSelector(0));
await page.waitForSelector(editorSelector);
})
);
});
Expand Down Expand Up @@ -404,11 +406,12 @@ describe("Ink Editor", () => {
await awaitPromise(clickHandle);
await commit(page);

await page.waitForSelector(getEditorSelector(0));
const editorSelector = getEditorSelector(0);
await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1);

await page.waitForSelector(`${getEditorSelector(0)} button.delete`);
await page.click(`${getEditorSelector(0)} button.delete`);
await page.waitForSelector(`${editorSelector} button.delete`);
await page.click(`${editorSelector} button.delete`);
await waitForSerialized(page, 0);

const twoToOne = Array.from(new Array(13).keys(), n => n + 2).concat(
Expand All @@ -421,7 +424,7 @@ describe("Ink Editor", () => {

await kbUndo(page);
await waitForSerialized(page, 1);
await page.waitForSelector(getEditorSelector(0));
await page.waitForSelector(editorSelector);
})
);
});
Expand Down Expand Up @@ -941,7 +944,6 @@ describe("Ink Editor", () => {

await page.waitForSelector(getEditorSelector(1));
await waitForSerialized(page, 1);
await page.waitForSelector(getEditorSelector(1));
await page.waitForSelector("#editorUndoBar", { hidden: true });
})
);
Expand Down

0 comments on commit 01d542e

Please sign in to comment.