Files
HKSingleParty/99_references/voyager-main/e2e/community-feed.spec.ts
2025-05-28 09:55:51 +08:00

31 lines
822 B
TypeScript

import { test, expect } from "@playwright/test";
import { posts } from "./testdata/posts";
test("load community posts", async ({ page }) => {
await page.route("*/**/api/v3/post/list**", async (route) => {
await route.fulfill({ json: { posts } });
});
await page.goto("/");
await page.waitForURL("/posts/lemmy.world/all");
await expect(page).toHaveTitle("Voyager for Lemmy");
await expect(page.getByText(posts[0].post.name)).toBeVisible();
});
test("navigate to post on click", async ({ page }) => {
await page.route("*/**/api/v3/post/list**", async (route) => {
await route.fulfill({ json: { posts } });
});
await page.goto("/");
await page.getByText(posts[0].post.name).click();
await expect(page).toHaveURL(
"/posts/lemmy.world/c/community_1@test.lemmy/comments/999",
);
});