October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Why Cypress Screenshot Dimensions Differ From the Browser Viewport

Cypress viewport settings, screenshot capture area, and saved image dimensions are different measurements. Here’s how to find which setting explains the mismatch.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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 the viewportWidth and viewportHeight configuration 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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

  1. Confirm the effective AUT viewport. Check viewportWidth, viewportHeight, every cy.viewport() call, and suite-level configuration. The documented baseline is 1000 by 660 pixels.
  2. Confirm the capture area. Identify whether the command captures viewport, fullPage, runner, or an element. Review clip and element padding.
  3. Inspect screenshot metadata. Log the callback’s dimensions, scaled, and path; if an event handler edits the file, report the resulting dimensions.
  4. For headless runs, inspect browser launch options. Check screen dimensions and device scale factor separately from the AUT viewport.
  5. 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.