-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Azure AD login for a Web App #18390
Comments
A similar thing will work for Playwright, if you use |
@mxschmitt Can you elaborate more on this ? Do you mean to do a page.request.post on before test ? don't we need to store the decoded token in the local storage similar to how they did in the above post ? |
is this what you meant to say ?
|
Yes, you need to rewrite injectTokens to Playwright. So you can do something like: await page.evaluate(yourToken => {
window.localStorage.setItem("key", yourToken);
}, yourToken) See here for evaluating JavaScript: https://playwright.dev/docs/evaluating and you can do the "heavy request" in globalSetup so its done a single time and set stuff always in beforeEach, or use storage states: https://playwright.dev/docs/auth |
How does storage states work with localstorage ? |
As most of these keys which we need to set on the localstorage are dynamic like here
if i do something like you mentioned above
|
See in https://playwright.dev/docs/evaluating that you need to pass the variables over as an argument which you want to use inside the callback (which runs inside the browser). Local Storage gets serialized as well with storage states. I recommend reading through https://playwright.dev/docs/evaluating and https://playwright.dev/docs/auth |
Quick Question as i am very new to playwright
and in the test
does the above makes sense ? |
@mxschmitt i am pretty confused with the approach here this is what i did as for now i feel this only limited to beforeeach setup , give we need to use the same page object for running tests - i don't think the global setup would work here here is what i did but that doesn't seem to be working
if i just load the token to the local storage and run page.goto that doesn't seem to be working for me , do we need to store the localstorage to storage state ? |
I made some progress setting up the global setup but this is not working for me as expected , can you correct me if any of my setups are wrong here
Every time this setup runs, I keep getting this error
|
i either get the above error or |
@bheemreddy181 I'll have to close this since this becomes more of a general programming discussion rather then a playwright-specific discussion. Please ask this question on other forums like StackOverflow, or possible on https://aka.ms/playwright/slack! |
Is there a way we can simulate a similar functionality in playwright https://medium.com/version-1/using-cypress-to-test-azure-active-directory-protected-spas-47d04f5add9 ?
The text was updated successfully, but these errors were encountered: