Files
clawhub/e2e/upload-auth-smoke.pw.test.ts
Val Alexander deb592d4ce docs: update repository guidelines and improve formatting across multiple files
- Enhanced AGENTS.md with clearer project structure and development commands.
- Updated CHANGELOG.md to reflect recent fixes and additions.
- Improved formatting in CONTRIBUTING.md for better readability.
- Adjusted package.json and configuration files for consistent command structure.
- Refined README.md and VISION.md for clarity and organization.
- Standardized code formatting in various TypeScript files for consistency.

These changes aim to enhance documentation clarity and maintainability across the repository.
2026-03-18 21:56:01 -05:00

49 lines
1.8 KiB
TypeScript

import { stat } from "node:fs/promises";
import { expect, test } from "@playwright/test";
import { expectHealthyPage, trackRuntimeErrors } from "./helpers/runtimeErrors";
async function hasAuthStorageState() {
const path = process.env.PLAYWRIGHT_AUTH_STORAGE_STATE?.trim();
if (!path) return null;
try {
const file = await stat(path);
return file.isFile() ? path : null;
} catch {
return null;
}
}
test("authenticated upload preflight stays healthy", async ({ browser, baseURL }) => {
const storageState = await hasAuthStorageState();
test.skip(!storageState, "Set PLAYWRIGHT_AUTH_STORAGE_STATE to run authenticated smoke.");
if (!storageState) return;
const context = await browser.newContext({ baseURL, storageState });
const page = await context.newPage();
const errors = trackRuntimeErrors(page);
await page.goto("/upload?updateSlug=gifgrep", { waitUntil: "domcontentloaded" });
await expect(page.getByRole("heading", { name: /publish a skill/i })).toBeVisible();
await expect(page.locator("#slug")).toHaveValue("gifgrep");
await expectHealthyPage(page, errors);
await context.close();
});
test("authenticated import preflight stays healthy", async ({ browser, baseURL }) => {
const storageState = await hasAuthStorageState();
test.skip(!storageState, "Set PLAYWRIGHT_AUTH_STORAGE_STATE to run authenticated smoke.");
if (!storageState) return;
const context = await browser.newContext({ baseURL, storageState });
const page = await context.newPage();
const errors = trackRuntimeErrors(page);
await page.goto("/import", { waitUntil: "domcontentloaded" });
await expect(page.getByRole("heading", { name: "Import from GitHub" })).toBeVisible();
await expect(page.getByPlaceholder("owner/repo")).toBeVisible();
await expectHealthyPage(page, errors);
await context.close();
});