I dont know how this was working before, but if we do:
cat -n /usr/share/perl5/HTTP/Response.pm | grep Error
We notice that error_as_HTML returns 'An Error Occurred' for page title and that is what we should be expecting?
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Caused by bug 37056.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Previous patch "Bug 35362: (follow-up) Fix guaruntor preview modal close in test"
didn't adjust the other occurrences.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This patch updates the selenium test to correct the selector used to
close the preview modal as it changed with this patchset.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
to highlight the problem
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>
These tests highlight the fact that the 'place hold' button visibility in the
search results page **does not** match the 'place hold' button visibility in
the detail page, given the same conditions.
Since that this is a known behavior, these tests should be commented out as they
are failing by design.
prove t/db_dependent/selenium/opac_holds.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Tests added to cover different use cases and combinations of circulation rules values for authenticated and unauthenticated users
At the moment, 2 tests are failing, documented on the [DO NOT PUSH] commit.
These 2 failing tests fail for the search results page but pass on the detail page counterpart. Ideally they should match, for consistency sake.
But this may be the use case "details page should be more correct, results page is always an approximation" mentioned by Nick.
More test combinations may be added in the future.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
When submitting the form to create a new patron we are doing a POST
memberentry.pl that is redirecting to moremember.pl
The selenium test is expecting for the end of the request to test the
page's title against "Patron details for ".
But it's only waiting for the POST response (302), not the GET
moremember that will display the patron's details.
You can simulate a slow server using cpulimit: `cpulimit -b -p $PID -l 1`
replacing $PID with the pid of the starman process.
Note that other tests are failing using 1%, but... baby steps.
The current failre:
# Failed test at t/db_dependent/selenium/basic_workflow.t line 122
Wide character in print at /usr/share/perl/5.32/Test2/Formatter/TAP.pm line 125
# 'Add patron (test cat description) › Patrons › Koha'
# doesn't match '(?^u:Patron details for test_patron_surname)'
The next one (NOT fixed by this patch):
# Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
# '
#
# Checkouts (0)# # '# doesn't match '(?^u:Checkouts \(1\))'
t/db_dependent/selenium/basic_workflow.t .. 14/22 # Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
# '
#
# Checkouts (1)
#
# '
# doesn't match '(?^u:Checkouts \(2\))'
t/db_dependent/selenium/basic_workflow.t .. 16/22 # Failed test at t/db_dependent/selenium/basic_workflow.t line 256.
# '
#
# Checkouts (2)
#
# '
# doesn't match '(?^u:Checkouts \(3\))'
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 34478: TO SQUASH op modify=>edit_form, add=>add_form ( pass opadd to template )- memberentry.pl
The template expects opadd when showing the form - along the way it was changed to 'add' and broke new patron
entry
Bug 34478: TO SQUASH op modify=>edit_form, add=>add_form ( pass op to template )- memberentry.pl
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jenkins is failing with
koha_1 | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
koha_1 | /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
koha_1 | (eval 582):1 in Selenium::Remote::Driver::__ANON__
koha_1 | (eval 584):2 in Selenium::Remote::Driver::__ANON__
koha_1 | (eval 556):17 in Selenium::Remote::Driver::_execute_command
koha_1 | /usr/share/perl5/Selenium/Remote/WebElement.pm:125 in Selenium::Remote::WebElement::_execute_command
koha_1 | t/db_dependent/selenium/authentication_2fa.t:276 in Selenium::Remote::WebElement::send_keys
koha_1 | /usr/share/perl/5.32/Test/Builder.pm:334 in main::__ANON__
koha_1 | /usr/share/perl/5.32/Test/Builder.pm:334 in (eval)
koha_1 | /usr/share/perl/5.32/Test/More.pm:809 in Test::Builder::subtest
koha_1 | t/db_dependent/selenium/authentication_2fa.t:294 in Test::More::subtest
koha_1 |
selenium_1 | 1702911648831 Marionette INFO Stopped listening on port 41385
selenium_1 | JavaScript error: resource:///modules/Interactions.jsm, line 230: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver]
selenium_1 | 15:00:49.452 INFO [ActiveSessions$1.onStop] - Removing session c3461b22-7a80-4b56-b177-653a53cc2651 (org.openqa.selenium.firefox.GeckoDriverService)
koha_1 | # Looks like you planned 7 tests but ran 3.
koha_1 |
koha_1 | # Failed test 'Enforce 2FA setup on first login'
koha_1 | # at t/db_dependent/selenium/authentication_2fa.t line 294.
koha_1 | Error while executing command: element not interactable: Element <input id="pin_code" name="pin_code" type="text"> is not reachable by keyboard at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.
The error is: "Element <input id="pin_code" name="pin_code" type="text"> is not reachable by keyboard"
A guess is that the input is either 1. outside of the viewport, or 2. not
displayed yet.
1. We are hidding #registration-form then show it when we retrieved the
info (after POST /api/v1/auth/two-factor/registration)
2. Couldn't there be a race condition?
In auth.tt
284 success: function (data) {
292 $("#registration-form").show();
And in the selenium test:
$s->wait_for_ajax; # There is an ajax request to populate the qr_code and the secret
Not sure this wait_for_ajax is waiting for the end of success, I don't
think so.
This patch is supposed to fix both theories.
Test plan:
0. Do not apply the patch
1. Edit auth.tt and sleep 1 second before showing the form:
290 const sleep = ms => new Promise(r => setTimeout(r, ms));
291 await sleep(1000);
292 $("#registration-form").show();
You will also need to replace the following line (284):
success: function (data) {
with
success: async function (data) {
2. prove t/db_dependent/selenium/authentication_2fa.t
=> "is not reachable by keyboard" error!
3. Apply the patch, keep the sleep
4. prove t/db_dependent/selenium/authentication_2fa.t
=> Tests are passing
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit (tcohen): Tidied a bit to clear complaints
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
If 'Test category' if on the second page the test will fail to
locate the Edit button.
To make sure it is displayed on the screen we are selecting "All" in the
dropdown list.
This is done a couple of lines later in the script for the same purpose.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This patch adds a test to cover the new functionality of searching an attribute not searched by default.
It also moves the addition of objects to the cleanup array right after they are created. Patrons are added to the front of the array to ensure no constraints are violated when deleting. This change ensures that if the tests die before reachign the end, the data generated is still cleaned up.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This fix patrons_search.t but other selenium tests certainly need
adjustements
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Test plan, on k-t-d selenium (ktd --selenium up):
1) Apply just this tests patch
2) Run: prove t/db_dependent/selenium/administration_tasks.t
3) Notice it fails. Apply the other patch. Restart plack
4) Repeat step 2. Notice it passes.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch re-instates the classes used for the selenium tests.. I
checked we weren't using them for javascript or css, but didn't think
about tests before.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The unit tests were written to assume we always do a 'contains' search,
but the new system preference allows for 'starts_with' or 'contains'.
As such, for the tests to pass, we need to explicitly mock the
preference to 'contains'
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
These are not needed: 942 and 200 have no subfields for
homebranch and holdingbranch.
The tests pass without these changes.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Items without a home and current library can cause errors in Koha.
On the bibliographic page, items appear without the "edit" drop-down
or the selection check box. On a bulk delete page, items without
a home library create a red error that says "Cannot delete".
Making the home and current library values mandatory
helps avoid these issues.
Test plan (using koha-testing-docker (KTD)):
1. Reset KTD so that the web installer is used to setup Koha.[1]
2. Setup Koha using the web installer
-> When setting up the default settings, don't add any of the
optional data.
3. Once setup and logged in, check the two frameworks (default and ACQ)
and note that $952$a and $952$b are not mandatory.
4. Apply the patch.
5. Repeat steps 1-2.
6. Once setup and logged in, check the two frameworks (default and ACQ)
and note that $952$a and $952$b are now mandatory.
[1] How to access the web installer to setup Koha in KTD:
1. Access the database server:
mysql -uroot -ppassword -hkoha-db-1
2. Drop the koha_kohadev database: drop database koha_kohadev;
3. Create the database: create database koha_kohadev;
4. Add privileges (for a real installation this would be limited):
grant all on koha_kohadev.* to koha_kohadev;
5. Restart everything (there may be some errors listed):
flush_memcached and then restart_all
6. Access the web installer: go to 127.0.0.1:8081
7. Use the database user name and password:
get from /etc/koha/sites/kohadev/koha-conf.xml
(default: koha_kohadev, password)
8. Continue through the installation process.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The test was checking for the value of an input field.
But with this patch set, there is no longer an input, but
a link element with the title. This adjusts the patch to look
for the correct element.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
There is a missing wait_for_ajax. After we click "next", we need to make
sure we are using the correct response.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We should not rely on existing data, and we should remove data at the end.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This adds a new Selenium test to automatically test the correct
behaviour when expanding/collapsing System preferences sections
after a System preferences search.
Test plan:
1) Apply the other patch from this bug report, then run the
new Selenium unit test which should pass without failures:
prove -v t/db_dependent/selenium/system_preferences_search.t
Signed-off-by: Fridolin <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This was for debugging purpose.
Test plan:
Run the tests and confirm that the screenshot is not generated when the
patch is applied
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>
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>