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

(-)a/t/cypress/integration/Agreements_spec.ts (-9 / +5 lines)
Lines 125-133 describe("Agreement CRUD operations", () => { Link Here
125
    beforeEach(() => {
125
    beforeEach(() => {
126
        cy.login();
126
        cy.login();
127
        cy.title().should("eq", "Koha staff interface");
127
        cy.title().should("eq", "Koha staff interface");
128
129
        cy.intercept("GET", "/api/v1/authorised_value_categories*").as("avs");
130
        cy.intercept("GET", "/api/v1/acquisitions/vendors*").as("vendors");
131
    });
128
    });
132
129
133
    after(() => {
130
    after(() => {
Lines 140-146 describe("Agreement CRUD operations", () => { Link Here
140
            statusCode: 500,
137
            statusCode: 500,
141
            error: "Something went wrong",
138
            error: "Something went wrong",
142
        });
139
        });
143
        cy.visit("/cgi-bin/koha/erm/erm.pl");
140
        cy.visit_and_wait("/cgi-bin/koha/erm/erm.pl");
144
        cy.get("#navmenulist").contains("Agreements").click();
141
        cy.get("#navmenulist").contains("Agreements").click();
145
        cy.get("main div[class='dialog alert']").contains(
142
        cy.get("main div[class='dialog alert']").contains(
146
            /Something went wrong/
143
            /Something went wrong/
Lines 180-187 describe("Agreement CRUD operations", () => { Link Here
180
        });
177
        });
181
178
182
        // Click the button in the toolbar
179
        // Click the button in the toolbar
183
        cy.visit("/cgi-bin/koha/erm/agreements");
180
        cy.visit_and_wait("/cgi-bin/koha/erm/agreements");
184
        cy.wait(["@avs", "@vendors"]);
185
        cy.contains("New agreement").click();
181
        cy.contains("New agreement").click();
186
        cy.get("#agreements_add h2").contains("New agreement");
182
        cy.get("#agreements_add h2").contains("New agreement");
187
183
Lines 379-385 describe("Agreement CRUD operations", () => { Link Here
379
                "X-Total-Count": "1",
375
                "X-Total-Count": "1",
380
            },
376
            },
381
        }).as("get-single-agreement-search-result");
377
        }).as("get-single-agreement-search-result");
382
        cy.visit("/cgi-bin/koha/erm/agreements");
378
        cy.visit_and_wait("/cgi-bin/koha/erm/agreements");
383
379
384
        // Intercept request after edit click
380
        // Intercept request after edit click
385
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as(
381
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as(
Lines 470-476 describe("Agreement CRUD operations", () => { Link Here
470
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as(
466
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as(
471
            "get-agreement"
467
            "get-agreement"
472
        );
468
        );
473
        cy.visit("/cgi-bin/koha/erm/agreements");
469
        cy.visit_and_wait("/cgi-bin/koha/erm/agreements");
474
        let name_link = cy.get(
470
        let name_link = cy.get(
475
            "#agreements_list table tbody tr:first td:first a"
471
            "#agreements_list table tbody tr:first td:first a"
476
        );
472
        );
Lines 506-512 describe("Agreement CRUD operations", () => { Link Here
506
            },
502
            },
507
        });
503
        });
508
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement);
504
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement);
509
        cy.visit("/cgi-bin/koha/erm/agreements");
505
        cy.visit_and_wait("/cgi-bin/koha/erm/agreements");
510
506
511
        cy.get("#agreements_list table tbody tr:first")
507
        cy.get("#agreements_list table tbody tr:first")
512
            .contains("Delete")
508
            .contains("Delete")
(-)a/t/cypress/integration/Dialog_spec.ts (-4 / +4 lines)
Lines 46-52 describe("Dialog operations", () => { Link Here
46
                "X-Total-Count": "0",
46
                "X-Total-Count": "0",
47
            },
47
            },
48
        });
48
        });
49
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
49
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages");
50
        cy.get("#packages_list").contains("There are no packages defined");
50
        cy.get("#packages_list").contains("There are no packages defined");
51
    });
51
    });
52
52
Lines 56-62 describe("Dialog operations", () => { Link Here
56
            statusCode: 500,
56
            statusCode: 500,
57
            error: "Something went wrong",
57
            error: "Something went wrong",
58
        });
58
        });
59
        cy.visit("/cgi-bin/koha/erm/erm.pl");
59
        cy.visit_and_wait("/cgi-bin/koha/erm/erm.pl");
60
        cy.get("#navmenulist").contains("Packages").click();
60
        cy.get("#navmenulist").contains("Packages").click();
61
        cy.get("main div[class='dialog alert']").contains(
61
        cy.get("main div[class='dialog alert']").contains(
62
            /Something went wrong/
62
            /Something went wrong/
Lines 73-79 describe("Dialog operations", () => { Link Here
73
        let erm_package = get_package();
73
        let erm_package = get_package();
74
        cy.intercept("GET", "/api/v1/erm/agreements*", []);
74
        cy.intercept("GET", "/api/v1/erm/agreements*", []);
75
75
76
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages/add");
76
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages/add");
77
        cy.get("#package_name").type(erm_package.name);
77
        cy.get("#package_name").type(erm_package.name);
78
        cy.get("#package_type .vs__search").type(
78
        cy.get("#package_type .vs__search").type(
79
            erm_package.package_type + "{enter}",
79
            erm_package.package_type + "{enter}",
Lines 123-129 describe("Dialog operations", () => { Link Here
123
            "/api/v1/erm/eholdings/local/packages/*",
123
            "/api/v1/erm/eholdings/local/packages/*",
124
            erm_package
124
            erm_package
125
        );
125
        );
126
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
126
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages");
127
127
128
        cy.get("#packages_list table tbody tr:first").contains("Edit").click();
128
        cy.get("#packages_list table tbody tr:first").contains("Edit").click();
129
        cy.get("#packages_add").contains("Submit").click();
129
        cy.get("#packages_add").contains("Submit").click();
(-)a/t/cypress/integration/Licenses_spec.ts (-5 / +5 lines)
Lines 53-59 describe("License CRUD operations", () => { Link Here
53
            statusCode: 500,
53
            statusCode: 500,
54
            error: "Something went wrong",
54
            error: "Something went wrong",
55
        });
55
        });
56
        cy.visit("/cgi-bin/koha/erm/erm.pl");
56
        cy.visit_and_wait("/cgi-bin/koha/erm/erm.pl");
57
        cy.get("#navmenulist").contains("Licenses").click();
57
        cy.get("#navmenulist").contains("Licenses").click();
58
        cy.get("main div[class='dialog alert']").contains(
58
        cy.get("main div[class='dialog alert']").contains(
59
            /Something went wrong/
59
            /Something went wrong/
Lines 83-89 describe("License CRUD operations", () => { Link Here
83
83
84
    it("Add license", () => {
84
    it("Add license", () => {
85
        // Click the button in the toolbar
85
        // Click the button in the toolbar
86
        cy.visit("/cgi-bin/koha/erm/licenses");
86
        cy.visit_and_wait("/cgi-bin/koha/erm/licenses");
87
        cy.contains("New license").click();
87
        cy.contains("New license").click();
88
        cy.get("#licenses_add h2").contains("New license");
88
        cy.get("#licenses_add h2").contains("New license");
89
89
Lines 160-166 describe("License CRUD operations", () => { Link Here
160
        cy.intercept("GET", "/api/v1/erm/licenses/*", license).as(
160
        cy.intercept("GET", "/api/v1/erm/licenses/*", license).as(
161
            "get-license"
161
            "get-license"
162
        );
162
        );
163
        cy.visit("/cgi-bin/koha/erm/licenses");
163
        cy.visit_and_wait("/cgi-bin/koha/erm/licenses");
164
        cy.get("#licenses_list table tbody tr:first")
164
        cy.get("#licenses_list table tbody tr:first")
165
            .contains("Edit")
165
            .contains("Edit")
166
            .click();
166
            .click();
Lines 218-224 describe("License CRUD operations", () => { Link Here
218
        cy.intercept("GET", "/api/v1/erm/licenses/*", license).as(
218
        cy.intercept("GET", "/api/v1/erm/licenses/*", license).as(
219
            "get-license"
219
            "get-license"
220
        );
220
        );
221
        cy.visit("/cgi-bin/koha/erm/licenses");
221
        cy.visit_and_wait("/cgi-bin/koha/erm/licenses");
222
        let name_link = cy.get(
222
        let name_link = cy.get(
223
            "#licenses_list table tbody tr:first td:first a"
223
            "#licenses_list table tbody tr:first td:first a"
224
        );
224
        );
Lines 248-254 describe("License CRUD operations", () => { Link Here
248
            },
248
            },
249
        });
249
        });
250
        cy.intercept("GET", "/api/v1/erm/licenses/*", license);
250
        cy.intercept("GET", "/api/v1/erm/licenses/*", license);
251
        cy.visit("/cgi-bin/koha/erm/licenses");
251
        cy.visit_and_wait("/cgi-bin/koha/erm/licenses");
252
252
253
        cy.get("#licenses_list table tbody tr:first")
253
        cy.get("#licenses_list table tbody tr:first")
254
            .contains("Delete")
254
            .contains("Delete")
(-)a/t/cypress/integration/Packages_spec.ts (-5 / +5 lines)
Lines 44-50 describe("Package CRUD operations", () => { Link Here
44
            statusCode: 500,
44
            statusCode: 500,
45
            error: "Something went wrong",
45
            error: "Something went wrong",
46
        });
46
        });
47
        cy.visit("/cgi-bin/koha/erm/erm.pl");
47
        cy.visit_and_wait("/cgi-bin/koha/erm/erm.pl");
48
        cy.get("#navmenulist").contains("Packages").click();
48
        cy.get("#navmenulist").contains("Packages").click();
49
        cy.get("main div[class='dialog alert']").contains(
49
        cy.get("main div[class='dialog alert']").contains(
50
            /Something went wrong/
50
            /Something went wrong/
Lines 88-94 describe("Package CRUD operations", () => { Link Here
88
        cy.intercept("GET", "/api/v1/erm/agreements*", []);
88
        cy.intercept("GET", "/api/v1/erm/agreements*", []);
89
89
90
        // Click the button in the toolbar
90
        // Click the button in the toolbar
91
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
91
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages");
92
        cy.contains("New package").click();
92
        cy.contains("New package").click();
93
        cy.get("#packages_add h2").contains("New package");
93
        cy.get("#packages_add h2").contains("New package");
94
94
Lines 164-170 describe("Package CRUD operations", () => { Link Here
164
            "/api/v1/erm/eholdings/local/packages/*",
164
            "/api/v1/erm/eholdings/local/packages/*",
165
            erm_package
165
            erm_package
166
        ).as("get-package");
166
        ).as("get-package");
167
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
167
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages");
168
        // Intercept related agreements request after entering agreement edit
168
        // Intercept related agreements request after entering agreement edit
169
        cy.intercept("GET", "/api/v1/erm/agreements*", {
169
        cy.intercept("GET", "/api/v1/erm/agreements*", {
170
            statusCode: 200,
170
            statusCode: 200,
Lines 219-225 describe("Package CRUD operations", () => { Link Here
219
            "/api/v1/erm/eholdings/local/packages/*",
219
            "/api/v1/erm/eholdings/local/packages/*",
220
            erm_package
220
            erm_package
221
        ).as("get-package");
221
        ).as("get-package");
222
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
222
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages");
223
        let name_link = cy.get(
223
        let name_link = cy.get(
224
            "#packages_list table tbody tr:first td:first a"
224
            "#packages_list table tbody tr:first td:first a"
225
        );
225
        );
Lines 290-296 describe("Package CRUD operations", () => { Link Here
290
            "/api/v1/erm/eholdings/local/packages/*",
290
            "/api/v1/erm/eholdings/local/packages/*",
291
            erm_package
291
            erm_package
292
        );
292
        );
293
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
293
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/packages");
294
294
295
        cy.get("#packages_list table tbody tr:first")
295
        cy.get("#packages_list table tbody tr:first")
296
            .contains("Delete")
296
            .contains("Delete")
(-)a/t/cypress/integration/Titles_spec.ts (-6 / +6 lines)
Lines 47-53 describe("Title CRUD operations", () => { Link Here
47
            statusCode: 200,
47
            statusCode: 200,
48
            body: []
48
            body: []
49
        }).as("get-empty-packages");
49
        }).as("get-empty-packages");
50
        cy.visit("/cgi-bin/koha/erm/eholdings/local/titles");
50
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/titles");
51
        cy.wait(500);
51
        cy.wait(500);
52
        cy.get("#toolbar a").contains("Import from list").click();
52
        cy.get("#toolbar a").contains("Import from list").click();
53
        cy.get("h2").contains("Import from a list");
53
        cy.get("h2").contains("Import from a list");
Lines 78-84 describe("Title CRUD operations", () => { Link Here
78
            statusCode: 500,
78
            statusCode: 500,
79
            error: "Something went wrong",
79
            error: "Something went wrong",
80
        });
80
        });
81
        cy.visit("/cgi-bin/koha/erm/erm.pl");
81
        cy.visit_and_wait("/cgi-bin/koha/erm/erm.pl");
82
        cy.get("#navmenulist").contains("Titles").click();
82
        cy.get("#navmenulist").contains("Titles").click();
83
        cy.get("main div[class='dialog alert']").contains(
83
        cy.get("main div[class='dialog alert']").contains(
84
            /Something went wrong/
84
            /Something went wrong/
Lines 124-130 describe("Title CRUD operations", () => { Link Here
124
        });
124
        });
125
125
126
        // Click the button in the toolbar
126
        // Click the button in the toolbar
127
        cy.visit("/cgi-bin/koha/erm/eholdings/local/titles");
127
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/titles");
128
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
128
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
129
        cy.contains("New title").click();
129
        cy.contains("New title").click();
130
        cy.get("#titles_add h2").contains("New title");
130
        cy.get("#titles_add h2").contains("New title");
Lines 219-225 describe("Title CRUD operations", () => { Link Here
219
            "/api/v1/erm/eholdings/local/titles/*",
219
            "/api/v1/erm/eholdings/local/titles/*",
220
            erm_title
220
            erm_title
221
        ).as("get-title");
221
        ).as("get-title");
222
        cy.visit("/cgi-bin/koha/erm/eholdings/local/titles");
222
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/titles");
223
        // Intercept related packages request after entering title edit
223
        // Intercept related packages request after entering title edit
224
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
224
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
225
            statusCode: 200,
225
            statusCode: 200,
Lines 306-312 describe("Title CRUD operations", () => { Link Here
306
                }
306
                }
307
            }
307
            }
308
        ).as("get-title");
308
        ).as("get-title");
309
        cy.visit("/cgi-bin/koha/erm/eholdings/local/titles");
309
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/titles");
310
        let title_link = cy.get(
310
        let title_link = cy.get(
311
            "#titles_list table tbody tr:first td:first a"
311
            "#titles_list table tbody tr:first td:first a"
312
        );
312
        );
Lines 369-375 describe("Title CRUD operations", () => { Link Here
369
            "/api/v1/erm/eholdings/local/titles/*",
369
            "/api/v1/erm/eholdings/local/titles/*",
370
            erm_title
370
            erm_title
371
        );
371
        );
372
        cy.visit("/cgi-bin/koha/erm/eholdings/local/titles");
372
        cy.visit_and_wait("/cgi-bin/koha/erm/eholdings/local/titles");
373
373
374
        cy.get("#titles_list table tbody tr:first")
374
        cy.get("#titles_list table tbody tr:first")
375
            .contains("Delete")
375
            .contains("Delete")
(-)a/t/cypress/support/commands.js (-1 / +7 lines)
Lines 70-72 Cypress.Commands.add('reset_initial_ERM_sys_pref_value', () => { Link Here
70
    cy.login();
70
    cy.login();
71
    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"));
72
})
72
})
73
- 
73
74
Cypress.Commands.add('visit_and_wait', (url) => {
75
    cy.intercept("GET", "/api/v1/authorised_value_categories*").as("avs");
76
    cy.intercept("GET", "/api/v1/acquisitions/vendors*").as("vendors");
77
    cy.visit(url);
78
    cy.wait(["@avs", "@vendors"]);
79
})

Return to bug 33370