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

(-)a/t/cypress/integration/ERM/Agreements_spec.ts (-4 / +20 lines)
Lines 242-247 describe("Agreement CRUD operations", () => { Link Here
242
    });
242
    });
243
243
244
    it("Add agreement", () => {
244
    it("Add agreement", () => {
245
        let agreement = get_agreement();
246
        let vendors = cy.get_vendors_to_relate();
245
        // No agreement, no license yet
247
        // No agreement, no license yet
246
        cy.intercept("GET", "/api/v1/erm/agreements*", {
248
        cy.intercept("GET", "/api/v1/erm/agreements*", {
247
            statusCode: 200,
249
            statusCode: 200,
Lines 251-256 describe("Agreement CRUD operations", () => { Link Here
251
            statusCode: 200,
253
            statusCode: 200,
252
            body: [],
254
            body: [],
253
        });
255
        });
256
        //Intercept vendors request
257
        cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
258
            statusCode: 200,
259
            body: vendors,
260
        });
254
261
255
        // Click the button in the toolbar
262
        // Click the button in the toolbar
256
        cy.visit("/cgi-bin/koha/erm/agreements");
263
        cy.visit("/cgi-bin/koha/erm/agreements");
Lines 259-267 describe("Agreement CRUD operations", () => { Link Here
259
        cy.left_menu_active_item_is("Agreements");
266
        cy.left_menu_active_item_is("Agreements");
260
267
261
        // Fill in the form for normal attributes
268
        // Fill in the form for normal attributes
262
        let agreement = get_agreement();
263
        let vendors = cy.get_vendors_to_relate();
264
265
        cy.get("#agreements_add").contains("Submit").click();
269
        cy.get("#agreements_add").contains("Submit").click();
266
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
270
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
267
            "have.length",
271
            "have.length",
Lines 288-293 describe("Agreement CRUD operations", () => { Link Here
288
        );
292
        );
289
        cy.get("#agreement_vendor_id .vs__selected").contains(vendors[0].name);
293
        cy.get("#agreement_vendor_id .vs__selected").contains(vendors[0].name);
290
294
295
        // vendor aliases
296
        cy.get("#agreement_vendor_id .vs__search").click();
297
        cy.get("#agreement_vendor_id #vs1__option-1").contains(vendors[1].name);
298
        cy.get("#agreement_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
299
291
        cy.contains("Add new period").click();
300
        cy.contains("Add new period").click();
292
        cy.get("#agreements_add").contains("Submit").click();
301
        cy.get("#agreements_add").contains("Submit").click();
293
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
302
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
Lines 460-466 describe("Agreement CRUD operations", () => { Link Here
460
        let vendors = cy.get_vendors_to_relate();
469
        let vendors = cy.get_vendors_to_relate();
461
470
462
        // Intercept vendors request
471
        // Intercept vendors request
463
        cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", {
472
        cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
464
            statusCode: 200,
473
            statusCode: 200,
465
            body: vendors,
474
            body: vendors,
466
        }).as("get-vendor-options");
475
        }).as("get-vendor-options");
Lines 520-525 describe("Agreement CRUD operations", () => { Link Here
520
            agreements[0].description
529
            agreements[0].description
521
        );
530
        );
522
        cy.get("#agreement_status .vs__selected").contains("Active");
531
        cy.get("#agreement_status .vs__selected").contains("Active");
532
533
        //vendors
523
        cy.get("#agreement_vendor_id .vs__selected").contains(
534
        cy.get("#agreement_vendor_id .vs__selected").contains(
524
            agreement.vendor[0].name
535
            agreement.vendor[0].name
525
        );
536
        );
Lines 529-534 describe("Agreement CRUD operations", () => { Link Here
529
            { force: true }
540
            { force: true }
530
        );
541
        );
531
542
543
        //vendor aliases
544
        cy.get("#agreement_vendor_id .vs__search").click();
545
        cy.get("#agreement_vendor_id #vs1__option-1").contains(vendors[1].name);
546
        cy.get("#agreement_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
547
532
        cy.get("#agreement_is_perpetual_no").should("be.checked");
548
        cy.get("#agreement_is_perpetual_no").should("be.checked");
533
        cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]);
549
        cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]);
534
        cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]);
550
        cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]);
(-)a/t/cypress/integration/ERM/Licenses_spec.ts (-4 / +19 lines)
Lines 80-85 describe("License CRUD operations", () => { Link Here
80
    });
80
    });
81
81
82
    it("Add license", () => {
82
    it("Add license", () => {
83
        let license = get_license();
84
        let vendors = cy.get_vendors_to_relate();
85
        //Intercept vendors request
86
        cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
87
            statusCode: 200,
88
            body: vendors,
89
        });
83
        // Click the button in the toolbar
90
        // Click the button in the toolbar
84
        cy.visit("/cgi-bin/koha/erm/licenses");
91
        cy.visit("/cgi-bin/koha/erm/licenses");
85
        cy.contains("New license").click();
92
        cy.contains("New license").click();
Lines 87-95 describe("License CRUD operations", () => { Link Here
87
        cy.left_menu_active_item_is("Licenses");
94
        cy.left_menu_active_item_is("Licenses");
88
95
89
        // Fill in the form for normal attributes
96
        // Fill in the form for normal attributes
90
        let license = get_license();
91
        let vendors = cy.get_vendors_to_relate();
92
93
        cy.get("#licenses_add").contains("Submit").click();
97
        cy.get("#licenses_add").contains("Submit").click();
94
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
98
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
95
            "have.length",
99
            "have.length",
Lines 108-113 describe("License CRUD operations", () => { Link Here
108
        // vendors
112
        // vendors
109
        cy.get("#license_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new license
113
        cy.get("#license_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new license
110
114
115
        // vendor aliases
116
        cy.get("#license_vendor_id .vs__search").click();
117
        cy.get("#license_vendor_id #vs1__option-1").contains(vendors[1].name);
118
        cy.get("#license_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
119
111
        cy.get("#license_vendor_id .vs__search").type(
120
        cy.get("#license_vendor_id .vs__search").type(
112
            vendors[0].name + "{enter}",
121
            vendors[0].name + "{enter}",
113
            { force: true }
122
            { force: true }
Lines 168-174 describe("License CRUD operations", () => { Link Here
168
        let vendors = cy.get_vendors_to_relate();
177
        let vendors = cy.get_vendors_to_relate();
169
178
170
        // Intercept vendors request
179
        // Intercept vendors request
171
        cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", {
180
        cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
172
            statusCode: 200,
181
            statusCode: 200,
173
            body: vendors,
182
            body: vendors,
174
        }).as("get-vendor-options");
183
        }).as("get-vendor-options");
Lines 195-200 describe("License CRUD operations", () => { Link Here
195
        // Form has been correctly filled in
204
        // Form has been correctly filled in
196
        cy.get("#license_name").should("have.value", license.name);
205
        cy.get("#license_name").should("have.value", license.name);
197
206
207
        //vendors
198
        cy.get("#license_vendor_id .vs__selected").contains(
208
        cy.get("#license_vendor_id .vs__selected").contains(
199
            license.vendor[0].name
209
            license.vendor[0].name
200
        );
210
        );
Lines 204-209 describe("License CRUD operations", () => { Link Here
204
            { force: true }
214
            { force: true }
205
        );
215
        );
206
216
217
        //vendor aliases
218
        cy.get("#license_vendor_id .vs__search").click();
219
        cy.get("#license_vendor_id #vs1__option-1").contains(vendors[1].name);
220
        cy.get("#license_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
221
207
        cy.get("#license_description").should(
222
        cy.get("#license_description").should(
208
            "have.value",
223
            "have.value",
209
            license.description
224
            license.description
(-)a/t/cypress/support/e2e.js (-2 / +3 lines)
Lines 123-129 cy.get_vendors_to_relate = () => { Link Here
123
        {
123
        {
124
            "id": 2,
124
            "id": 2,
125
            "name": "My Vendor 2",
125
            "name": "My Vendor 2",
126
            "aliases": [],
126
            "aliases": [
127
                {"alias": "alias", alias_id: 1, vendor_id: 2}
128
            ],
127
        }
129
        }
128
    ]
130
    ]
129
}
131
}
130
- 

Return to bug 33480