Lines 24-34
Link Here
|
24 |
// -- This will overwrite an existing command -- |
24 |
// -- This will overwrite an existing command -- |
25 |
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
25 |
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
26 |
|
26 |
|
|
|
27 |
function get_fallback_login_value(param) { |
28 |
|
29 |
var env_var = param == 'username' ? 'KOHA_USER' : 'KOHA_PASS'; |
30 |
|
31 |
return typeof Cypress.env(env_var) === 'undefined' ? 'koha' : Cypress.env(env_var); |
32 |
} |
27 |
|
33 |
|
28 |
Cypress.Commands.add('login', (username, password) => { |
34 |
Cypress.Commands.add('login', (username, password) => { |
|
|
35 |
var user = typeof username === 'undefined' ? get_fallback_login_value('username') : username; |
36 |
var pass = typeof password === 'undefined' ? get_fallback_login_value('password') : password; |
29 |
cy.visit('/cgi-bin/koha/mainpage.pl?logout.x=1') |
37 |
cy.visit('/cgi-bin/koha/mainpage.pl?logout.x=1') |
30 |
cy.get("#userid").type(username) |
38 |
cy.get("#userid").type(user) |
31 |
cy.get("#password").type(password) |
39 |
cy.get("#password").type(pass) |
32 |
cy.get("#submit-button").click() |
40 |
cy.get("#submit-button").click() |
33 |
}) |
41 |
}) |
34 |
|
42 |
|
Lines 49-55
Cypress.Commands.add('set_ERM_sys_pref_value', (enable) => {
Link Here
|
49 |
}) |
57 |
}) |
50 |
|
58 |
|
51 |
Cypress.Commands.add('fetch_initial_ERM_sys_pref_value', () => { |
59 |
Cypress.Commands.add('fetch_initial_ERM_sys_pref_value', () => { |
52 |
cy.login("koha", "koha"); |
60 |
cy.login(); |
53 |
cy.visit('/cgi-bin/koha/admin/admin-home.pl') |
61 |
cy.visit('/cgi-bin/koha/admin/admin-home.pl') |
54 |
cy.get("h4").contains("Global system preferences").click(); |
62 |
cy.get("h4").contains("Global system preferences").click(); |
55 |
cy.get("a[title^=E-resource]").contains("E-resource management").click(); |
63 |
cy.get("a[title^=E-resource]").contains("E-resource management").click(); |
Lines 59-64
Cypress.Commands.add('fetch_initial_ERM_sys_pref_value', () => {
Link Here
|
59 |
}) |
67 |
}) |
60 |
|
68 |
|
61 |
Cypress.Commands.add('reset_initial_ERM_sys_pref_value', () => { |
69 |
Cypress.Commands.add('reset_initial_ERM_sys_pref_value', () => { |
62 |
cy.login("koha", "koha"); |
70 |
cy.login(); |
63 |
cy.set_ERM_sys_pref_value(Cypress.env("initial_ERM_Module_sys_pref_value")); |
71 |
cy.set_ERM_sys_pref_value(Cypress.env("initial_ERM_Module_sys_pref_value")); |
64 |
}) |
72 |
}) |
65 |
- |
|
|