e2e
Technical notes on web development, DevOps, and AI integration.
10 articles
- 14:25testing
Vertical E2E in Three Layers: a Green Toast Proves Nothing
One Playwright flow through three layers: the UI action, the database row via docker exec, then the search API, with permanent cleanup inside the test.
TL;DR: A green UI test once hid a failed database write because the API returned success before the commit finished. Vertical tests fix this: one Playwright flow checks the UI, the actual database row, and the search API. Each test creates its own data and deletes it, so failures point to the exact broken layer.
#playwright#testing#e2e - 13:15testing
The Artifacts Folder Was Empty After a CI Failure
One suite, two recordings: trace and video retain-on-failure as failure evidence, and a tour spec that records on purpose even when tests pass.
TL;DR: The Playwright config was set to record traces only on first retry, but retries defaulted to zero, so failed tests left no artifacts. Switching to retain-on-failure for traces and videos keeps evidence only for failures without bloating the suite. Proving it works means deliberately breaking a test and checking test-results.
#playwright#testing#e2e - 06:00testing
Catching leaked E2E rows with test.afterAll
An afterAll safety net for E2E rows left behind when a test times out: identity unique per worker, a sweep limited to owned and stale rows, idempotent delete.
TL;DR: A timed-out test skipped its DELETE step, leaving a stale row in the admin grid despite a passing spec. The fix adds an afterAll hook that cleans up rows even when tests fail or time out. It targets only this run's rows to avoid deleting data from other workers.
#playwright#testing#e2e - 19:06security
The Masked Public Roster: Ship Names, Not Phone Numbers
Hiding sensitive columns in the UI is not protection. The real mask lives in the API layer, proven by negative E2E assertions.
TL;DR: The article describes a common flaw where the UI hides sensitive fields but the API still sends full records to the client, violating OWASP API3:2023 and Indonesia's data minimization rules. The fix strips fields server-side via a projection DTO containing only public data. A Playwright test enforces negative assertions, ensuring PII never reaches the DOM.
#privacy#security#playwright - 18:56testing
A 192-Page Crawl, One 404, One Wrong Citation
An internal link-audit crawler in Playwright: static seeds, dynamic discovery, and a wrong citation in the commit message replaced by verified sources.
TL;DR: A Playwright-based crawler hit one dynamic 404: a slug containing an apostrophe got double-encoded, breaking the URL before it reached the router. The cited Next.js issue was a false reference, so MDN docs and issue #89879 became the real evidence. Final tally: 192 pages, zero hard-broken links, fix scheduled separately.
#playwright#e2e#nextjs - 17:57testing
Why My Login Assertion Never Failed
A URL assertion in the admin login fixture looked safe and could never fail: the route is identical before and after login. Swap it for a post-login marker.
TL;DR: The login helper asserted the URL was /admincms, but that route shows both before and after login so the check always passed. Playwright's auto-retry couldn't save it since the condition was true from the start. Replacing it with a check for the admin-user-chip, visible only after a valid session, lets the test correctly fail on bad credentials.
#playwright#e2e#testing - 16:46testing
Fixture First: Writing the Login Helper Before Any Spec
One login helper and one evidence helper written before the first spec that needs them, and why getByLabel needs exact: true on this admin form.
TL;DR: Task 0 required building reusable Playwright helpers before any specs, enforcing short behavior-focused tests. loginAsAdmin uses real user-facing selectors like getByLabel with exact true and getByRole instead of test ids to avoid mismatches. A simple screenshot helper centralizes evidence and the team deferred faster storageState auth to keep tests isolated for now.
#playwright#e2e#testing - 13:27testing
The Test That Counts Requests, Not Pixels
A Playwright test that intercepts network traffic to prove a form blocks submission client-side, plus a date-filter edge case that almost slipped through.
TL;DR: The test checks that submitting without a service pillar shows an inline error and sends no network request, verified via Playwright route interception. It fills all other fields and handles dev-only login plus a required phone setup wizard beforehand. It also adds coverage for a date filter edge case, ensuring today-to-today includes today using an exclusive bound the next day.
#playwright#testing#e2e - 08:17testing
Admin E2E: Testing Role and Bidang Guards Through the UI
Three Playwright specs for the admin area: login through the real UI, CRUD down to permanent delete with API verification, and role/bidang guards tested up to the server's 403.
TL;DR: We moved admin E2E tests beyond happy paths to guardrails, logging in via UI and reusing the localStorage token. It covers full CRUD in the Tiptap editor and trash flow, verifying permanent deletes via API not just UI. It also validates authorization, hiding user management from editors and blocking bidang users with a 403.
#playwright#e2e#testing