Rukon
Full-Stack Development3 min read

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.

By

TestingNext.jsPlaywrightAccessibilityCI

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?

FindingCauseFix
/work took 2.3 to 3.2 seconds per requestArticle counts re-ran a text projection over every article for every projectOne pass per day, cached (details)
Tall sections could stay invisibleThe scroll reveal waited for 15 % of an element to be visible, which a section taller than about six screens never reachesReveal on the first visible pixel; content also shows without JavaScript
Mobile menu stayed open after browser backIt closed only from a link's click handlerClose on any route change, on an outside tap, and return focus on Escape
Low contrast on small textTwo colour tokens were just under 4.5:1, worse on tinted panelsTokens adjusted to at least 4.5:1 in both themes
A sitemap URL redirectedAn alias redirect pointed the wrong wayRedirects now lead only to public URLs
Long inline code overflowed on phonesUnbreakable tokens in proseAllow inline code to wrap anywhere
Findings from the first runs, each fixed at its cause.

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.