-
Notifications
You must be signed in to change notification settings - Fork 9
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
Playwright Multiple user authentication" Screen is launching a blank page. #619
Comments
I am having this same issue. Using the Playwright dev Authentication document, I am passing the Playwright page object to my fixture where I set my authenticated context state, I set the context, and when I call new_page() it opens an entirely new blank page with that context, leaving another blank page without. I have tried closing the first page when I create the second, but my test still sees the first page, and still fails because my test runs against the blank page. I also tried just not passing the page object to the fixture where I make the new page (just mashing buttons at this point), which did not resolve the issue. Closing the initial page would be ideal, but if there was some way to just get the test to ignore the first one, I'd take that. |
Closing the initial page - does it help playwright to execute tests on the
other page after closing the blank page? Wondering how playwright control
switches to blank page to an actual other page to execute the test? Can you
please advise
…On Fri, Jun 7, 2024 at 2:07 PM BrandonCowart ***@***.***> wrote:
I am having this same issue. Using the Playwright dev Authentication
document, I am passing the Playwright page object to my fixture where I set
my authenticated context state, I set the context, and when I call
new_page() it opens an entirely new blank page with that context, leaving
another blank page without.
I have tried closing the first page when I create the second, but my test
still sees the first page, and still fails because my test runs against the
blank page.
I also tried just not passing the page object to the fixture where I make
the new page (just mashing buttons at this point), which did not resolve
the issue.
Closing the initial page would be ideal, but if there was some way to just
get the test to ignore the first one, I'd take that.
—
Reply to this email directly, view it on GitHub
<#619 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3C5PQ7JHJNXTOSDNXANSILZGIAGNAVCNFSM6AAAAABI7FKH4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGM3TCOBQGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
@InduKrish I'm still figuring this out, but closing the initial page seems to close the actual window (while in --headed mode I can see the actual browser window close). However, the test still seems to execute against a blank window (with url= about:blank). I believe this is because I am still using Playwright's default Page fixture, because of the way I define my tests
I'm honestly not sure how to operate without that, though. If I take out the default page fixture, and just try to use my own DashboardHomePage object, I need to re-define all of the default functionality like .locator() in order to use it. |
We are using Playwright testing library for our test framework, and it is really helpful, now we are trying to do authentication once then reuse session storage, storage state (cookies) for the rest of the tests instead of manually logging in every time.
here is the link for reference.
https://playwright.dev/docs/auth
I am able to capture session storage and reuse it for logging in and perform only playwright page queries , not able to execute screen queries(eg: queryByTestId())..
i see the test opens a blank page and the other page with the actual URL.
looks like the issue is that the screen fixture opens up a blank page, and it is searching for the locator on the blank page.
if i remove screen fixture from the code below, it works ok, but adding a screen fixture opens up a blank page, and queryByTestId() is looking to search for the element on the blank page, instead of searching the element on the other window that opens the actual URL.
Can you please advise how to get rid of the blank page or how to make screen point to the actual page instead of the blank page? Can you please assist?
Test:
The text was updated successfully, but these errors were encountered: