
Stop hardcoding image URLs in your Storybook stories
If you've ever run Chromatic or Percy on a Storybook that pulls images from Lorem Picsum, you know the pain. Every snapshot run fetches a different image. Your baseline diffs never settle. You end up suppressing noise instead of catching real regressions. It's a slow leak that eventually makes your visual testing pipeline worthless. The fix is boring: use deterministic image URLs . Every run, same image. No surprises. The problem with random placeholder URLs Here's a typical story using Lorem Picsum: // ProductCard.stories.jsx export const Default = { args : { title : " Wireless Headphones " , price : " $79 " , image : " https://picsum.photos/400/300 " , // different image every time }, }; picsum.photos/400/300 serves a random photo on every request. That's fine for visual design work, but it means every snapshot run is comparing against a different image. Your visual diff tool flags the image as changed — because it is changed — and your team either ignores the alert or spends 10 minu
Continue reading on Dev.to React
Opens in a new tab


