b3a7f98e5a
CI / E2E Cloudflare (4/8) (push) Failing after 0s
CI / E2E Cloudflare (8/8) (push) Failing after 1s
CI / Lint (push) Failing after 1s
Auto Extract / Extract (push) Failing after 4s
CI / Version Check (push) Failing after 9s
CI / Integration Tests (push) Failing after 1s
CI / E2E tests (1/8) (push) Failing after 1s
CI / E2E tests (2/8) (push) Failing after 2s
CI / E2E tests (3/8) (push) Failing after 2s
CI / Browser Tests (push) Failing after 1s
CI / E2E tests (5/8) (push) Failing after 1s
CI / E2E Cloudflare (2/8) (push) Failing after 2s
CI / Typecheck (push) Failing after 1s
CI / Changeset Validation (push) Failing after 2s
CI / E2E Cloudflare (5/8) (push) Failing after 1s
CI / E2E Cloudflare (6/8) (push) Failing after 1s
CI / E2E Cloudflare (7/8) (push) Failing after 1s
CodeQL / Analyze (javascript-typescript) (push) Failing after 1s
Format / Format (push) Failing after 0s
CodeQL / Analyze (actions) (push) Failing after 4s
CI / E2E tests (4/8) (push) Failing after 1s
CI / E2E tests (6/8) (push) Failing after 1s
CI / E2E tests (7/8) (push) Failing after 2s
CI / E2E tests (8/8) (push) Failing after 1s
CI / E2E Cloudflare (1/8) (push) Failing after 1s
CI / E2E Cloudflare (3/8) (push) Failing after 2s
Preview Releases / Publish Preview (push) Failing after 0s
zizmor / Run zizmor (push) Failing after 1s
Release / Release (push) Failing after 2s
CI / Smoke Tests (push) Failing after 5m36s
CI / Tests (push) Failing after 6m36s
Release / Sync Templates (push) Has been skipped
CI / E2E Tests (push) Has been cancelled
115 lines
3.8 KiB
TypeScript
115 lines
3.8 KiB
TypeScript
/**
|
|
* Theme Marketplace E2E Tests
|
|
*
|
|
* Tests the theme marketplace admin pages:
|
|
* - Browse page at /themes/marketplace
|
|
* - Detail page at /themes/marketplace/{themeId}
|
|
*
|
|
* These tests run against a mock marketplace server (port 4445) that serves
|
|
* canned theme data.
|
|
*/
|
|
|
|
import { test, expect } from "../fixtures";
|
|
|
|
// URL patterns (module scope for e18e/prefer-static-regex)
|
|
const THEME_DETAIL_URL_PATTERN = /\/themes\/marketplace\/minimal-blog/;
|
|
const THEME_BROWSE_URL_PATTERN = /\/themes\/marketplace\/?$/;
|
|
|
|
test.describe("Theme Marketplace", () => {
|
|
test.beforeEach(async ({ admin }) => {
|
|
await admin.devBypassAuth();
|
|
});
|
|
|
|
test.describe("Browse page", () => {
|
|
test("renders theme cards", async ({ admin, page }) => {
|
|
await admin.goto("/themes/marketplace");
|
|
await admin.waitForShell();
|
|
await admin.waitForLoading();
|
|
|
|
// Wait for at least one theme to load
|
|
await expect(page.getByText("Minimal Blog").first()).toBeVisible({ timeout: 15000 });
|
|
await expect(page.getByText("Portfolio Pro").first()).toBeVisible();
|
|
});
|
|
|
|
test("theme cards show name, author, and description", async ({ admin, page }) => {
|
|
await admin.goto("/themes/marketplace");
|
|
await admin.waitForShell();
|
|
await admin.waitForLoading();
|
|
|
|
await expect(page.getByText("Minimal Blog").first()).toBeVisible({ timeout: 15000 });
|
|
|
|
// Author and description should be visible somewhere on the page
|
|
await expect(page.getByText("EmDash Labs").first()).toBeVisible();
|
|
await expect(page.getByText("A clean, minimal blog theme.")).toBeVisible();
|
|
});
|
|
|
|
test("search filters themes by name", async ({ admin, page }) => {
|
|
await admin.goto("/themes/marketplace");
|
|
await admin.waitForShell();
|
|
await admin.waitForLoading();
|
|
|
|
await expect(page.getByText("Minimal Blog").first()).toBeVisible({ timeout: 15000 });
|
|
|
|
// Search for something that doesn't match
|
|
const searchInput = page.getByPlaceholder("Search themes...");
|
|
await searchInput.fill("nonexistent-theme-xyz");
|
|
|
|
// Wait for debounce
|
|
await page.waitForTimeout(1000);
|
|
|
|
// Neither theme should match
|
|
await expect(page.getByText("Minimal Blog").first()).not.toBeVisible({ timeout: 5000 });
|
|
await expect(page.getByText("Portfolio Pro")).not.toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe("Theme detail page", () => {
|
|
test("navigates to detail page on click", async ({ admin, page }) => {
|
|
await admin.goto("/themes/marketplace");
|
|
await admin.waitForShell();
|
|
await admin.waitForLoading();
|
|
|
|
// Wait for themes to load, then click
|
|
const themeLink = page.locator("a", { hasText: "Minimal Blog" }).first();
|
|
await expect(themeLink).toBeVisible({ timeout: 15000 });
|
|
await themeLink.click();
|
|
|
|
// URL should include the theme ID
|
|
await expect(page).toHaveURL(THEME_DETAIL_URL_PATTERN, { timeout: 10000 });
|
|
});
|
|
|
|
test("detail page shows theme info", async ({ admin, page }) => {
|
|
await admin.goto("/themes/marketplace/minimal-blog");
|
|
await admin.waitForShell();
|
|
await admin.waitForLoading();
|
|
|
|
// Theme name (use first() for multiple h1s)
|
|
await expect(page.locator("h1").first()).toContainText("Minimal Blog", {
|
|
timeout: 15000,
|
|
});
|
|
|
|
// Author
|
|
await expect(page.getByText("EmDash Labs").first()).toBeVisible();
|
|
|
|
// Description
|
|
await expect(page.getByText("A clean, minimal blog theme.")).toBeVisible();
|
|
});
|
|
|
|
test("back link navigates to browse", async ({ admin, page }) => {
|
|
await admin.goto("/themes/marketplace/minimal-blog");
|
|
await admin.waitForShell();
|
|
await admin.waitForLoading();
|
|
|
|
await expect(page.locator("h1").first()).toContainText("Minimal Blog", {
|
|
timeout: 15000,
|
|
});
|
|
|
|
// Click back link
|
|
const backLink = page.locator("a", { hasText: "Themes" }).first();
|
|
await backLink.click();
|
|
|
|
await expect(page).toHaveURL(THEME_BROWSE_URL_PATTERN, { timeout: 10000 });
|
|
});
|
|
});
|
|
});
|