Playwright-test – cross-browser end-to-end test suite with Playwright
github.com
github.com
Playwright feels much more like you’re simply driving a browser because you are — it gets out of your way like any good tool should, so you can debug your tests instead of your browser automation toolkit. The trade-off of Playwright is that meant, at least early on, that it wasn’t “batteries included” and the ecosystem around it is only just now starting to mature. This is a great time to start using Playwright IMO.
One gripe with Playwright is that you lose the ability to easily deploy your tests to services like Browserstack where you can do true multi-device testing. For that you need to use Selenium, or (recently?) Cypress. Because of the nature of Playwright only targeting specific browser engines, it seems unlikely that Browserstack would ever fully support it.
But there is probably a place for both, with Playwright closer to the bottom of the pyramid and Selenium / Browserstack toward the top for only the most critical e2e acceptance tests. You could also write your tests in such a way that they could mostly run on Selenium with just a few changes to how you orchestrate them, although then you might end up chasing the “lowest common denominator” of what’s available in either paradigm.
As an aside, I’d love to hear the story of how the Puppeteer team left Google for Microsoft while taking their toys with them. I wonder if there is some drama there? :)
[0] https://docs.cypress.io/guides/references/trade-offs#Permane...
So much so that I wrote what may? be the first third-party client for it: https://metacpan.org/pod/Playwright
Here's my writeup on why I like playwright versus selenium: https://troglodyne.net/posts/1617057517
Most of this is invisible to end-users of selenium, as it's just a hammer they pick up; the struggles of the maintainers is not (nor should it be) something they have to worry about.
Nevertheless, they probably could get some hay mentioning that their API implements a significant amount more functionality versus every other cross-browser testing framework.
That said, they really don't have to, the work really stands by itself.
It's pretty apparent that it requires an awful lot of maintenance to keep up with the browsers, so if this really does reduce the workload on them then that ought be noticeable on my end with fewer bugs, quirks and backwards compatibility issues. This is more exciting to me than all of the other features (I'm a bit dubious of the ability to detect if a page has really 'loaded', for instance).
You can even choose different events to wait for!
That said, there's no accounting for developers who think FOUCs are normal, etc and generally make your life as a tester and end user difficult.
The one thing that was missing was a purpose-made test runner. I'm using mocha currently, and while it works fine, there isn't a built-in way to e.g. run the test against multiple browsers w/o ugly for loops/before statements (that I'm aware of). It looks like this defaults to running against all browsers so you don't even have to think about it. The screenshot assertions also look nice!
Very cool! Excited to try this out.
It is possible, for instance, to extend the runner with an extra set of matcher that are out there & available to Jest?
It looks like puppeteer may now support FF, but not WebKit/Safari.
It just seems like there is probably a story there.
>We are the same team that originally built Puppeteer at Google but has since then moved on. Puppeteer proved that there is a lot of interest in the new generation of ever-green, capable, and reliable automation drivers. With Playwright, we'd like to take it one step further and offer the same functionality for all the popular rendering engines. We'd like to see Playwright vendor-neutral and shared governed.
Out of curiosity, does anyone know of any advantages of Playwright when compared to Cypress?
We’re working on plugging in playwright into a cloud service for visual testing @superadmin.so, running multiple browsers in Linux can be pretty hairy to setup.
Playwright is just an API for controlling the browser, and appears to be far more powerful in that regard.
Compare the api documentation, and it's not even close: https://docs.cypress.io/api/table-of-contents
Playwright also has a python version (https://github.com/microsoft/playwright-python)
And I just discovered that they now have a real nifty debugger you can use to inspect/step-through tests as they run (https://playwright.dev/docs/next/debug/#playwright-inspector)
Both of them are essentially wrapping devtools protocols. AFAIK, much of the playwright approach was guided by trying to Hew as closely to the puppeteer approach, but cross-platform. Both the APIs are very similar.