@@ -, +, @@ --- t/cypress/integration/Agreements_spec.ts | 2 +- t/cypress/integration/Licenses_spec.ts | 2 +- t/cypress/integration/Packages_spec.ts | 2 +- t/cypress/integration/Titles_spec.ts | 2 +- t/cypress/support/commands.js | 11 ++++++----- 5 files changed, 10 insertions(+), 9 deletions(-) --- a/t/cypress/integration/Agreements_spec.ts +++ a/t/cypress/integration/Agreements_spec.ts @@ -123,7 +123,7 @@ describe("Agreement CRUD operations", () => { }); beforeEach(() => { - cy.login("koha", "koha"); + cy.login(); cy.title().should("eq", "Koha staff interface"); }); --- a/t/cypress/integration/Licenses_spec.ts +++ a/t/cypress/integration/Licenses_spec.ts @@ -39,7 +39,7 @@ describe("License CRUD operations", () => { }); beforeEach(() => { - cy.login("koha", "koha"); + cy.login(); cy.title().should("eq", "Koha staff interface"); }); --- a/t/cypress/integration/Packages_spec.ts +++ a/t/cypress/integration/Packages_spec.ts @@ -30,7 +30,7 @@ describe("Package CRUD operations", () => { }); beforeEach(() => { - cy.login("koha", "koha"); + cy.login(); cy.title().should("eq", "Koha staff interface"); }); --- a/t/cypress/integration/Titles_spec.ts +++ a/t/cypress/integration/Titles_spec.ts @@ -73,7 +73,7 @@ describe("Title CRUD operations", () => { }); beforeEach(() => { - cy.login("koha", "koha"); + cy.login(); cy.title().should("eq", "Koha staff interface"); }); --- a/t/cypress/support/commands.js +++ a/t/cypress/support/commands.js @@ -24,11 +24,12 @@ // -- This will overwrite an existing command -- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) - Cypress.Commands.add('login', (username, password) => { + var user = typeof username === 'undefined' ? Cypress.env('KOHA_USER') : username; + var pass = typeof password === 'undefined' ? Cypress.env('KOHA_PASS') : password; cy.visit('/cgi-bin/koha/mainpage.pl?logout.x=1') - cy.get("#userid").type(username) - cy.get("#password").type(password) + cy.get("#userid").type(user) + cy.get("#password").type(pass) cy.get("#submit-button").click() }) @@ -49,7 +50,7 @@ Cypress.Commands.add('set_ERM_sys_pref_value', (enable) => { }) Cypress.Commands.add('fetch_initial_ERM_sys_pref_value', () => { - cy.login("koha", "koha"); + cy.login(); cy.visit('/cgi-bin/koha/admin/admin-home.pl') cy.get("h4").contains("Global system preferences").click(); cy.get("a[title^=E-resource]").contains("E-resource management").click(); @@ -59,6 +60,6 @@ Cypress.Commands.add('fetch_initial_ERM_sys_pref_value', () => { }) Cypress.Commands.add('reset_initial_ERM_sys_pref_value', () => { - cy.login("koha", "koha"); + cy.login(); cy.set_ERM_sys_pref_value(Cypress.env("initial_ERM_Module_sys_pref_value")); }) --