Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/jhroemer/jhroemer.github.io. My personal website jensroemer.com
Something went wrong. Try again.
2.5 kB · 93 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394import { test, expect, type Page } from "@playwright/test";import GET_https_public_api_bsky_app_xrpc_app_bsky_feed_getPo_post_2F3ljphoefymc2l_ZS1KSLN from "./mocks/GET_https_public.api.bsky.app_xrpc_app.bsky.feed.getPo.post%2F3ljphoefymc2l_ZS1KSLN";
export const setupFixtures = async ( page: Page, fixtures: { url: string; response: unknown }[]) => { await Promise.all( fixtures.map(async (fixture) => { await page.route(fixture.url, async (route) => { await route.fulfill({ json: fixture.response }); }); }) );};
test("Root page", async ({ page }) => { await page.emulateMedia({ colorScheme: "light" });
await page.goto("/", { waitUntil: "networkidle", });
await expect(page).toHaveScreenshot("root-light.png");
await page.emulateMedia({ colorScheme: "dark" });
await expect(page).toHaveScreenshot("root-dark.png");});
test("About page", async ({ page }) => { await page.emulateMedia({ colorScheme: "light" });
await page.goto("/about", { waitUntil: "networkidle", });
await expect(page).toHaveScreenshot("about-light.png");
await page.emulateMedia({ colorScheme: "dark" });
await expect(page).toHaveScreenshot("about-dark.png");});
test("Blog/writing page", async ({ page }) => { await page.emulateMedia({ colorScheme: "light" });
await page.goto("/writing", { waitUntil: "networkidle", });
await expect(page).toHaveScreenshot("blog-light.png");
await page.emulateMedia({ colorScheme: "dark" });
await expect(page).toHaveScreenshot("blog-dark.png");});
test("Projects page", async ({ page }) => { await page.emulateMedia({ colorScheme: "light" });
await page.goto("/projects", { waitUntil: "networkidle", });
await expect(page).toHaveScreenshot("projects-light.png");
await page.emulateMedia({ colorScheme: "dark" });
await expect(page).toHaveScreenshot("projects-dark.png");});
test("Blog comments", async ({ page }) => { setupFixtures(page, [ GET_https_public_api_bsky_app_xrpc_app_bsky_feed_getPo_post_2F3ljphoefymc2l_ZS1KSLN, ]);
await page.emulateMedia({ colorScheme: "light" });
await page.goto("/writing/jheys-exploding-layers", { waitUntil: "networkidle", });
await page.evaluate(() => { window.scrollTo(0, document.body.scrollHeight); });
await expect(page).toHaveScreenshot("blog-comments-light.png");
await page.emulateMedia({ colorScheme: "dark" });
await expect(page).toHaveScreenshot("blog-comments-dark.png");});