A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
tests: add a test for browser rendering
Mohamed Bassem4ea8878cd894
diff --git a/packages/e2e_tests/setup/html/browser-rendered.html b/packages/e2e_tests/setup/html/browser-rendered.htmlnew file mode 100644index 00000000..e8cdfae3--- /dev/null+++ b/packages/e2e_tests/setup/html/browser-rendered.html@@ -0,0 +1,27 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Static crawler shell</title>+ </head>+ <body>+ <main id="app">Static shell only</main>+ <script>+ setTimeout(() => {+ const fromCodes = (codes) => String.fromCharCode(...codes);+ const heading = document.createElement("h1");+ heading.textContent = fromCodes([+ 66, 114, 111, 119, 115, 101, 114, 32, 114, 101, 110, 100, 101, 114,+ 101, 100, 32, 99, 114, 97, 119, 108, 101, 114, 32, 99, 111, 110, 116,+ 101, 110, 116,+ ]);+ document.title = fromCodes([+ 66, 114, 111, 119, 115, 101, 114, 32, 114, 101, 110, 100, 101, 114,+ 101, 100, 32, 116, 105, 116, 108, 101,+ ]);+ document.getElementById("app").replaceChildren(heading);+ }, 100);+ </script>+ </body>+</html>diff --git a/packages/e2e_tests/tests/workers/crawler.test.ts b/packages/e2e_tests/tests/workers/crawler.test.tsindex 534f9f2a..1bdef024 100644--- a/packages/e2e_tests/tests/workers/crawler.test.ts+++ b/packages/e2e_tests/tests/workers/crawler.test.ts@@ -67,6 +67,36 @@ describe("Crawler Tests", () => {).toBeDefined();});+ it("should crawl browser-rendered content", async () => {+ let { data: bookmark } = await client.POST("/bookmarks", {+ body: {+ type: "link",+ url: "http://nginx:80/browser-rendered.html",+ },+ });+ assert(bookmark);++ await waitUntil(async () => {+ const data = await getBookmark(bookmark!.id);+ assert(data);+ assert(data.content.type === "link");+ return data.content.crawledAt !== null;+ }, "Browser-rendered bookmark is crawled");++ bookmark = await getBookmark(bookmark.id);+ assert(bookmark && bookmark.content.type === "link");+ expect(bookmark.content.crawledAt).toBeDefined();+ expect(bookmark.content.htmlContent).toContain(+ "Browser rendered crawler content",+ );+ expect(bookmark.content.htmlContent).not.toContain("Static shell only");+ expect(bookmark.content.title).toContain("Browser rendered title");+ expect(bookmark.content.url).toBe("http://nginx:80/browser-rendered.html");+ expect(+ bookmark.assets.find((a) => a.assetType === "screenshot"),+ ).toBeDefined();+ });+it("image lings jobs be converted into images", async () => {let { data: bookmark } = await client.POST("/bookmarks", {body: {