Skip to content
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

Introduce a getRect utility function for the integration tests #18154

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 5 additions & 8 deletions test/integration/caret_browsing_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import { closePages, loadAndWait } from "./test_utils.mjs";
import { closePages, getRect, loadAndWait } from "./test_utils.mjs";

const waitForSelectionChange = (page, selection) =>
page.waitForFunction(
Expand All @@ -38,13 +38,10 @@ describe("Caret browsing", () => {
it("must move the caret down and check the selection", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const spanRect = await page.evaluate(() => {
const span = document.querySelector(
`.page[data-page-number="1"] > .textLayer > span`
);
const { x, y, width, height } = span.getBoundingClientRect();
return { x, y, width, height };
});
const spanRect = await getRect(
page,
`.page[data-page-number="1"] > .textLayer > span`
);
await page.mouse.click(
spanRect.x + 1,
spanRect.y + spanRect.height / 2,
Expand Down
Loading