Skip to content

Commit

Permalink
test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Dheeraj committed Jul 5, 2024
1 parent 2530b19 commit 8a9ea8a
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions tests/integration.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
async function waitForHighlights() {
console.log("Waiting for highlights...");
await page.waitForSelector(".Highlight .Highlight__part", {
visible: true,
});
console.log("Highlights are visible.");
}

async function highlight(start, end) {
console.log(
`Highlighting from ${JSON.stringify(start)} to ${JSON.stringify(end)}`
);
await page.mouse.move(start.x, start.y);
await page.mouse.down();
await page.waitFor(50);
Expand All @@ -18,11 +13,10 @@ async function highlight(start, end) {
await page.mouse.up();
}

jest.setTimeout(60000); // Increased timeout
jest.setTimeout(30000);

beforeAll(async () => {
await page.goto("http://localhost:3000");
console.log("Page loaded");
});

it("should display highlights", async () => {
Expand All @@ -39,3 +33,30 @@ it("should display hover tips over highlights", async () => {
});
await expect(page).toMatchTextContent("Flow or TypeScript?");
});

// it("should highlight text", async () => {
// await page.setViewport({ width: 1397, height: 1329 });
// await waitForHighlights();
// await highlight({ x: 400, y: 300 }, { x: 500, y: 300 });
// await page.waitForSelector(".PdfHighlighter__tip-container", {
// visible: true,
// });
// });

// it("should allow a selection on multiple pages", async () => {
// await page.setViewport({ width: 1397, height: 1329 });
// await waitForHighlights();
// await highlight({ x: 30, y: 10 }, { x: 489, y: 3000 });
// const addHighlightPopup = await page.waitForSelector(".Tip__compact", {
// visible: true,
// });
// await addHighlightPopup.click();
// const commentTextArea = await page.waitForSelector(
// "div.PdfHighlighter__tip-container textarea"
// );
// await commentTextArea.type("test");
// const saveCommentButton = await page.waitForSelector(
// "div.PdfHighlighter__tip-container input[type=submit]"
// );
// await saveCommentButton.click();
// });

0 comments on commit 8a9ea8a

Please sign in to comment.