Bug 29285 - UI tests: Selenium 4 support or setup Cypress to make them rewritable with it
Summary: UI tests: Selenium 4 support or setup Cypress to make them rewritable with it
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Victor Grousset/tuxayo
QA Contact: Testopia
URL:
Keywords:
Depends on: 27055
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-20 13:45 UTC by Victor Grousset/tuxayo
Modified: 2025-01-20 17:57 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Grousset/tuxayo 2021-10-20 13:45:13 UTC
Now v4 is the default when getting the docker image selenium/standalone-firefox .

For Selenium 4, the maintainer of our current perl bindings wrote another client: https://metacpan.org/pod/Selenium::Client
Comment 1 Katrin Fischer 2023-06-24 20:44:52 UTC
Is this one still valid?
Comment 2 Victor Grousset/tuxayo 2023-12-19 07:31:41 UTC
Unfortunately yes and no.

Yes because Firefox is stuck at some old version (2 or 3 years old) because only Selenium 4 supports recent ones.

No because Selenium tests are less reliable so higher maintenance. So the work (kinda unpredictable like from Selenium 2 to 3) to change our Selenium lib would not be worth for just prolonging their use.
The alternative is setting up Cypress to be able to replace Selenium. As opposed to today.

Jonathan told me a few months what are the limitations:
No DB access to inject and delete/rollback data. That's why current Cypress usage mocks all network queries.
Path forward would be to read koha-conf and use cypress-mysql (see cypress-studio in Jonathan's GitLab repo)
Then the issue is data generation (no TestBuilder!) and cleaning.
«IMO there shouldn't be time spent on a migration to Selenium (at least for now)»

That doesn't look a small task to find a trick to use TestBuilder or recode it plus the rest so we are kinda stuck at the crossroads between the two ways.
Comment 3 Victor Grousset/tuxayo 2024-01-02 18:35:07 UTC
> Yes because Firefox is stuck at some old version

In case someone needs the info, it's Firefox 92, from September 2021.
Comment 4 Victor Grousset/tuxayo 2024-12-06 05:31:03 UTC
Moving here a discussion where I erroneously thought Bug 38503 would allow to replace TestBuilder.

> Bug 38503 won't help much here.

Now that there is an easy way to have well populated json objects (in sync with the tables because the API is kept well in sync) in the Cypress tests, is there much to do to feed them to the API? Most TestBuilder usage should be on tables that are well covered by the API.

Here is what I found in the Selenium tests:
- Koha::Patrons
- biblio record
- Koha::Libraries

- Koha::Virtualshelves (Bug 38050)
- items
- Koha::ItemTypes
- Koha::Patron::Categories

"that are well covered by the API" => nope >_<
Only the 1st group has the add endpoint and only one of the others has work in progress on it.


There is also the need to have something else added to easily cleanup data. Like truncating tables.
And since it seems not possible to use transactions there nor mock sysprefs, the more subtle data to cleanup like circ rules and sysprefs need more crafty ways.
Maybe using an SQL connector[1], getting an SQL dump of a table and on cleanup truncating and inserting would do the trick?

[1] https://www.npmjs.com/package/mariadb or maybe there is a more generic one. To not add yet another DBMS specific thing.


Is there a shorter path forward? Whether it's using Bug 38503 or not.