Test a component with the worst real data
Demo data is written to look good. Real data has a 40-letter surname, an email with no place to break, no avatar, zero rows and a count in the millions. A component is done when it survives those.
1. Find what it takes
Read the component and where its data comes from: each field, its type, whether it can be missing, and what the person does in it (a button, a link). Note the widths the project supports; with none stated, use 390 and 1280.
2. Write the worst cases for each field
Pick only what the field can really receive:
- text: empty, one character, 80 characters with spaces, 60 with none (
averyveryverylong…@example.com), right-to-left text, emoji - missing: the field absent,
null, an empty string - images: no URL, a URL that 404s, a very tall or wide image
- numbers: 0, 1, 1,234,567, negative if it can be, a long decimal
- lists: none, one, many (enough to scroll)
- dates: today, years ago, missing
Write them as one or more data files in the component's own format, next to the demo data. Keep the demo data unchanged.
3. Render and measure
Load the real component with each data set at both widths, in a headless browser (Playwright). Measure, don't eyeball:
js// inside page.evaluate, for each card or row element `el` const box = el.getBoundingClientRect(); const over = [...el.querySelectorAll('*')].filter((c) => c.getBoundingClientRect().right > box.right + 1); const pageScroll = document.documentElement.scrollWidth > innerWidth; const broken = [...document.images].filter((i) => i.complete && i.naturalWidth === 0); const words = document.body.innerText.match(/\b(?:undefined|null|NaN)\b|\[object Object\]/g);
Also check plurals ("1 tasks"), number formatting, an empty list that shows nothing, and a button pushed out of view. Take a screenshot of each failing case. Every failure goes on a list with its data set and width.
4. Fix the component
Fix in the component and its styles, never by trimming the data:
- long text:
min-width: 0on flex children, then wrap (overflow-wrap: anywherefor emails and URLs) or truncate with the full value intitle; keep actions on screen - missing image: a fallback (initials or a placeholder) on missing URL and on
error - missing field: leave it out or show a dash, never the raw
undefined - counts:
Intl.NumberFormatandIntl.PluralRules, or the project's own helpers - empty list: a line that says so, and the next action if there is one
Change only what a measured failure needs; keep the component's look with the demo data.
5. Measure again
Rerun every data set at both widths, plus the demo data. All checks from step 3 must pass, and the demo must look as before. Leave the worst-case data files and the script in the repo if it has a place for tests.
Finish
Copybook's notes for the agent:
- Report a table: data set, width, what broke, the fix, and the result after. Attach the before and after screenshots of the worst one.
- "The demo looks fine" is the reason to run this, not a reason to stop early.
- Say what you did not try: other languages, zoom at 200%, a screen reader.
Based on emilkowalski/skills (MIT), rewritten by Copybook.


