testing
Technical notes on web development, DevOps, and AI integration.
83 articles
- 20:10backend
A Past Schedule Publishes Now: Three CMS Scheduling Contracts
Two parity assertions showed a past scheduled_at publishing instantly and a future event_date only setting sort order.
TL;DR: A parity test showed a past scheduled_at gets published instantly in the POST response, so there's no cron worker; treat published as derived from the current time. A future event_date still publishes immediately, proving it only controls sort order, not visibility. Keep both fields separate and trust the admin response for effective status.
#cms#scheduling#wordpress - 17:04testing
Five Stale Baselines at Once: Regeneration Is a Decision
Five hard failures at once on the public pages, all visual baselines. When --update-snapshots is safe, and when it silently blesses a broken render.
TL;DR: Five visual failures on the public pages looked like stale baselines after recent UI changes, but blind regeneration would lock in any shipped bugs. Regenerate in the same environment as CI with an explicit mode, then review changed PNGs like a code diff to catch unintended layout shifts. A visual baseline is an executable spec, so unreviewed updates remove oversight rather than fix tests.
#playwright#testing#qa - 15:43testing
The E2E Suite Went Green While Every Route Reported MISS
A routing crawl passed while all 26 routes printed MISS. Calling a Playwright locator method directly is not an assertion, and adversarial runs exposed the rest.
TL;DR: The suite passed because locator.toBeAttached() resolves instantly without asserting, so all 26 routes checked nothing. Wrapping it in expect() with a 45-second timeout fixed it; Radix dropdown items exist only while open, so anchor on the trigger button. Lesson: green proves selectors matched, not that pages work—break tests on purpose to confirm they can fail.
#playwright#testing#e2e - 14:56testing
The Route Smoke Test That Stopped at Status 200
The crawl test was all green because every route returned 200, while the pages I opened were empty shells. The fix: one key element per route.
TL;DR: A route returning 200 doesn't prove the page rendered; empty shells pass too. The fix is a key-element map: each route gets one Playwright locator that must actually attach, using expect assertions, toBeAttached, and locator.or for multiple render states. This catches broken renders early and doubles as self-updating documentation.
#playwright#testing#qa - 14:40testing
Three Interactions Tested Without Writing a Single Row
Testing empty-form validation, the back button, and the filter without writing a single row, plus two Playwright locator traps and the Radix portal.
TL;DR: The three most fragile interactions on a shared CMS editor form—validation, back navigation, filtering—test fine on a completely empty form, no data writes needed. Two Playwright traps surfaced: a back button lacking a button role, and shadcn Select options portaled to the body, breaking selectOption(). Non-mutating tests run anywhere without cleanup, leaving data-writing tests for real flows.
#playwright#testing#qa - 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 - 12:12frontend
A Video Description Box With a Show More That Earns Its Place
A three-line clamp plus a post-mount overflow measurement keeps the show-more toggle honest: it renders only when text is truly cut.
TL;DR: KotaPortal's video descriptions could grow so long that Like and Share buttons fell below the fold. Instead of truncating by character count, the component clamps text to three lines with Tailwind's line-clamp-3, then measures scrollHeight against clientHeight after mount to show a toggle only when needed. The "Deskripsi" label was dropped since the box and toggle make it redundant.
#react#css#tailwindcss - 17:05testing
Retired Terms Must Stay Retired After a Rebrand
A rebrand is a per-surface decision list: five string surfaces, two entries that must not change, and a legacy-guard test that keeps retired terms retired.
TL;DR: Renaming Duta Muda and Jelajah Kota to PESONA meant mapping five surfaces—copy, SEO metadata, admin labels, wordmark, and database rows—instead of a blind find-and-replace. Exceptions like contact emails, a deferred site title, and archived documents stayed untouched. A legacy-guard test with negative assertions keeps retired terms from creeping back in.
#testing#vitest#nextjs