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

(-)a/t/cypress/integration/KohaTable_spec.ts (-41 / +111 lines)
Lines 591-599 describe("Hit all tables", () => { Link Here
591
                            });
591
                            });
592
                        });
592
                        });
593
                });
593
                });
594
            cy.query(
595
                "SELECT value FROM systempreferences WHERE variable='AlwaysShowHoldingsTableFilters'"
596
            ).then(value => {
597
                cy.wrap(value).as("syspref_AlwaysShowHoldingsTableFilters");
598
            });
594
        });
599
        });
595
600
596
        afterEach(() => {});
601
        afterEach(
602
            () =>
603
                function () {
604
                    cleanup();
605
                    cy.set_syspref(
606
                        "AlwaysShowHoldingsTableFilters",
607
                        this.syspref_AlwaysShowHoldingsTableFilters
608
                    );
609
                }
610
        );
597
611
598
        it("Correctly init the table", function () {
612
        it("Correctly init the table", function () {
599
            // Do not use `() => {` or this.biblio_id won't be retrieved
613
            // Do not use `() => {` or this.biblio_id won't be retrieved
Lines 610-615 describe("Hit all tables", () => { Link Here
610
                    damaged_status: 0,
624
                    damaged_status: 0,
611
                    not_for_loan_status: 0,
625
                    not_for_loan_status: 0,
612
                    course_item: null,
626
                    course_item: null,
627
                    cover_image_ids: [],
613
                },
628
                },
614
            }).then(items => {
629
            }).then(items => {
615
                cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, {
630
                cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, {
Lines 638-644 describe("Hit all tables", () => { Link Here
638
                    RESTdefaultPageSize
653
                    RESTdefaultPageSize
639
                );
654
                );
640
655
641
                cy.get(".show_filters").click();
642
                cy.get(`#${table_id}_wrapper .dt-info`).contains(
656
                cy.get(`#${table_id}_wrapper .dt-info`).contains(
643
                    `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries`
657
                    `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries`
644
                );
658
                );
Lines 660-665 describe("Hit all tables", () => { Link Here
660
                    damaged_status: 0,
674
                    damaged_status: 0,
661
                    not_for_loan_status: 0,
675
                    not_for_loan_status: 0,
662
                    course_item: null,
676
                    course_item: null,
677
                    cover_image_ids: [],
663
                },
678
                },
664
            }).then(items => {
679
            }).then(items => {
665
                cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, {
680
                cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, {
Lines 671-722 describe("Hit all tables", () => { Link Here
671
                    },
686
                    },
672
                });
687
                });
673
688
674
                cy.visit(
689
                cy.set_syspref("AlwaysShowHoldingsTableFilters", 0).then(() => {
675
                    "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" +
690
                    cy.visit(
676
                        biblio_id
691
                        "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" +
677
                );
692
                            biblio_id
693
                    );
678
694
679
                // Hide the 'URL' column
695
                    // Hide the 'URL' column
680
                mock_table_settings(
696
                    mock_table_settings(
681
                    {
697
                        {
682
                        columns: { uri: { is_hidden: 1 } },
698
                            columns: { uri: { is_hidden: 1 } },
683
                    },
699
                        },
684
                    "items_table_settings.holdings"
700
                        "items_table_settings.holdings"
685
                );
701
                    );
686
702
687
                cy.window().then(win => {
703
                    cy.window().then(win => {
688
                    win.libraries_map = items.reduce((map, i) => {
704
                        win.libraries_map = items.reduce((map, i) => {
689
                        map[i.library_id] = i.library_id;
705
                            map[i.library_id] = i.library_id;
690
                        return map;
706
                            return map;
691
                    }, {});
707
                        }, {});
708
                    });
709
710
                    cy.get("@columns").then(columns => {
711
                        cy.get(`#${table_id}_wrapper tbody tr`).should(
712
                            "have.length",
713
                            RESTdefaultPageSize
714
                        );
715
716
                        // Filters are not displayed
717
                        cy.get(`#${table_id} thead tr`).should(
718
                            "have.length",
719
                            1
720
                        );
721
722
                        cy.get(`#${table_id} th`).contains("Status");
723
                        cy.get(`#${table_id} th`)
724
                            .contains("URL")
725
                            .should("not.exist");
726
                        cy.get(`#${table_id} th`)
727
                            .contains("Course reserves")
728
                            .should("not.exist");
729
730
                        cy.get(".show_filters").click();
731
                        cy.get(`#${table_id}_wrapper .dt-info`).contains(
732
                            `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries`
733
                        );
734
                        // Filters are displayed
735
                        cy.get(`#${table_id} thead tr`).should(
736
                            "have.length",
737
                            2
738
                        );
739
740
                        cy.get(`#${table_id} th`).contains("Status");
741
                        cy.get(`#${table_id} th`)
742
                            .contains("URL")
743
                            .should("not.exist");
744
                        cy.get(`#${table_id} th`)
745
                            .contains("Course reserves")
746
                            .should("not.exist");
747
                    });
692
                });
748
                });
693
749
694
                cy.get("@columns").then(columns => {
750
                cy.set_syspref("AlwaysShowHoldingsTableFilters", 1).then(() => {
695
                    cy.get(`#${table_id}_wrapper tbody tr`).should(
751
                    cy.visit(
696
                        "have.length",
752
                        "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" +
697
                        RESTdefaultPageSize
753
                            biblio_id
698
                    );
754
                    );
699
755
700
                    cy.get(`#${table_id} th`).contains("Status");
756
                    // Hide the 'URL' column
701
                    cy.get(`#${table_id} th`)
757
                    mock_table_settings(
702
                        .contains("URL")
758
                        {
703
                        .should("not.exist");
759
                            columns: { uri: { is_hidden: 1 } },
704
                    cy.get(`#${table_id} th`)
760
                        },
705
                        .contains("Course reserves")
761
                        "items_table_settings.holdings"
706
                        .should("not.exist");
707
708
                    cy.get(".show_filters").click();
709
                    cy.get(`#${table_id}_wrapper .dt-info`).contains(
710
                        `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries`
711
                    );
762
                    );
712
763
713
                    cy.get(`#${table_id} th`).contains("Status");
764
                    cy.window().then(win => {
714
                    cy.get(`#${table_id} th`)
765
                        win.libraries_map = items.reduce((map, i) => {
715
                        .contains("URL")
766
                            map[i.library_id] = i.library_id;
716
                        .should("not.exist");
767
                            return map;
717
                    cy.get(`#${table_id} th`)
768
                        }, {});
718
                        .contains("Course reserves")
769
                    });
719
                        .should("not.exist");
770
771
                    cy.get("@columns").then(columns => {
772
                        cy.get(`#${table_id}_wrapper tbody tr`).should(
773
                            "have.length",
774
                            RESTdefaultPageSize
775
                        );
776
777
                        // Filters are displayed
778
                        cy.get(`#${table_id} thead tr`).should(
779
                            "have.length",
780
                            2
781
                        );
782
783
                        cy.get(".hide_filters").click();
784
785
                        // Filters are not displayed
786
                        cy.get(`#${table_id} thead tr`).should(
787
                            "have.length",
788
                            1
789
                        );
790
                    });
720
                });
791
                });
721
            });
792
            });
722
        });
793
        });
723
- 

Return to bug 38108