DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober 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 Scan×
Skip to content
World desk6 min

How to Test a Mobile Web App with Cypress

A practical Cypress workflow for responsive mobile web testing: choose viewport sizes, assert real user outcomes, and distinguish browser resizing from native-device testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Cypress to test how a website or web app behaves at deliberately chosen mobile-sized browser viewports: set the size with cy.viewport(), load the page, and assert what a user should see and be able to do. This is responsive mobile web testing—not a simulation of a complete iOS or Android device, and Cypress does not run native mobile apps.

What Cypress mobile viewport testing does—and does not—cover

Cypress changes the application-under-test viewport to specified pixel dimensions or a documented preset. You can also set portrait or landscape orientation. That lets you check responsive layout and behavior in a browser, including whether navigation collapses, content fits, or a menu opens. See the Cypress viewport API documentation.

As an Amazon Associate I earn from qualifying purchases.

Resizing a browser does not reproduce a physical phone. Cypress documents that viewport resizing does not simulate devicePixelRatio. It also does not test native iOS or Android apps: Cypress’s FAQ says, “Cypress will never be able to run on a native mobile app.” Some mobile-like actions, such as swiping, can be mimicked with custom commands, but that is not equivalent to exercising a real touchscreen. See Cypress’s FAQ.

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

Choose viewport sizes around your app’s breakpoints

Test the sizes that exercise meaningful layout changes rather than every possible resolution. Include at least one size on either side of important responsive breakpoints, and check portrait or landscape when the interface supports both. Cypress’s documentation demonstrates named desktop and phone-sized navigation cases; the dimensions below are illustrative values, not universal device specifications.

#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • 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.****
  • Small phone: catch cramped layouts, clipped controls, and horizontal overflow.
  • Typical phone-sized viewport: verify the primary mobile navigation and actions.
  • Tablet-sized viewport: check the transition between phone and desktop layouts.

Replace the example dimensions with values that exercise your CSS breakpoints and the layouts your users need. A viewport dimension is a browser window size, not a guarantee of how a particular handset will render the page.

Write an end-to-end responsive navigation test

This example runs a separate test for each size, visits the application, and checks both visibility and interaction. Replace the route and selectors with your app’s route and stable test hooks.

const sizes = [
  { name: 'small phone', width: 320, height: 568 },
  { name: 'phone', width: 375, height: 812 },
  { name: 'tablet', width: 768, height: 1024 },
]

describe('responsive navigation', () => {
  for (const size of sizes) {
    it(`works at ${size.name}`, () => {
      cy.viewport(size.width, size.height)
      cy.visit('/')

      cy.get('[data-testid="desktop-nav"]').should('not.be.visible')
      cy.get('[data-testid="mobile-menu-button"]')
        .should('be.visible')
        .click()
      cy.get('[data-testid="mobile-nav"]').should('be.visible')
    })
  }
})

The viewport call belongs before the page visit so the page loads at the intended size. Assertions should describe user-visible outcomes, not merely the existence of DOM nodes. For example, verify that a menu button is visible and opens the mobile navigation; add checks for closing the menu, following a link, or dismissing it if those behaviors matter to your interface.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • 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.

Set viewport sizes in Cypress configuration or in a test

Cypress’s documented default application viewport is 1000 × 660 pixels. You can set global defaults, set viewport values for a test or suite, or use cy.viewport() when a test needs to change size. Cypress automatically restores the default viewport size between tests.

Set a global default

In the Cypress configuration file, set viewportWidth and viewportHeight for your project. This is useful when most tests should start from the same viewport; individual tests can still use cy.viewport() for responsive cases.

import { defineConfig } from 'cypress'

export default defineConfig({
  e2e: {
    viewportWidth: 375,
    viewportHeight: 812,
  },
})

Configuration format can depend on your project setup. See Cypress configuration documentation.

Rank #3
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • 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.

Set the viewport for a particular test

Use test configuration when a test or suite has a known viewport requirement. Use cy.viewport() when the size is selected dynamically or you want to iterate over several sizes within a test workflow.

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

Since Cypress 16.0.0, changing viewportWidth or viewportHeight through Cypress.config() during test execution throws an error. Use test configuration or cy.viewport() instead. See the Cypress.config() API documentation.

Cover the mobile outcomes users rely on

Use behavior-focused assertions at each selected viewport. A responsive test suite is more useful when it covers the key changes in your interface than when it merely repeats the same page load at many dimensions.

Rank #4
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • 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.
  • Navigation: check which navigation is shown, whether the mobile menu opens and closes, and whether its links work.
  • Content and layout: check important text and controls remain visible, content wraps as intended, and the page does not acquire unwanted horizontal overflow.
  • Forms and primary actions: verify controls can be reached and used, validation messages appear, and submission reaches the expected state.
  • Menus and dialogs: check that overlays fit the viewport and can be dismissed using the supported controls.
  • Touch-like interactions: test the actual behavior your web app implements. Custom commands can mimic actions such as swiping, but do not treat them as physical-device touch validation.

Use component tests when layout isolation helps

For an individual responsive component, Cypress component testing mounts it in a real browser, which can make it easier to isolate layout and interaction behavior. End-to-end tests remain useful for checking the complete app, including routing and integrated page behavior. See Cypress component testing documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Add visual checks without confusing them with behavior tests

Functional assertions establish that controls and responsive states behave as expected. Screenshot comparison can catch visual defects those assertions may miss, such as a misaligned element or a change in wrapping. For useful comparisons, keep the rendering conditions consistent: viewport dimensions and orientation, browser version, operating system, display scaling, and font environment can all affect screenshots. Cypress explains these considerations in its visual testing guide.

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

Choose whether a check is functional or screenshot-based, and keep its environment stable. A visual match in one browser setup does not prove that every device or operating system renders identically.

Best Value
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • 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.

Troubleshoot common viewport-test failures

  • The wrong navigation appears: confirm the viewport is set before visiting the page, and check that the chosen dimensions actually cross the breakpoint in your CSS.
  • A hidden element passes a presence check: assert visibility or the relevant user outcome rather than only querying whether the element exists.
  • The test changes size through Cypress.config() and errors: on Cypress 16.0.0 and later, use cy.viewport() or test configuration for viewport changes.
  • A page does not load during cy.visit(): check that the route is reachable and that the app has loaded as expected. Cypress’s cy.visit() documentation describes navigation and load behavior.
  • A screenshot differs between runs or machines: fix the viewport and keep browser, operating system, display scaling, and fonts consistent before treating the difference as an app regression.
  • A test is being treated as proof of phone behavior: remember that viewport resizing does not emulate device pixel ratio or native hardware. Validate on actual target devices when those characteristics are material.

Or skip the browser setup

If you need a screenshot rather than a Cypress interaction test, ScreenshotNeo is a website screenshot API and MCP server. It cannot replace Cypress assertions or native-device testing, but one GET request can return a screenshot or PDF. The API documentation covers its 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 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 cost nothing, with the result identified in response headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. 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: 1,000 screenshots a month, no card required.

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

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 *

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.

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
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver 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.