Release Barcode Tools 0.2.0
Verify / verify (push) Canceled after 0s

This commit is contained in:
2026-09-02 11:08:20 +02:00
parent 81677e1134
commit d94e03b81a
29 changed files with 1266 additions and 100 deletions
+88 -3
View File
@@ -34,17 +34,102 @@ test("generates an inert SVG and validates a GTIN", async ({ page }) => {
await page
.getByRole("textbox", { name: "Payload", exact: true })
.fill("browser-local barcode gate");
await page.getByRole("button", { name: "Generate", exact: true }).click();
await page
.getByRole("region", { name: "Scalable barcode" })
.getByRole("button", { name: "Generate", exact: true })
.click();
await expect(
page.getByRole("img", { name: "Generated barcode preview" }),
).toBeVisible();
await expect(page.getByText(/Vector bounds/u)).toBeVisible();
await page.getByRole("tab", { name: "GS1 helper" }).click();
await page.getByText("Print size and quiet-zone plan").click();
await expect(page.getByText(/Manual measurement required/u)).toBeVisible();
await page.getByRole("button", { name: "GS1 helper" }).click();
await expect(page.getByText("Batch / lot", { exact: true })).toBeVisible();
await expect(page.getByText("Serial", { exact: true })).toBeVisible();
await page.getByLabel("Complete GTIN").fill("4006381333931");
await expect(page.getByText("The check digit is valid.")).toBeVisible();
expect(external).toEqual([]);
});
test("requests camera permission only after the explicit start action", async ({
page,
}) => {
await page.addInitScript(() => {
const state = { requests: 0, stopped: false };
Object.defineProperty(window, "__barcodeCameraState", { value: state });
Object.defineProperty(navigator, "mediaDevices", {
configurable: true,
value: {
getUserMedia: async () => {
state.requests += 1;
const stream = document.createElement("canvas").captureStream(1);
for (const track of stream.getTracks()) {
const stop = track.stop.bind(track);
track.stop = () => {
state.stopped = true;
stop();
};
}
return stream;
},
},
});
Object.defineProperty(window, "BarcodeDetector", {
configurable: true,
value: class {
async detect() {
return [{ rawValue: "camera-local", format: "qr_code" }];
}
},
});
HTMLMediaElement.prototype.play = async () => undefined;
});
const external = await localOnly(page);
await page.goto("/deep/nested/barcode/");
await page.getByRole("button", { name: "Decode" }).click();
await expect
.poll(() =>
page.evaluate(
() =>
(
window as unknown as {
__barcodeCameraState: { requests: number };
}
).__barcodeCameraState.requests,
),
)
.toBe(0);
await page.getByRole("button", { name: "Start camera" }).click();
await expect(page.getByText("camera-local", { exact: true })).toBeVisible();
await expect
.poll(() =>
page.evaluate(
() =>
(
window as unknown as {
__barcodeCameraState: { requests: number };
}
).__barcodeCameraState.requests,
),
)
.toBe(1);
await page.getByRole("button", { name: "Stop camera" }).click();
await expect
.poll(() =>
page.evaluate(
() =>
(
window as unknown as {
__barcodeCameraState: { stopped: boolean };
}
).__barcodeCameraState.stopped,
),
)
.toBe(true);
expect(external).toEqual([]);
});
test("serves the release identity and hardened headers", async ({
request,
}) => {
@@ -57,7 +142,7 @@ test("serves the release identity and hardened headers", async ({
const manifest = await request.get("/deep/nested/barcode/toolbox-app.json");
await expect(manifest.json()).resolves.toMatchObject({
id: "de.add-ideas.barcode-tools",
version: "0.1.0",
version: "0.2.0",
entry: "./",
});
});