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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js (-1 / +1 lines)
Lines 97-103 export const routes = [ Link Here
97
            },
97
            },
98
            {
98
            {
99
                path: "/cgi-bin/koha/preservation/waiting-list",
99
                path: "/cgi-bin/koha/preservation/waiting-list",
100
                title: $__("Waiting List"),
100
                title: $__("Waiting list"),
101
                icon: "fa fa-recycle",
101
                icon: "fa fa-recycle",
102
                is_end_node: true,
102
                is_end_node: true,
103
                children: [
103
                children: [
(-)a/t/cypress/integration/Preservation/Trains.ts (-15 / +13 lines)
Lines 208-226 describe("Trains", () => { Link Here
208
        cy.title().should("eq", "Koha staff interface");
208
        cy.title().should("eq", "Koha staff interface");
209
        cy.intercept(
209
        cy.intercept(
210
            "GET",
210
            "GET",
211
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationModule",
211
            "/api/v1/preservation/config",
212
            '{"value":"1"}'
212
            '{"permissions":{"manage_sysprefs":"1"},"settings":{"enabled":"1","not_for_loan_default_train_in":"42","not_for_loan_waiting_list_in": "24"}}'
213
        );
214
        cy.intercept(
215
            "GET",
216
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn",
217
            '{"value":"24"}'
218
        );
219
        cy.intercept(
220
            "GET",
221
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanDefaultTrainIn",
222
            '{"value":"42"}'
223
        );
213
        );
214
224
        cy.intercept(
215
        cy.intercept(
225
            "GET",
216
            "GET",
226
            "/api/v1/authorised_value_categories/NOT_LOAN/authorised_values",
217
            "/api/v1/authorised_value_categories/NOT_LOAN/authorised_values",
Lines 277-283 describe("Trains", () => { Link Here
277
        );
268
        );
278
269
279
        // GET trains returns empty list
270
        // GET trains returns empty list
280
        cy.intercept("GET", "/api/v1/*", []);
271
        cy.intercept("GET", "/api/v1/preservation/trains*", []);
281
        cy.visit("/cgi-bin/koha/preservation/trains");
272
        cy.visit("/cgi-bin/koha/preservation/trains");
282
        cy.get("#trains_list").contains("There are no trains defined");
273
        cy.get("#trains_list").contains("There are no trains defined");
283
274
Lines 345-351 describe("Trains", () => { Link Here
345
        let train = get_train();
336
        let train = get_train();
346
        let processings = get_processings();
337
        let processings = get_processings();
347
        cy.intercept("GET", "/api/v1/preservation/trains/*", train);
338
        cy.intercept("GET", "/api/v1/preservation/trains/*", train);
348
        cy.intercept("GET", "/api/v1/preservation/trains", [train]);
339
        cy.intercept("GET", "/api/v1/preservation/trains*", {
340
            statusCode: 200,
341
            body: [train],
342
            headers: {
343
                "X-Base-Total-Count": "1",
344
                "X-Total-Count": "1",
345
            },
346
        });
347
349
        cy.intercept("GET", "/api/v1/preservation/processings*", processings);
348
        cy.intercept("GET", "/api/v1/preservation/processings*", processings);
350
        cy.visit("/cgi-bin/koha/preservation/trains");
349
        cy.visit("/cgi-bin/koha/preservation/trains");
351
        cy.get("#trains_list table tbody tr:first").contains("Edit").click();
350
        cy.get("#trains_list table tbody tr:first").contains("Edit").click();
Lines 361-367 describe("Trains", () => { Link Here
361
        // Submit the form, get 500
360
        // Submit the form, get 500
362
        cy.intercept("PUT", "/api/v1/preservation/trains/*", {
361
        cy.intercept("PUT", "/api/v1/preservation/trains/*", {
363
            statusCode: 500,
362
            statusCode: 500,
364
            error: "Something went wrong",
365
        });
363
        });
366
        cy.get("#trains_add").contains("Submit").click();
364
        cy.get("#trains_add").contains("Submit").click();
367
        cy.get("main div[class='dialog alert']").contains(
365
        cy.get("main div[class='dialog alert']").contains(
(-)a/t/cypress/integration/Preservation/WaitingList.ts (-19 / +16 lines)
Lines 21-52 function get_items() { Link Here
21
        },
21
        },
22
    ];
22
    ];
23
}
23
}
24
let config = {
25
    permissions: { manage_sysprefs: "1" },
26
    settings: {
27
        enabled: "1",
28
        not_for_loan_default_train_in: "42",
29
        not_for_loan_waiting_list_in: "24",
30
    },
31
};
24
describe("WaitingList", () => {
32
describe("WaitingList", () => {
25
    beforeEach(() => {
33
    beforeEach(() => {
26
        cy.login();
34
        cy.login();
27
        cy.title().should("eq", "Koha staff interface");
35
        cy.title().should("eq", "Koha staff interface");
28
        cy.intercept(
36
        cy.intercept(
29
            "GET",
37
            "GET",
30
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationModule",
38
            "/api/v1/preservation/config",
31
            '{"value":"1"}'
39
            JSON.stringify(config)
32
        );
33
        cy.intercept(
34
            "GET",
35
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn",
36
            '{"value":"24"}'
37
        );
38
        cy.intercept(
39
            "GET",
40
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanDefaultTrainIn",
41
            '{"value":"42"}'
42
        );
40
        );
43
    });
41
    });
44
42
45
    it("List", () => {
43
    it("List", () => {
44
        config.settings.not_for_loan_waiting_list_in = "";
46
        cy.intercept(
45
        cy.intercept(
47
            "GET",
46
            "GET",
48
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn",
47
            "/api/v1/preservation/config",
49
            '{"value":""}'
48
            JSON.stringify(config)
50
        );
49
        );
51
        cy.visit("/cgi-bin/koha/preservation/home.pl");
50
        cy.visit("/cgi-bin/koha/preservation/home.pl");
52
        cy.intercept("GET", "/api/v1/preservation/waiting-list/items*", []);
51
        cy.intercept("GET", "/api/v1/preservation/waiting-list/items*", []);
Lines 55-64 describe("WaitingList", () => { Link Here
55
            "You need to configure this module first."
54
            "You need to configure this module first."
56
        );
55
        );
57
56
57
        config.settings.not_for_loan_waiting_list_in = "42";
58
        cy.intercept(
58
        cy.intercept(
59
            "GET",
59
            "GET",
60
            "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn",
60
            "/api/v1/preservation/config",
61
            '{"value":"42"}'
61
            JSON.stringify(config)
62
        );
62
        );
63
        cy.visit("/cgi-bin/koha/preservation/home.pl");
63
        cy.visit("/cgi-bin/koha/preservation/home.pl");
64
        cy.intercept("GET", "/api/v1/preservation/waiting-list/items*", []);
64
        cy.intercept("GET", "/api/v1/preservation/waiting-list/items*", []);
Lines 73-79 describe("WaitingList", () => { Link Here
73
        cy.visit("/cgi-bin/koha/preservation/waiting-list");
73
        cy.visit("/cgi-bin/koha/preservation/waiting-list");
74
        cy.intercept("POST", "/api/v1/preservation/waiting-list/items", {
74
        cy.intercept("POST", "/api/v1/preservation/waiting-list/items", {
75
            statusCode: 500,
75
            statusCode: 500,
76
            error: "Something went wrong",
77
        });
76
        });
78
        cy.get("#waiting-list").contains("Add to waiting list").click();
77
        cy.get("#waiting-list").contains("Add to waiting list").click();
79
        cy.get("#barcode_list").type("bc_1\nbc_2\nbc_3");
78
        cy.get("#barcode_list").type("bc_1\nbc_2\nbc_3");
Lines 117-123 describe("WaitingList", () => { Link Here
117
        // Submit the form, get 500
116
        // Submit the form, get 500
118
        cy.intercept("DELETE", "/api/v1/preservation/waiting-list/items/*", {
117
        cy.intercept("DELETE", "/api/v1/preservation/waiting-list/items/*", {
119
            statusCode: 500,
118
            statusCode: 500,
120
            error: "Something went wrong",
121
        });
119
        });
122
        cy.get("#waiting-list table tbody tr:first").contains("Remove").click();
120
        cy.get("#waiting-list table tbody tr:first").contains("Remove").click();
123
        cy.contains("Yes, remove").click();
121
        cy.contains("Yes, remove").click();
124
- 

Return to bug 35201