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

(-)a/t/cypress/integration/AdditionalFields_spec.ts (-88 / +3 lines)
Lines 37-127 function get_no_additional_fields_license() { Link Here
37
        },
37
        },
38
    };
38
    };
39
}
39
}
40
function get_license() {
41
    return {
42
        license_id: 1,
43
        name: "license 1",
44
        description: "my first license",
45
        type: "local",
46
        status: "active",
47
        started_on: dates["today_iso"],
48
        ended_on: dates["tomorrow_iso"],
49
        user_roles: [],
50
        vendor_id: 1,
51
        vendor: [cy.get_vendors_to_relate()[0]],
52
        documents: [
53
            {
54
                license_id: 1,
55
                file_description: "file description",
56
                file_name: "file.json",
57
                notes: "file notes",
58
                physical_location: "file physical location",
59
                uri: "file uri",
60
                uploaded_on: "2022-10-27T11:57:02+00:00",
61
            },
62
        ],
63
        extended_attributes: [
64
            {
65
                field_id: 1,
66
                id: "1",
67
                record_id: "1",
68
                value: "REF",
69
            },
70
            {
71
                field_id: 1,
72
                id: "2",
73
                record_id: "1",
74
                value: "NFIC",
75
            },
76
            {
77
                field_id: 2,
78
                id: "3",
79
                record_id: "1",
80
                value: "some text",
81
            },
82
            {
83
                field_id: 3,
84
                id: "4",
85
                record_id: "1",
86
                value: "some repeatable text",
87
            },
88
            {
89
                field_id: 4,
90
                id: "5",
91
                record_id: "1",
92
                value: "AF",
93
            },
94
        ],
95
        _strings: {
96
            additional_field_values: [
97
                {
98
                    field_id: 1,
99
                    field_label: "AV Repeatable",
100
                    type: "av",
101
                    value_str: "Reference, Non-fiction",
102
                },
103
                {
104
                    field_id: 2,
105
                    field_label: "Text non-repeatable",
106
                    type: "text",
107
                    value_str: "some text",
108
                },
109
                {
110
                    field_id: 3,
111
                    field_label: "Text repeatable",
112
                    type: "text",
113
                    value_str: "some repeatable text",
114
                },
115
                {
116
                    field_id: 4,
117
                    field_label: "AV Searchable",
118
                    type: "av",
119
                    value_str: "Afghanistan",
120
                },
121
            ],
122
        },
123
    };
124
}
125
40
126
function get_licenses_additional_fields() {
41
function get_licenses_additional_fields() {
127
    return [
42
    return [
Lines 253-259 describe("Additional Fields operations", () => { Link Here
253
    });
168
    });
254
169
255
    it("Additional Fields display - Table (licenses)", () => {
170
    it("Additional Fields display - Table (licenses)", () => {
256
        let license = get_license();
171
        let license = cy.get_license();
257
        let licenses = [license];
172
        let licenses = [license];
258
        let license_additional_fields = get_licenses_additional_fields();
173
        let license_additional_fields = get_licenses_additional_fields();
259
        let av_cats = get_av_cats();
174
        let av_cats = get_av_cats();
Lines 296-302 describe("Additional Fields operations", () => { Link Here
296
211
297
    it("Additional Fields display - Show (licenses)", () => {
212
    it("Additional Fields display - Show (licenses)", () => {
298
        let empty_license = get_no_additional_fields_license();
213
        let empty_license = get_no_additional_fields_license();
299
        let license = get_license();
214
        let license = cy.get_license();
300
        let licenses = [license];
215
        let licenses = [license];
301
        let vendors = cy.get_vendors_to_relate();
216
        let vendors = cy.get_vendors_to_relate();
302
        let license_additional_fields = get_licenses_additional_fields();
217
        let license_additional_fields = get_licenses_additional_fields();
Lines 529-535 describe("Additional Fields operations", () => { Link Here
529
    });
444
    });
530
445
531
    it("Additional Fields entry - Edit (licenses)", () => {
446
    it("Additional Fields entry - Edit (licenses)", () => {
532
        let license = get_license();
447
        let license = cy.get_license();
533
        let licenses = [license];
448
        let licenses = [license];
534
        let vendors = cy.get_vendors_to_relate();
449
        let vendors = cy.get_vendors_to_relate();
535
        let license_additional_fields = get_licenses_additional_fields();
450
        let license_additional_fields = get_licenses_additional_fields();
(-)a/t/cypress/integration/ERM/Licenses_spec.ts (-30 / +5 lines)
Lines 8-38 const dates = { Link Here
8
    tomorrow_iso: dayjs().add(1, "day").format("YYYY-MM-DD"),
8
    tomorrow_iso: dayjs().add(1, "day").format("YYYY-MM-DD"),
9
    tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"),
9
    tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"),
10
};
10
};
11
function get_license() {
12
    return {
13
        license_id: 1,
14
        name: "license 1",
15
        description: "my first license",
16
        type: "local",
17
        status: "active",
18
        started_on: dates["today_iso"],
19
        ended_on: dates["tomorrow_iso"],
20
        user_roles: [],
21
        vendor_id: 1,
22
        vendor: [cy.get_vendors_to_relate()[0]],
23
        documents: [
24
            {
25
                license_id: 1,
26
                file_description: "file description",
27
                file_name: "file.json",
28
                notes: "file notes",
29
                physical_location: "file physical location",
30
                uri: "file uri",
31
                uploaded_on: "2022-10-27T11:57:02+00:00",
32
            },
33
        ],
34
    };
35
}
36
11
37
describe("License CRUD operations", () => {
12
describe("License CRUD operations", () => {
38
    beforeEach(() => {
13
    beforeEach(() => {
Lines 62-68 describe("License CRUD operations", () => { Link Here
62
        cy.get("#licenses_list").contains("There are no licenses defined");
37
        cy.get("#licenses_list").contains("There are no licenses defined");
63
38
64
        // GET licenses returns something
39
        // GET licenses returns something
65
        let license = get_license();
40
        let license = cy.get_license();
66
        let licenses = [license];
41
        let licenses = [license];
67
42
68
        cy.intercept("GET", "/api/v1/erm/licenses*", {
43
        cy.intercept("GET", "/api/v1/erm/licenses*", {
Lines 79-85 describe("License CRUD operations", () => { Link Here
79
    });
54
    });
80
55
81
    it("Add license", () => {
56
    it("Add license", () => {
82
        let license = get_license();
57
        let license = cy.get_license();
83
        let vendors = cy.get_vendors_to_relate();
58
        let vendors = cy.get_vendors_to_relate();
84
        //Intercept vendors request
59
        //Intercept vendors request
85
        cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
60
        cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
Lines 174-180 describe("License CRUD operations", () => { Link Here
174
    });
149
    });
175
150
176
    it("Edit license", () => {
151
    it("Edit license", () => {
177
        let license = get_license();
152
        let license = cy.get_license();
178
        let licenses = [license];
153
        let licenses = [license];
179
        let vendors = cy.get_vendors_to_relate();
154
        let vendors = cy.get_vendors_to_relate();
180
155
Lines 256-262 describe("License CRUD operations", () => { Link Here
256
    });
231
    });
257
232
258
    it("Show license", () => {
233
    it("Show license", () => {
259
        let license = get_license();
234
        let license = cy.get_license();
260
        let licenses = [license];
235
        let licenses = [license];
261
        // Click the "name" link from the list
236
        // Click the "name" link from the list
262
        cy.intercept("GET", "/api/v1/erm/licenses*", {
237
        cy.intercept("GET", "/api/v1/erm/licenses*", {
Lines 286-292 describe("License CRUD operations", () => { Link Here
286
    });
261
    });
287
262
288
    it("Delete license", () => {
263
    it("Delete license", () => {
289
        let license = get_license();
264
        let license = cy.get_license();
290
        let licenses = [license];
265
        let licenses = [license];
291
266
292
        // Click the 'Delete' button from the list
267
        // Click the 'Delete' button from the list
(-)a/t/cypress/support/e2e.js (-1 / +86 lines)
Lines 53-58 const dates = { Link Here
53
    tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"),
53
    tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"),
54
}
54
}
55
55
56
cy.get_license = () => {
57
    return {
58
        license_id: 1,
59
        name: "license 1",
60
        description: "my first license",
61
        type: "local",
62
        status: "active",
63
        started_on: dates["today_iso"],
64
        ended_on: dates["tomorrow_iso"],
65
        user_roles: [],
66
        vendor_id: 1,
67
        vendor: [cy.get_vendors_to_relate()[0]],
68
        documents: [
69
            {
70
                license_id: 1,
71
                file_description: "file description",
72
                file_name: "file.json",
73
                notes: "file notes",
74
                physical_location: "file physical location",
75
                uri: "file uri",
76
                uploaded_on: "2022-10-27T11:57:02+00:00",
77
            },
78
        ],
79
        extended_attributes: [
80
            {
81
                field_id: 1,
82
                id: "1",
83
                record_id: "1",
84
                value: "REF",
85
            },
86
            {
87
                field_id: 1,
88
                id: "2",
89
                record_id: "1",
90
                value: "NFIC",
91
            },
92
            {
93
                field_id: 2,
94
                id: "3",
95
                record_id: "1",
96
                value: "some text",
97
            },
98
            {
99
                field_id: 3,
100
                id: "4",
101
                record_id: "1",
102
                value: "some repeatable text",
103
            },
104
            {
105
                field_id: 4,
106
                id: "5",
107
                record_id: "1",
108
                value: "AF",
109
            },
110
        ],
111
        _strings: {
112
            additional_field_values: [
113
                {
114
                    field_id: 1,
115
                    field_label: "AV Repeatable",
116
                    type: "av",
117
                    value_str: "Reference, Non-fiction",
118
                },
119
                {
120
                    field_id: 2,
121
                    field_label: "Text non-repeatable",
122
                    type: "text",
123
                    value_str: "some text",
124
                },
125
                {
126
                    field_id: 3,
127
                    field_label: "Text repeatable",
128
                    type: "text",
129
                    value_str: "some repeatable text",
130
                },
131
                {
132
                    field_id: 4,
133
                    field_label: "AV Searchable",
134
                    type: "av",
135
                    value_str: "Afghanistan",
136
                },
137
            ],
138
        },
139
    };
140
}
141
56
cy.get_agreement = () => {
142
cy.get_agreement = () => {
57
    let licenses = cy.get_licenses_to_relate();
143
    let licenses = cy.get_licenses_to_relate();
58
    return {
144
    return {
59
- 

Return to bug 35287