-
Notifications
You must be signed in to change notification settings - Fork 288
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
Feature Request: Support incognito browser contexts #81
Comments
Update: Here's how I managed to make it working right now, it's not very pretty IMO but it works. If its run in headful mode you will see a window pop-up and close before the incognito ones appear. As mentionned in the documentation, I created a custom environment in a file named
I link to it in from the
I wish I could redefine |
Yeah good idea, I would prefer to avoid environment variable and add an option in config |
Follow up #133 |
@Niceplace you could have added after this
in puppeteer_environment.js and use |
Hi @justfathi I'm exactly trying to use those config line to open separate new browser context for each test, I've changed my config as you suggested, but still doesn't look like it's doing it, |
@mohammedalnuaimi there is a better way to do this than what I mentioned above. let page, context; If you want a new page/tab just use "await context.newPage();". If you want a new browser then do "await global.BROWSER.createIncognitoBrowserContext();" which will give you the "context" and you can use this to get a new page/tab |
thanks @justfathi the thing is I'm using the custom implementation suggested by Jest-puppeteer which suggests setting up three config files: setup.js, environment and tearmdown.js |
@justfathi I think your previous answer triggered me thinking a bit deeper about it, so the solution for this is I only need to change the line in the test where we first create the page from Thanks mate |
Puppeteer 1.5.0 introduces a new feature, the support for incognito browser contexts.
Since all the tests seem to run in the same browser instance here, we could leverage this functionality to ensure isolation between all tabs. This could be useful to run multiple tests that require separate user sessions / cookies, etc.
I'm thinking the solution could be implemented here :
https://github.com/smooth-code/jest-puppeteer/blob/d06f58feca62d5ea5225d53a20035db6dd82d750/packages/jest-environment-puppeteer/src/PuppeteerEnvironment.js#L50
My suggestion :
Do you think I need to consider other things or that makes sense ?
If this seems like a reasonable solution, are you open to PRs ? :)
Thanks !
The text was updated successfully, but these errors were encountered: