Lines 180-183
describe("Filters", () => {
Link Here
|
180 |
).should("have.value", null); |
180 |
).should("have.value", null); |
181 |
}); |
181 |
}); |
182 |
}); |
182 |
}); |
|
|
183 |
|
184 |
describe.only("Exact search for all attributes", () => { |
185 |
// In this case the library column is bind to library.name and library.library_id |
186 |
it("From the form", () => { |
187 |
cy.task("buildSampleObjects", { |
188 |
object: "patron", |
189 |
count: RESTdefaultPageSize, |
190 |
values: {}, |
191 |
}).then(patrons => { |
192 |
// Needs more properties to not explode |
193 |
// account_balace: balance_str.escapeHtml(...).format_price is not a function |
194 |
patrons = patrons.map(p => ({ ...p, account_balance: 0 })); |
195 |
|
196 |
cy.intercept("GET", "/api/v1/patrons*", { |
197 |
statusCode: 200, |
198 |
body: patrons, |
199 |
headers: { |
200 |
"X-Base-Total-Count": baseTotalCount, |
201 |
"X-Total-Count": baseTotalCount, |
202 |
}, |
203 |
}).as("searchPatrons"); |
204 |
|
205 |
cy.visit("/cgi-bin/koha/members/members-home.pl"); |
206 |
|
207 |
cy.window().then(win => { |
208 |
win.categories_map = patrons.reduce((map, p) => { |
209 |
map[p.category_id.toLowerCase()] = p.category_id; |
210 |
return map; |
211 |
}, {}); |
212 |
}); |
213 |
|
214 |
cy.get("form.patron_search_form .branchcode_filter").select( |
215 |
"CPL" |
216 |
); |
217 |
cy.get("form.patron_search_form input[type='submit']").click(); |
218 |
|
219 |
cy.wait("@searchPatrons").then(interception => { |
220 |
const q = interception.request.query.q; |
221 |
expect(q).to.equal( |
222 |
'[{"library.name":"CPL"},{"me.library_id":"CPL"}]' |
223 |
); |
224 |
}); |
225 |
}); |
226 |
}); |
227 |
|
228 |
it("From the column filter", () => { |
229 |
cy.task("buildSampleObjects", { |
230 |
object: "patron", |
231 |
count: RESTdefaultPageSize, |
232 |
values: {}, |
233 |
}).then(patrons => { |
234 |
// Needs more properties to not explode |
235 |
// account_balace: balance_str.escapeHtml(...).format_price is not a function |
236 |
patrons = patrons.map(p => ({ ...p, account_balance: 0 })); |
237 |
|
238 |
cy.intercept("GET", "/api/v1/patrons*", { |
239 |
statusCode: 200, |
240 |
body: patrons, |
241 |
headers: { |
242 |
"X-Base-Total-Count": baseTotalCount, |
243 |
"X-Total-Count": baseTotalCount, |
244 |
}, |
245 |
}).as("searchPatrons"); |
246 |
|
247 |
cy.visit("/cgi-bin/koha/members/members-home.pl"); |
248 |
|
249 |
cy.window().then(win => { |
250 |
win.categories_map = patrons.reduce((map, p) => { |
251 |
map[p.category_id.toLowerCase()] = p.category_id; |
252 |
return map; |
253 |
}, {}); |
254 |
}); |
255 |
|
256 |
cy.get("form.patron_search_form input[type='submit']").click(); |
257 |
|
258 |
cy.wait("@searchPatrons"); |
259 |
|
260 |
cy.get( |
261 |
`#${table_id} thead tr th[data-filter='libraries'] select` |
262 |
).select("^CPL$"); |
263 |
|
264 |
cy.wait("@searchPatrons").then(interception => { |
265 |
const q = interception.request.query.q; |
266 |
expect(q).to.equal( |
267 |
'[{"library.name":"CPL"},{"me.library_id":"CPL"}]' |
268 |
); |
269 |
}); |
270 |
}); |
271 |
}); |
272 |
}); |
183 |
}); |
273 |
}); |
184 |
- |
|
|