Commit graph

139 commits

Author SHA1 Message Date
2568234cda
Bug 28787: Comment selenium test that will fail if no SMTP server is defined
This is a deadlock I think. Any ideas how we could continue to test that
in any conditions?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:38:45 -03:00
6e099d0bbd
Bug 28787: Send a notice with the TOTP token
Bug 28786 let librarians enable a Two-factor authentication but force them to use
an application to generate the TOTP token.

This new enhancement add the ability to send an email containing the token to the
patron once it's authenticaed

The new notice template has the code '2FA_OTP_TOKEN'

Test plan:
- Setup the two-factor authentication (you need the config entry and the
syspref ON)
- Enable it for your logged in patron
- Logout
- Login and notice the new link "Send the code by email"
- Click on it and confirm that you received an email with the code
- Use the code to be fully logged in

QA question: Is 400 the correct error code to tell the email has not
been sent?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:38:43 -03:00
a26211d53d Revert "Bug 31104: Add a selenium test"
This reverts commit 56d79a483d.
2022-08-08 11:18:02 -03:00
dd3ba23f4a
Bug 29971: Add selenium tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-05 14:48:50 -03:00
bf32471053
Bug 25449: (QA follow-up) Fix basic_workflow.t
Now that we have made item.itype a required field, we need to ensure we
set it for the corresponding selenium test.. this wasn't entirely easy
as the html select is hidden by select2. I had to find the select2 span,
trigger a click event to open it and then find and click an option.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-21 09:40:46 -03:00
0800662227
Bug 25449: Fix basic_workflow.t
We need to create an itemtype for the biblio, then the item form will
have 942$c prefilled by default

STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
        /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
        (eval 1726):1 in Selenium::Remote::Driver::__ANON__
        (eval 1728):2 in Selenium::Remote::Driver::__ANON__
        /usr/share/perl5/Selenium/Remote/Driver.pm:953 in Selenium::Remote::Driver::_execute_command
        t/db_dependent/selenium/basic_workflow.t:224 in Selenium::Remote::Driver::get_title

Error while executing command: unexpected alert open: Dismissed user prompt dialog: Form not submitted because of the following problem(s)
------------------------------------------------------------------------------------

- 1 mandatory fields empty (highlighted) at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-21 09:40:46 -03:00
083769164b
Bug 31139: Fix basic_workflow.t
Error while executing command: element not interactable: Element <input id="tag_952_subfield_w_810691" class="input_marceditor items.replacementpricedate noEnterSubmit flatpickr-input" name="items.replacementpricedate" type="hidden"> is not reachable by keyboard at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.

Not sure if it's coming from bug 30717 or not. git bisect told me it was the culprit but we released 22.05 and it seems that we got basic_workflow.t green since then.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-15 10:47:52 -03:00
56d79a483d
Bug 31104: Add a selenium test
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-12 10:46:35 -03:00
c0803a10fd
Bug 21978: Fix Selenium tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-12 10:23:41 -03:00
Michal Urban
ed4250e7a9
Bug 30768: Capitalizing "pin" in 2FA setup
Change of text from "pin" to "PIN" in the 2FA setup interface.
This slight changes clarifies that "PIN" is an acronym,
 and increases user comprehension

To test:
1) Log in as an Administrator
2) Enable TwoFactorAuthentication
3) Log in to a user with superlibrarian permissions.
4) On the user profile page, click the "More" dropdown button,
click "Manage Two-Factor
5) Check that "pin" is displayed in lowercase, in both instances.
6) Apply patch.
7) Refresh the page and observe that "pin" has changed to "PIN"
8) Sign off.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-09 09:43:29 -03:00
169c535e88
Bug 29860: Remove item type-related warnings
To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/selenium/regressions.t
=> FAIL: You see several
item-level_itypes set but no itemtype set for item (985) at /kohadevbox/koha/Koha/Schema/Result/Item.pm line 905.
2. Apply this patch
3. Repeat 1
=> SUCCESS: No more item type warnings
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-01 15:59:07 -03:00
b9a755d795
Bug 30695: (follow-up) Fix selenium test
The tab title words were re-ordered and we forgot to update the
corresponding selenium test.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2022-05-17 08:23:58 +01:00
b63f6d95f7 Bug 30639: Split search terms for patron search
If several terms are passed we should split them.

Test plan:
Search for "edna acosta" (without quotes) in the filters from the left
side of the main patron search
Do some regression tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-06 10:33:10 -10:00
ff980555f3 Bug 28998: Adjust Selenium test
Test plan:
Run t/db_dependent/selenium/authentication_2fa.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-04 05:18:31 -10:00
31450d8f2f Bug 29894: Add Selenium tests for disable 2FA
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-02 11:22:58 -10:00
83bd88e040 Bug 30576: (follow-up) Corrections to behaviour to reflect unit tests
The unit tests highlighted my original patch didn't cover the full
preference description.

We now replace the 'standard' option with the fields from the preference
and we also add those fields as options to the field selection in
advanced searches.

This patch also adjusts the tests to test for that and reflects the
expected changes to the number of options displayed in the select boxes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-28 10:49:20 -10:00
e02e1cba5f Bug 30626: (QA follow-up) Fix test plan
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-28 10:49:20 -10:00
7148e222d5 Bug 30626: Fix test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-28 10:49:20 -10:00
c8199147b1 Bug 30595: Prevent update_child_to_adult.t to fail randomly
t/db_dependent/selenium/update_child_to_adult.t ..         # Looks like you planned 3 tests but ran 2.

    #   Failed test 'Update child to adult'
    #   at t/db_dependent/selenium/update_child_to_adult.t line 132.
    # Looks like you planned 3 tests but ran 2.
    # Looks like you failed 1 test of 2 run.
t/db_dependent/selenium/update_child_to_adult.t .. 1/1
 #   Failed test 'Update child to patron'
 #   at t/db_dependent/selenium/update_child_to_adult.t line 153.
Cannot wait more for element '//input[@type="submit"]' to be visible at /kohadevbox/koha/t/lib/Selenium.pm line 189.

It happens when there are too many patron's categories and the submit
button is not in the viewport.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-22 10:02:52 -10:00
74792b35a8
Bug 28786: Fix 2FA selenium tests
Looks like there was a bad rebase at some point.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2022-04-22 15:40:21 +01:00
6eeb9bc1b3 Bug 28786: Two-factor authentication for staff client - TOTP
This patchset introduces the Two-factor authentication (2FA) idea in
Koha.

It is far for complete, and only implement one way of doing it, but at
least it's a first step.
The idea here is to offer the librarian user the ability to
enable/disable 2FA when logging in to Koha.

It will use time-based, one-time passwords (TOTP) as the second factor,
an application to handle that will be required.

https://en.wikipedia.org/wiki/Time-based_One-Time_Password

More developements are possible on top of this:
* Send a notice (sms or email) with the code
* Force 2FA for librarians
* Implementation for OPAC
* WebAuthn, FIDO2, etc. - https://fidoalliance.org/category/intro-fido/

Test plan:
 0.
  a. % apt install -y libauth-googleauth-perl && updatedatabase && restart_all
  b. To test this you will need an app to generate the TOTP token, you can
 use FreeOTP that is open source and easy to use.
 1. Turn on TwoFactorAuthentication
 2. Go to your account, click 'More' > 'Manage Two-Factor authentication'
 3. Click Enable, scan the QR code with the app, insert the pin code and
 register
 4. Your account now requires 2FA to login!
 5. Notice that you can browse until you logout
 6. Logout
 7. Enter the credential and the pincode provided by the app
 8. Logout
 9. Enter the credential, no pincode
10. Confirm that you are stuck on the second auth form (ie. you cannot
access other Koha pages)
11. Click logout => First login form
12. Enter the credential and the pincode provided by the app

Sponsored-by: Orex Digital

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-20 20:43:15 -10:00
61f82da49a Bug 30063: Add selenium tests
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-04 09:47:01 +02:00
35fb56169a Bug 30063: Fix selenium tests
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-04 09:47:01 +02:00
a8636478c2 Bug 29915: (QA follow-up) Spelling
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-22 10:17:33 -10:00
a5c6c7afab Bug 29915: Add selenium tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-22 10:17:33 -10:00
65cc721e9f Bug 29779: Fix unit tests count
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-02-11 09:11:39 -10:00
1c054e70f8 Bug 29779: Make selenium tests return green even if lib is missing
Some selenium tests are not correctly written and they fail is
Selenium::Remote::Driver is missing.

Test plan:
1. Remove the lib rm `pmpath Selenium::Remote::Driver`
2. prove t/db_dependent/selenium/
should return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-31 21:55:40 -10:00
78cb924b12 Bug 29690: Add selenium test
Run prove t/db_dependent/selenium/regressions.t on KTD with selenium

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-28 21:52:54 -10:00
e214d5e976 Bug 29696: Add tests
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 21:10:07 -10:00
65edbe5af2 Bug 29485: (follow-up) Trying to prevent administration_tasks.t to fail randomly
Recreated the problem after run #47
Error while executing command: no such element: Unable to locate element: //*[@id="userid"] at /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm line 411.

With this patch I do not longer recreate the failure. It's ugly but,
well, I don't have any other solutions. It seems that the accept_alert
is taking too long and is async (??)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-24 09:38:13 +01:00
26dd400283 Bug 29485: Trying to prevent administration_tasks.t to fail randomly
Since bug 19185, and Koha_Master running the tests after t/db_dependent/selenium/01-installation.t is ran, t/db_dependent/selenium/administration_tasks.t is failing randomly with:

12:32:59 koha_1       | STRACE:	/usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
12:32:59 koha_1       | 	(eval 1710):1 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1       | 	(eval 1712):2 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in Selenium::Remote::Driver::_execute_command
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in (eval)
12:32:59 koha_1       | 	/kohadevbox/koha/t/lib/Selenium.pm:170 in Selenium::Remote::Driver::find_element
12:32:59 koha_1       | 	t/db_dependent/selenium/administration_tasks.t:188 in t::lib::Selenium::click

I don't recreate it locally.

The screenshot of the failure shows that the screen is still on the authorised value list view.

This does not make a lot of sense, but I am failing to find a logic
here.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-15 15:06:25 +01:00
d895962994 Bug 29368: Fix remove_from_cart
Reusing what has been done previously.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-29 15:46:17 +02:00
4988c80905 Bug 29368: Correctly mock Zebra index from tests
This is just reusing what is done in Search.t (and that is correct).
But search_utf8.t and remove_from_cart.t are wrong as we want to use the
UI (and we cannot mock the zebra index, ie. koha-conf, from tests for
plack).

This still needs some work but improve a bit the existing code and make
tests pass (hopefully!)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-29 15:45:53 +02:00
d821cf9c9c Bug 28959: Fix other cases
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-28 17:47:38 +02:00
54a1c5433b Bug 19185: Fix regressions.t
The following test is failing:
| #   Failed test 'OPAC - Remove from cart'
| #   at t/db_dependent/selenium/regressions.t line 132.
| Can't call method "get_value" on an undefined value at t/db_dependent/selenium/regressions.t line 110.
| # Looks like your test exited with 2 just after 3.
| [12:14:08] t/db_dependent/selenium/regressions.t

We are dependind on the search engine and the records in the DB but the
installer is not inserting any records.

This patch is suggesting to reuse the code from search_utf8
(and so make it reusable first) for remove_from_cart test.
This code is mocking the Zebra index with some MARC data and so the
search will return results. We will finally be able to click on the
add to/remove from cart links.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-26 16:46:02 +02:00
e203730002 Bug 19185: Add missing +x on new test files
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 13:09:34 +02:00
39e969f05f Bug 19185: Split installation and onboarding
The previous installation tests were testing the full onboarding process
by not selecting all the sample data.
It would be good to test the whole sample data set.

So there are now 2 files, 00-onboarding.t and 01-installation.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
4fb71cc8ac Bug 19185: DB must exist but empty
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
cfccfcab02 Bug 19185: Fix tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
ae7ddc4ab2 Bug 19185: Add selenium tests for installation and onboarding process
== Test plan ==
1. Apply the patches (including bug 19821)
2. restart_all
3. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
4. result: Config entry 'database_test' does not exist at
     /home/vagrant/kohaclone/t/lib/Bootstrap.pm line 18
5. Edit $KOHA_CONF, add a database_test entry identical to database
     You should have:
     <database>koha_kohadev</database>
     <database_test>koha_kohadev</database_test>
6. restart_all
7. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
8. result: Entries 'database_test' and 'database' have the same value in your
     config at /home/vagrant/kohaclone/t/lib/Bootstrap.pm line 20.
9. Edit $KOHA_CONF, edit database_test with koha_test as DB name
10. restart_all
11. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
12. result: Access denied for user 'koha_kohadev'@'localhost'
       to database 'koha_test'
13. Connect to the DBMS
14. Example for koha_testing_docker
      docker exec -it koha_db_1 bash
      mysql -u root --password=password
15. GRANT ALL PRIVILEGES ON `koha_test`.* TO 'koha_kohadev';
16. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
17. result: All tests successful.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
93350d14b2 Bug 28929: Add selenium tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Bug 28929: (follow-up) Add exec flag to tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-09-30 09:18:57 +02:00
9d6d641d1f Bug 17600: Standardize our EXPORT_OK
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:47 +02:00
dca25b9dce Bug 28409: Adjust regression test
We are no longer expecting an URI escaped value but a corrected category
value, either 1 or 2.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 10:12:54 +02:00
8df6ac9c88 Bug 28489: Add selenium tests
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

JD amended patch: Remove libraries the tests created

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-14 17:35:19 +02:00
f4568e7f7c Bug 26703: Fix selenium tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 15:25:07 +02:00
03dea5f51e Bug 27029: Add a selenium regression test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-27 12:03:42 +01:00
de73925929 Bug 26847: (follow-up) fix get_attribute() call
Since the upgrade to Selenium 3 in bug 27055, an additional parameter is
required for get_attribute() to actually work.
https://metacpan.org/pod/Selenium::Remote::WebElement#get_attribute

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-05 14:40:26 +01:00
69bf6e80cf Bug 26847: Add UI test for categorycode in masthead
This test adds a regression test for the addition of categorycode
into the masthead of the staff client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-04 16:31:29 +01:00
3c3406257e Bug 27055: Fix compatibility with newer Firefox+Selenium version
Fix "submit is not a function error"
A submit button should not be named "submit", in this case, it's id.
https://stackoverflow.com/questions/833032/submit-is-not-a-function-error-in-javascript

Fix some uses of get_attribute()

Fix a fail by setting a global implicit_wait_timeout, default value is 0
in our lib. Other libs set it higher which helps to not have to manually
deal with part of the timing issues.

Fix: remove usage of click_when_visible() because it doesn't work with
elements not in the top of the page. Because they are off screen.

Fix: use $driver->quit() in error_handler to not forget an open Firefox.
With the current version, it fills /dev/shm and fails with around 5
Firefox opened.
Also use quit() it at the end of every script.

Fix: filling item fields, to fill only the displayed one (not those
with display:none)

== Test plan ==
1. Update selenium/standalone-firefox to the latest version [1]
2. prove t/db_dependent/selenium/authentication.t
3. It fails with: arguments[0].form.submit is not a function
4. Apply patch
5. Retest
6. Success

[1] In koha-testing-docker you can do it with
docker-compose.yml:
     selenium:
-        image: selenium/standalone-firefox:2.53.1-americium
+        image: selenium/standalone-firefox

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2020-12-30 12:04:49 -03:00
48e74cebed Bug 12430: Fix selenium/regressions.t failure
Test failed with
    # Looks like you planned 4 tests but ran 3.
t/db_dependent/selenium/regressions.t .. 2/5
 #   Failed test 'OPAC - Remove from cart'
 #   at t/db_dependent/selenium/regressions.t line 109.
Error while executing command: clickElement: An unknown server-side error occurred while processing the command.: Element is not clickable at point (583.7000122070312, 14). Other element would receive the click: <a class="page-link" href="/cgi-bin/koha/opac-search.pl?idx=kw&amp;q=d&amp;offset=420&amp;sort_by=relevance_dsc&amp;count=20" aria-label="Go to the last page"></a>

https://pic.infini.fr//Qhq7pLBq/jT9wZ7F1
The remove from basket link for the biblio 3 is hidden by the floating
toolbar.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-12-04 17:05:34 +01:00