How a Silent Cypress cy.session() Bug Masked Auth Failures as Flaky Tests

A software engineer discovered that Cypress's cy.session() validate() function was silently passing even when user sessions had expired, causing test failures to appear random and unrelated to authentication. The root cause was a relative URL in cy.request() resolving against the app's baseUrl instead of the identity provider, meaning the request never actually checked the IdP. Because the single-page app returns a 200 OK with an HTML response for any unrecognised path, the status-code assertion always passed regardless of session state. When tests eventually ran with an expired session, the app's own auth check would redirect to the login page, causing specs to fail on unrelated selectors and be mislabelled as flaky. The engineer found that two compounding bugs — the wrong URL target and cy.request's inability to attach bearer tokens from web storage — rendered the entire session validation check effectively decorative.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in