Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

How to Test a Redux Store With Cypress

Use a fresh Redux store wrapped in Provider for Cypress component tests. For end-to-end tests, prefer user-visible behavior and expose the store only for exceptional cases.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For Cypress component tests, wrap the Redux-connected component in React-Redux’s Provider and give it a fresh store created for that test. For end-to-end tests, usually leave Redux behind the application interface: exercise the page as a user would and assert the visible result. Expose the store to Cypress only when direct inspection or dispatch is genuinely needed.

Choose the right testing level

Test type Best for Redux setup What to assert
Cypress component test Focused behavior of a connected component in a testbed Mount through a Provider using a fresh, optionally preloaded store The component’s visible response to initial state or interaction
Cypress end-to-end test A workflow through the running application Use the app’s normal store setup; expose the store only deliberately if needed Public UI and browser behavior, with direct Redux checks reserved for exceptional cases

The component-test approach makes state setup controlled without bypassing the component’s real Redux connection. End-to-end tests answer a broader question: whether the application behaves correctly through its browser-facing interface.

As an Amazon Associate I earn from qualifying purchases.

Set up a component test with a fresh store

Create a store factory such as setupStore or getStore, then use it to provide a new store to each test. Do not import one long-lived mutable store into every spec: state changes can leak between tests and make results depend on execution order.

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

Create a reusable Provider-wrapped mount command

Adapt this Cypress-documented pattern to your app’s store factory and import paths:

#1 Best Overall
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
import React from 'react'
import { Provider } from 'react-redux'
import { mount } from 'cypress/react'
import { setupStore } from '../../src/app/store'

Cypress.Commands.add('mount', (component, options = {}) => {
  const { reduxStore = setupStore(), ...mountOptions } = options

  return mount(
    <Provider store={reduxStore}>{component}</Provider>,
    mountOptions
  )
})

The important detail is that the default expression calls the store factory for the mount, rather than reusing a singleton. If your app uses a different Cypress component-testing mount import or store constructor, change those imports and names to match your configuration.

Seed the scenario the test is meant to cover

When a test concerns a specific starting state, either create a store with preloaded state or dispatch setup actions on a new store before mounting. Dispatching an action is useful when the scenario is naturally described as an application event; preloaded state is useful when the test needs a particular state snapshot.

it('shows the signed-in user name', () => {
  const reduxStore = setupStore()
  reduxStore.dispatch(setUser({ name: 'Ada Lovelace' }))

  cy.mount(<UserProfile />, { reduxStore })
  cy.contains('Ada Lovelace').should('be.visible')
})

This checks the connected component’s rendered output while retaining the real store and reducer behavior. Avoid substituting mocked selectors or React-Redux hooks when the purpose is to verify that UI and Redux logic work together.

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

Write end-to-end tests through the application interface

In an end-to-end test, interact with the page as a user would and assert the resulting UI. Cypress’s ordinary browser-facing surfaces—such as the DOM, network, and storage—are generally the right test boundary. For API-driven behavior, mock the external request where useful, then verify what the application displays or does.

Rank #3
ASUS 2026 15" FHD IPS Chromebook, Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage, HDMI, Super-Fast WiFi, Chrome OS, Pastel Silver (Renewed)
  • Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage
  • 15" FHD IPS Display, Intel UHD Graphics
  • 1x USB Type C, 1 x USB Type A, 1x Headphone/Microphone Combo Jack, HDMI
  • Fast WiFi and Bluetooth, Integrated Webcam
  • Chrome OS, AC Charger Included, Pastel Silver

Directly reading or dispatching Redux state is possible, but it requires application code to expose a reference to the app or store. Treat that as an explicit diagnostic or test hook, not an automatic Cypress capability or the default end-to-end pattern. Keep it controlled so production behavior and the public testing boundary remain clear.

Expose the store only when there is a concrete reason

If a state assertion or dispatch is necessary—for example, to reach a state that would otherwise be impractical to produce—conditionally attach the store to the browser window in the test environment, then access it through cy.window(). The exact property and conditional wiring depend on the application; there is no universal Redux property that Cypress can discover automatically.

Rank #4
Lenovo Chromebook 2-in-1 - Lightweight Laptop - Google Gemini - Intel® N150 CPU - 14" WUXGA IPS Touchscreen Display - 4GB RAM - 128GB UFS Storage - Integrated Intel® Graphics - Luna Grey
  • THE BETTER WAY TO LAPTOP – Imagine a Chromebook that’s as flexible as your day: thin and lightweight with built-in Google apps and stress-free security.
  • TAKE HITS KEEP MOVING – Sleek, light, and built to last- the Chromebook 2-in-1 is just 0.69” thick and 3.3lbs. Enjoy long-lasting battery life, fast charging, and military-grade durability for nonstop productivity wherever life takes you.
  • PERFORMANCE THAT MATCHES YOUR HUSTLE – Fuel your ideas with an Intel Core processor and 128GB storage. Boot up in under 10 seconds to start the day powerfully efficient.
  • FLEX YOUR CREATIVITY ANYWHERE, ANYTIME – Create, work, or unwind your way with a versatile 2-in-1 design. Flip easily between laptop, tent, and tablet modes with a responsive touchscreen built for flexibility.
  • BRILLIANT VIEWS AND IMMERSIVE AUDIO – See, hear, and create with awesome clarity. The WUXGA display brings rich detail to your work and play, while audio tuned by Waves MaxxAudio provides immersive, balanced sound.
// Application bootstrap: test-only exposure, adapted to your app.
if (window.Cypress) {
  window.store = store
}

// Cypress test
cy.window().its('store').then((store) => {
  store.dispatch(setUser({ name: 'Ada Lovelace' }))
})

Use this sparingly. A test that dispatches directly can be useful for setup or diagnosis, but it does not prove a user can reach that state through the application workflow.

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

Keep Redux integration real and external dependencies controlled

Redux’s testing guidance favors integration tests with a real store for connected React behavior: render the UI with a Provider, exercise it, and verify the visible transition. Mock external network requests when needed; avoid mocking selectors or hooks if doing so removes the Redux integration the test is supposed to cover.

Best Value
HP Chromebook 14 Laptop, Intel Celeron N4120, 4 GB RAM, 64 GB eMMC, 14" HD Display, Chrome OS, Thin Design, 4K Graphics, Long Battery Life, Ash Gray Keyboard (14a-na0226nr, 2022, Mineral Silver)
  • FOR HOME, WORK, & SCHOOL – With an Intel processor, 14-inch display, custom-tuned stereo speakers, and long battery life, this Chromebook laptop lets you knock out any assignment or binge-watch your favorite shows..Voltage:5.0 volts
  • HD DISPLAY, PORTABLE DESIGN – See every bit of detail on this micro-edge, anti-glare, 14-inch HD (1366 x 768) display (1); easily take this thin and lightweight laptop PC from room to room, on trips, or in a backpack.
  • ALL-DAY PERFORMANCE – Reliably tackle all your assignments at once with the quad-core, Intel Celeron N4120—the perfect processor for performance, power consumption, and value (2).
  • 4K READY – Smoothly stream 4K content and play your favorite next-gen games with Intel UHD Graphics 600 (3) (4).
  • MEMORY AND STORAGE – Enjoy a boost to your system’s performance with 4 GB of RAM while saving more of your favorite memories with 64 GB of reliable flash-based eMMC storage (5).

For complex pure logic, isolated unit tests can still be appropriate. Redux also names Vitest Browser Mode and React Testing Library as recommended options for testing connected React components; that is context for tool selection, not a reason Cypress cannot test them.

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

Troubleshoot common setup failures

  • “Could not find store in context” or a related context error: the component was mounted outside a React-Redux Provider, or the wrapper did not receive the store. Ensure the custom mount wraps the component and passes the same store you initialized.
  • A test passes alone but fails in the full suite: check for a shared mutable store. Make the mount default call a store factory and pass a newly created instance to each scenario.
  • The initial UI is not the expected state: confirm the setup action was dispatched to the exact store passed to cy.mount, or that preloaded state is supplied to the store creation path used by the test.
  • cy.window() cannot find the store: Cypress does not expose Redux automatically. Add an explicit, test-only application reference before attempting to read it, and use the same property name in the test.
  • The end-to-end test depends on internal state details: reconsider whether it can assert the public UI or network behavior instead. Direct store coupling can make the test less representative of a user’s workflow.

Or skip the browser setup

If you need screenshots of pages while documenting or diagnosing a UI state, ScreenshotNeo can capture a URL with one GET request; it is separate from Cypress and does not replace Redux tests. Its cleanup removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are not billed; an MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000.

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

See the ScreenshotNeo API documentation for request options. Learn more at ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.