[Koha-devel] Cross-browser automated testing in Javascript (Puppeteer/Playwright)

dcook at prosentient.com.au dcook at prosentient.com.au
Thu Feb 4 23:21:48 CET 2021


Based on
https://github.com/teodesian/Selenium-Remote-Driver/issues/452#issuecomment-
760415316, there's only 1 person maintaining that library, and he's even
saying there's a lot of work to do on it. 

It would either be Puppeteer *or* Playwright. I'd be more inclined to go
with Playwright as it supports Chromium, Firefox, and WebKit. That said,
I've only used it with Chromium.  

Selenium seems a lot more heavy-weight and has a diminishing reputation.
With Selenium, you need a Java-based server (we're using a Docker container
for that), whereas with Puppeteer/Playwright, all you need is Node.js
installed and then you just need to install the puppeteer/playwright Node
module and it installs everything you need into a disposable node_modules
directory. (Actually, Playwright has a few options for where to install the
browser binaries, but not relevant here.)

I have a fair bit on my plate at the moment, but I know code speaks louder
than words too, so maybe at some point I could put something together...

David Cook
Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia

Office: 02 9212 0899
Online: 02 8005 0595

-----Original Message-----
From: Victor Grousset/tuxayo <victor at tuxayo.net> 
Sent: Friday, 5 February 2021 7:29 AM
To: dcook at prosentient.com.au; 'koha-devel'
<koha-devel at lists.koha-community.org>
Cc: 'Tomas Cohen Arazi' <tomascohen at theke.io>
Subject: Re: Cross-browser automated testing in Javascript
(Puppeteer/Playwright)

Hi :)

On 21-02-01 05:08, dcook at prosentient.com.au wrote:
> What do people think about doing our cross-browser automated testing 
> in Javascript rather than Perl? We're already using Node.js for 
> generating Koha's CSS:
> https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and
> _staff_interface 
>
<https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staf
f_interface>.
> 
> 
> I've been playing with Puppeteer and Playwright lately for non-test 
> related browser automation, and they're pretty easy to work with.
> Playwright is based on Puppeteer, and their basic APIs are the same, 
> so fairly interchangeable. (We'd need to use another library like Jest 
> or Playwright-test to do the test evaluation.)
> 
> It looks like we only have 6 files that use Selenium, so it wouldn't 
> be a big drama to replace them.

Thanks for you exploration work :D

I don't think I can help much in setting up the test stack **but** I can
rewrite all the tests in whatever the community see fit.

Though I don't really know what would be the gains in practice of switching
to Playwright compared to staying with Selenium via Perl.
Or switching to Selenium via JavaScript if our Perl lib gives troubles.
No opinion for now.

About our Selenium Perl lib, it's still being maintained with good work in
progress to support the upcoming Selenium 4
https://github.com/teodesian/Selenium-Remote-Driver/issues/452#issuecomment-
760415316

Is Puppeteer needed in a stack using Playwright? Because it's centered on
Chromium, it's already a good surprise that Google worked to bring
experimental Firefox support. But it's hard to bet that it will get stable
and still be maintained for years.
https://github.com/puppeteer/puppeteer/#q-what-is-the-status-of-cross-browse
r-support


> There is a Perl library https://metacpan.org/pod/Playwright
> <https://metacpan.org/pod/Playwright> but it's just a wrapper around 
> Playwright anyway and it's so new that I'd be a bit wary of using it.

If the tests are to be rewritten to use Playwright, +1 to do that in JS
rather than Perl to avoid depending on an unofficial lib.


-- 
Victor Grousset/tuxayo




More information about the Koha-devel mailing list