Koha-clms/t/cypress/integration
Pedro Amorim 8c4344cced
Bug 42705: Fix SCO spec WebBasedSelfCheck setup
cy.login() in beforeEach broke the test in two ways: the intranet staff session cookie bled into the OPAC request (HTTP cookies have no port scope in
browsers), and navigating from intranet→OPAC mid-test hit a cross-origin block in Cypress. The afterEach suffered the same race condition - the syspref POST fired before the login redirect completed.

Replace with cy.request(), which makes HTTP calls at the runner level without touching the browser's current origin. cy.visitOpac() is then the first
browser navigation, so no cross-origin issue arises. A three-step flow satisfies Koha's CSRF middleware:
1) GET the login page to obtain a session and its token
2) POST credentials to authenticate
3) POST to the svc endpoint.

This fixes the #barcode and #patronlogin not found issues

The CSRF token also requires encodeURIComponent() — base64 uses +, which a
URL-encoded form body decodes as a space, silently corrupting the token and causing the login to fail.

This resolves the 403 Forbidden issue

Everything must pass:
$ cypress run --spec t/cypress/integration/OPAC/SCO_spec.ts

as well as npm run cypress open (cypress ui)

ktd selenium:
$ perl /kohadevbox/misc4dev/run_tests.pl --run-only t/cypress/integration/OPAC/SCO_spec.ts

squash

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

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-06-02 15:07:22 +00:00
..
Acquisitions Bug 40383: (follow-up) Fix EdifactModal Cypress test reliability 2026-05-22 12:59:11 -06:00
Admin Bug 40191: Update Cypress tests for split button navigation changes 2026-01-22 09:25:55 -07:00
Auth Bug 40816: Fix Auth/csrf.ts 2026-04-23 09:24:53 -06:00
Circulation Bug 23415: Add debt override support to circulation checkout page 2026-03-22 23:27:26 +01:00
ERM Bug 41615: (follow-up) Simplify 'List license' test - visit licenses directly for 500 test 2026-03-21 16:10:00 +00:00
ILL Bug 37762: (QA follow-up): Warn and return 500 on schema validation failure in progress_request 2026-05-15 08:11:12 -06:00
Islands Bug 26355: (follow-up) Fix cypress tests 2026-05-07 07:56:15 -06:00
KohaTable Bug 42048: Add a Cypress test 2026-04-14 10:49:04 -06:00
OPAC Bug 42705: Fix SCO spec WebBasedSelfCheck setup 2026-06-02 15:07:22 +00:00
Patron Bug 42423: Add a Cypress test 2026-04-23 09:25:08 -06:00
Preservation Bug 40191: Update Cypress tests for split button navigation changes 2026-01-22 09:25:55 -07:00
SIP2 Bug 41311: Add ability for SIP to send patron home library ( branchcode ) in AO field 2026-04-23 16:04:07 -06:00
Tools Bug 42733: Add tests 2026-06-02 15:07:18 +00:00
t Bug 41587: (follow-up) Remove unused imports causing webpack node: URI errors 2026-03-20 15:16:23 +00:00
AdditionalFields_spec.ts Bug 38446: Add a dedicated route to retrieve ERM-related additional fields 2025-11-17 15:15:38 -07:00
BiblioFrameworkCode_spec.ts Bug 42606: Add Cypress tests 2026-05-26 08:37:34 -06:00
Breadcrumbs_spec.ts Bug 38201: Add VueFramework cypress tests 2025-10-02 09:40:16 -06:00
HttpClient_spec.ts Bug 42705: Add HttpClient_spec.ts 2026-06-02 15:07:21 +00:00
InfiniteScrollSelect_spec.ts Bug 40191: Update Cypress tests for split button navigation changes 2026-01-22 09:25:55 -07:00
PatronSearchDebounce_spec.ts Bug 41039: Add cypress tests 2025-11-18 06:56:54 -07:00
Toolbar_spec.ts Bug 40430: Fix Toolbar_spec.ts 2025-07-21 14:01:28 -06:00
VueFramework_spec.ts Bug 38262: Fix VueFramework_spec.ts 2026-02-12 07:58:40 -07:00
flatpickr_spec.ts Revert "Bug 37493: [DONT PUSH] Test only - Force test fail" 2024-09-02 17:21:50 +02:00