mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 21:46:35 +00:00
test: update tests
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import { expect, test } from "playwright/test";
|
||||
import {
|
||||
opaquePng,
|
||||
transparentPng,
|
||||
tinyBase64,
|
||||
svgMarkup,
|
||||
pixelRow,
|
||||
svgMarkup,
|
||||
tinyBase64,
|
||||
transparentPng,
|
||||
} from "./helpers/fixtures";
|
||||
import {
|
||||
trackErrors,
|
||||
openTool,
|
||||
uploadImage,
|
||||
expectNoErrorAlert,
|
||||
expectNoErrors,
|
||||
openTool,
|
||||
trackErrors,
|
||||
uploadImage,
|
||||
} from "./helpers/page";
|
||||
|
||||
for (const [id, input] of [
|
||||
@@ -30,7 +30,7 @@ for (const [id, input] of [
|
||||
await openTool(page, id);
|
||||
await page.locator(".text-source textarea").fill(input);
|
||||
await page.getByRole("button", { name: "Render text" }).click();
|
||||
await expect(page.locator('img[alt="result"]')).toBeVisible();
|
||||
await expect(page.locator('img[alt="Result image"]')).toBeVisible();
|
||||
}).toPass({ timeout: 25_000 });
|
||||
await expectNoErrorAlert(page);
|
||||
expectNoErrors(sink);
|
||||
@@ -50,8 +50,8 @@ test("png-to-base64 shows decoded text result", async ({ page }) => {
|
||||
});
|
||||
|
||||
for (const [input, expected] of [
|
||||
[tinyBase64, "Yes — valid PNG signature."],
|
||||
["aGVsbG8=", "No — the content is not a PNG."],
|
||||
[tinyBase64, "Yes — this is a valid PNG signature."],
|
||||
["aGVsbG8=", "No — the signature does not match a PNG file."],
|
||||
] as const) {
|
||||
test(`verify-is-png verdict: ${expected}`, async ({ page }) => {
|
||||
await expect(async () => {
|
||||
@@ -67,7 +67,7 @@ test("png-is-transparent: opaque image → 'No'", async ({ page }) => {
|
||||
await openTool(page, "png-is-transparent");
|
||||
await uploadImage(page, opaquePng);
|
||||
await expect(page.locator(".verdict-text")).toContainText(
|
||||
"No — fully opaque.",
|
||||
"No — all pixels are fully opaque.",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ test("png-is-transparent: transparent image → 'Yes'", async ({ page }) => {
|
||||
await openTool(page, "png-is-transparent");
|
||||
await uploadImage(page, transparentPng);
|
||||
await expect(page.locator(".verdict-text")).toContainText(
|
||||
"Yes — has transparency.",
|
||||
"Yes — there are transparent or semi-transparent pixels.",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ test("png-is-grayscale: colored image → 'No'", async ({ page }) => {
|
||||
await openTool(page, "png-is-grayscale");
|
||||
await uploadImage(page, opaquePng);
|
||||
await expect(page.locator(".verdict-text")).toContainText(
|
||||
"No — contains colors.",
|
||||
"No — colored pixels were found.",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user