hasolidit-mcp 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +80 -0
- package/.mcp.json +10 -0
- package/.nvmrc +1 -0
- package/AGENTS.md +33 -0
- package/LICENSE +19 -0
- package/README.md +83 -0
- package/eslint.config.js +10 -0
- package/fixtures/AGENTS.md +25 -0
- package/fixtures/new-posts.html +3238 -0
- package/fixtures/search-results.html +1806 -0
- package/fixtures/thread.html +8792 -0
- package/package.json +25 -0
- package/playwright.config.ts +13 -0
- package/scripts/capture-fixtures.ts +44 -0
- package/src/browser.ts +26 -0
- package/src/index.ts +89 -0
- package/src/tools/new-posts.ts +82 -0
- package/src/tools/search.ts +111 -0
- package/src/tools/view-thread.ts +85 -0
- package/tests/AGENTS.md +32 -0
- package/tests/new-posts.test.ts +60 -0
- package/tests/search.test.ts +65 -0
- package/tests/test.ts +31 -0
- package/tests/view-thread.test.ts +61 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { test, expect } from "./test.ts";
|
|
2
|
+
|
|
3
|
+
// A known long-lived thread with multiple pages
|
|
4
|
+
const THREAD_URL =
|
|
5
|
+
"https://www.hasolidit.com/kehila/threads/%D7%94%D7%90%D7%9D-%D7%A2%D7%9C%D7%99-%D7%9C%D7%91%D7%A8%D7%95%D7%97-%D7%9E%D7%99%D7%A9%D7%A8%D7%90%D7%9C.34810/";
|
|
6
|
+
|
|
7
|
+
test.describe("view_thread", () => {
|
|
8
|
+
test("extracts posts from a thread", async ({ page }) => {
|
|
9
|
+
await page.goto(THREAD_URL);
|
|
10
|
+
await page.waitForSelector(".message--post", { timeout: 30000 });
|
|
11
|
+
|
|
12
|
+
// Thread title
|
|
13
|
+
const title = await page.locator("h1.p-title-value").textContent();
|
|
14
|
+
expect(title?.trim().length).toBeGreaterThan(0);
|
|
15
|
+
|
|
16
|
+
// Posts exist
|
|
17
|
+
const posts = page.locator("article.message--post");
|
|
18
|
+
const count = await posts.count();
|
|
19
|
+
expect(count).toBeGreaterThan(0);
|
|
20
|
+
|
|
21
|
+
// First post structure
|
|
22
|
+
const first = posts.first();
|
|
23
|
+
|
|
24
|
+
const author = await first
|
|
25
|
+
.locator("h4.message-name")
|
|
26
|
+
.textContent();
|
|
27
|
+
expect(author?.trim().length).toBeGreaterThan(0);
|
|
28
|
+
|
|
29
|
+
const timeEl = first.locator(".message-attribution-main time").first();
|
|
30
|
+
const datetime = await timeEl.getAttribute("datetime");
|
|
31
|
+
expect(datetime).toBeTruthy();
|
|
32
|
+
|
|
33
|
+
const content = await first
|
|
34
|
+
.locator(".message-body .bbWrapper")
|
|
35
|
+
.first()
|
|
36
|
+
.innerText();
|
|
37
|
+
expect(content.trim().length).toBeGreaterThan(0);
|
|
38
|
+
|
|
39
|
+
const postLink = first.locator("a.message-attribution-gadget");
|
|
40
|
+
const href = await postLink.getAttribute("href");
|
|
41
|
+
expect(href).toContain("/post-");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("pagination works", async ({ page }) => {
|
|
45
|
+
await page.goto(THREAD_URL);
|
|
46
|
+
await page.waitForSelector(".message--post", { timeout: 30000 });
|
|
47
|
+
|
|
48
|
+
// This thread should have multiple pages
|
|
49
|
+
const pageNav = page.locator(".pageNav-page");
|
|
50
|
+
const pageCount = await pageNav.count();
|
|
51
|
+
expect(pageCount).toBeGreaterThan(1);
|
|
52
|
+
|
|
53
|
+
// Navigate to page 2
|
|
54
|
+
const page2Url = THREAD_URL.replace(/\/$/, "") + "/page-2";
|
|
55
|
+
await page.goto(page2Url);
|
|
56
|
+
await page.waitForSelector(".message--post", { timeout: 30000 });
|
|
57
|
+
|
|
58
|
+
const posts = page.locator("article.message--post");
|
|
59
|
+
expect(await posts.count()).toBeGreaterThan(0);
|
|
60
|
+
});
|
|
61
|
+
});
|