mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(docs): Two-Doors home, otter-orange brand, Pagefind search, and enterprise SSO/SCIM/roles guides
Docs site redesign: Two-Doors home, otter-orange brand, Pagefind search, enterprise SSO/SCIM/roles guides.
This commit is contained in:
@@ -1,75 +1,41 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Docs Homepage", () => {
|
||||
test.describe("docs homepage (Two Doors)", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/");
|
||||
});
|
||||
|
||||
test("page loads with correct title", async ({ page }) => {
|
||||
test("title contains SnapOtter", async ({ page }) => {
|
||||
await expect(page).toHaveTitle(/SnapOtter/);
|
||||
});
|
||||
|
||||
test("hero renders site name and tagline", async ({ page }) => {
|
||||
await expect(page.getByText("SnapOtter").first()).toBeVisible();
|
||||
await expect(page.getByText("Self-Hosted File Toolkit")).toBeVisible();
|
||||
test("hero renders eyebrow, name, and value prop", async ({ page }) => {
|
||||
await expect(page.getByRole("heading", { name: "SnapOtter Documentation" })).toBeVisible();
|
||||
await expect(page.getByText("Self-hosted", { exact: false }).first()).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("157 tools for image, video, audio, PDF, and data processing"),
|
||||
page.getByText("running entirely on your hardware", { exact: false }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("hero renders action buttons", async ({ page }) => {
|
||||
const getStarted = page.getByRole("link", { name: "Get started", exact: true });
|
||||
await expect(getStarted).toBeVisible();
|
||||
await expect(getStarted).toHaveAttribute("href", /getting-started/);
|
||||
|
||||
const apiRef = page.getByRole("link", { name: "API reference", exact: true });
|
||||
await expect(apiRef).toBeVisible();
|
||||
await expect(apiRef).toHaveAttribute("href", /\/api\/rest/);
|
||||
});
|
||||
|
||||
test("features section renders all 6 feature cards", async ({ page }) => {
|
||||
const features = [
|
||||
"157 Tools, 5 Modalities",
|
||||
"Local AI",
|
||||
"Pipelines",
|
||||
"REST API",
|
||||
"File Library",
|
||||
"Teams & Access Control",
|
||||
];
|
||||
for (const feature of features) {
|
||||
await expect(page.getByRole("heading", { name: feature }).first()).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("Docker quick-start code block is visible", async ({ page }) => {
|
||||
test("hero shows the quick-start docker command", async ({ page }) => {
|
||||
await expect(page.getByText("docker run", { exact: false }).first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Docs Navbar", () => {
|
||||
test("renders nav links", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.getByRole("link", { name: "Guide" }).first()).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: "API Reference" }).first()).toBeVisible();
|
||||
test("renders both audience doors and a sample link in each", async ({ page }) => {
|
||||
await expect(page.getByRole("heading", { name: "Self-hosting" })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Enterprise" })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: "Quick start" })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: "SCIM provisioning" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Guide nav link navigates to getting-started", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
test("renders the modality strip with counts", async ({ page }) => {
|
||||
await expect(page.getByText("157 tools across 5 modalities")).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /Image/ })).toBeVisible();
|
||||
});
|
||||
|
||||
test("nav links work", async ({ page }) => {
|
||||
await expect(page.getByRole("link", { name: "Guide" }).first()).toBeVisible();
|
||||
await page.getByRole("link", { name: "Guide" }).first().click();
|
||||
await expect(page).toHaveURL(/getting-started/);
|
||||
await expect(page.getByRole("heading", { name: "Getting Started" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("API Reference nav link navigates to REST API", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.getByRole("link", { name: "API Reference" }).first().click();
|
||||
await expect(page).toHaveURL(/\/api\/rest/);
|
||||
await expect(page.getByText("REST API Reference")).toBeVisible();
|
||||
});
|
||||
|
||||
test("logo links back to homepage", async ({ page }) => {
|
||||
await page.goto("/guide/getting-started");
|
||||
await page.locator(".VPNavBarTitle a, .title a").first().click();
|
||||
await expect(page).toHaveURL("/");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,39 +1,23 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.describe("Docs Search", () => {
|
||||
test.describe("docs search (Pagefind)", () => {
|
||||
test("search button is visible", async ({ page }) => {
|
||||
await page.goto("/guide/getting-started");
|
||||
const searchButton = page.locator(
|
||||
".VPNavBarSearch button, .DocSearch-Button, button[aria-label*='Search'], .VPNavBarSearchButton button",
|
||||
);
|
||||
await expect(searchButton.first()).toBeVisible();
|
||||
await page.goto("/");
|
||||
await expect(page.locator(".blog-search").first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("clicking search opens search dialog", async ({ page }) => {
|
||||
await page.goto("/guide/getting-started");
|
||||
const searchButton = page.locator(
|
||||
".VPNavBarSearch button, .DocSearch-Button, button[aria-label*='Search'], .VPNavBarSearchButton button",
|
||||
);
|
||||
await searchButton.first().click();
|
||||
await expect(
|
||||
page.locator(".VPLocalSearchBox, .DocSearch-Modal, [role='dialog']").first(),
|
||||
).toBeVisible();
|
||||
test("clicking search opens the dialog with an input", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.locator(".blog-search").first().click();
|
||||
await expect(page.locator('input[placeholder="Search Docs"]')).toBeVisible();
|
||||
});
|
||||
|
||||
test("typing in search shows results", async ({ page }) => {
|
||||
await page.goto("/guide/getting-started");
|
||||
const searchButton = page.locator(
|
||||
".VPNavBarSearch button, .DocSearch-Button, button[aria-label*='Search'], .VPNavBarSearchButton button",
|
||||
);
|
||||
await searchButton.first().click();
|
||||
const searchInput = page
|
||||
.locator(".VPLocalSearchBox input, .DocSearch-Input, [role='dialog'] input")
|
||||
.first();
|
||||
await searchInput.fill("docker");
|
||||
const results = page.locator(
|
||||
".VPLocalSearchBox .result, .DocSearch-Hits, [role='dialog'] .result, [role='listbox'] [role='option']",
|
||||
);
|
||||
await expect(results.first()).toBeVisible({ timeout: 5000 });
|
||||
test("typing a query shows results", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.locator(".blog-search").first().click();
|
||||
const input = page.locator('input[placeholder="Search Docs"]');
|
||||
await input.fill("docker");
|
||||
await expect(page.locator('[role="option"]').first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,16 +32,21 @@ test.describe("Theme Toggle", () => {
|
||||
|
||||
test("clicking theme toggle changes appearance", async ({ page }) => {
|
||||
await page.goto("/guide/getting-started");
|
||||
const initialClass = await page.locator("html").getAttribute("class");
|
||||
const html = page.locator("html");
|
||||
const initialClass = await html.getAttribute("class");
|
||||
const wasDark = initialClass?.includes("dark") ?? false;
|
||||
|
||||
await page.evaluate(() => {
|
||||
const btn = document.querySelector('button[role="switch"].VPSwitchAppearance');
|
||||
if (btn) (btn as HTMLElement).click();
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
// Click the visible toggle inside our custom nav area (the hidden default
|
||||
// VPNavBarAppearance is first in DOM order, so a bare querySelector would
|
||||
// hit it instead). Playwright's click auto-waits for hydration.
|
||||
await page.locator('.nav-bar-right button[role="switch"]').click();
|
||||
|
||||
const newClass = await page.locator("html").getAttribute("class");
|
||||
expect(newClass).not.toBe(initialClass);
|
||||
// Assert the dark class actually toggled
|
||||
if (wasDark) {
|
||||
await expect(html).not.toHaveClass(/dark/);
|
||||
} else {
|
||||
await expect(html).toHaveClass(/dark/);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ test.describe("Docs Sidebar - Guide Section", () => {
|
||||
"Getting started",
|
||||
"Architecture",
|
||||
"Configuration",
|
||||
"SAML SSO",
|
||||
"SCIM Provisioning",
|
||||
"Users, Roles & Permissions",
|
||||
"Database",
|
||||
"Deployment",
|
||||
"Docker tags",
|
||||
|
||||
Reference in New Issue
Block a user