"Authenticating with MSAL-protected single-page applications using Playwright has been a challenge for many developers. However, by setting up an Azure test user and client secret, acquiring tokens via the ROPC flow, and building a token factory, testers can seamlessly authenticate their automated tests. This approach avoids bypassing authentication or using popup windows to enter credentials, providing a more robust testing experience.
Source: https://dev.to/yahyaalshwaily/testing-msal-protected-single-page-applications-in-playwright-2f35