Files
SnapOtter/tests/qa/smoke.qa.spec.ts
T
SnapOtterandGitHub d8cf979d4b fix: resolve 18 QA-discovered bugs across tools, previews, and the AI pipeline (#242)
Exhaustive QA sweep of all 157 tools. Fixes: CSP blob media, csv-excel ExcelJS interop, ocr-pdf segfault, chart-maker upload, non-PDF doc preview, RAW decode, merge-tool multi-file path, html-to-image chromium, ogv/wma/amr/ac3 preview fallbacks, meme/gif/stabilize codecs, nav+home a11y. Plus orphan-format and test-debt cleanup, the AI bundle build script, and a reusable Playwright QA harness under tests/qa/.
2026-06-15 22:26:24 +08:00

68 lines
2.4 KiB
TypeScript

import { expect, test } from "@playwright/test";
import {
assertAudioPreview,
assertDocumentPreview,
assertImageRendered,
assertNoBrokenImages,
assertVideoPreview,
downloadResult,
fixture,
gotoTool,
imageInfo,
instrument,
isClean,
issuesSummary,
magicMatches,
processTool,
uploadFiles,
} from "./qa-helpers";
// Harness smoke: validates upload, per-modality preview oracles, processing,
// download + decode verification, and the console instrument against the live
// QA container. Also satisfies the Phase 0 "one tool per modality" smoke.
test("image: resize round-trip, previews, dimension oracle", async ({ page }) => {
const issues = instrument(page);
await gotoTool(page, "resize");
await uploadFiles(page, fixture("formats", "sample.png"));
await assertNoBrokenImages(page);
await page.locator("#resize-width").fill("64");
const res = await processTool(page, "resize", "fast");
expect(res.ok, res.error).toBe(true);
await assertImageRendered(page, "Processed", "resize output");
const dl = await downloadResult(page, "resize");
expect(dl.size).toBeGreaterThan(0);
const dims = imageInfo(dl.path);
expect(dims.width, "resized width applied").toBe(64);
expect(isClean(issues), issuesSummary(issues)).toBe(true);
});
test("image: convert png -> webp, magic-byte oracle", async ({ page }) => {
await gotoTool(page, "convert");
await uploadFiles(page, fixture("formats", "sample.png"));
await assertNoBrokenImages(page);
await page.locator("#convert-target-format").selectOption("webp");
const res = await processTool(page, "convert", "fast");
expect(res.ok, res.error).toBe(true);
const dl = await downloadResult(page, "convert");
expect(magicMatches(dl.buf, "webp"), `expected webp, got ${dl.name}`).toBe(true);
});
test("video: input preview decodes (tiny.mp4)", async ({ page }) => {
await gotoTool(page, "convert-video");
await uploadFiles(page, fixture("media", "tiny.mp4"));
await assertVideoPreview(page);
});
test("audio: input waveform ready (tiny.mp3)", async ({ page }) => {
await gotoTool(page, "convert-audio");
await uploadFiles(page, fixture("media", "tiny.mp3"));
await assertAudioPreview(page);
});
test("document: pdf input preview renders (tiny.pdf)", async ({ page }) => {
await gotoTool(page, "rotate-pdf");
await uploadFiles(page, fixture("documents", "tiny.pdf"));
await assertDocumentPreview(page);
});