View | Details | Raw Unified | Return to bug 34319
Collapse All | Expand All

(-)a/cypress.config.ts (+22 lines)
Line 0 Link Here
1
import { defineConfig } from "cypress";
2
3
export default defineConfig({
4
    fixturesFolder: "t/cypress/fixtures",
5
    screenshotsFolder: "t/cypress/screenshots",
6
    videosFolder: "t/cypress/videos",
7
    defaultCommandTimeout: 10000,
8
9
    e2e: {
10
        experimentalStudio: true,
11
        baseUrl: "http://localhost:8081",
12
        specPattern: "t/cypress/integration/**/*.*",
13
        supportFile: "t/cypress/support/e2e.js",
14
    },
15
16
    component: {
17
        devServer: {
18
            framework: "vue-cli",
19
            bundler: "webpack",
20
        },
21
    },
22
});
(-)a/cypress.json (-11 lines)
Lines 1-11 Link Here
1
{
2
    "baseUrl": "http://kohadev-intra.mydnsname.org:8081",
3
    "fixturesFolder": "t/cypress/fixtures",
4
    "integrationFolder": "t/cypress/integration",
5
    "pluginsFile": "t/cypress/plugins",
6
    "screenshotsFolder": "t/cypress/screenshots",
7
    "supportFile": "t/cypress/support",
8
    "videosFolder": "t/cypress/videos",
9
    "testFiles": "**/*.*",
10
    "defaultCommandTimeout": 10000
11
}
(-)a/package.json (-1 / +1 lines)
Lines 17-23 Link Here
17
    "babel-core": "^7.0.0-beta.3",
17
    "babel-core": "^7.0.0-beta.3",
18
    "bootstrap": "^4.5.2",
18
    "bootstrap": "^4.5.2",
19
    "css-loader": "^6.6.0",
19
    "css-loader": "^6.6.0",
20
    "cypress": "^9.5.2",
20
    "cypress": "^12.17.2",
21
    "datatables.net-buttons": "^2.3.4",
21
    "datatables.net-buttons": "^2.3.4",
22
    "datatables.net-vue3": "^2.0.0",
22
    "datatables.net-vue3": "^2.0.0",
23
    "gulp": "^4.0.2",
23
    "gulp": "^4.0.2",
(-)a/t/cypress/support/commands.js (-41 lines)
Lines 1-41 Link Here
1
// ***********************************************
2
// This example commands.js shows you how to
3
// create various custom commands and overwrite
4
// existing commands.
5
//
6
// For more comprehensive examples of custom
7
// commands please read more here:
8
// https://on.cypress.io/custom-commands
9
// ***********************************************
10
//
11
//
12
// -- This is a parent command --
13
// Cypress.Commands.add('login', (email, password) => { ... })
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) {
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
}
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
})
(-)a/t/cypress/support/index.js (-17 / +37 lines)
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
- 

Return to bug 34319