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

If a Cypress test passes only after another test, breaks when CSS changes, or stays flaky despite a fixed sleep, look for hidden dependencies rather than adding more waiting. Cypress’s documented anti-patterns point to a common remedy: make setup deliberate, synchronization condition-based, and tests independent. The examples below follow Cypress’s current guidance; a documented anti-pattern is a useful diagnostic clue, not proof that it caused a particular failure.

1. Making one test depend on another

A test should pass on its own and in any order. If a preceding test leaves behind a logged-in session, record, or page state that the next test silently needs, the latter can fail when run alone, reordered, or selected for a focused run.

Cypress states that “Tests should always be able to be run independently from one another and still pass.” Its test isolation guidance explains the default behavior for end-to-end tests: before each test, Cypress resets the page to about:blank, clears cookies across domains, and clears localStorage and sessionStorage. It does not clear IndexedDB or every other browser storage mechanism.

How to find and fix the dependency

  • Run a failing test by itself, including with .only(), as Cypress recommends when investigating test coupling.
  • Give each test the setup it requires. Move genuinely common setup into a hook, but do not make one test responsible for another test’s prerequisites.
  • Organize specs around features and user flows so a test’s setup and assertions reflect the behavior being checked.

Component tests reset the rendered component and the same listed cookie and storage categories. Cypress says component testing does not support configuring test isolation behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

2. Turning off isolation as a blanket speed fix

Setting testIsolation: false for an end-to-end suite or describe block can retain browser state and may improve performance in a particular suite. It also allows tests to affect one another, which can hide dependencies and create order-sensitive failures. Treat it as a workload-specific trade-off, not a default optimization.

If you consider disabling isolation, first run each test alone and confirm that it establishes the state it needs. Cypress notes that cy.session() follows the test-isolation configuration; with isolation enabled, visit the application after setting up or restoring a session when the test needs a page. See the isolation documentation for configuration details and behavior.

3. Selecting elements through volatile styling

Selectors based on CSS classes, presentation-oriented IDs, or incidental markup can break when the interface is restyled or refactored, even if the user-visible behavior is unchanged. Cypress recommends dedicated data-* attributes for test targeting, such as [data-cy="submit"].

Prefer a selector that expresses test intent

// Fragile if the class is only for styling
cy.get('.btn-primary').click()

// A purpose-built test hook
cy.get('[data-cy="submit"]').click()

A data attribute is not mandatory for every query. Text can be the right choice when the test is checking what a user sees; semantic attributes can be suitable when they express meaningful HTML behavior. The goal is to avoid coupling a test to implementation details that are likely to change. Cypress’s best-practices guidance shows its selector recommendations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

4. Using fixed sleeps instead of waiting for a condition

A command such as cy.wait(3000) guesses how long work will take. If the application is ready sooner, the test wastes time; if it is slower, the sleep does not make the required condition true. Cypress calls arbitrary waits an anti-pattern and says, “You almost never need to wait for an arbitrary period of time.”

For UI state, assert the state you need

Cypress retries queries and assertions, so express the expected condition directly:

cy.get('[data-cy="results"]').should('be.visible')

This waits for the result element to satisfy the assertion or for Cypress’s command timeout to be reached. It does not assume that a particular number of milliseconds guarantees readiness.

For a specific request, alias and wait for it

cy.intercept('GET', '/api/items').as('getItems')
cy.visit('/items')
cy.wait('@getItems')
cy.get('[data-cy="results"]').should('be.visible')

Use the route pattern that matches the application’s request. Waiting for the aliased request synchronizes with that network event; assert on the resulting UI as well when the behavior under test includes rendering.

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.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

cy.visit() resolves when the page’s load event fires, and cy.request() resolves when its response arrives. An extra sleep after either is generally unnecessary. Consult the official cy.wait() API documentation for the distinction between fixed waits and waiting on an alias.

Do not guess at server startup time in CI

Starting cypress run concurrently with a server boot does not guarantee the server is ready when tests begin. Use a readiness check or a CI action that waits for the server, rather than adding a guessed sleep. Cypress describes this startup race in its continuous integration guidance.

5. Repeating UI login and leaving application state to chance

When login is setup rather than the behavior under test, Cypress recommends programmatic login where appropriate. Establish authentication and other necessary state deliberately instead of replaying a lengthy UI flow in every test. Keep the UI login flow in tests that actually verify login behavior.

The right setup depends on the application’s authentication and test environment; Cypress’s guidance does not prescribe one backend-specific login recipe. If a test needs an authenticated page and uses cy.session(), account for the interaction between sessions and isolation described above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

6. Depending on sites your team does not control

Visiting or interacting with an uncontrolled third-party site makes a test depend on systems outside the application under test. Changes, availability, or behavior at that site can affect the run. Cypress recommends avoiding this pattern; where appropriate, use a third-party API through cy.request() instead. Choose a strategy suited to the dependency and the behavior the test is meant to verify—do not mistake an external-site check for a controlled application test.

7. Sharing page objects when they obscure the flow

Cypress lists sharing page objects among discouraged patterns and recommends organizing tests around features and user flows rather than mirroring page structure. The concern is that an abstraction can make a test’s intent or state dependencies harder to see. This is Cypress’s guidance, not a rule that every helper or abstraction is harmful: keep shared code when it makes behavior clearer and does not conceal setup or coupling.

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

8. Writing only one assertion per end-to-end test

Cypress identifies the “single assertion end-to-end only” approach as an anti-pattern. A user flow can have several related assertions about one outcome, and there is no need to split each assertion into a separate browser journey merely to keep the count at one.

Keep assertions relevant to the behavior under test. The opposite extreme—combining unrelated behaviors into one long scenario—also makes failures harder to interpret. Group related checks around a feature or user flow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

9. Hard-coding secrets in test files

Do not put credentials, tokens, or other secrets directly in test source or expose sensitive values to the browser context. Use a secret-handling mechanism appropriate to your local and CI environments. A test-only environment does not make an exposed secret safe.

10. Repeating application URLs instead of setting baseUrl

Cypress identifies calling cy.visit() without configuring baseUrl as an anti-pattern. Set the application’s base URL in Cypress configuration, then visit paths relative to it:

// cypress.config.js
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    baseUrl: 'http://localhost:3000'
  }
})

// In a spec
cy.visit('/login')

This avoids repeating a fully qualified local URL and makes it easier to switch application environments. Cypress also notes that configuring the base URL can avoid an initial reload as the runner changes from its startup URL to the application URL.

Diagnose a flaky Cypress test by its symptom

What you see Likely pattern to inspect Better next step
Passes in the full suite but fails alone or after reordering Hidden state dependency between tests Run the test alone; make its setup explicit and preserve isolation unless there is a justified suite-level reason not to.
Breaks after a CSS or markup change without a user-facing behavior change Selector tied to styling or incidental structure Use a purpose-built data-* hook, or query user-visible text/semantics when those are what the test verifies.
Slow suite, yet occasional timing failures remain Fixed-duration waits Assert on the UI condition or wait for a specific aliased request.
Fails intermittently at the start of a CI run Tests may start before the app server is ready Add an explicit readiness check or use a CI wait action.
Unpredictable failures during an external-site interaction Dependency on a site outside the team’s control Test the application boundary and use a suitable API strategy for third-party behavior where appropriate.

Screenshot alternative for Cypress workflows

For screenshots of webpages outside Cypress’s test assertions, ScreenshotNeo is a screenshot API and MCP server for developers. It can return PNG, JPEG, WebP, or PDF captures; its response headers identify page verdict and billing status. It is separate from Cypress and does not replace browser assertions or controlled test setup.

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.

Or skip the browser setup

For a screenshot request, a single GET call can capture a URL. See the ScreenshotNeo API documentation for options and response details.

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

Before capture, ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response indicates its verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up free for 1,000 screenshots a month with no card.

Further Cypress learning

Cypress offers free official courses and examples through Real World Testing with Cypress.

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.