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

(-)a/t/cypress/integration/Agreements_spec.ts (-7 / +46 lines)
Lines 491-496 describe("Agreement CRUD operations", () => { Link Here
491
        let agreement = get_agreement();
491
        let agreement = get_agreement();
492
        let agreements = [agreement];
492
        let agreements = [agreement];
493
493
494
        // Delete from list
494
        // Click the 'Delete' button from the list
495
        // Click the 'Delete' button from the list
495
        cy.intercept("GET", "/api/v1/erm/agreements*", {
496
        cy.intercept("GET", "/api/v1/erm/agreements*", {
496
            statusCode: 200,
497
            statusCode: 200,
Lines 506-532 describe("Agreement CRUD operations", () => { Link Here
506
        cy.get("#agreements_list table tbody tr:first")
507
        cy.get("#agreements_list table tbody tr:first")
507
            .contains("Delete")
508
            .contains("Delete")
508
            .click();
509
            .click();
509
        cy.get("#agreements_confirm_delete h2").contains("Delete agreement");
510
        cy.get(".dialog.alert.confirmation h1").contains("remove this agreement");
510
        cy.contains("Agreement name: " + agreement.name);
511
        cy.contains(agreement.name);
511
512
512
        // Submit the form, get 500
513
        // Accept the confirmation dialog, get 500
513
        cy.intercept("DELETE", "/api/v1/erm/agreements/*", {
514
        cy.intercept("DELETE", "/api/v1/erm/agreements/*", {
514
            statusCode: 500,
515
            statusCode: 500,
515
            error: "Something went wrong",
516
            error: "Something went wrong",
516
        });
517
        });
517
        cy.contains("Yes, delete").click();
518
        cy.contains("Accept").click();
518
        cy.get("main div[class='dialog alert']").contains(
519
        cy.get("main div[class='dialog alert']").contains(
519
            "Something went wrong: Error: Internal Server Error"
520
            "Something went wrong: Error: Internal Server Error"
520
        );
521
        );
521
522
522
        // Submit the form, success!
523
        // Accept the confirmation dialog, success!
523
        cy.intercept("DELETE", "/api/v1/erm/agreements/*", {
524
        cy.intercept("DELETE", "/api/v1/erm/agreements/*", {
524
            statusCode: 204,
525
            statusCode: 204,
525
            body: null,
526
            body: null,
526
        });
527
        });
528
        cy.get("#agreements_list table tbody tr:first")
529
            .contains("Delete")
530
            .click();
531
        cy.get(".dialog.alert.confirmation h1").contains("remove this agreement");
527
        cy.contains("Yes, delete").click();
532
        cy.contains("Yes, delete").click();
528
        cy.get("main div[class='dialog message']").contains(
533
        cy.get("main div[class='dialog message']").contains("Agreement").contains("deleted");
529
            "Agreement deleted"
534
535
        // Delete from show
536
        // Click the "name" link from the list
537
        cy.intercept("GET", "/api/v1/erm/agreements*", {
538
            statusCode: 200,
539
            body: agreements,
540
            headers: {
541
                "X-Base-Total-Count": "1",
542
                "X-Total-Count": "1",
543
            },
544
        });
545
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as(
546
            "get-agreement"
530
        );
547
        );
548
        cy.visit("/cgi-bin/koha/erm/agreements");
549
        let name_link = cy.get(
550
            "#agreements_list table tbody tr:first td:first a"
551
        );
552
        name_link.should(
553
            "have.text",
554
            agreement.name + " (#" + agreement.agreement_id + ")"
555
        );
556
        name_link.click();
557
        cy.wait("@get-agreement");
558
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
559
        cy.get("#agreements_show h2").contains(
560
            "Agreement #" + agreement.agreement_id
561
        );
562
563
        cy.get('#agreements_show .action_links .fa-trash').click();
564
        cy.get(".dialog.alert.confirmation h1").contains("remove this agreement");
565
        cy.contains("Yes, delete").click();
566
        cy.get("main div[class='dialog message']").contains("Agreement").contains("deleted");
567
568
        //Make sure we return to list after deleting from show
569
        cy.get("#agreements_list table tbody tr:first")
531
    });
570
    });
532
});
571
});
(-)a/t/cypress/integration/Licenses_spec.ts (-6 / +44 lines)
Lines 253-262 describe("License CRUD operations", () => { Link Here
253
        cy.get("#licenses_list table tbody tr:first")
253
        cy.get("#licenses_list table tbody tr:first")
254
            .contains("Delete")
254
            .contains("Delete")
255
            .click();
255
            .click();
256
        cy.get("#licenses_confirm_delete h2").contains("Delete license");
256
        cy.get(".dialog.alert.confirmation h1").contains("remove this license");
257
        cy.contains("License name: " + license.name);
257
        cy.contains(license.name);
258
258
259
        // Submit the form, get 500
259
        // Accept the confirmation dialog, get 500
260
        cy.intercept("DELETE", "/api/v1/erm/licenses/*", {
260
        cy.intercept("DELETE", "/api/v1/erm/licenses/*", {
261
            statusCode: 500,
261
            statusCode: 500,
262
            error: "Something went wrong",
262
            error: "Something went wrong",
Lines 266-279 describe("License CRUD operations", () => { Link Here
266
            "Something went wrong: Error: Internal Server Error"
266
            "Something went wrong: Error: Internal Server Error"
267
        );
267
        );
268
268
269
        // Submit the form, success!
269
        // Accept the confirmation dialog, success!
270
        cy.intercept("DELETE", "/api/v1/erm/licenses/*", {
270
        cy.intercept("DELETE", "/api/v1/erm/licenses/*", {
271
            statusCode: 204,
271
            statusCode: 204,
272
            body: null,
272
            body: null,
273
        });
273
        });
274
        cy.get("#licenses_list table tbody tr:first")
275
            .contains("Delete")
276
            .click();
277
        cy.get(".dialog.alert.confirmation h1").contains("remove this license");
274
        cy.contains("Yes, delete").click();
278
        cy.contains("Yes, delete").click();
275
        cy.get("main div[class='dialog message']").contains(
279
        cy.get("main div[class='dialog message']").contains("License").contains("deleted");
276
            "License deleted"
280
281
        // Delete from show
282
        // Click the "name" link from the list
283
        cy.intercept("GET", "/api/v1/erm/licenses*", {
284
            statusCode: 200,
285
            body: licenses,
286
            headers: {
287
                "X-Base-Total-Count": "1",
288
                "X-Total-Count": "1",
289
            },
290
        });
291
        cy.intercept("GET", "/api/v1/erm/licenses/*", license).as(
292
            "get-license"
277
        );
293
        );
294
        cy.visit("/cgi-bin/koha/erm/licenses");
295
        let name_link = cy.get(
296
            "#licenses_list table tbody tr:first td:first a"
297
        );
298
        name_link.should(
299
            "have.text",
300
            license.name + " (#" + license.license_id + ")"
301
        );
302
        name_link.click();
303
        cy.wait("@get-license");
304
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
305
        cy.get("#licenses_show h2").contains(
306
            "License #" + license.license_id
307
        );
308
309
        cy.get('#licenses_show .action_links .fa-trash').click();
310
        cy.get(".dialog.alert.confirmation h1").contains("remove this license");
311
        cy.contains("Yes, delete").click();
312
        cy.get("main div[class='dialog message']").contains("License").contains("deleted");
313
314
        //Make sure we return to list after deleting from show
315
        cy.get("#licenses_list table tbody tr:first")
278
    });
316
    });
279
});
317
});
(-)a/t/cypress/integration/Packages_spec.ts (-5 / +47 lines)
Lines 295-304 describe("Package CRUD operations", () => { Link Here
295
        cy.get("#packages_list table tbody tr:first")
295
        cy.get("#packages_list table tbody tr:first")
296
            .contains("Delete")
296
            .contains("Delete")
297
            .click();
297
            .click();
298
        cy.get("#packages_confirm_delete h2").contains("Delete package");
298
        cy.get(".dialog.alert.confirmation h1").contains("remove this package");
299
        cy.contains("Package name: " + erm_package.name);
299
        cy.contains(erm_package.name);
300
300
301
        // Submit the form, get 500
301
        // Accept the confirmation dialog, get 500
302
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/packages/*", {
302
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/packages/*", {
303
            statusCode: 500,
303
            statusCode: 500,
304
            error: "Something went wrong",
304
            error: "Something went wrong",
Lines 308-319 describe("Package CRUD operations", () => { Link Here
308
            "Something went wrong: Error: Internal Server Error"
308
            "Something went wrong: Error: Internal Server Error"
309
        );
309
        );
310
310
311
        // Submit the form, success!
311
        // Accept the confirmation dialog, success!
312
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/packages/*", {
312
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/packages/*", {
313
            statusCode: 204,
313
            statusCode: 204,
314
            body: null,
314
            body: null,
315
        });
315
        });
316
        cy.get("#packages_list table tbody tr:first")
317
            .contains("Delete")
318
            .click();
319
        cy.get(".dialog.alert.confirmation h1").contains("remove this package");
320
        cy.contains("Yes, delete").click();
321
        cy.get("main div[class='dialog message']").contains("Local package").contains("deleted");
322
323
        // Delete from show
324
        // Click the "name" link from the list
325
        cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", {
326
            statusCode: 200,
327
            body: packages,
328
            headers: {
329
                "X-Base-Total-Count": "1",
330
                "X-Total-Count": "1",
331
            },
332
        });
333
        cy.intercept(
334
            "GET",
335
            "/api/v1/erm/eholdings/local/packages/*",
336
            erm_package
337
        ).as("get-package");
338
        cy.visit("/cgi-bin/koha/erm/eholdings/local/packages");
339
        let name_link = cy.get(
340
            "#packages_list table tbody tr:first td:first a"
341
        );
342
        name_link.should(
343
            "have.text",
344
            erm_package.name + " (#" + erm_package.package_id + ")"
345
        );
346
        name_link.click();
347
        cy.wait("@get-package");
348
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
349
        cy.get("#packages_show h2").contains(
350
            "Package #" + erm_package.package_id
351
        );
352
353
        cy.get('#packages_show .action_links .fa-trash').click();
354
        cy.get(".dialog.alert.confirmation h1").contains("remove this package");
316
        cy.contains("Yes, delete").click();
355
        cy.contains("Yes, delete").click();
317
        cy.get("main div[class='dialog message']").contains("Package deleted");
356
        cy.get("main div[class='dialog message']").contains("Local package").contains("deleted");
357
358
        //Make sure we return to list after deleting from show
359
        cy.get("#packages_list table tbody tr:first")
318
    });
360
    });
319
});
361
});
(-)a/t/cypress/integration/Titles_spec.ts (-6 / +59 lines)
Lines 428-437 describe("Title CRUD operations", () => { Link Here
428
        cy.get("#titles_list table tbody tr:first")
428
        cy.get("#titles_list table tbody tr:first")
429
            .contains("Delete")
429
            .contains("Delete")
430
            .click();
430
            .click();
431
        cy.get("#eholdings_confirm_delete h2").contains("Delete title");
431
        cy.get(".dialog.alert.confirmation h1").contains("remove this title");
432
        cy.contains("Title: " + erm_title.publication_title);
432
        cy.contains(erm_title.publication_title);
433
433
434
        // Submit the form, get 500
434
        // Accept the confirmation dialog, get 500
435
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/titles/*", {
435
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/titles/*", {
436
            statusCode: 500,
436
            statusCode: 500,
437
            error: "Something went wrong",
437
            error: "Something went wrong",
Lines 441-452 describe("Title CRUD operations", () => { Link Here
441
            "Something went wrong: Error: Internal Server Error"
441
            "Something went wrong: Error: Internal Server Error"
442
        );
442
        );
443
443
444
        // Submit the form, success!
444
        // Accept the confirmation dialog, success!
445
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/titles/*", {
445
        cy.intercept("DELETE", "/api/v1/erm/eholdings/local/titles/*", {
446
            statusCode: 204,
446
            statusCode: 204,
447
            body: null,
447
            body: null,
448
        });
448
        });
449
        cy.get("#titles_list table tbody tr:first")
450
            .contains("Delete")
451
            .click();
452
        cy.get(".dialog.alert.confirmation h1").contains("remove this title");
453
        cy.contains("Yes, delete").click();
454
        cy.get("main div[class='dialog message']").contains("Local title").contains("deleted");
455
456
        // Delete from show
457
        // Click the "name" link from the list
458
        cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", {
459
            statusCode: 200,
460
            body: titles,
461
            headers: {
462
                "X-Base-Total-Count": "1",
463
                "X-Total-Count": "1",
464
            },
465
        });
466
        // Title with empty resources.
467
        cy.intercept(
468
            {
469
                method: "GET",
470
                url: "/api/v1/erm/eholdings/local/titles/*",
471
                times: 1
472
            },
473
            {
474
                body: {
475
                    publication_title: "publication title",
476
                    resources: [],
477
                    title_id: 1,
478
                }
479
            }
480
        ).as("get-title");
481
        cy.visit("/cgi-bin/koha/erm/eholdings/local/titles");
482
        let title_link = cy.get(
483
            "#titles_list table tbody tr:first td:first a"
484
        );
485
        title_link.should(
486
            "have.text",
487
            erm_title.publication_title + " (#" + erm_title.title_id + ")"
488
        );
489
        cy.get(
490
            "#titles_list table tbody tr:first td:first a"
491
        ).click();
492
        cy.wait("@get-title");
493
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
494
        cy.get("#eholdings_title_show h2").contains(
495
            "Title #" + erm_title.title_id
496
        );
497
498
        cy.get('#eholdings_title_show .action_links .fa-trash').click();
499
        cy.get(".dialog.alert.confirmation h1").contains("remove this title");
449
        cy.contains("Yes, delete").click();
500
        cy.contains("Yes, delete").click();
450
        cy.get("main div[class='dialog message']").contains("Title deleted");
501
        cy.get("main div[class='dialog message']").contains("Local title").contains("deleted");
502
503
        //Make sure we return to list after deleting from show
504
        cy.get("#titles_list table tbody tr:first")
451
    });
505
    });
452
});
506
});
453
- 

Return to bug 32991