Flaky Loki screenshot tests usually point to nondeterministic story state or rendering conditions—not simply an image-comparison problem. Make asynchronous work finish explicitly, stop uncontrolled motion, and run baseline creation and CI in the same pinned browser environment before adjusting diff sensitivity.
1. Make story readiness explicit
A story that fetches data, computes on mount, or re-renders after an event may be captured before it reaches its intended state. Loki’s Handling Flaky Tests guide recommends an async callback pattern to signal when that work is complete. Loki handles most network traffic and image loading, but other asynchronous work may still need an explicit completion signal.
As an Amazon Associate I earn from qualifying purchases.
Use the callback pattern documented for your installed Loki version in stories with asynchronous setup. Signal completion only after the state that should appear in the screenshot has rendered. Avoid replacing a readiness signal with an arbitrary sleep: a fixed delay can be too short on a slow run and unnecessarily long on a fast one.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →2. Stop motion and changing content
Loki disables common CSS transitions and animations and requestAnimationFrame by default. Those defaults do not cover every moving visual: Loki documents limitations involving looping requestAnimationFrame, GIFs, SVG animation, Lottie, and React Native Animated content.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
For those cases, make the story deterministic: render a test-only static state or disable the animation in the story. Loki documents both a context/decorator approach and Loki-targeted CSS for controlling animation. If a story cannot meaningfully be represented by one still frame, selectively skip that story rather than treating every capture as a failed assertion.
3. Pin the capture environment
Generate references and run tests using the same controlled environment. Playwright’s visual comparison guidance warns that host operating system, browser version, settings, hardware, power source, and headless mode can change screenshot output.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- Keep the browser build, operating-system image, headless mode, viewport, fonts, and relevant settings consistent between baseline creation and CI.
- Loki’s CLI exposes a Docker image option; its configuration supports named targets and viewport dimensions. Treat sample Docker image values in older docs as examples, not universal current versions, and verify compatibility with your installed Loki and browser.
- Use a static Storybook build in CI, as Loki’s CI guide recommends, so the test does not depend on a changing development server.
4. Check failed requests and capture boundaries
Loki fails a test by default when a story makes a network request that fails. Investigate the failed request and make the fixture or dependency deterministic. Configure fetchFailIgnore only for a deliberately understood URL pattern; using it to silence an unexplained failure can conceal a broken story.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Also verify chromeSelector if you use it to constrain the capture. Loki describes this as cropping to the selector’s dimensions, not as a DOM-only screenshot. An absolutely positioned element outside or above that area may still appear in the captured image.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
5. Choose a diff engine from representative changes
Loki documents three diff engines. Their trade-offs differ, so compare them against known intentional changes and accidental visual noise before changing engines or tolerance.
| Engine | Documented behavior | Trade-off to check |
|---|---|---|
pixelmatch |
More sensitive to changes on large images and less susceptible to anti-alias flakiness. | Check whether its sensitivity catches the real changes your project cares about. |
gm (GraphicsMagick) |
Generally faster; tolerance is based on the overall image. | Requires GraphicsMagick as an external dependency. An overall-image tolerance may treat localized changes differently from a per-pixel approach. |
looks-same |
JavaScript-only, slower, and measures tolerance across neighboring pixels; this may help with differing pixel densities. | Compare its behavior and runtime on your representative screenshots. |
These descriptions come from Loki’s configuration documentation, whose related pages display an August 27, 2024 update date. No universal safe tolerance is established there: choose thresholds from your own diffs, preserving detection of meaningful UI changes.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
6. Use retries and tolerance narrowly
Loki’s CLI documentation lists chromeRetries with a default of zero, chromeLoadTimeout with a default of 60,000 milliseconds, and chromeTolerance defaulting to zero. Check the installed version’s documentation before relying on a flag or default, and remember that tolerance behavior depends on the selected diff engine.
Free tools Windows power users keep installed
One-click scans. No signup required.
Fix state, timing, or environment variation first. A retry can help with an occasional capture failure, but persistent differing pixels call for a deterministic fixture or rendering setup. Keep tolerance small and document which expected noise it is meant to exclude.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
7. Review reference updates like code changes
Loki separates testing, updating, and approving references, and stores reference images, current screenshots, and diffs in configurable directories. Its CI guidance recommends requiring references; a missing baseline can make CI behavior misleading. Review the expected image, actual capture, and diff before approving or updating a reference.
Playwright likewise documents explicit snapshot updates and recommends committing and reviewing screenshot changes. A baseline update should record an intentional design change, not convert an unexplained failure into the new accepted output.
Troubleshooting by symptom
| Symptom | Likely cause | What to check |
|---|---|---|
| The screenshot shows a loading or intermediate state. | Asynchronous work or a re-render has not finished. | Add Loki’s async completion callback to the story and signal it after the intended state renders. |
| Only animated stories vary between runs. | The animation type is outside Loki’s automatic controls. | Use a static test state, disable motion with the documented Loki approach, or selectively skip a story that has no meaningful still state. |
| Local captures pass but CI differs. | Browser, OS, fonts, headless mode, viewport, or other rendering conditions differ. | Compare and pin the capture environment; use a static Storybook build in CI. |
| A test fails despite an apparently correct image. | A story request may be failing, or capture boundaries may include unexpected content. | Inspect network failures and the chromeSelector crop behavior before suppressing failures. |
| Many unrelated pixels differ. | The environment or story state may be unstable, or the chosen engine may react differently to rendering noise. | Stabilize state and environment first, then compare engines on representative diffs. |
| A reference appears unexpectedly absent or CI behaves inconsistently. | The reference may not exist or may not be required in CI. | Require references and review the current capture and diff before creating or approving a baseline. |
Or skip the browser setup
If your goal is to capture a page rather than stabilize a Loki component story, ScreenshotNeo offers a one-request screenshot API. For example, this cURL request saves a WebP screenshot of the target URL; see the ScreenshotNeo API documentation for options and response details:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with the page verdict and billing status included in response headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




