дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 17:21:13 +02:00
A Playwright project had no test tree and no Rerun Failed Tests: its output went through the Jest / Vitest parser, single tests ran with Jest's `-t`, and projects without a `test` script weren't detected at all. - Detection: a `package.json` script that runs `playwright test` is a test configuration and records `testRunner: "playwright"` (new optional `RunExtras.test_runner`, `test-runner` in `run.toml`); a package with a `playwright.config.*` that no script runs gets `npx playwright test`. - Test tree: test runs add `--reporter=list` unless a reporter is named, parsed into file › [project] › describe chain › test with status, duration, location and failure details. - Gutter: `test.describe` blocks and `fixme` / `fail` / `serial` tests get run / debug icons and run by declaration line (`file:line`); in a project with Playwright and another runner, specs run on Playwright's configuration and other tests on the other runner's. - Rerun Failed Tests / run selected tests: the files plus `--grep` on the describe chain and title, with `--project` when the run named projects. New fixture `fixtures/playwright-app`; `smoke/run.test.ts` runs it after `ts-app`. Co-authored-by: wildcatDownstairs <[email protected]>
37 рядки
1013 B
TypeScript
37 рядки
1013 B
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { applyCoupon, shipping, subtotal, type Line } from "../src/checkout.ts";
|
|
|
|
const mug: Line = { sku: "mug", price: 12, quantity: 2 };
|
|
const lamp: Line = { sku: "lamp", price: 40, quantity: 1 };
|
|
|
|
test.describe("checkout", () => {
|
|
test("adds up the lines", () => {
|
|
expect(subtotal([mug, lamp])).toBe(64);
|
|
});
|
|
|
|
test.describe("shipping", () => {
|
|
test("is free from 50", () => {
|
|
expect(shipping([mug, lamp])).toBe(0);
|
|
});
|
|
|
|
test("is a flat rate below 50", () => {
|
|
expect(shipping([mug])).toBe(4.99);
|
|
});
|
|
});
|
|
|
|
test("intentionally fails (set OPENIDEA_FAIL=1)", () => {
|
|
test.skip(!process.env.OPENIDEA_FAIL, "set OPENIDEA_FAIL=1");
|
|
expect(shipping([lamp])).toBe(0);
|
|
});
|
|
});
|
|
|
|
test.describe("coupons", () => {
|
|
test("halves the total", () => {
|
|
expect(applyCoupon(64, "HALF")).toBe(32);
|
|
});
|
|
|
|
test("rejects unknown codes", () => {
|
|
expect(() => applyCoupon(64, "NOPE")).toThrow("unknown coupon");
|
|
});
|
|
});
|