21 lines
775 B
TypeScript
21 lines
775 B
TypeScript
import { test, expect } from "@playwright/test";
|
|
|
|
test("/blog/[slug] returns 404 for non-existent slug", async ({ page }) => {
|
|
const response = await page.goto("/blog/this-slug-does-not-exist", {
|
|
waitUntil: "domcontentloaded",
|
|
});
|
|
expect(response?.status()).toBe(404);
|
|
});
|
|
|
|
test("/blog/[slug] for a real slug renders the article", async ({ page }) => {
|
|
// The mock blog repository is empty by default — so this test currently
|
|
// expects 404. When seeded data exists in Payload, replace 404 with 200
|
|
// and check for article.title in the page body.
|
|
test.skip(
|
|
true,
|
|
"Pending: seed a published article in Payload before enabling this test",
|
|
);
|
|
await page.goto("/blog/example-slug");
|
|
await expect(page.locator("h1").first()).toBeVisible();
|
|
});
|