简体   繁体   中英

Login to Azure-Active Directory from cypress tests

I have to write automation tests for application that requires login to Azure Active Directory.
The tests are written with cypress and TypeScript.
Im looking for an idea how to do login from my tests with user name and password.
The login process must include 2FA.
I tried to do it in interactive mode, but I had a problem how to get the OTP, This is the reason that I want to do the login in non-interactive mode.
Any idea how to login programmatically?

When I've talked to people on the AAD product team, they've usually said it's not a good idea to try to automate the login UI. They have checks in place to check for odd behaviour and this could trip those, breaking your tests.

I don't have a good solution to offer for this. You could somehow inject tokens into your front-end that you acquired in a different way. ROPC is an option but won't support MFA. Another is to bootstrap the process manually and keep a refresh token somewhere that you can then use to get tokens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM