10 / 10

How do you test navigation between pages in Cypress?

Difficulty: 5/10
page navigation, URL assertions, network stubbing

​

Typical Navigation Test Flow
  1. 1

    Visit a page

  2. 2

    Click a link/button

  3. 3

    Verify the new URL

  4. 4

    Assert content on the new page

Example
Other methods of navigation:
  1. 1

    Click Button That Navigates

  2. 2

    Navigate via JS or Redirect

Example

Scenario Questions

0-2 years experience

  1. 1Imagine you need to verify that clicking the 'Login' button on the homepage takes the user to '/login'. How would you write a Cypress test for that?
  2. 2If the navigation fails intermittently, what simple Cypress command could you add to make the test more reliable?

2-5 years experience

  1. 1You have a multi‑step wizard where each step updates the URL hash. How would you assert that moving from step 2 to step 3 updates the hash correctly, and what would you do if the hash sometimes lags behind?
  2. 2During a recent sprint, a teammate reported that a Cypress test for navigating to the 'Settings' page started failing after a new API call was added. Walk me through how you'd debug the failure.

5-8 years experience

  1. 1Our application uses lazy‑loaded modules and sometimes the navigation test times out. How would you redesign the Cypress navigation tests to be resilient at scale, considering network stubbing and retries?
  2. 2We plan to run Cypress tests in parallel across multiple CI agents. What considerations would you make for navigation tests to avoid flaky results and keep execution time low?

8+ years experience

  1. 1The company is moving from a monolithic Cypress suite to a modular, shared component library for tests. How would you structure navigation test utilities to support multiple teams while maintaining consistency?
  2. 2If we need to migrate legacy Selenium navigation tests to Cypress across dozens of services, what strategy would you propose to ensure coverage, minimize risk, and handle differing routing implementations?

Follow-up Questions

  • What would you change if the app uses client‑side routing that doesn't update the full URL?
  • How do you prevent flaky navigation tests caused by asynchronous data loading?
  • Can you describe a way to verify that the destination page rendered the expected elements after navigation?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.