Commit graph

283 commits

Author SHA1 Message Date
ad1c38b589 Bug 34913: Fix a selenium test
t/db_dependent/selenium/administration_tasks.t ....... 3/3 Cannot show all entries from table //div[@id="libraries_wrapper"] at /kohadevbox/koha/t/lib/Selenium.pm line 247.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 204a840a4d71c677d49378588f4ed529cdc83fea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-01-29 10:15:53 +01:00
d8df06a8cd Bug 35070: (QA follow-up) Fix missing TT filter
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c3d78bc35a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-01-08 15:18:37 +01:00
Julian Maurice
829ef649c0 Bug 35070: Add test verifying plugins cannot override core templates
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2233c230b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-01-08 15:18:37 +01:00
cd2e54f6e1 Bug 35070: Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 21fd864416)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-01-08 15:18:37 +01:00
Julian Maurice
fe5b461cbf Bug 35070: Add plugin hook template_include_paths
It allows to add paths to Template::Toolkit's INCLUDE_PATH option

http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH

Test plan:
1. Install the modified kitchen sink plugin:

    git clone --branch template-include-paths \
    https://github.com/jajm/dev-koha-plugin-kitchen-sink.git

2. Run misc/devel/install_plugins.pl
3. Restart memcached and koha
4. Go to Administration -> Manage Plugins
5. Run the KitchenSink plugin's tool
6. Click on "Schedule greeting"
7. Go to Administration -> Manage jobs
8. If you don't see any jobs, uncheck "Current jobs only"
9. You should see a job of type "Unknown job type
   'plugin_kitchensink_greeter". Click on the "View" button
10. Under the Report section you should see "This is the report block"
11. Under the Detailed messages section you should see "This is the
    detail block"
12. Open the browser console, you should see a message "This is the js
    block"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5047e0761c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-01-08 15:18:37 +01:00
Magnus Enger
6fec4ea0df
Bug 26170: Add protected status for patrons
This set of patches makes it possible to protect patrons from being accidetally
deleted or merged with other patrons, from the UI and from (well behaved) cron
jobs. The following subroutines are affected:
- Koha::Patron::delete
- Koha::Patron::merge_with
- Koha::Patron::safe_to_delete
- C4::Members::GetBorrowersToExpunge

Please note:
- This does not intend to protect patrons from being edited, only from being
  deleted

To test:

* Tests
- Run the affected tests:
  prove t/db_dependent/Members.t
  prove t/db_dependent/Koha/Patrons.t

* Editing protected status and manual deletion
- Add a new user, note the presence of the "Protected" field under "Library
  management", but leave it at the default "No", for now.
- Note that "Protected" is displayed in the "Library use" section of the patron
  details.
- Note that More > Delete is avaiable as an action when the patron is saved
- Edit the user and set "Protected" to "Yes"
- Note that More > Delete is now disabled, with a note that the patron is protected

* Batch patron deletion
- Go to Tools > Batch patron deletion and anonymization
- Check the box for "Verify you want to delete patrons"
- Choose the category of your protected patron for "whose patron category is"
  and click "Next" to run the actual deletion
- Check that your protected patron was not deleted

* Merging patrons
- Make sure you have two patrons with similar names or the same category, so
  you can find them with one search. One should be protected, one not.
- Search for the patrons, tick their boxes and click on "Merge selected patrons"
- Select one of the patrons as the "patron to keep".
. Click on "Merge patrons"
- "No valid patrons to merge were found" should be shown
- Repeat this with the other patron as the "patron to keep"
(A future enhancement could be to not allow a protected patron to be selected for
merging in the first place.)

* misc/cronjobs/delete_patrons.pl
- Make sure you have a protected patron, in a category with at least one more
  patron.
- Run something like this (at least in ktd):
  $ perl misc/cronjobs/delete_patrons.pl --category_code <code> -v --confirm
  (Replace <code> with the actual categorycode.)
- Make sure the borrowernumber of the protected patron is not mentioned in the
  output of the script.
- Check the protected patron was not deleted
- Check the non-protected patrons were deleted

* REST API (with ktd)
- Make sure you still have a protected patron, and note their borrowernumber
- Enable RESTBasicAuth and restart all the things
- Run these two commands from the command line on the host:
  $ curl -u koha:koha --request GET "http://localhost:8081/api/v1/patrons/54"
  $ curl -u koha:koha --request DELETE "http://localhost:8081/api/v1/patrons/54"
  (Replace 54 with the actual borrowernumber of your protected patron.)
- The first curl command should give you the patron details. The second should
  give this output:
  {"error":"Protected patrons cannot be deleted","error_code":"is_protected"}

There could be more functions/scripts where patrons are deleted that I have not
thought about. Please report them on the bug if you find any!

Update 2023-10-19: Fix "More > Delete" on patron, so link can not be clicked.
Update 2023-10-19: Rebase

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-01 17:23:06 -03:00
c6283f5d9a
Bug 33245: TestBuilder: Default value for anonymized
When we create a patron with TestBuilder, we normally
do not expect an anonymized status. This will certainly
hold for the patrons we are creating for testing is_active
in a following patch.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:48 -04:00
719b300001
Bug 33963: Remove leftovers from previous works
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-06-15 08:48:12 -03:00
50d3c3c0a8 Bug 33718: Fix the mock of Koha::Config->get in mock_config
It should not mock calls for other sections than 'config' in
koha-conf.xml.

Test plan:
Without this patch:
[1] Enable AutoLinkBiblios, CatalogModuleRelink and LinkerRelink.
This will trigger a SearchAuthorities call when creating a sample biblio.
Note: SearchAuthorities calls Zconn and gets back information from
a wrong part of koha-conf.xml.
[2] Run t/db_dependent/Koha/Pseudonymization.t
You should see something like:
  {UNKNOWN}: Can't use string ("authorities") as a HASH ref while "strict refs" in use at /usr/share/koha/C4/Context.pm line 587. at /usr/share/koha/C4/Biblio.pm line 302

With this patch:
[3] Run t/db_dependent/Koha/Pseudonymization.t. Should pass now.
[4] git grep -l mock_config | xargs -i{} prove {}
    Exclude Mocks.pm.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2023-05-16 11:47:22 +02:00
Julian Maurice
a87315e682
Bug 25503: Make Koha::Exporter::Record tests pass with unimarc
Signed-off-by: Marie-Luce <marie-luce.laflamme@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

https://bugs.koha-community.org/show_bug.cgi?id=25508
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-10 15:26:18 -03:00
6ab19f01b8
Bug 29234: (QA follow-up) Fix test that expects wrong defaults
This patch changes the get_items_that_can_fill tests so they explicitly
set a 'datearrived' as the new defaults for fresh transfer objects from
TestBuilder is more sane and has this field undef. Tests *should always*
create their required scenarios explicitly.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 18:35:54 +02:00
80f5b33511
Bug 29234: Unit test
This patch adds a test that a pending stock rotation transfer is initiated on
checkin, as well as updating the defaults for creating transfer objects

To test:
prove -v t/db_dependent/Circulation.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 11:56:49 +02:00
813bd47b4c
Bug 32353: Don't generate item group for holds in tests
See bug 31447, we don't want the tests to deal with potential failures
because of some item groups.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-22 10:04:37 -03:00
d766992f2b
Bug 32353: Pick the default value for FK
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-22 10:04:37 -03:00
9b9b8f1920
Bug 32350: Use array_minus and ignore nesting
Note: Test will be extended in follow-up. This fixes the
module_bit hash to follow the FK path from user_permissions
to permissions to userflags. One step was missed in the
existing test, although it did not fail. The change here
revealed that now.

Test plan:
Run t/db_dependent/TestBuilder.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: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 12:40:28 -03:00
527f8fadcc
Bug 32010: 2AF selenium tests - Alert can appear when we are waiting for ajax
If we are waiting for ajax (there is a sleep 1s) and the alert pops up
at the same time, Selenium is raising "unexpected alert open"

We should not wait for the ajax request, but better wait for the
alert actually.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-22 08:55:09 -03:00
Stefan Berndtsson
2f6b597b08
Bug 31896: New after_recall_action hook
Hooks added:
after_recall_action with new action add

How to test:
Run tests in t/db_dependent/Koha/Plugins/Recall_hooks.t

Sponsored by: Gothenburg University Library

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT} Adding get_from_storage ;) For current consistency.
See further bug 32107.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 14:34:41 -03:00
Agustin Moyano
016105cf8c
Bug 31378: Rename Auth Provider to Identity Provider and add Client.t tests
Signed-off-by: Lukasz Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 14:39:51 -03:00
3bf57d92a1
Bug 32030: ERM - REST API - GET POST PUT DELETE specs
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:37 -03:00
7e0009e96a
Bug 32030: fix test builder for boolean
assume that tinyint are boolean (not really true but shouldn't hurt)

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:32 -03:00
Stefan Berndtsson
68f7ea8cdf
Bug 31895: New after_account_action hook
Hooks added:
after_account_action with new action add_credit

How to test:
Run tests in t/db_dependent/Koha/Plugins/Account_hooks.t

Sponsored by: Gothenburg University Library

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-11-07 11:16:27 -03:00
cccae533fe
Bug 31992: Fix t::lib::Mocks::Zebra
This will fix t/db_dependent/www/batch.t and t/db_dependent/www/search_utf8.t

QA - improvement ideas welcome! It's definitely not the best we can do.

Test plan:
  prove t/db_dependent/www/search_utf8.t t/db_dependent/www/batch.t
must return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-28 16:30:05 -03:00
5f8126aef3
Bug 31162: (follow-up) Fix Mocks/Zebra.pm
This patch updates the t/lib/Mocks/Zebra.pm testing module for the
change of navigation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-27 08:22:38 -03:00
adf252d96c
Bug 17170: Add API route for SearchFilters
This adds the API routes and tests

Sponsored-by: Sponsored by: Round Rock Public Library [https://www.roundrocktexas.gov/departments/library/]

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:15:14 -03:00
a26cc8a29b
Bug 31684: Set Koha::Plugin::Test version to 'v1.01'
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-10-21 10:01:22 -03:00
246efd2e9b
Bug 31883: Filter trim causes false warnings
Test plan:
Run xt/find-missing-filters.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: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-20 11:22:33 -03:00
Solène Desvaux
f43558f539
Bug 30952: Staff interface redesign (header)
What this patch does:
- change the navigation bar style
- change the breadcrumbs style
- change the "last borrower" link style
- move the search bar inside the navigation bar
- move the help link to the same row as the breadcrumbs

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-12 15:58:16 -03:00
88cc881521
Bug 30982: API tweaks
This patch makes the following changes to the 'background_jobs' API:

* We now call them 'jobs'
* Removed deprecated query parameter definitions
* Added only_current query parameter
* Controller gets adapted to use $rs->filter_by_current when
  only_current is passed

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:49 -03:00
727193dead
Bug 31351: (QA follow-up) Adjust tests accordingly
Test plan:
Run t/db_dependent/Koha/BackgroundJob.t
Run t/db_dependent/Koha/BackgroundJobs.t
Prove t/db_dependent/Koha/BackgroundJobs

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:59:07 -07:00
b306cb47ce
Bug 31145: Supply defaults for vendors and funds
This is a convenience bug - when koha testing docker creates sample vendors and budgets there are small issues:

1 - The vendor website gets a random string - you can't edit the vendor without removing this
2 - The funds have random values for statistical categories, and you get empty dropdowns when choosing a fund in ordering

To test:
1 - Apply patch
2 - Restart all
3 - Edit 'My vendor'
4 - note webstie is empty and you can save without changing anythign
5 - Add order to basket for my vendor
6 - Confirm that when selecting a fund statistic 1 and statistic 2 remain as text input fields

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:16 -03:00
fdc933adb4
Bug 31133: Don't generate values for more than one FK
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-12 10:57:52 -03:00
b4eaac91c9
Bug 30275: (QA follow-up) Fix TestBuilder.t
This patch adds 'CheckoutRenewal.checkout_id' to the list of non-foreign
key relations found in _should_be_fk.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-06 12:18:46 -03:00
defcdd85a4
Bug 30889: Unit tests
This patch adds a unit test for the 'enqueue' part of the bug. We check
that the mocked context (and interface) are recorded with the job
enqueue in the new 'context' field.

We do not yet test the 'process' end, where we then read the context out
and set the job Context from it.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-30 12:03:19 -03:00
6cd0249725
Bug 30830: Add Koha Objects for Koha Import Items
To test:
prove -v t/db_dependent/Koha/Import/Record/Items.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-05-31 08:53:55 -03:00
7709b2cddf Bug 29924: (follow-up) Add default value undef for TestBuilder
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-06 10:33:09 -10: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
211044ad1a Bug 30410: Unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-13 15:55:40 +02: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
8fdfa80609 Bug 30181: (QA follow-up) Update BatchTest
This patch updates t::lib::Koha::BackgroundJob::BatchTest to the new
style, and also removes a couple stray cases in which job_id was still
passed as a parameter.

Tests are rewritten a bit, so they actually test more of the behaviors.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/BackgroundJobs.t
=> SUCCESS: Tests pass!
3. Sign off :-D

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-22 10:17:33 -10:00
1bbfda8c78 Bug 30072: (follow-up) Fix UT after Bug 29857
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-03 16:11:50 -10:00
f51868cb82 Bug 30072: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-03 16:11:49 -10:00
2b9fae5445 Bug 29857: Rename base class as Koha::Exception
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-03-01 22:47:47 -10:00
5520b8fb84 Bug 29458: Fix selenium test
The authentication.t selenium tests (and a couple of others) were
failing with:
Error while executing command: element not interactable: Element <input class="btn btn-primary" type="submit"> could not be scrolled into view at /usr/local/share/perl/5.32.1/Selenium/Remote/Driver.pm line 411. at /usr/local/share/perl/5.32.1/Selenium/Remote/Driver.pm line 356.

We changed the other of the form, and t::lib::Selenium::submit_form was
not getting the correct (first) form. The one from the auth modal was
retrieved and submit button was clicked. Selenium raised an error as it
is not displayed.
The ->is_displayed selenium method does not work, as per the doc
"""
Note: This does *not* tell you an element's 'visibility' property; as it still takes up space in the DOM and is therefore considered 'displayed'.
"""
https://metacpan.org/pod/Selenium::Remote::WebElement#is_displayed

"The internet" is saying we should be able to use the following in our
xpath expression: not(ancestor::div[contains(@style,'display:none')]
but it actually only works if the display:none rule is defined on the
node (not from .css). Which does not work for us.

The only solution I found is to check for the size of the element, which
is (0,0) if not effectively displayed.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-02-11 09:11:39 -10:00
20366164af Bug 29495: Fix TestBuilder.t
Value not allowed for auto_incr issue_id in Issue at /kohadevbox/koha/t/lib/TestBuilder.pm line 387.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-18 23:03:59 -10:00
53956232f9 Bug 29565: Prevent regressions.t to fail on slow boxes
It's failing randomly on some Jenkins' nodes

 #   Failed test 'Encoding in session variables'
 #   at t/db_dependent/selenium/regressions.t line 300.
 Can't call method "get_text" on an undefined value at t/db_dependent/selenium/regressions.t line 285.

It can be recreated locally with the following changes:
@ t/lib/Selenium.pm:50 @ sub new {
     );
     bless $self, $class;
     $self->add_error_handler;
-    $self->driver->set_implicit_wait_timeout(5000);
+    $self->driver->set_implicit_wait_timeout(1000);
     return $self;
 }

@ t/lib/Selenium.pm:50 @ sub new {
     );
     bless $self, $class;
     $self->add_error_handler;
-    $self->driver->set_implicit_wait_timeout(5000);
+    $self->driver->set_implicit_wait_timeout(1000);
     return $self;
 }

This patch suggests to simply double the timeout.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-24 09:38:13 +01:00
22392e4a61 Bug 29273: Remove warnings from plugin tests
This patch is suggesting to move the broken test plugins into a separate
directory.

t/lib/plugins and t/lib/bad_plugins

Signed-off-by: David Nind <david@davidnind.com>
JK: Add executable bit to Broken.t
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-15 12:38:39 +01:00
064933165b Bug 27173: Add tests
Test plan:
Run t/db_dependent/Koha/Plugins/authority_hooks.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-03 15:40:52 +01:00
b296b8ae23 Bug 29350: Don't need to escape the 'delete' TT methods
Will be needed by bug 22605.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-02 15:58:08 +01: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