junit-pioneer / junit-pioneer

JUnit 5 Extension Pack
https://junit-pioneer.org
Eclipse Public License 2.0
536 stars 75 forks source link

Support Playwright #426

Open nipafx opened 3 years ago

nipafx commented 3 years ago

Playwright is "a Node.js library to automate Chromium, Firefox and WebKit with a single API" that now also supports Java. Let's see how we can best integrate it with JUnit Jupiter.

One thing to note is that we should keep the dependency on Playwright optional (aka provided), so we don't drag it in ourselves if users don't already use it. It should probably also be in its own package org.junitpioneer.(jupiter.?)playwright. If it proves successful and grows, we can always spin it out into its own project by moving the package there.

In this issue, let's collect and discuss ideas. For their implementation, we can create dedicated issues.

My only idea so far:

nipafx commented 3 years ago

PSA: I'm gonna work on this on stream on February 9th, starting at 1800 UTC.

beatngu13 commented 3 years ago

Related: I once leveraged @ParameterizedTest for cross-browser testing with Selenium:

https://gist.github.com/beatngu13/8d5f60355d7fbef143198f020b1efca3

Haven't looked into Playwright so far, but maybe something similar can be done here.

nipafx commented 3 years ago

I'm pretty sure, I've already written an extension like this for Selenium, but I can't find it. No idea where that one went. I dimly remember opening a PR somewhere... 🙈

beatngu13 commented 3 years ago

One thing to note is that we should keep the dependency on Playwright optional (aka provided), so we don't drag it in ourselves if users don't already use it.

Rather than using provided, how about optional (Maven) / feature variants (Gradle)? Haven't used these myself, but it sounds exciting! (Related blog post.)

If it proves successful and grows, we can always spin it out into its own project by moving the package there.

junit-pioneer-playwright, junit-pioneer-selenium, … 👏

Bukama commented 3 years ago

Hm. One of the most common tools to automate browsers is Selenium, which supports many langauges, including Java and JavaScript. And for Selenium there is already a great extension, called Selenium-Jupiter. See my test project including description etc here: https://github.com/Bukama/seleniumtest

nipafx commented 3 years ago

Thanks for the link to feature variants, @beatngu13. I took a peek and they sure look interesting, but I feel like we don't need them here. In this instance, we don't need Playwright for specific Pioneer features (which is what that blog post describes) - instead we integrate with it and that only makes sense if Playwright is already present (that's why I thought, we should use provided) and I want the user to make that decision and pick the version.

uchagani commented 2 years ago

@nipafx perhaps this already solves the issue https://github.com/uchagani/junit-playwright