|
Lines 34-44
describe("catalogue/detail/holdings_table with items", () => {
Link Here
|
| 34 |
it("Correctly init the table", function () { |
34 |
it("Correctly init the table", function () { |
| 35 |
// Do not use `() => {` or this.objects won't be retrieved |
35 |
// Do not use `() => {` or this.objects won't be retrieved |
| 36 |
const biblio_id = this.objects.biblio.biblio_id; |
36 |
const biblio_id = this.objects.biblio.biblio_id; |
|
|
37 |
|
| 38 |
cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`).as( |
| 39 |
"searchItems" |
| 40 |
); |
| 41 |
|
| 37 |
cy.set_syspref("AlwaysShowHoldingsTableFilters", 1).then(() => { |
42 |
cy.set_syspref("AlwaysShowHoldingsTableFilters", 1).then(() => { |
| 38 |
cy.visit( |
43 |
cy.visit( |
| 39 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
44 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
| 40 |
); |
45 |
); |
| 41 |
|
46 |
|
|
|
47 |
cy.wait("@searchItems"); |
| 48 |
|
| 42 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
49 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
| 43 |
"have.length", |
50 |
"have.length", |
| 44 |
RESTdefaultPageSize |
51 |
RESTdefaultPageSize |
|
Lines 54-59
describe("catalogue/detail/holdings_table with items", () => {
Link Here
|
| 54 |
// Do not use `() => {` or this.objects won't be retrieved |
61 |
// Do not use `() => {` or this.objects won't be retrieved |
| 55 |
const biblio_id = this.objects.biblio.biblio_id; |
62 |
const biblio_id = this.objects.biblio.biblio_id; |
| 56 |
|
63 |
|
|
|
64 |
cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`).as( |
| 65 |
"searchItems" |
| 66 |
); |
| 67 |
|
| 57 |
cy.set_syspref("AlwaysShowHoldingsTableFilters", 0).then(() => { |
68 |
cy.set_syspref("AlwaysShowHoldingsTableFilters", 0).then(() => { |
| 58 |
cy.visit( |
69 |
cy.visit( |
| 59 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
70 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
|
Lines 67-72
describe("catalogue/detail/holdings_table with items", () => {
Link Here
|
| 67 |
"items_table_settings.holdings" |
78 |
"items_table_settings.holdings" |
| 68 |
); |
79 |
); |
| 69 |
|
80 |
|
|
|
81 |
cy.wait("@searchItems"); |
| 82 |
|
| 70 |
cy.get("@columns").then(columns => { |
83 |
cy.get("@columns").then(columns => { |
| 71 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
84 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
| 72 |
"have.length", |
85 |
"have.length", |
|
Lines 83-88
describe("catalogue/detail/holdings_table with items", () => {
Link Here
|
| 83 |
.should("not.exist"); |
96 |
.should("not.exist"); |
| 84 |
|
97 |
|
| 85 |
cy.get(`.${table_id}_table_controls .show_filters`).click(); |
98 |
cy.get(`.${table_id}_table_controls .show_filters`).click(); |
|
|
99 |
cy.wait("@searchItems"); |
| 86 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
100 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
| 87 |
`Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` |
101 |
`Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` |
| 88 |
); |
102 |
); |
|
Lines 110-115
describe("catalogue/detail/holdings_table with items", () => {
Link Here
|
| 110 |
"items_table_settings.holdings" |
124 |
"items_table_settings.holdings" |
| 111 |
); |
125 |
); |
| 112 |
|
126 |
|
|
|
127 |
cy.wait("@searchItems"); |
| 128 |
|
| 113 |
cy.get("@columns").then(columns => { |
129 |
cy.get("@columns").then(columns => { |
| 114 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
130 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
| 115 |
"have.length", |
131 |
"have.length", |
|
Lines 120-125
describe("catalogue/detail/holdings_table with items", () => {
Link Here
|
| 120 |
cy.get(`#${table_id} thead tr`).should("have.length", 2); |
136 |
cy.get(`#${table_id} thead tr`).should("have.length", 2); |
| 121 |
|
137 |
|
| 122 |
cy.get(`.${table_id}_table_controls .hide_filters`).click(); |
138 |
cy.get(`.${table_id}_table_controls .hide_filters`).click(); |
|
|
139 |
cy.wait("@searchItems"); |
| 123 |
|
140 |
|
| 124 |
// Filters are not displayed |
141 |
// Filters are not displayed |
| 125 |
cy.get(`#${table_id} thead tr`).should("have.length", 1); |
142 |
cy.get(`#${table_id} thead tr`).should("have.length", 1); |
|
Lines 290-297
describe("catalogue/detail/holdings_table without items", () => {
Link Here
|
| 290 |
// Do not use `() => {` or this.objects won't be retrieved |
307 |
// Do not use `() => {` or this.objects won't be retrieved |
| 291 |
const biblio_id = this.objects.biblio.biblio_id; |
308 |
const biblio_id = this.objects.biblio.biblio_id; |
| 292 |
|
309 |
|
|
|
310 |
cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`).as( |
| 311 |
"searchItems" |
| 312 |
); |
| 313 |
|
| 293 |
cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id); |
314 |
cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id); |
| 294 |
|
315 |
|
|
|
316 |
// No API request |
| 317 |
cy.get("@searchItems.all").should("have.length", 0); |
| 318 |
|
| 295 |
cy.get(`#${table_id}_wrapper`).should("not.exist"); |
319 |
cy.get(`#${table_id}_wrapper`).should("not.exist"); |
| 296 |
}); |
320 |
}); |
| 297 |
}); |
321 |
}); |
| 298 |
- |
|
|