
You Wrote 14 Playwright Scripts Just to Screenshot Your Own App
It started simple. One Playwright script to capture the homepage. const browser = await chromium . launch (); const page = await browser . newPage (); await page . goto ( ' https://myapp.com ' ); await page . screenshot ({ path : ' homepage.png ' }); await browser . close (); Then the team needed the pricing page. So I added another script. Then the dashboard (which needs login first). Then the settings page (which needs a specific tab clicked). Then mobile versions. Two months later I had 14 Playwright scripts. Some shared a login helper. Some had hardcoded waits. One had a try-catch that silently swallowed errors because the cookie banner sometimes loaded and sometimes didn't. I was maintaining a bespoke test suite, except it wasn't testing anything. It was just taking pictures. Config, not code Here's what those 14 scripts look like as config: { "hiddenElements" : { "myapp.com" : [ ".cookie-banner" , ".chat-widget" ] }, "screenshots" : [ { "name" : "homepage" , "url" : "https://myap
Continue reading on Dev.to
Opens in a new tab



