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

(-)a/t/cypress/integration/ERM/Packages_spec.ts (-26 / +5 lines)
Lines 2-28 import { mount } from "@cypress/vue"; Link Here
2
const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!)
2
const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!)
3
                                   Also note that moment.js is deprecated */
3
                                   Also note that moment.js is deprecated */
4
4
5
function get_package() {
6
    return {
7
        package_id: 1,
8
        name: "package 1",
9
        package_type: "complete",
10
        content_type: "Print",
11
        package_agreements: [
12
            {
13
                agreement: {
14
                    agreement_id: 2,
15
                    description: "agreement description",
16
                    name: "agreement name",
17
                },
18
                agreement_id: 2,
19
                package_id: 1,
20
            },
21
        ],
22
        resources_count: 0,
23
    };
24
}
25
26
describe("Package CRUD operations", () => {
5
describe("Package CRUD operations", () => {
27
    beforeEach(() => {
6
    beforeEach(() => {
28
        cy.login();
7
        cy.login();
Lines 58-64 describe("Package CRUD operations", () => { Link Here
58
        cy.get("#packages_list").contains("There are no packages defined");
37
        cy.get("#packages_list").contains("There are no packages defined");
59
38
60
        // GET packages returns something
39
        // GET packages returns something
61
        let erm_package = get_package();
40
        let erm_package = cy.get_package();
62
        let packages = [erm_package];
41
        let packages = [erm_package];
63
42
64
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
43
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
Lines 88-94 describe("Package CRUD operations", () => { Link Here
88
        cy.left_menu_active_item_is("Packages");
67
        cy.left_menu_active_item_is("Packages");
89
68
90
        // Fill in the form for normal attributes
69
        // Fill in the form for normal attributes
91
        let erm_package = get_package();
70
        let erm_package = cy.get_package();
92
71
93
        cy.get("#packages_add").contains("Submit").click();
72
        cy.get("#packages_add").contains("Submit").click();
94
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
73
        cy.get("input:invalid,textarea:invalid,select:invalid").should(
Lines 146-152 describe("Package CRUD operations", () => { Link Here
146
    });
125
    });
147
126
148
    it("Edit package", () => {
127
    it("Edit package", () => {
149
        let erm_package = get_package();
128
        let erm_package = cy.get_package();
150
        let packages = [erm_package];
129
        let packages = [erm_package];
151
        // Click the 'Edit' button from the list
130
        // Click the 'Edit' button from the list
152
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
131
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
Lines 205-211 describe("Package CRUD operations", () => { Link Here
205
    });
184
    });
206
185
207
    it("Show package", () => {
186
    it("Show package", () => {
208
        let erm_package = get_package();
187
        let erm_package = cy.get_package();
209
        let packages = [erm_package];
188
        let packages = [erm_package];
210
        // Click the "name" link from the list
189
        // Click the "name" link from the list
211
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
190
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
Lines 277-283 describe("Package CRUD operations", () => { Link Here
277
    });
256
    });
278
257
279
    it("Delete package", () => {
258
    it("Delete package", () => {
280
        let erm_package = get_package();
259
        let erm_package = cy.get_package();
281
        let packages = [erm_package];
260
        let packages = [erm_package];
282
261
283
        // Click the 'Delete' button from the list
262
        // Click the 'Delete' button from the list
(-)a/t/cypress/support/e2e.js (-1 / +141 lines)
Lines 214-219 cy.get_agreement = () => { Link Here
214
                uploaded_on: "2022-10-27T11:57:02+00:00",
214
                uploaded_on: "2022-10-27T11:57:02+00:00",
215
            },
215
            },
216
        ],
216
        ],
217
        extended_attributes: [
218
            {
219
                field_id: 1,
220
                id: "1",
221
                record_id: "1",
222
                value: "REF",
223
            },
224
            {
225
                field_id: 1,
226
                id: "2",
227
                record_id: "1",
228
                value: "NFIC",
229
            },
230
            {
231
                field_id: 2,
232
                id: "3",
233
                record_id: "1",
234
                value: "some text",
235
            },
236
            {
237
                field_id: 3,
238
                id: "4",
239
                record_id: "1",
240
                value: "some repeatable text",
241
            },
242
            {
243
                field_id: 4,
244
                id: "5",
245
                record_id: "1",
246
                value: "AF",
247
            },
248
        ],
249
        _strings: {
250
            additional_field_values: [
251
                {
252
                    field_id: 1,
253
                    field_label: "AV Repeatable",
254
                    type: "av",
255
                    value_str: "Reference, Non-fiction",
256
                },
257
                {
258
                    field_id: 2,
259
                    field_label: "Text non-repeatable",
260
                    type: "text",
261
                    value_str: "some text",
262
                },
263
                {
264
                    field_id: 3,
265
                    field_label: "Text repeatable",
266
                    type: "text",
267
                    value_str: "some repeatable text",
268
                },
269
                {
270
                    field_id: 4,
271
                    field_label: "AV Searchable",
272
                    type: "av",
273
                    value_str: "Afghanistan",
274
                },
275
            ],
276
        }
277
    };
278
}
279
280
cy.get_package = () => {
281
    return {
282
        package_id: 1,
283
        name: "package 1",
284
        package_type: "complete",
285
        content_type: "Print",
286
        package_agreements: [
287
            {
288
                agreement: {
289
                    agreement_id: 2,
290
                    description: "agreement description",
291
                    name: "agreement name",
292
                },
293
                agreement_id: 2,
294
                package_id: 1,
295
            },
296
        ],
297
        extended_attributes: [
298
            {
299
                field_id: 1,
300
                id: "1",
301
                record_id: "1",
302
                value: "REF",
303
            },
304
            {
305
                field_id: 1,
306
                id: "2",
307
                record_id: "1",
308
                value: "NFIC",
309
            },
310
            {
311
                field_id: 2,
312
                id: "3",
313
                record_id: "1",
314
                value: "some text",
315
            },
316
            {
317
                field_id: 3,
318
                id: "4",
319
                record_id: "1",
320
                value: "some repeatable text",
321
            },
322
            {
323
                field_id: 4,
324
                id: "5",
325
                record_id: "1",
326
                value: "AF",
327
            },
328
        ],
329
        _strings: {
330
            additional_field_values: [
331
                {
332
                    field_id: 1,
333
                    field_label: "AV Repeatable",
334
                    type: "av",
335
                    value_str: "Reference, Non-fiction",
336
                },
337
                {
338
                    field_id: 2,
339
                    field_label: "Text non-repeatable",
340
                    type: "text",
341
                    value_str: "some text",
342
                },
343
                {
344
                    field_id: 3,
345
                    field_label: "Text repeatable",
346
                    type: "text",
347
                    value_str: "some repeatable text",
348
                },
349
                {
350
                    field_id: 4,
351
                    field_label: "AV Searchable",
352
                    type: "av",
353
                    value_str: "Afghanistan",
354
                },
355
            ],
356
        },
357
        resources_count: 0,
217
    };
358
    };
218
}
359
}
219
360
220
- 

Return to bug 37576