🐧 Linux TippsDebian 11 Long Term Support reaches end-of-life(31.08.2026 um 02:00 Uhr)
🕵️ SicherheitslückenUSN-8741-1: Flatpak vulnerabilities(10.09.2026 um 10:44 Uhr)
🕵️ SicherheitslückenUSN-8742-1: Netty vulnerability(10.09.2026 um 11:01 Uhr)
🕵️ SicherheitslückenUSN-8737-2: GNU C Library vulnerabilities(10.09.2026 um 13:25 Uhr)
🕵️ SicherheitslückenUSN-8743-1: PHP vulnerabilities(10.09.2026 um 13:48 Uhr)
🕵️ SicherheitslückenUSN-8744-1: Python vulnerabilities(10.09.2026 um 15:53 Uhr)
🐧 Linux TippsUSN-8748-1: Linux kernel (NVIDIA) vulnerabilities(10.09.2026 um 17:32 Uhr)
🕵️ SicherheitslückenUSN-8745-1: KissFFT vulnerabilities(10.09.2026 um 17:36 Uhr)
🕵️ SicherheitslückenUSN-8746-1: libEBML vulnerability(10.09.2026 um 17:48 Uhr)
🕵️ SicherheitslückenUSN-8747-1: Beets vulnerability(10.09.2026 um 17:56 Uhr)
🐧 Linux TippsDebian 11 Long Term Support reaches end-of-life(31.08.2026 um 02:00 Uhr)
🕵️ SicherheitslückenUSN-8741-1: Flatpak vulnerabilities(10.09.2026 um 10:44 Uhr)
🕵️ SicherheitslückenUSN-8742-1: Netty vulnerability(10.09.2026 um 11:01 Uhr)
🕵️ SicherheitslückenUSN-8737-2: GNU C Library vulnerabilities(10.09.2026 um 13:25 Uhr)
🕵️ SicherheitslückenUSN-8743-1: PHP vulnerabilities(10.09.2026 um 13:48 Uhr)
🕵️ SicherheitslückenUSN-8744-1: Python vulnerabilities(10.09.2026 um 15:53 Uhr)
🐧 Linux TippsUSN-8748-1: Linux kernel (NVIDIA) vulnerabilities(10.09.2026 um 17:32 Uhr)
🕵️ SicherheitslückenUSN-8745-1: KissFFT vulnerabilities(10.09.2026 um 17:36 Uhr)
🕵️ SicherheitslückenUSN-8746-1: libEBML vulnerability(10.09.2026 um 17:48 Uhr)
🕵️ SicherheitslückenUSN-8747-1: Beets vulnerability(10.09.2026 um 17:56 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 4 Min Lesezeit
0

Building CRUD API Suites (Playwright + TypeScript, Ch.13)

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

With — see

src/tests/api/articles-crud.spec.ts.






Unique data per test



Two tests creating an article titled "Test" collide on the slug. So we generate a

unique title — and therefore a unique slug — per test:




CODE
function uniqueTitle(prefix: string): string {
return `${prefix} ${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
}






This is the lightweight version of the per-test isolation we formalize in Part 4.






Create






CODE
test("create returns the new article with a generated slug", async ({ authedApi }) => {
const title = uniqueTitle("CRUD create");
const res = await authedApi.post("articles", {
data: {
article: { title, description: "made by a test", body: "body", tagList: ["api", "crud"] },
},
});
expect(res.ok()).toBeTruthy();

const { article } = await res.json();
expect(article.title).toBe(title);
expect(article.slug).toContain("crud-create-"); // server slugified the title
expect(article.tagList).toEqual(["api", "crud"]);
expect(article.author.username).toBe("playwright");

await authedApi.delete(`articles/${article.slug}`); // clean up
});









The quirk this caught



My first draft of the update and delete tests created an article without a

tagList. They failed — not in my test, in the API:




CODE
{ "errors": { "body": ["tagList is not iterable"] } }






Inkwell's create endpoint assumes tagList is always an array and never guards

against undefined. A client that omits it gets a 500-style error instead of a

clean validation message. This is exactly the kind of contract gap an API suite

exists to find
— invisible from the UI, which always sends the field. The fix in

our tests is to always send tagList (even []); the real fix would be a guard

in the API.





Update and delete



Update keeps the slug; delete makes the resource 404 afterward — both worth

asserting explicitly:




CODE
test("update changes fields without changing the slug", async ({ authedApi }) => {
const create = await authedApi.post("articles", {
data: { article: { title: uniqueTitle("CRUD update"), description: "old", body: "b", tagList: [] } },
});
const { article } = await create.json();

const res = await authedApi.put(`articles/${article.slug}`, {
data: { article: { description: "new description" } },
});
expect(res.ok()).toBeTruthy();

const updated = (await res.json()).article;
expect(updated.slug).toBe(article.slug); // slug is stable
expect(updated.description).toBe("new description");

await authedApi.delete(`articles/${article.slug}`);
});

test("delete removes the article (404 afterward)", async ({ authedApi }) => {
const create = await authedApi.post("articles", {
data: { article: { title: uniqueTitle("CRUD delete"), description: "d", body: "b", tagList: [] } },
});
const { article } = await create.json();

const del = await authedApi.delete(`articles/${article.slug}`);
expect(del.status()).toBe(200);

const after = await authedApi.get(`articles/${article.slug}`);
expect(after.status()).toBe(404); // really gone
});









Don't forget the negative path



Mutations are gated by auth. Prove the gate works — with the anonymous api

client, not authedApi:




CODE
test("create without a token is rejected", async ({ api }) => {
const res = await api.post("articles", {
data: { article: { title: "no auth", description: "d", body: "b" } },
});
expect(res.status()).toBe(401);
});









The pattern



Every test here: arrange (create unique data), act (the operation under

test), assert, clean up (delete). No shared state, no order dependence,

fully parallel. But notice the repetition — "log in, create an article, hand it to

the test, delete it after" shows up again and again. That boilerplate is begging to

become a fixture.






Next up



Chapter 14 — Scenario helpers: reusable provisioning. We extract "create an

article (and tear it down)" into a fixture/helper so tests start from the state they

need in one line — closing Part 3. Tag: ch-14.




Following along? Star the repo

and tell me the weirdest API quirk your tests have ever caught.


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
OpenAI GPT-6 Astra vs Anthropic Fable 5.1 vs Gemini 3.8 Flash
1 Quelle
Google Open-Sources Mantis: A Modular Skills Toolkit That Lets Coding Agents Find, Reproduce and Patch Vulnerabilities
1 Quelle
Text Watermarking in Python: Catch Whoever Copies Your Writing
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Building CRUD API Suites (Playwright + TypeScript, Ch.13)

Thematisch verwandte Begriffe: Building, CRUD, Suites, Playwright · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...