Commit graph

6261 commits

Author SHA1 Message Date
0adc264edb
Bug 32349: Remove TEST_QA
There is an env var that we are passing from koha-testing-docker, TEST_QA.
It's used in Koha from a single test file, t/00-testcritic.t.
If not set, no test is run.

Do we really need this? libtest-perl-critic-perl is packaged and automatically installed.

Signed-off-by: Mason James <mtj@kohaaloha.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-11 20:44:21 -03:00
8b714dc30c
Bug 32208: Extend Auth.t
Test plan:
Without follow-up patch, Auth.t should fail:
    not ok 5 - No permission response
    not ok 6 - checkauth returned failure

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-10 18:19:55 -03:00
67d239c1ff
Bug 31908: Add selenium tests
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-10 18:19:01 -03:00
795b4cb6de
Bug 31908: Add a test to show issue
Test plan:
Without next patch, run Auth.t.
Should fail now before next patch resolves problem:
    not ok 2 - Login of patron2 approved
    ok 3 - Did not return previous session ID
    not ok 4 - New session ID not empty

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

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-10 18:19:01 -03:00
c3d7d72bc3
Bug 32529: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-05 09:21:15 -03:00
f8b7a5a9cd
Bug 32529: Add Koha::Holds->filter_by_found
This patch adds a method for filtering Koha::Holds resultsets by the
status belonging to Koha's concept of 'found'.

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

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-05 09:21:10 -03:00
ac6b7f9b58
Bug 32456: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-27 10:42:19 -03:00
3dcdd6db78
Bug 32394: (follow-up) Add param for Koha::BackgroundJob::StageMARCForImport->enqueue
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-16 09:00:45 -03:00
76d676a868
Bug 20596: Add unit test for multiple values in authority search
This patch adds a unit test which returns 2 authority records
via an implicit OR when searching for strings from two different
authority records.

Test plan:
1. prove t/db_dependent/Search.t

Signed-off-by: Jan Kissig <jan.kissig@th-wildau.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-15 09:52:16 -03:00
b8e4d7d770
Bug 32394: Add tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-14 14:32:27 -03:00
9e025bb7aa
Bug 32394: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-14 14:31:37 -03:00
d7c1d52051
Bug 32417: Add unit test
Test plan:
Run t/db_dependent/Koha/Acquisition/Order.t
This test should fail without the follow-up and pass with it.
* not ok 53 - No croak on missing biblionumber when cancelling an order

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-13 09:14:08 -03:00
3411a2c002
Bug 32366: (bug 30460 follow-up) Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-01 10:02:21 -03:00
7f8156cf5c
Bug 29274: Remove z_reset.t
From the description of commit d25f3e8437

"""
    Bug 22709: (RM follow-up) Clean up plugin tests

    The plugin tests were failing due to failed rollbacks and run order.
    This patch moves them into their own directory and adds a reset test to
    restore the original state of the plugin system after the tests have
    run.
"""

This is wrong, the tests are run in a random order.

We don't need this file.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-01 09:33:04 -03:00
a69efaa2a5
Bug 32351: Fix t/db_dependent/Koha/Charges/Sales.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:20 -03:00
3200c18e7d
Bug 32351: Fix t/db_dependent/Circulation/NoIssuesChargeGuarantees.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:20 -03:00
8455c0b83d
Bug 32351: Fix t/db_dependent/api/v1/patrons.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:19 -03:00
11ac81782f
Bug 32351: Fix Koha/Patrons.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:19 -03:00
ca77a59a9b
Bug 32351: Fix TemplateToolkit.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:18 -03:00
cd49ab5c28
Bug 32351: Fix CourseItems.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:18 -03:00
5f07e7afff
Bug 32351: Fix Circulation.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:17 -03:00
4824bbf195
Bug 32351: Fix Reserves.t
itemtypes.notforloan already defaults to 0

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:17 -03:00
a471e6d5bc
Bug 32351: Fix Members.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:16 -03:00
ade52182c4
Bug 32351: Fix Illrequests.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:16 -03:00
d077aa2e7d
Bug 32351: Fix Budgets.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:15 -03:00
eecad982ee
Bug 32351: Fix Acquisition.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:15 -03:00
ad3d34bfd1
Bug 32351: Holds.t - remove wrong column reference
Found by bug 32350.
The test does not need this value at all..

Test plan:
Run test.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:14 -03:00
f1d2ec4aa8
Bug 31381: Add tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:13 -03:00
46aa87c600
Bug 32350: Add subtest for bad columns
Test plan:
Run t/db_dependent/TestBuilder.t
And now run the whole test suite :)

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:33 -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
404c88fe87 Bug 31969: Use filter_by_last_update
This script has a pattern to delete rows depending on a given
date/number of days, we should use the filter_by_last_update
Koha::Objects method.
No need for another method and tests, everything is already tested
there.

This patch also suggests to rename the reference to "background" and
"bg" with "jobs", which seems more appropriate and not an abbreviation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-25 09:40:09 -03:00
11918dcb72
Bug 32304: BackgroundJobs.t: Fix subtest purge
Instead of deleting, I added a count :)
Note that one of the purges eventually deletes my
older jobs..

Test plan:
Run t/db_dependent/Koha/BackgroundJobs.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-25 09:38:17 -03:00
0a1d7aa520
Bug 32304: Fix subtest search_limited
Jenkins reported:
    not ok 1 - No jobs found without userenv

We need to check if there are jobs without borrowernumber.

Test plan:
Run test again.

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-25 09:38:13 -03:00
509ff8f05c
Bug 32343: Prevent Koha/Patron.t to fail randomly
Highlighted by Bug 32030: fix test builder for boolean

The attribute is named "unique_id", not "unique"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-25 09:27:45 -03:00
1672bd3ed2
Bug 32269: Prevent Circulation.t to fail randomly
Highlighted by Bug 32030: fix test builder for boolean

    #   Failed test 'Checkouts with auto-renewal can be renewed earliest on due date if no renewalbefore'
    #   at t/db_dependent/Circulation.t line 343.
    #          got: '2022-11-18T14:16:12'
    #     expected: '2022-12-02T00:00:00'

    #   Failed test 'Checkouts with auto-renewal can be renewed earliest on due date if no renewalbefore'
    #   at t/db_dependent/Circulation.t line 349.
    #          got: '2022-11-18T14:16:12'
    #     expected: '2022-12-02T23:59:00'
    # Looks like you failed 2 tests of 5

We were reaching return $now

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-23 09:29:45 -03:00
c6e5467e5f
Bug 31378: Tests shouldn't remove all patrons
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-22 18:23:07 -03:00
158ddef999
Bug 31080: Unit tests
Unit tests for add_to_bundle functionality that prevents bundle nesting.

Test plan
1) Run t/db_dependent/Koha/Item.t
2) The test should fail
3) Apply the second patch
4) Re-run the test and watch it pass.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-22 16:28:11 -03:00
7c7db3eb6b
Bug 24606: (QA follow-up) Fix Template.t
The test cases here still assumed UTF-8 enocding in the middle
of the process. Can be much simpler.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-22 13:33:39 -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
d8d03c8efa
Bug 32178: Adapt tests to new auth.session params
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-18 12:04:30 -03:00
cb7b9b37c9
Bug 32268: Prevent XSLT.t to fail randomly
Can't call method "itemnumber" on an undefined value at /kohadevbox/koha/Koha/Recall.pm line 343.

We should set item_level and not let TestBuilder pick a value.

This may have been caught (make it more obvious) by the recent change to
TestBuilder for boolean (Bug 32030: fix test builder for boolean)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-18 12:04:28 -03:00
3d8ff90a8f
Bug 32010: Make sure the alert will be displayed after the ajax call
There is a missing wait_for_ajax call at after we click but wait_for_ajax
is waiting for the return of success, and the alert is there.

22:01:57 koha_1       | STRACE:	/usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
22:01:57 koha_1       | 	/usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
22:01:57 koha_1       | 	(eval 541):1 in Selenium::Remote::Driver::__ANON__
22:01:57 koha_1       | 	(eval 543):2 in Selenium::Remote::Driver::__ANON__
22:01:57 koha_1       | 	/usr/share/perl5/Selenium/Remote/Driver.pm:654 in Selenium::Remote::Driver::_execute_command
22:01:57 koha_1       | 	t/db_dependent/selenium/authentication_2fa.t:282 in Selenium::Remote::Driver::get_alert_text
22:01:57 koha_1       | 	/usr/share/perl/5.32/Test/Builder.pm:334 in main::__ANON__
22:01:57 koha_1       | 	/usr/share/perl/5.32/Test/Builder.pm:334 in (eval)
22:01:57 koha_1       | 	/usr/share/perl/5.32/Test/More.pm:809 in Test::Builder::subtest
22:01:57 koha_1       | 	t/db_dependent/selenium/authentication_2fa.t:291 in Test::More::subtest
22:01:57 koha_1       |
22:01:57 koha_1       |     # Looks like you planned 7 tests but ran 4.
22:01:57 koha_1       |
22:01:57 koha_1       | #   Failed test 'Enforce 2FA setup on first login'
22:01:57 koha_1       | #   at t/db_dependent/selenium/authentication_2fa.t line 291.
22:01:57 koha_1       | Error while executing command: no such alert at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.
22:01:57 koha_1       |  at /usr/share/perl5/Selenium/Remote/Driver.pm line 356.
22:01:57 koha_1       | # Looks like your test exited with 255 just after 4.
22:01:57 koha_1       | [20:59:37] t/db_dependent/selenium/authentication_2fa.t

Test plan:
Confirm that the test pass (execute it in a loop, hundreds of times)
Confirm that the behaviour of 2FA "enforced" (see bug 30588) is still
working as expected.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-18 12:04:28 -03:00
ac041571c3
Bug 24606: (QA follow-up) Add test for encoding/decoding
NOTE: I have the impression that this unit test is quite
rudimentary. I do not see the apply function tested?

Test plan:
Run t/db_dependent/Koha/Item/Templates.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
tcohen amended: stray deps
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-18 12:04:27 -03:00
923609f42e
Bug 32267: (bug 32154 follow-up) Fix Agreements.t
#   Failed test at t/db_dependent/Koha/ERM/Agreements.t line 111.
    #     Structures begin differing at:
    #          $got->[0]{user_role_id} = '2'
    #     $expected->[0]{user_role_id} = Does not exist
    # Looks like you failed 1 test of 4.

Another fix may be better, please suggest if you disagree

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-18 12:04:25 -03:00
a922c8cc96
Bug 32242: Add selenium tests
This is not testing the thing at the correct level, but at least we test
the whole workflow.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 14:16:12 -03:00
98aaabee9f
Bug 32248: Remove t/00-checkdatabase-version.t
Since bug 25078 we do no longer use updatedatabase.pl. This test was
there to make sure the RM(aints) was replacing the XXX correctly.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 14:06:59 -03:00
a711e153d6
Bug 32131: Make sure we login before we restore original pref's value
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 13:39:46 -03:00
fc48e6117f
Bug 32131: Move set_ERM_sys_pref_value to before
We cannot (yet) move login to before, but we can set the pref before all
the tests. We need to login in before anyway to retrieve the value of
the pref.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 13:39:45 -03:00
5d794c99cc
Bug 32131: Cypress tests are failing if ERMModule is off
This patch solves this by enabling the system preference before each test,
right after login. It also sets the system preference back to its original
initial value after the tests finish running.

To test:
1) Disable ERMModule system preference
2) Run cypess tests: yarn cypress open / yarn cypress run
3) Verify that tests run successfully
(Optional): While tests are running, visit the system preferences panel and verify that the system preference is now "Enable".
4) Wait for the tests to finish and confirm that the system preference is set back to its original "Disable" value.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 13:39:45 -03:00
32aceb32d4
Bug 32240: Prevent erm_users.t to fail if checkout exist
We should not (never) remove all patrons before tests

Test plan:
0. Don't apply the patch
1. Check an item out
2. Run the tests
=> Fail
3. Apply the patch
4. Create a patron with the erm permission
5. Run the tests
=> Must return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 13:39:44 -03:00