Commit Graph

14 Commits

Author SHA1 Message Date
Jonathan Druart f89e68c220
Bug 42772: Cypress.env => cy.env
Warning: The allowCypressEnv configuration option is enabled. This allows any browser code to read values from Cypress.env(). This is insecure and will be removed in a future major version.

1. Replace Cypress.env() calls with cy.env() (for sensitive values) or Cypress.expose() (for public configuration)
2. Set allowCypressEnv: false in your Cypress configuration to disable Cypress.env()

Learn more: https://on.cypress.io/cypress-env-migration

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-20 12:45:01 +00:00
Jonathan Druart 7b307694fa
Bug 42772: Remove experimentalStudio from config
The experimentalStudio option was removed in Cypress version 15.4.0.

Cypress Studio is now available for all users.

You can safely remove this option from your config.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-20 12:45:00 +00:00
Tomás Cohen Arazi af4c4a33ed
Bug 41362: Allow Cypress tests to use KOHA_USER and KOHA_PASS as override
The cypress.config.ts file had hardcoded API credentials (koha:koha)
which don't work in KTD environments that use different credentials.

This patch makes the config use KOHA_USER and KOHA_PASS environment
variables if set, falling back to koha:koha if not.

Test plan:
1. On a running KTD, run the cypress tests:
   $ ktd --shell
  k$ run_cypress
=> SUCCESS: Tests are run, no errors about credentials
2. Edit your KTD .env file, so KOHA_USER=tcohen, KOHA_PASS=tomasito
3. Shut your kTD down, and start a fresh one
4. Repeat 1
=> SUCCESS: The command shows `cypress run --env KOHA_USER=tcohen,KOHA_PASS=tomasito` is run.
=> FAIL: Some tests fail right away with invalid credentials error
5. Apply this patch
6. Repeat 1
=> SUCCESS: Same command as 4
=> SUCCESS: Tests don't fail for credentials
7. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-06 07:45:35 -07:00
Jonathan Druart 70b7bb0f33
Bug 38201: Move cypress components under t/cypress
(cherry picked from commit 5cf8a60eb99e37abc365639d05e9da9ca931f7d6)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-02 09:40:23 -06:00
Matt Blenkinsop 0edc8702aa
Bug 38201: Add component tests for ShowElement
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-02 09:40:17 -06:00
Jonathan Druart 3ba5e7863c
Bug 40346: Use KOHA_INTRANET_URL for the baseUrl
This will prevent the test to reload when the URL changes

See https://github.com/cypress-io/cypress/issues/2777

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-07-21 14:01:23 -06:00
Jonathan Druart 3ff1e96931
Bug 40346: Introduce loginOpac and visitOpac - Cypress
To be able to test the OPAC interface we need to add those 2 new
commands

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-07-21 14:01:22 -06:00
Jonathan Druart 52c57538c7
Bug 40174: Introduce Cypress auth plugin
So we can easily retrieve the value for the Authorization header.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-07-21 14:01:17 -06:00
Jonathan Druart 79060544a4
Bug 40170: Replace cypress-mysql with mysql2 - Cypress tests
This patch suggests to replace cypress-mysql with mysql2

cypress-mysql provides a custom Cypress command (cy.query) that run within the browser context.
This approach mixes test-side and server-side and is limited in flexibility and error handling.

mysql2 runs inside Cypress plugins (Node process) via cy.task calls, which are executed server-side (outside the browser)

This is needed for the follow-up bug reports where we need to request
the DB from other plugins

Test plan:
Run `yarn install` to install the mysql2
All the Cypress tests modified by this patch must still pass
The new test t/cypress/integration/t/db.ts must also pass

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-07-08 15:42:03 -06:00
Victor Grousset/tuxayo 4dbe67f6f2
Bug 38770: Remove @vue/cli-service and babel
And the webpack related dead config.

Test plan:
1. Do not apply
2. Switch to node 22
     sudo sed 's/18.x/22.x/g' -i /etc/apt/sources.list.d/nodesource.list
     sudo apt update ; sudo apt install nodejs
3. Try to install node deps
     sudo yarn install --modules-folder /kohadevbox/node_modules
4. It fails
     error @achrinza/node-ipc@9.2.5: The engine "node" is incompatible with this module.
     Expected version "8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18". Got "22.12.0"
5. Apply patches
6. Try to install node deps
     sudo yarn install --modules-folder /kohadevbox/node_modules
7. It works! :)

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>
2025-01-16 15:56:15 +01:00
Jonathan Druart c9c2331ba7
Bug 36012: Extend cypress's requestTimeout value
default to 5000 but tests are failing because of slow Jenkins's nodes.
We could try and extend to 10000 (10s) and see if it gets better.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tests pass with and without the patch on my computer. Tested with:

yarn cypress run --env KOHA_USER=koha,KOHA_PASS=koha \
        --spec t/cypress/integration/ERM/Agreements_spec.ts

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-22 15:07:36 +01:00
Jonathan Druart f6ec375be2
Bug 36177: Add Cypress tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-12 17:47:34 +01:00
Jonathan Druart 06c62ab84a
Bug 36177: Cypress tests - cypress-mysql config
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-12 17:47:34 +01:00
Jonathan Druart 4f45300d91
Bug 34319: Upgrade cypress 9.7.0 to 12.17.2
We are currently using 9.7.0. Since 10 the config file structure changed, and has been renamed cypress.json to cypress.config.ts

https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0

Also cypress-studio (used for bug 34076) is not working on 9.7.0.

Test plan:
yarn install
yarn build
mv /root/.cache/Cypress/12.17.2/ /kohadevbox/Cypress/
perl /kohadevbox/misc4dev/run_tests.pl --run-cypress-tests-only

You should not get any failures from the tests.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-05 11:52:25 -03:00