Rayrun
โ† Back to Discord Forum

To bypass Google login into an app

guitarsngamesposted in #help-playwright
Open in Discord
guitarsngames
guitarsngames

I am testing an app which has login via Google account. Is it possible to do anything in Playwright, so that it behaves like a conventional browser. By that I mean that I don't need to login into the app via Google account every time I try to use an app, because Browser already knows I logged in into Google account. However, in Playwright I login each time for each test. I want to speed this process up by bypassing Google login.

What I tried so far.

  1. Here https://playwright.dev/python/docs/auth . I stored state.json with one test by using context.storage_state(path="state.json"). And tried to add it into another test with the following command browser.new_context(storage_state="state.json"). For some reason that does not help.

  2. Tried to load state.json into actual json object and use context.add_cookies(cookies) , but alo with no success.

Anyone has experience with such a task?

This thread is trying to answer question "Is it possible to bypass Google login in Playwright while testing an app?"

6 replies
jennifer0419
jennifer0419

Are you using Firebase?

guitarsngames
guitarsngames

Nope

guitarsngames
guitarsngames

I am not sure actually

jennifer0419
jennifer0419

If it turns out that you are, take a look at https://github.com/microsoft/playwright/issues/11164. Skip the whole extraneous debate about how Firebase stores its data. There are a few solutions in there. Also, please ๐Ÿ‘ the issue if you agree we need this to help get more attention on it! If not, this message won't help you and sorry about that.

The timing of this question is impeccable lol I'm trying to use Playwright for logging in with Google auth in my Firebase app that I'm building for a #100DaysOfCode challenge right now on X.

Here's a more precise link to where the solution starts, @guitarsngames:

https://github.com/microsoft/playwright/issues/11164#issuecomment-1633293473

I haven't tried it yet but I'm excited to rip into it and give you props if it fixes my problem, @jennifer0419 ๐Ÿ™

I just hope Playwright supports this integration out of the box at some point. There's a lot of people who would start using Playwright immediately if this was easier.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].