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

How to Test Ionic Mobile Apps with Cypress

Cypress can test Ionic’s browser-rendered UI and mobile-sized layouts, but not a shipped native app. Here’s how to set up E2E tests, control state, and handle the limits of simulated swipes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can use Cypress to test the browser-rendered part of an Ionic app: start it with ionic serve, have Cypress visit the local app, and check key user journeys at desktop and mobile-sized browser viewports. Cypress does not run a shipped native iOS or Android app. Use native-device execution as well when you need to verify native plugins, hardware, or platform-runtime behavior.

Can Cypress test native mobile apps?

No. Cypress tests web applications in a browser, including Ionic applications rendered for the browser. Cypress states that it cannot run on a native mobile app, though it can test mobile web browsers and browser-based mobile applications such as Ionic apps (Cypress FAQ).

That distinction is about the execution target, not the layout. A Cypress test can set a narrow viewport and verify responsive presentation, but that is still a browser test—not execution inside a phone’s native app runtime or a physical device. Browser tests also cannot directly establish that camera access, fingerprint authentication, or another native feature works.

How do I test an Ionic app with Cypress?

1. Start the Ionic app in a browser

From the project directory, run:

ionic serve

The Ionic CLI starts a local development server for browser development and testing and watches for file changes. Use the command options that fit your project—for example, the documented options for browser selection, host, HTTPS, and configuration are listed in the Ionic serve reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
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.

2. Install Cypress and configure E2E testing

Install Cypress as a development dependency using the method in the current Cypress installation guide, then open Cypress and use its Launchpad to configure end-to-end testing. Keep the Ionic server running while you run browser E2E tests; Cypress’s E2E guidance expects the application to be available when the test visits it.

Set a baseUrl in the current Cypress configuration for the local address printed by ionic serve. Then a spec can visit the app using a relative path:

describe('Ionic app', () => {
  it('opens the home page', () => {
    cy.visit('/');
    cy.get('[data-cy="home-title"]').should('be.visible');
  });
});

The Cypress Ionic tutorial published on July 8, 2020 demonstrates the overall approach, but its older file names and cypress.json configuration are historical. Use the configuration format documented for your installed Cypress version rather than copying that old setup verbatim.

Rank #2
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.

3. Make initial app state predictable

A test should start from a known state. Decide how your app handles onboarding, stored preferences, authentication, and other persisted data, then arrange that state before visiting the route under test. The Ionic tutorial imports Ionic Storage and sets a tutorial flag to control onboarding; that key and storage setup belong to its example and should not be assumed to exist in another app.

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

Where practical, add stable selectors such as data-cy attributes to controls that tests need to identify. Assert the resulting visible state—not just that Cypress issued a click—so a test catches a broken or blocked user journey.

4. Exercise important journeys

Use E2E tests for flows that matter across the running app: onboarding, navigation, search, adding an item to favorites, or switching a theme. The Cypress Ionic example covers those kinds of browser interactions, including onboarding slides and dark-mode styling. Adapt the journeys and assertions to the behavior your app actually provides.

Rank #3
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.

How do I test an Ionic app at a mobile viewport size?

Use cy.viewport() in a test, or configure a default viewport for the suite. Cypress supports named presets and explicit dimensions; see the viewport command reference.

describe('mobile layout', () => {
  beforeEach(() => {
    cy.viewport('iphone-6');
    cy.visit('/');
  });

  it('keeps the primary navigation visible', () => {
    cy.get('[data-cy="primary-navigation"]').should('be.visible');
  });
});

Choose viewport sizes that reflect the responsive breakpoints and layouts your team supports. A preset or custom width and height changes the browser’s available viewport; it does not emulate a complete phone, reproduce every browser behavior, or prove the app works in a native WebView. The 2020 Ionic tutorial uses an iPhone 5 preset as an example, not as a current device recommendation.

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

How do I test swipes in Cypress?

Cypress does not turn a browser test into native touch input. For a browser-side interaction that responds to mouse events, the Cypress Ionic tutorial demonstrates a custom command that dispatches mousedown, mousemove, and mouseup events on the active slide. A simplified example is:

Rank #4
Sale
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black
  • PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
  • NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
  • HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone
Cypress.Commands.add('dragSlide', (selector) => {
  cy.get(selector)
    .trigger('mousedown', { which: 1, pageX: 300, pageY: 200 })
    .trigger('mousemove', { which: 1, pageX: 100, pageY: 200 })
    .trigger('mouseup');
});

describe('onboarding', () => {
  it('moves to the next slide', () => {
    cy.visit('/');
    cy.dragSlide('[data-cy="active-slide"]');
    cy.get('[data-cy="next-slide"]').should('be.visible');
  });
});

The selector, event coordinates, and expected result must match the app’s actual markup and interaction. This tests a browser event path only. It does not inject a physical touch gesture or prove that the native gesture recognizer behaves correctly on iOS or Android. Cypress’s FAQ likewise describes swipe behavior as something that can be mimicked with custom commands.

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

When should you use Cypress component tests instead of E2E?

Choose the test scope based on what you need to prove:

Test type Execution target and scope Best fit What it does not establish
Cypress component test A component mounted directly in a real browser Testing a component’s states and behavior in isolation with a shorter feedback loop That full-app navigation and integration work end to end
Cypress E2E test The running browser-rendered app Checking important user journeys and integration across the web UI Native app, hardware, or platform-runtime behavior
Native-device test The native iOS or Android app on the relevant execution stack Checking native plugins, device-dependent behavior, and platform-specific concerns Coverage beyond the device, OS, and cases actually exercised

Cypress documents both component testing and E2E testing. For native execution, Ionic’s end-to-end testing reference example distinguishes the browser approach from its native iOS and Android example, which names WebdriverIO and Appium.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
  • ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
  • CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
  • PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
  • 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US

When browser tests are not enough

Add testing in the native app/device stack when the behavior depends on a native plugin, hardware, native touch handling, or a platform runtime. A browser viewport and simulated mouse events can help catch web UI regressions, but they cannot verify camera operation, fingerprint authentication, or actual device gestures. Match the execution target to the claim you need confidence in.

Or skip the browser setup

If your task is to capture a page image rather than test an Ionic interaction, ScreenshotNeo is a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF; its browser-based capture is not a substitute for Cypress tests or native-device testing.

For example, request a screenshot of your running Ionic app. Replace the target URL with the address reachable by the capture service:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server gives AI agents screenshot tools, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for the free plan.

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

Frequently Asked Questions

Can a Cypress viewport test confirm how Ionic looks on every phone?

No. It checks browser rendering at the configured dimensions, not every device, browser, WebView, or native runtime.

Does a Cypress swipe test prove touch support works in a native app?

No. Dispatching browser mouse events exercises a browser interaction path; native touch behavior needs native-device execution.

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.

Leave a Reply

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

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.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.