Commit graph

7570 commits

Author SHA1 Message Date
323863ba14
Bug 23685: (follow-up) Add export limit for guided reports
Test plan:
Set pref ReportsExportLimit to some positive integer.
Test if exporting a report respects that limit.
Run t/db_dependent/Koha/Reports.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-27 18:00:29 +02:00
b4054dbb15
Bug 37812: (QA follow-up) Add watchers for warning and confirmation prop and initialise modals with bootstrap methods on changes in Dialog.vue
- Use more targeted selectors in cypress tests Trains.ts, WaitingList.ts.
- Await result of accept_callback, then close modal.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-20 09:16:04 +01:00
d09ef98b85
Bug 37812: (QA follow-up) Prevent cypress test failures by correcting modal selector, removing ambiguity of contains calls, replace by get with respective ids
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-20 09:15:54 +01:00
a5702bb71a
Bug 37812: (QA follow-up) Prevent cypress test failure by adjusting selector in DataProviders_spec.ts
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-20 09:15:51 +01:00
7cd31e98e0
Bug 37898: Wrap some ERM api tests inside a transaction
Trivial ones.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:50:20 +01:00
979d1cb2c5
Bug 37898: Wrap Patroncards.t inside a transaction
This tests leave data on the DB and need to be fixed. This patch does
that.

To test:
1. Run:
   $ ktd --shell
  k$ echo "SELECT COUNT(*) FROM creator_layouts \G" | koha-mysql kohadev
2. Run:
  k$ prove t/db_dependent/Patroncards.t
=> SUCCESS: Tests pass
3. Repeat 1
=> FAIL: Numbers don't match the original ones!
4. Apply this patch
5. Repeat 2 and 3
=> SUCCESS: Tests still pass!
=> SUCCESS: Numbers match!
6. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:50:20 +01:00
be0931fdf7
Bug 37898: Wrap Relationships.t inside a transaction
This tests leave data on the DB and need to be fixed. This patch does
that.

To test:
1. Run:
   $ ktd --shell
  k$ echo "SELECT COUNT(*) FROM borrowers \G" | koha-mysql kohadev
  k$ echo "SELECT COUNT(*) FROM borrower_relationships \G" | koha-mysql kohadev
2. Run:
  k$ prove t/db_dependent/Patron/Relationships.t
=> SUCCESS: Tests pass
3. Repeat 1
=> FAIL: Numbers don't match the original ones!
4. Apply this patch
5. Repeat 2 and 3
=> SUCCESS: Tests still pass!
=> SUCCESS: Numbers match!
6. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:50:20 +01:00
e052614d7f
Bug 37898: Wrap labels tests inside transactions
This tests are written in a way that the cleanup is done explicitly. So
I found no evidence of them leaving the database dirty. But it felt
worth wrapping anyway, because any dev adding something could easily
introduce new data inadvertedly.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:50:19 +01:00
b41fa9b487
Bug 37898: Wrap Indexer.t inside a transaction
This tests leave new data on the DB. This patch fixes it.

To test:
1. Run:
   $ ktd --shell
  k$ echo "SELECT COUNT(*) FROM biblio \G" | koha-mysql kohadev
2. Run:
  k$ prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t
=> SUCCESS: Tests pass
3. Repeat 1
=> FAIL: Biblio count raised
4. Apply this patch
5. Repeat 2 and 3
=> SUCCESS: Tests pass
=> SUCCESS: Biblio count remains
6. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:50:19 +01:00
3615baf92f
Bug 35100: (follow-up) Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:41:58 +01:00
edf978668a
Bug 35100: (follow-up) Fix test
Previous patches changed the return values, just needed to update expectations

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:41:55 +01:00
bcb4ac59d4
Bug 35100: Revert change to request_transfer
This patch reverts the change to request_transfer, opting to tackle the
StockRotationAdvance requirement to stay in place in ModItemTransfer
itself.

We also add a FIXME to RotatingCollections.. I'll look to removing that
on another bug to reduce the scope of this one.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:41:53 +01:00
d64a206a25
Bug 35100: Various fixes
1) Don't automagically always set a transfer to in transit on checkin..
   wait for the user to actually confirm that's the case
2) New transfers triggered by a hold should take precidence, so hide
   transfers for any other reason from display
3) Update get_transfer and get_transfers to ensure ordering isn't lost
   when prefetch is used and add tests for this

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:41:50 +01:00
08cecd6c6f
Bug 35100: Unit tests
This patch adds a unit test to ensure StockrotationAdvance transfers are
not cancelled from request_transfer when called with 'replace'.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:41:42 +01:00
1c875b0157
Bug 36474: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-09-19 12:39:13 +01:00
954215d6f9
Bug 37929: Remove it.only from Agreements_spec
Test plan:
1) Run the cypress tests for Agreements_spec.ts
yarn cypress run --spec t/cypress/integration/ERM/Agreements_spec.ts
2) Only the Delete test will run
3) Apply patch and yarn build
4) Run test again, all tests should run

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-17 10:48:38 +02:00
cae45797b8
Bug 30856: Remove C4::Reserves::CanReserveBeCanceledFromOpac
This subroutine can easily be replaced and is not really needed.

Test plan:
No changes expected, try to suspend/resume holds from the OPAC

Note that you cannot affect somebody's else holds.

Note for QA: The extra fetch of Koha::Hold will be removed on bug 37868.

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-16 13:47:07 +02:00
c895a8d563
Bug 37380: Replace uses of GetMarcControlnumber for get_control_number()
Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-16 10:41:05 +02:00
9936c99903
Bug 37380: Unit tests
Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-16 10:41:04 +02:00
eca1cb153b
Bug 31161: Unit tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-16 10:40:58 +02:00
1740a293eb
Bug 37757: (follow-up) Adjust existing tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-09-13 16:16:01 -03:00
ea17ce2ffa
Bug 37818: (follow-up) Remove failing XXX tests from Installer.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 16:18:26 +02:00
23b00bdc06
Bug 37917: Add some wait time to RecordSources_spec.ts for the intercepted request responses
This patch introduces the `cy.wait(500)` we use in several other Cypress
tests when an (intercepted) API request is made. This is very important
when tables are being rendered as DataTables is particularly bulky and
prone to take longer to finish loading the components if the CPU load is
a bit high.

I wasn't able to reproduce the problem very often, but you can test
yourself:

1. Run:
   $ ktd --shell
  k$ run_cypress --spec t/cypress/integration/Admin/RecordSources_spec.ts
2. Run it many times
=> FAIL: At some point it fails, you can overload your computer to try
3. Apply the patch
4. Repeat 2
=> SUCCESS: No failures :-D
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 16:06:29 +02:00
d321dc6934
Bug 35402: Fix cypress test csrf.ts
The tests were failing because of the class having changed from
message to alert.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 16:06:27 +02:00
3b0f4ad5e8
Bug 37636: Unit test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 16:06:26 +02:00
d50aa6aa72
Bug 37757: (follow-up) Warn on bad values and survive
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 16:06:24 +02:00
24f84f11a2
Bug 37757: Unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 16:06:23 +02:00
eea4595f3e
Bug 37732: Fix 'Invalid PIN code' styling for 2FA
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 12:02:53 +02:00
af9701174f
Bug 37732: Fix administration_tasks.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-13 12:02:53 +02:00
b824c29eef
Bug 37870: Run tests from ClassSources.t within transactions
Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-12 13:52:35 +02:00
405c2ac6b6
Bug 37870: Fix sort order of class sources
There are several things going on here.
The tests are failing randomly when some additional class sources are in the
DB. This should never happen on Jenkins, but it happened, see the third
patch of this patch set (spoiler: tests not run within a txn)

There were also a sorting problem: by default sort will show
uppercases first:
  A, B, C, a, b, c
However we want:
  a, A, b, B, c, C
which is what fc does (https://perldoc.perl.org/functions/fc)

Test plan:
0. Checkout the main branch, without patches from this patchset.
1. Run t/db_dependent/ClassSources.t several times
=> Notice that new entries in the DB table 'class_sources' are created
2. Run t/db_dependent/Koha/UI/Form/Builder/Biblio.t and
t/db_dependent/Koha/UI/Form/Builder/Item.t
=> They fail (if not, run t/db_dependent/ClassSources.t again)
3. Apply the patches
4. Run t/db_dependent/ClassSources.t
=> No more additional entries in DB, tests are correctly run within
transactions
5. Run t/db_dependent/Koha/UI/Form/Builder/Biblio.t and
   t/db_dependent/Koha/UI/Form/Builder/Item.t several times
=> They always pass

Note that the sort should actually be done on the description, not the
code. But that's for another bug...

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-12 13:52:35 +02:00
3ded6e0e60
Bug 37513: Fix and add more Cypress tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-09 17:44:51 +02:00
fab4a60f28
Bug 35402: Fix cypress tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-09 11:44:19 +02:00
e2ce99e3d5
Revert "Bug 37493: [DONT PUSH] Test only - Force test fail"
This reverts commit 0d69fc6090.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-02 17:21:50 +02:00
0d69fc6090
Bug 37493: [DONT PUSH] Test only - Force test fail
Apply this patch only, run:
1) cypress run --spec "t/cypress/integration/flatpickr_spec.ts"
2) run `git status`.
  Notice t/cypress/screenshots/ and t/cypress/videos/ show
3) Apply 2nd patch. Repeat 2). Notice its empty

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-02 12:13:44 +02:00
be6e795b43
Bug 34440: (QA follow-up) Tidy changes to t/db_dependent/Koha/Item.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-30 16:41:33 +02:00
33d5ab614c
Bug 34440: Unit test for change to Koha::Item
This adds a unit test for the new preparation_period handling introduced
into the find_booking method of Koha::Item.

Sponsored-by: Cuyahoga County Public Library <https://cuyahogalibrary.org/>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-30 16:41:33 +02:00
34ff421c1c
Bug 36919: Remove yet another warning from Koha/Object.t
DBIx::Class::Storage::DBI::insert(): Missing value for primary key column 'currency' on Currency - perhaps you forgot to set its 'is_auto_increment' attribute during add_columns()? Treating 'currency' implicitly as an autoinc, and attempting value retrieval at /kohadevbox/koha/Koha/Object.pm line 172
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-29 18:16:23 +02:00
f14db22d8a
Bug 36919: Remove another warning from Koha/Object.t
C4::Context->userenv not defined! at /kohadevbox/koha/Koha/Patron.pm
line 1890.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-29 18:16:23 +02:00
722bb10c35
Bug 34088: Add unit tests
This patch adds unit tests to cover the moved and newly introduced
methods in the Koha namespace.

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

Fixed QA complaint about file permissions.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-29 18:16:20 +02:00
317456da49
Bug 37686: Fix render_resource_not_found() and render_resource_deleted() misses
This patch refactors some small pieces of code to use the helpers as
prescribed on our coding guidelines [1] instead of manually crafting
responses.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/
=> SUCCESS: All tests pass
3. Sign off :-D

[1] https://wiki.koha-community.org/wiki/Coding_Guidelines_-_API#REST4:_Controller_code_.5BDRAFT.5D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-29 18:16:19 +02:00
5b63d200a8
Bug 37748: Adjust the 'Update child to patron' selenium test
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-29 17:24:03 +02:00
4f52463551
Bug 35402: Fix some selenium tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-27 12:14:26 +02:00
190205f603
Bug 37513: Add Koha::RecordSource->usage_count
This patch adds the `usage_count` method to be used for embedding from
the API. Tests cover all use cases.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-27 12:14:24 +02:00
9b0196b7b6
Bug 37513: Handle Koha::Exceptions::Object::FKConstraintDeletio in controller
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-27 12:14:24 +02:00
e2538b5e83
Bug 37620: Fix Total-Count headers
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-27 12:14:21 +02:00
c0af0dad35
Bug 36915: (follow-up) Add tests
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-27 12:14:20 +02:00
ede0b6d8d7
Bug 23387: Add caching to C4::ClassSource
These routines ultimately need to be moved to the Koha namespace, for now though,
we can reduce look ups during import and batch modification by caching the values
here for each request

To test:
1 - prove -v t/db_dependent/ClassSources.t
2 - Import some records with items, confirm cn_sort values correctly built
3 - Edit some items, confirm cn_Sort correclty built

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-26 17:39:31 +02:00
c8cc04a397
Bug 35044: (QA follow-up): DRY code before set_additional_fields
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:26 +02:00
27fd0042be
Bug 35044: Add tests
Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 18:21:25 +02:00