Testing a Portfolio Like a Production Application
This site now runs two checks against a started production build on every push: an HTTP crawl of routes, links, metadata, structured data, the feed and private terms, and a real-browser pass over clicks, the mobile menu, ten screen widths and accessibility. What they found on the first run.
Why test a portfolio at all?
A portfolio is read by the people deciding whether to hire or work with you. A project card that does nothing when clicked, a page that scrolls sideways on a phone, or a private name in a script costs more there than almost anywhere else. Typecheck, lint and a successful build say the code compiles; they say nothing about what a visitor gets.
What does the HTTP check cover?
npm run check:site starts from the sitemap of a running production build and fails on anything a visitor or a crawler would hit:
- every sitemap URL answers 200, with no duplicates and no private routes
- every internal link and image on every page resolves, with redirect loops and chains reported
- every page has a unique title, a description, a canonical URL matching itself, Open Graph and Twitter tags, and exactly one h1
- every JSON-LD block parses, the RSS feed is well formed and every item links to a page in the sitemap
- robots.txt names the sitemap and excludes the private routes; unknown URLs answer 404
- no protected term appears in any page, the feed, the sitemap, a redirect target or a browser JavaScript chunk
The protected terms are read at run time from the site's own confidentiality registry, so the check adds no new copy of them to the public repository.
What does the browser check cover?
npm run check:browser drives an installed Chrome or Edge through playwright-core, so CI downloads no browser. It loads pages at desktop and phone sizes and records console errors, uncaught exceptions, hydration warnings, failed requests, broken images and horizontal overflow. It runs a ten-width viewport matrix from 320 to 1920 pixels, clicks every project link on the homepage and the work page and asserts the page it lands on, exercises the mobile menu (navigation, Escape, outside tap, browser back and forward), the work filters and refresh, runs axe-core for WCAG 2 A and AA, and measures layout shift and JavaScript weight.
What did the first run find?
| Finding | Cause | Fix |
|---|---|---|
| /work took 2.3 to 3.2 seconds per request | Article counts re-ran a text projection over every article for every project | One pass per day, cached (details) |
| Tall sections could stay invisible | The scroll reveal waited for 15 % of an element to be visible, which a section taller than about six screens never reaches | Reveal on the first visible pixel; content also shows without JavaScript |
| Mobile menu stayed open after browser back | It closed only from a link's click handler | Close on any route change, on an outside tap, and return focus on Escape |
| Low contrast on small text | Two colour tokens were just under 4.5:1, worse on tinted panels | Tokens adjusted to at least 4.5:1 in both themes |
| A sitemap URL redirected | An alias redirect pointed the wrong way | Redirects now lead only to public URLs |
| Long inline code overflowed on phones | Unbreakable tokens in prose | Allow inline code to wrap anywhere |
What did the checks get wrong?
Several first failures were the tests, not the site, and each was fixed in the test rather than by loosening it. A comma-separated selector with an attribute filter appended only filtered its last part, so every click picked the first project. A case-insensitive match for a short acronym fired inside the word "afterthought". Contrast was measured while a fade-in was still running, so axe now runs with reduced motion. A browser restoring a page from its back-forward cache resolves the back action before the URL updates, so the test now waits for the URL.
Where do the checks run?
In CI on every push and pull request, after typecheck, lint, the confidentiality suite and the build, against the built site started on the runner. After a merge they run again against the live domain. The site is listed on the work page alongside the systems it describes.
Related
Keep reading
One Client Import Shipped Every Project to the Browser
A client component on this site imported one small value from a content module, and the bundler shipped the whole module, every project included, to every visitor. How it was found, why render-time hiding did not help, and the server-only boundary that now makes it a build error.
A Listing Page From 2.5 Seconds to 20 ms Without a Cache Layer
The work page on this site spent 2.3 to 3.2 seconds per request recomputing the same article projection fourteen times. Counting in one pass, computing the published list once per day, and rendering the cards on the server brought it to about 20 ms.
Google Sign-In Without a Client Library: Server-Side PKCE and Grants Read on Every Request
RPOMS added Google sign-in through its Supabase project's provider with no client library in the browser bundle. Google proves who someone is and grants nothing; a Super Admin grants access per service and capability, and revocation takes effect on the next request.