Lines 1-23
Link Here
|
1 |
// *********************************************************** |
1 |
// *********************************************** |
2 |
// This example support/index.js is processed and |
2 |
// This example commands.js shows you how to |
3 |
// loaded automatically before your test files. |
3 |
// create various custom commands and overwrite |
|
|
4 |
// existing commands. |
4 |
// |
5 |
// |
5 |
// This is a great place to put global configuration and |
6 |
// For more comprehensive examples of custom |
6 |
// behavior that modifies Cypress. |
7 |
// commands please read more here: |
|
|
8 |
// https://on.cypress.io/custom-commands |
9 |
// *********************************************** |
7 |
// |
10 |
// |
8 |
// You can change the location of this file or turn off |
|
|
9 |
// automatically serving support files with the |
10 |
// 'supportFile' configuration option. |
11 |
// |
11 |
// |
12 |
// You can read more here: |
12 |
// -- This is a parent command -- |
13 |
// https://on.cypress.io/configuration |
13 |
// Cypress.Commands.add('login', (email, password) => { ... }) |
14 |
// *********************************************************** |
14 |
// |
|
|
15 |
// |
16 |
// -- This is a child command -- |
17 |
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) |
18 |
// |
19 |
// |
20 |
// -- This is a dual command -- |
21 |
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) |
22 |
// |
23 |
// |
24 |
// -- This will overwrite an existing command -- |
25 |
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
26 |
|
27 |
function get_fallback_login_value(param) { |
15 |
|
28 |
|
16 |
// Import commands.js using ES2015 syntax: |
29 |
var env_var = param == 'username' ? 'KOHA_USER' : 'KOHA_PASS'; |
17 |
import './commands'; |
|
|
18 |
|
30 |
|
19 |
// Alternatively you can use CommonJS syntax: |
31 |
return typeof Cypress.env(env_var) === 'undefined' ? 'koha' : Cypress.env(env_var); |
20 |
// require('./commands') |
32 |
} |
|
|
33 |
|
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; |
37 |
cy.visit('/cgi-bin/koha/mainpage.pl?logout.x=1') |
38 |
cy.get("#userid").type(user) |
39 |
cy.get("#password").type(pass) |
40 |
cy.get("#submit-button").click() |
41 |
}) |
21 |
|
42 |
|
22 |
cy.get_title = () => { |
43 |
cy.get_title = () => { |
23 |
return { |
44 |
return { |
Lines 86-89
cy.get_agreements_to_relate = () => {
Link Here
|
86 |
name: "fourth agreement name" |
107 |
name: "fourth agreement name" |
87 |
}, |
108 |
}, |
88 |
] |
109 |
] |
89 |
} |
110 |
} |
90 |
- |
|
|