Set Cypress’s application viewport with cy.viewport(width, height), check that the interface responds as expected, then save the visible area with cy.screenshot(name, { capture: 'viewport' }). This tests responsive layouts at chosen dimensions; it does not emulate every characteristic of a physical phone or compare screenshots for visual changes.
Write a responsive test at several mobile sizes
Choose dimensions that exercise your site’s breakpoints and the layouts your audience needs. The sizes below are illustrative test inputs, not claims about the most common phones. Replace the example selectors with elements from your application.
const mobileViewports = [
{ name: 'narrow mobile', width: 320, height: 640 },
{ name: 'typical mobile', width: 375, height: 812 },
{ name: 'wide mobile', width: 414, height: 896 },
]
describe('responsive navigation', () => {
mobileViewports.forEach(({ name, width, height }) => {
it(`works at ${name}`, () => {
cy.viewport(width, height)
cy.visit('/')
cy.get('[data-testid="mobile-menu-button"]').should('be.visible')
cy.get('[data-testid="desktop-navigation"]').should('not.be.visible')
cy.screenshot(`navigation-${width}x${height}`, {
capture: 'viewport',
})
})
})
})
- Set the viewport before visiting the page so the application loads at the dimensions under test.
- Assert the behavior that matters, such as which navigation is visible, whether a button can be reached, or whether content fits without unwanted overflow.
- Capture after the assertions establish the desired UI state. Cypress saves screenshots to
cypress/screenshotsby default.
The example uses numeric width and height values. Cypress also accepts supported device presets and portrait or landscape orientation. For a particular project, explicit pixel dimensions make breakpoint coverage easy to see and repeat. Consult the Cypress viewport command documentation for the current preset list and command details.
Set a default viewport or change it per test
Cypress documents a default viewport of 1000 by 660 pixels. Set viewportWidth and viewportHeight in Cypress configuration when a size should be the default, or in suite or test configuration when only that group needs it. Use cy.viewport() when the size changes during a test. A viewport changed with that command resets to the configured default between tests. See Cypress configuration.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match#1 Best Overall
- Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
- Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
- AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
- Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
- Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****
For responsive tests that cover multiple breakpoints, setting the dimensions inside each test makes the target size explicit. In Cypress 16.0.0 and later, Cypress.config() can no longer set viewportWidth or viewportHeight during test execution; use cy.viewport() instead.
Choose the screenshot capture mode that matches the question
| Capture mode | What it captures | Use it for |
|---|---|---|
viewport |
The currently visible application viewport at the dimensions set by the test. | Reviewing what a user sees in the mobile viewport. |
fullPage |
The page from top to bottom, stitched from captures at multiple scroll positions. | Reviewing page-length content. Fixed or sticky elements may repeat in the stitched result. |
runner |
The Cypress browser context, including the runner. | Debugging when the test interface is relevant; it is not an application-only screenshot. |
The default capture mode is fullPage, so specify capture: 'viewport' when the goal is a mobile-screen view. Automatic screenshots captured on test failure are coerced to runner captures. The Cypress screenshot command documentation describes capture modes and options.
Rank #2
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
Make screenshots useful and repeatable
- Control the application state. Wait for the relevant content and assert the expected state before capturing. Cypress’s screenshot API disables JavaScript timers and CSS animations by default during capture; callbacks are available when a test needs synchronous adjustments before or after capture.
- Keep comparison environments consistent. Use the same viewport, operating system, browser version, display scaling, and installed fonts when comparing images. Differences in the rendering environment can cause visual diffs that do not reflect meaningful application changes.
- Know what Cypress does automatically. Cypress captures screenshots on failure during
cypress run, but not automatically duringcypress open. The default screenshot folder iscypress/screenshotsand can be changed in configuration. - Do not confuse viewport with display size.
cy.viewport()sets the application viewport. Thebefore:browser:launchAPI can configure a headless browser’s display size, which affects screenshots and videos separately. Changing browser window size is not a substitute for setting the application viewport.
These commands test layout at a viewport size; Cypress does not simulate devicePixelRatio. Treat the result as responsive viewport testing, not complete physical-device emulation. See the viewport documentation and browser launch API documentation.
Use a visual testing service if you need image comparison
cy.screenshot() captures an image but does not compare it with a baseline or identify visual changes. Cypress’s visual testing guide lists integrations including Applitools Eyes, Argos, Chromatic, Happo, LambdaTest SmartUI, and Percy. The guide describes capabilities such as AI-assisted comparison, pull-request review, cloud rendering, and comparisons across browsers or responsive widths. Check each provider’s current features, availability, and commercial terms before choosing one; those details can change.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Rank #3
- Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
- 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
- Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
- 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
- US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.
When comparing services, focus on the questions that affect your workflow: how comparison works, which browsers and widths are rendered, whether component and end-to-end tests are supported, how review and approval happen, and how well the integration fits your Cypress and CI setup.
Troubleshoot common problems
- The screenshot is desktop-sized. Set
cy.viewport(width, height)in the test beforecy.visit(). Do not rely on changing the headless browser’s display size. - The screenshot includes Cypress controls. Specify
{ capture: 'viewport' }for an application-only viewport image; a runner capture includes the Cypress browser context. - A full-page image repeats a header or toolbar. This can happen because full-page capture stitches multiple scroll positions and fixed or sticky content may recur. Use viewport capture for the view a mobile user sees.
- The image changes between runs without a code change. Verify the application state and rendering environment, including browser, operating system, fonts, display scaling, and viewport dimensions.
- You expected an automatic failure image in interactive mode. Cypress automatically captures failure screenshots during
cypress run, notcypress open. Callcy.screenshot()explicitly when you need an image during an interactive run. - You expected Cypress to report visual differences. The built-in command only captures. Add a visual testing integration if you need baseline comparison and review.
Or skip the browser setup
If you need a screenshot file rather than a Cypress test assertion, ScreenshotNeo offers a one-request screenshot API. It removes cookie banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides screenshot tools for AI agents.
Here is the cURL call; replace YOUR_API_KEY with your key and change the target URL as needed. See the ScreenshotNeo API documentation for request options.
Rank #4
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo’s free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free and get 1,000 screenshots a month with no card.
Frequently Asked Questions
Does Cypress emulate an iPhone or Android device when I set a mobile viewport?
No. It sets the application viewport dimensions but does not simulate device pixel ratio or provide complete physical-device emulation.
Best Value
- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
- DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
- CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
- PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
- BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
Does Cypress compare screenshots automatically?
No. Its built-in screenshot command captures images; comparison requires a visual testing integration.
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.

