A Cypress screenshot can be a different size from the application’s browser viewport because viewport size, screenshot capture area, and saved image dimensions are separate things. First check whether Cypress captured the viewport, full page, runner, or an element; then inspect clipping, element padding, screenshot metadata, and—especially in headless runs—the browser’s screen size and device scale.
Which dimensions are you comparing?
“Viewport” can refer to several measurements in a Cypress run. Identify which two you mean before changing configuration:
As an Amazon Associate I earn from qualifying purchases.
- AUT viewport: the application-under-test viewport in CSS pixels. Cypress sets it with
cy.viewport()or theviewportWidthandviewportHeightconfiguration values. The documented defaults are 1000 by 660 pixels; the viewport resets to configured defaults between tests. Cypress viewport documentation and configuration reference. - Runner preview: Cypress may scale and center the application preview to fit the runner pane. Its apparent size on screen does not mean the AUT viewport changed. Cypress visual-testing guide.
- Capture area: the region Cypress is asked to save: the current viewport, the full page, the runner, or a particular element.
- Image dimensions: the pixel width and height of the file that was actually saved. Cropping, element padding, headless browser screen dimensions, and device scale can affect this independently of the AUT viewport.
In particular, cy.viewport(1280, 800) controls the AUT viewport in CSS pixels; it does not promise that every screenshot mode will save a 1280-by-800 image.
Check the screenshot mode, crop, and element options
The capture option determines what Cypress includes. In the cy.screenshot() documentation, the documented choices are:
#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
| Capture mode | Area included | What to verify |
|---|---|---|
viewport |
The AUT in its current viewport. | Check the effective cy.viewport() call or configured viewport dimensions. |
fullPage |
The AUT from top to bottom. | The saved image is expected to extend beyond the viewport when the page is taller than the visible area. |
runner |
The browser viewport, including the Command Log. Test Replay has documented exceptions when it hides the Runner UI. | Do not compare this image’s dimensions with the AUT viewport as if they were the same capture. |
Also inspect clip, which specifies a screenshot crop rectangle. If you are taking an element screenshot, the image is scoped to that element; padding can enlarge the element screenshot. These options can produce dimensions that intentionally differ from the viewport. See the screenshot command reference.
Log the dimensions Cypress reports
Use the screenshot callback or the after:screenshot event to inspect the saved image’s reported dimensions, whether the AUT was scaled, and the output path. This helps distinguish a capture-mode or scaling issue from a mismatch in the values you expected.
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
cy.screenshot('dimension-check', { capture: 'viewport' }).then((details) => {
cy.log(`Screenshot: ${details.path}`)
cy.log(`Dimensions: ${details.dimensions.width}x${details.dimensions.height}`)
cy.log(`AUT scaled: ${details.scaled}`)
})
The properties are useful diagnostic metadata, not a substitute for checking which area was captured. If an after:screenshot handler modifies the image file, return details that describe the changed file, including its dimensions. Cypress documents screenshot callbacks and the event in its screenshot API reference.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Set and verify the AUT viewport
For a screenshot of the current AUT viewport, set the dimensions explicitly and use viewport capture. For example:
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.
cy.viewport(1280, 800)
cy.screenshot('viewport-check', { capture: 'viewport' })
You can also set defaults in Cypress configuration:
import { defineConfig } from 'cypress'
export default defineConfig({
viewportWidth: 1280,
viewportHeight: 800,
})
Check all cy.viewport() calls, including suite-level setup, because a later call can change the dimensions for a test. Cypress’s documented defaults are 1000 by 660 pixels, and the viewport resets to the configured defaults between tests. See the viewport command documentation and configuration reference.
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
Account for headless browser screen size and device scale
In headless runs, browser screen dimensions can affect screenshot and video size separately from the AUT’s configured viewport. Cypress’s before:browser:launch documentation gives a Chrome example using --window-size=1400,1200: in its documented non-retina example, a device scale factor of 1 produces a 1400-by-1200 full-page screenshot, while factor 2 produces 2800 by 2400. These are examples, not universal results across browsers and environments.
The distinction matters: Cypress says the headless screen-size setting changes the display size of the screen and does not affect the viewportWidth and viewportHeight set in Cypress configuration. Inspect the browser launch options as well as Cypress viewport settings when the discrepancy appears only in headless runs.
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.
Also, cy.viewport() does not simulate devicePixelRatio. A requested CSS-pixel viewport and the screenshot file’s pixel dimensions therefore need not match one-to-one. Cypress viewport documentation.
Use this debugging sequence
- Confirm the effective AUT viewport. Check
viewportWidth,viewportHeight, everycy.viewport()call, and suite-level configuration. The documented baseline is 1000 by 660 pixels. - Confirm the capture area. Identify whether the command captures
viewport,fullPage,runner, or an element. Reviewclipand elementpadding. - Inspect screenshot metadata. Log the callback’s
dimensions,scaled, and path; if an event handler edits the file, report the resulting dimensions. - For headless runs, inspect browser launch options. Check screen dimensions and device scale factor separately from the AUT viewport.
- For visual regression, stabilize the rendering environment. Keep viewport, browser, operating system, display scaling, and installed fonts consistent. Cypress notes these can change rendered pixels enough to affect a pixel comparison. Cypress visual-testing guide.
Or skip the browser setup
For a website screenshot outside a Cypress test, ScreenshotNeo is a screenshot API and MCP server. Its one-call API can return an image or PDF; its documentation covers the available parameters.
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 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the page verdict and billing status in headers. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Why does the Cypress runner preview look smaller than my configured viewport?
Cypress scales and centers the preview to fit the available runner pane. That display scaling does not itself change the AUT viewport.
Does cy.viewport() set devicePixelRatio?
No. Cypress documents that cy.viewport() does not simulate devicePixelRatio.
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.




