How to mock login in cypress

We are using @okta/okta-auth-js client and I want to mock the login (without actual credentials) for cypress. But I’m getting error at token.getWithoutPrompt.

We’ve successfully implemented Okta login in the JHipster project. If you generate an app with OAuth 2.0 / OIDC for authentication, it’ll create e2e tests for you that work with Keycloak. They also work with Okta, but we did have to integrate Puppeteer too because Okta uses JS on their login form, whereas Keycloak does not.

This PR shows some of the code we added to make things work. https://github.com/jhipster/generator-jhipster/pull/13611

@mraible I don’t want to actually login, I just want to mock the login for my e2e testing so that they can run without internet.

Oh. I’m sorry, but I don’t know how to do that.

@mraible Can anyone from okta team help me out?

There’s an open issue on GitHub with someone trying to do something similar to what you want. I’d suggest joining that conversation.