💼 50 Interview Questions

50 Interview Questions: Think of a Cypress interview like a chess interview rather than a vocabulary test: nobody asks you to name the pieces.

Think of a Cypress interview like a chess interview rather than a vocabulary test: nobody asks you to name the pieces. They set up a board mid-game and watch which move you reach for and what you say about the move you rejected. Knowing that a knight moves in an L is assumed; choosing between two legal moves under time pressure is the thing being measured. Cypress interview questions test the same two distinct layers: whether you know what something is, and whether you can explain why it was designed that way. "What is cy.intercept()?" is Basic; "A service returns 500 errors 5% of the time in production — how do you build a strategy to keep your CI suite stable?" is Advanced. The gap between those two levels is the same gap as knowing Mockito's API versus knowing when and how to reach for it in a real regression suite. What's the fastest way to close that gap? Skipping Basic means hitting a wall at the first follow-up question in an interview; these 50 questions build the bridge step by step — Basic to solidify the fundamentals, Intermediate to solve real-world scenarios (flaky tests, race conditions, test isolation failures), Advanced to discuss CI pipeline design and architectural trade-offs.

🎬 cy.request(): Collapsing a 5-Step UI Login into 1 HTTP Call

Test (needs to verify the dashboard)

UI Login Form (5 steps)

Dashboard (the real test target)

The real test goal is "do the correct stats show on the dashboard?" — not the login itself. So is logging in through 5 UI steps really necessary in every single test?

Path 1 (slow) — The traditional way: cy.visit('/login') → type username → type password → click submit → wait for redirect. 5 steps, each requiring a real browser render.

Path 2 (fast) — cy.request() fires an HTTP request directly, WITHOUT ever opening the browser UI: POST /api/login. The server does the exact same validation, but no button renders and no input gets clicked.

The server response includes a JWT token — from the SERVER'S point of view, this is the exact same authentication result whether you logged in via the UI or via the API.

The token is written directly into the browser with window.localStorage.setItem(...) — when the dashboard page sees this token, it BELIEVES the user is logged in (because they genuinely are).

The lesson (the contrast) — when should you NOT use this shortcut? If you're testing the login flow ITSELF (wrong-password message, "remember me" checkbox) — then skipping the UI steps hides the very thing you're supposed to test. cy.request() is the right shortcut only when login is a PRECONDITION (dashboard, cart, profile), not the test subject.

API-First Login: When to Use It, When Not To

If the test target is "is the dashboard…

If the test target is "is the dashboard data correct?" — login is just a PRECONDITION, speed it up with cy.request().