Cypress.io is getting some traction these days and since my favorite FE superstar @bahmutov promotes it a lot I couldn't help myself but get my hands dirty. Writing FE tests was always a pain and Cypress is promising a painless experience.
Going through the docs definitely was painless. Documentation is spiced with lots of best practices and I would say it's a good read about the FE/E2E testing in general. But still... while they stress you should not log in by visiting the login page, Cypress doesn't work with OAuth/OpenID out of the box.
My web-app is secured with Keycloak (KC) - an open-source identity and access management server. I had the privilege to work on KC while in Red Hat and I still got a strong emotional attachment to the project. I want to encourage people to use KC thus finding and sharing a proper way to use Cypress with KC secured web-app was inevitable.
The logout command is trivial:
The test itself now couldn't be easier to scaffold:
Moving KC variables to environment variables will be the next natural step. Anyway, if you got any issues with this approach, or even better - suggestions, please comment.