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(launcher): Provide option to run puppeteer with different browsers #5137

Merged
merged 6 commits into from Nov 26, 2019

Conversation

mjzffr
Copy link
Contributor

@mjzffr mjzffr commented Nov 8, 2019

This is an initial refactoring of Launcher to enable run-time browser selection in Puppeteer, starting with Firefox. On our side, we're tracking this and related work at https://bugzilla.mozilla.org/show_bug.cgi?id=1590467

/cc @whimboo @andreastt @AutomatedTester

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@mjzffr mjzffr changed the title Add option to run different browsers with main puppeteer package feat(Laucher): Add option to run different browsers with main puppeteer package Nov 8, 2019
@mjzffr mjzffr changed the title feat(Laucher): Add option to run different browsers with main puppeteer package feat(Launcher): Provide option to run puppeteer with different browsers Nov 8, 2019
@mjzffr mjzffr changed the title feat(Launcher): Provide option to run puppeteer with different browsers feat(launcher): Provide option to run puppeteer with different browsers Nov 8, 2019
@mjzffr
Copy link
Contributor Author

mjzffr commented Nov 8, 2019

@mathiasbynens Hi! This is ready for review. My CLA is in the works.

I looked at the results of the checks and it seems the failures are known to be intermittent... Let me know.

This change introduces a PUPPETEER_PRODUCT environment
variable as a first step toward using Puppeteer with
many different browsers. Setting PUPPETEER_PRODUCT=firefox, for
example, enables Firefox-specific Launcher settings.

The state is also exposed as `puppeteer.product` in the API
to support adding other product-specific behaviour as needed.

The bulk of the change is a refactoring in Launcher
to decouple generic browser start-up from product-specific
configuration.
The funit script is renamed to fjunit (j for Juggler, which is
used only by the experimental puppeteer-firefox package.

In contrast, the funit script now refers to running Puppeteer
unit tests against the main puppeteer package with Firefox.
To do so with Firefox Nightly, run:

`BINARY=path/to/firefox npm run funit`

A number of changes in this patch make it easier to run
Puppeteer unit tests in Mozilla's CI.
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Nov 9, 2019
@mjzffr
Copy link
Contributor Author

mjzffr commented Nov 9, 2019

@googlebot I signed it!

@mathiasbynens
Copy link
Member

Yay, thanks for sending this over! Just as a heads-up, I won’t be able to review this as soon as I’d like, since I’m traveling for ChromeDevSummit and BlinkOn this week. I’ll get back to y’all as soon as I can.

Copy link
Member

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

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

I left some initial comments and questions. I want to do a more thorough second pass after BlinkOn, but figured this should get the conversation started.

Thanks again for your work on this!

test/puppeteer.spec.js Outdated Show resolved Hide resolved
lib/helper.js Show resolved Hide resolved
test/puppeteer.spec.js Outdated Show resolved Hide resolved
lib/Puppeteer.js Outdated Show resolved Hide resolved
lib/Launcher.js Outdated Show resolved Hide resolved
lib/Launcher.js Outdated Show resolved Hide resolved
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot removed the cla: no label Nov 15, 2019
@rodoabad
Copy link

Have the documents been updated on how to use this new feature? i.e. do you still need puppeteer-firefox?

@chrisLovesCode
Copy link

Have the documents been updated on how to use this new feature? i.e. do you still need puppeteer-firefox?

puppeteer.launch({product: 'firefox'})
but it's classified as experimental.
Have a look at the FAQ here: https://github.com/puppeteer/puppeteer#faq

@rodoabad
Copy link

rodoabad commented Feb 3, 2020

@chrisLovesCode it doesn't say if puppeteer downloads firefox like how it downloads chromium or not. If we still need puppeteer-firefox then that's fine. Just wish the documentation was clear on that apart from explaining the new API.

@chrisLovesCode
Copy link

okay , i got your point! ..yes i agree, would be nice to get some informations, currently i have not tried out to use firefox, but would like to do it soon, since i will write e2e tests with puppeteer

@mjzffr
Copy link
Contributor Author

mjzffr commented Feb 4, 2020

@rodoabad puppeteer doesn't download Firefox. That's tracked in #5151

Totally agree that this should be clearer from the docs; I expect that will get better as progress is made on Firefox support.

peterblazejewicz added a commit to peterblazejewicz/DefinitelyTyped that referenced this pull request Apr 7, 2020
peterblazejewicz added a commit to peterblazejewicz/DefinitelyTyped that referenced this pull request Apr 14, 2020
peterblazejewicz added a commit to peterblazejewicz/DefinitelyTyped that referenced this pull request Apr 29, 2020
typescript-bot pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request May 11, 2020
andreialecu pushed a commit to andreialecu/DefinitelyTyped that referenced this pull request May 12, 2020
jjballano-qatium pushed a commit to jjballano-qatium/DefinitelyTyped that referenced this pull request Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants