TL;DR: Great reference for cypress testing of components affected by the Auth-0 SPA SDK state: GitHub - adamjmcgrath/cypress-spa-example
Hi all,
After weeks of not getting our cypress tests working, we finally found this repo by Adam Grath: GitHub - adamjmcgrath/cypress-spa-example
It gives a very simple and clear example on how to implement the JS SPA SDK login and logout and it works straight out of the box with little configuration to fit your own tenant details. While we’re not related to the contributor we really enjoyed a simple solution compared to the insane amount of work-arounds presented out there and in the comment section of the official Auth-0 blog post (End-to-End Testing with Cypress and Auth0) which doesn’t address how to test secured pages / content.
The only back-draw is that one has to use localstorage
for the Auth-0 token. However, functionality should be just as when using memory
.