Lines 151-163
describe("catalogue/detail/holdings_table", () => {
Link Here
|
151 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
151 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
152 |
); |
152 |
); |
153 |
|
153 |
|
154 |
cy.window().then(win => { |
|
|
155 |
win.libraries_map = items.reduce((map, i) => { |
156 |
map[i.library_id] = i.library_id; |
157 |
return map; |
158 |
}, {}); |
159 |
}); |
160 |
|
161 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
154 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
162 |
"have.length", |
155 |
"have.length", |
163 |
RESTdefaultPageSize |
156 |
RESTdefaultPageSize |
Lines 210-222
describe("catalogue/detail/holdings_table", () => {
Link Here
|
210 |
"items_table_settings.holdings" |
203 |
"items_table_settings.holdings" |
211 |
); |
204 |
); |
212 |
|
205 |
|
213 |
cy.window().then(win => { |
|
|
214 |
win.libraries_map = items.reduce((map, i) => { |
215 |
map[i.library_id] = i.library_id; |
216 |
return map; |
217 |
}, {}); |
218 |
}); |
219 |
|
220 |
cy.get("@columns").then(columns => { |
206 |
cy.get("@columns").then(columns => { |
221 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
207 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
222 |
"have.length", |
208 |
"have.length", |
Lines 234-240
describe("catalogue/detail/holdings_table", () => {
Link Here
|
234 |
.contains("Course reserves") |
220 |
.contains("Course reserves") |
235 |
.should("not.exist"); |
221 |
.should("not.exist"); |
236 |
|
222 |
|
237 |
cy.get(".show_filters").click(); |
223 |
cy.get(`.${table_id}_table_controls .show_filters`).click(); |
238 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
224 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
239 |
`Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` |
225 |
`Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` |
240 |
); |
226 |
); |
Lines 265-277
describe("catalogue/detail/holdings_table", () => {
Link Here
|
265 |
"items_table_settings.holdings" |
251 |
"items_table_settings.holdings" |
266 |
); |
252 |
); |
267 |
|
253 |
|
268 |
cy.window().then(win => { |
|
|
269 |
win.libraries_map = items.reduce((map, i) => { |
270 |
map[i.library_id] = i.library_id; |
271 |
return map; |
272 |
}, {}); |
273 |
}); |
274 |
|
275 |
cy.get("@columns").then(columns => { |
254 |
cy.get("@columns").then(columns => { |
276 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
255 |
cy.get(`#${table_id}_wrapper tbody tr`).should( |
277 |
"have.length", |
256 |
"have.length", |
Lines 281-287
describe("catalogue/detail/holdings_table", () => {
Link Here
|
281 |
// Filters are displayed |
260 |
// Filters are displayed |
282 |
cy.get(`#${table_id} thead tr`).should("have.length", 2); |
261 |
cy.get(`#${table_id} thead tr`).should("have.length", 2); |
283 |
|
262 |
|
284 |
cy.get(".hide_filters").click(); |
263 |
cy.get(`.${table_id}_table_controls .hide_filters`).click(); |
285 |
|
264 |
|
286 |
// Filters are not displayed |
265 |
// Filters are not displayed |
287 |
cy.get(`#${table_id} thead tr`).should("have.length", 1); |
266 |
cy.get(`#${table_id} thead tr`).should("have.length", 1); |
Lines 289-292
describe("catalogue/detail/holdings_table", () => {
Link Here
|
289 |
}); |
268 |
}); |
290 |
}); |
269 |
}); |
291 |
}); |
270 |
}); |
|
|
271 |
|
272 |
it.only("Filters by code and description", function () { |
273 |
// Do not use `() => {` or this.biblio_id won't be retrieved |
274 |
const biblio_id = this.biblio_id; |
275 |
cy.task("buildSampleObjects", { |
276 |
object: "item", |
277 |
count: RESTdefaultPageSize, |
278 |
values: { |
279 |
biblio_id, |
280 |
checkout: null, |
281 |
transfer: null, |
282 |
lost_status: 0, |
283 |
withdrawn: 0, |
284 |
damaged_status: 0, |
285 |
not_for_loan_status: 0, |
286 |
course_item: null, |
287 |
cover_image_ids: [], |
288 |
}, |
289 |
}).then(items => { |
290 |
cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, { |
291 |
statuscode: 200, |
292 |
body: items, |
293 |
headers: { |
294 |
"X-Base-Total-Count": baseTotalCount, |
295 |
"X-Total-Count": baseTotalCount, |
296 |
}, |
297 |
}).as("searchItems"); |
298 |
|
299 |
cy.visit( |
300 |
"/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id |
301 |
); |
302 |
|
303 |
cy.window().then(win => { |
304 |
win.coded_values.library = new Map( |
305 |
items.map(i => [ |
306 |
i.home_library.name, |
307 |
i.home_library.library_id, |
308 |
]) |
309 |
); |
310 |
win.coded_values.item_type = new Map( |
311 |
items.map(i => [ |
312 |
i.item_type.description, |
313 |
i.item_type.item_type_id, |
314 |
]) |
315 |
); |
316 |
}); |
317 |
cy.wait("@searchItems"); |
318 |
|
319 |
let library_id = items[0].home_library.library_id; |
320 |
let library_name = items[0].home_library.name; |
321 |
cy.get(`#${table_id}_wrapper input.dt-input`).type(library_id); |
322 |
|
323 |
cy.wait("@searchItems").then(interception => { |
324 |
const q = interception.request.query.q; |
325 |
expect(q).to.match( |
326 |
new RegExp( |
327 |
`"me.home_library_id":{"like":"%${library_id}%"}` |
328 |
) |
329 |
); |
330 |
}); |
331 |
|
332 |
cy.get(`#${table_id}_wrapper input.dt-input`).clear(); |
333 |
cy.get(`#${table_id}_wrapper input.dt-input`).type(library_name); |
334 |
|
335 |
cy.wait("@searchItems").then(interception => { |
336 |
const q = interception.request.query.q; |
337 |
expect(q).to.match( |
338 |
new RegExp(`"me.home_library_id":\\["${library_id}"\\]`) |
339 |
); |
340 |
}); |
341 |
|
342 |
let item_type_id = items[0].item_type.item_type_id; |
343 |
let item_type_description = items[0].item_type.description; |
344 |
cy.get(`#${table_id}_wrapper input.dt-input`).clear(); |
345 |
cy.get(`#${table_id}_wrapper input.dt-input`).type(item_type_id); |
346 |
|
347 |
cy.wait("@searchItems").then(interception => { |
348 |
const q = interception.request.query.q; |
349 |
expect(q).to.match( |
350 |
new RegExp(`"me.item_type_id":{"like":"%${item_type_id}%"}`) |
351 |
); |
352 |
}); |
353 |
|
354 |
cy.get(`#${table_id}_wrapper input.dt-input`).clear(); |
355 |
cy.get(`#${table_id}_wrapper input.dt-input`).type( |
356 |
item_type_description |
357 |
); |
358 |
|
359 |
cy.wait("@searchItems").then(interception => { |
360 |
const q = interception.request.query.q; |
361 |
expect(q).to.match( |
362 |
new RegExp(`"me.item_type_id":\\["${item_type_id}"\\]`) |
363 |
); |
364 |
}); |
365 |
}); |
366 |
}); |
292 |
}); |
367 |
}); |
293 |
- |
|
|