Fredx87 / cypress-keycloak-commands

Cypress commands for login with Keycloak
MIT License
69 stars 30 forks source link

Is the static user fixture a requirement? #26

Open prewk opened 4 years ago

prewk commented 4 years ago

Wouldn't it be sensible to allow environment variables to determine the user, as is common in a CI context?

This solution requires one to commit user credentials into git 😓

prewk commented 4 years ago

I tried forking and fixing it, but for some weird reason I can't push to my fork! Never happened to me before, so I'm at loss here.. anyway, the solution I was going for was allowing kcLogin to take either the string it's taking today or a UserData object, and then doing a typeof user === 'string' check.

So the signature would change to kcLogin(user: string | UserData): Chainable<KcTokens>;

I don't know enough about Cypress or keycloak to be confident about that solution, however, and the tests in this package just sat around and failed to start so 🤷 hehe..

(Btw, is kcLogin really returning Chainable<KcTokens>..? Is Cypress solving that, because it seems to be missing a return on src/kc-login.ts:6 and src/kc-login.ts:11 but then again, I don't know much about Cypress)

jdtully commented 4 years ago

I ran into this problem as well, and separating the credentials from the repo is on my Issues list. It would be nice if the package was updated to work with .env as I DO have Cypress.env working beside for the credentials

jdtully commented 3 years ago

Any movement on this?

bethaniala commented 3 years ago

We're not using this plugin yet, because we would have to store the user credentials in git without encryption. It would be great if we had the flexibility of passing the username and password directly to kcLogin. This way we could store them in env variables or store them encrypted in git and decrypt them before calling kcLogin.

rm3l commented 3 years ago

We had similar concerns, so I opened #32 as a new PR before just seeing this open issue :-)

@prewk I thought about the same approach you mentioned to handle both types :-)

Hopefully the PR gets merged soon.

Meanwhile, if anyone wants to give it a try, feel free to point to the fork I created, by updating your package.json file :

"cypress-keycloak-commands": "rm3l/cypress-keycloak-commands#distrib",
prewk commented 3 years ago

Cool, I can't promise I have the time to try it atm due to stuff but awesome work!

jdtully commented 3 years ago

any movement on this repo?

prewk commented 3 years ago

This package is pretty solid: https://github.com/babangsund/cypress-keycloak