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>
(cherry picked from commit af4c4a33ed)
Signed-off-by: Chloé Zermatten <chloe.zermatten@openfifth.co.uk>
This commit is contained in:
parent
27576675d7
commit
6a43bc4872
|
|
@ -18,8 +18,8 @@ export default defineConfig({
|
|||
supportFile: "t/cypress/support/e2e.js",
|
||||
env: {
|
||||
opacBaseUrl: process.env.KOHA_OPAC_URL || "http://localhost:8080",
|
||||
apiUsername: "koha",
|
||||
apiPassword: "koha",
|
||||
apiUsername: process.env.KOHA_USER || "koha",
|
||||
apiPassword: process.env.KOHA_PASS || "koha",
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue