Skip to content
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

feat: add incognito mode #534

Merged
merged 7 commits into from Oct 20, 2020
Merged

feat: add incognito mode #534

merged 7 commits into from Oct 20, 2020

Conversation

Sethtrosity
Copy link
Contributor

Description

Added the ability to use Incognito tabs.
At least with chrome, it uses a cache for sites, incognito forces to reload everything.
This might help better detect when the "add to cart" button is updated.

Testing

Tested with a normal link with "headless:false" to see if it actually opens in "incognito" and it does.

001

002

New dependencies

@Sethtrosity Sethtrosity requested a review from jef as a code owner October 17, 2020 18:43
@SesioN SesioN mentioned this pull request Oct 19, 2020
Copy link
Owner

@jef jef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Just the one comment. Let me know what you think.

Thanks!

Comment on lines 38 to 39
const context = await browser.createIncognitoBrowserContext();
const page = (config.browser.isIncognito ? await context.newPage() : await browser.newPage());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd wrap this context within the if statement as well, so we don't create the incognito browser context without needing to.

@Sethtrosity
Copy link
Contributor Author

Sethtrosity commented Oct 19, 2020

Looks good overall! Just the one comment. Let me know what you think.

Thanks!

I'm not sure how you would wrap it in an if statement, but every browser has a BrowserContext by default, so I changed the code to assign context to be either default or incognito. Also, closing the page, closes the default BrowserContext, but you have to close the incognito BrowserContext separately. What do you think?

@jef
Copy link
Owner

jef commented Oct 20, 2020

Ah, that makes a lot of sense to me now. I remember being a little confused when I was playing with the context and passing it around in a feature branch I was working in.

Thanks for the explanation!

@jef jef merged commit 2b6457e into jef:main Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants