|
Lines 81-88
describe("Infinite scroll", () => {
Link Here
|
| 81 |
statusCode: 200, |
81 |
statusCode: 200, |
| 82 |
body: pageTwo, |
82 |
body: pageTwo, |
| 83 |
headers: { |
83 |
headers: { |
| 84 |
"X-Base-Total-Count": "20", |
84 |
"X-Base-Total-Count": "40", |
| 85 |
"X-Total-Count": "20", |
85 |
"X-Total-Count": "40", |
| 86 |
}, |
86 |
}, |
| 87 |
}).as("getPageTwo"); |
87 |
}).as("getPageTwo"); |
| 88 |
// Scroll the dropdown |
88 |
// Scroll the dropdown |
|
Lines 94-101
describe("Infinite scroll", () => {
Link Here
|
| 94 |
statusCode: 200, |
94 |
statusCode: 200, |
| 95 |
body: pageThree, |
95 |
body: pageThree, |
| 96 |
headers: { |
96 |
headers: { |
| 97 |
"X-Base-Total-Count": "20", |
97 |
"X-Base-Total-Count": "60", |
| 98 |
"X-Total-Count": "20", |
98 |
"X-Total-Count": "60", |
| 99 |
}, |
99 |
}, |
| 100 |
}).as("getPageThree"); |
100 |
}).as("getPageThree"); |
| 101 |
// Scroll the dropdown again |
101 |
// Scroll the dropdown again |
|
Lines 193-199
describe("Infinite scroll", () => {
Link Here
|
| 193 |
"X-Base-Total-Count": "20", |
193 |
"X-Base-Total-Count": "20", |
| 194 |
"X-Total-Count": "20", |
194 |
"X-Total-Count": "20", |
| 195 |
}, |
195 |
}, |
| 196 |
}); |
196 |
}).as("getPageOne"); |
| 197 |
|
197 |
|
| 198 |
// Click the button in the toolbar |
198 |
// Click the button in the toolbar |
| 199 |
cy.visit("/cgi-bin/koha/erm/agreements"); |
199 |
cy.visit("/cgi-bin/koha/erm/agreements"); |
|
Lines 201-241
describe("Infinite scroll", () => {
Link Here
|
| 201 |
|
201 |
|
| 202 |
cy.get("#agreement_licenses").contains("Add new license").click(); |
202 |
cy.get("#agreement_licenses").contains("Add new license").click(); |
| 203 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
203 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
|
|
204 |
cy.wait("@getPageOne"); |
| 204 |
cy.get("#license_id_0").find("li").as("options"); |
205 |
cy.get("#license_id_0").find("li").as("options"); |
| 205 |
cy.get("@options").should("have.length", 20); |
206 |
cy.get("@options").should("have.length", 20); |
| 206 |
|
|
|
| 207 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
207 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
| 208 |
statusCode: 200, |
208 |
statusCode: 200, |
| 209 |
body: pageTwo, |
209 |
body: pageTwo, |
| 210 |
headers: { |
210 |
headers: { |
| 211 |
"X-Base-Total-Count": "20", |
211 |
"X-Base-Total-Count": "40", |
| 212 |
"X-Total-Count": "20", |
212 |
"X-Total-Count": "40", |
| 213 |
}, |
213 |
}, |
| 214 |
}).as("getPageTwo"); |
214 |
}).as("getPageTwo"); |
| 215 |
// Scroll the dropdown |
215 |
// Scroll the dropdown |
| 216 |
cy.get(".vs__dropdown-menu").scrollTo("bottom"); |
216 |
cy.get( |
|
|
217 |
"#agreement_license_0 #license_id_0 .vs__dropdown-menu" |
| 218 |
).scrollTo("bottom"); |
| 217 |
cy.wait("@getPageTwo"); |
219 |
cy.wait("@getPageTwo"); |
| 218 |
|
|
|
| 219 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
220 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
| 220 |
statusCode: 200, |
221 |
statusCode: 200, |
| 221 |
body: pageThree, |
222 |
body: pageThree, |
| 222 |
headers: { |
223 |
headers: { |
| 223 |
"X-Base-Total-Count": "20", |
224 |
"X-Base-Total-Count": "60", |
| 224 |
"X-Total-Count": "20", |
225 |
"X-Total-Count": "60", |
| 225 |
}, |
226 |
}, |
| 226 |
}).as("finalPage"); |
227 |
}).as("finalPage"); |
| 227 |
// Scroll the dropdown again |
228 |
// Scroll the dropdown again |
| 228 |
cy.get(".vs__dropdown-menu").scrollTo("bottom"); |
229 |
cy.get( |
|
|
230 |
"#agreement_license_0 #license_id_0 .vs__dropdown-menu" |
| 231 |
).scrollTo("bottom"); |
| 229 |
cy.wait("@finalPage"); |
232 |
cy.wait("@finalPage"); |
| 230 |
|
233 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
|
|
234 |
statusCode: 200, |
| 235 |
body: [ |
| 236 |
{ |
| 237 |
license_id: 50, |
| 238 |
name: "License " + 50, |
| 239 |
description: "A test license", |
| 240 |
type: "local", |
| 241 |
status: "active", |
| 242 |
started_on: dates["today_iso"], |
| 243 |
ended_on: dates["tomorrow_iso"], |
| 244 |
user_roles: [], |
| 245 |
}, |
| 246 |
], |
| 247 |
headers: { |
| 248 |
"X-Base-Total-Count": "20", |
| 249 |
"X-Total-Count": "20", |
| 250 |
}, |
| 251 |
}).as("searchFilter"); |
| 231 |
// Select a license that is not in the first page of results |
252 |
// Select a license that is not in the first page of results |
| 232 |
cy.get("#agreement_license_0 #license_id_0 .vs__search").type( |
253 |
cy.get("#agreement_license_0 #license_id_0 .vs__search").type( |
| 233 |
"License 50{enter}", |
254 |
"License 50", |
|
|
255 |
{ force: true } |
| 256 |
); |
| 257 |
cy.wait([ |
| 258 |
"@searchFilter", |
| 259 |
"@searchFilter", |
| 260 |
"@searchFilter", |
| 261 |
"@searchFilter", |
| 262 |
"@searchFilter", |
| 263 |
"@searchFilter", |
| 264 |
"@searchFilter", |
| 265 |
"@searchFilter", |
| 266 |
"@searchFilter", |
| 267 |
"@searchFilter", |
| 268 |
]); |
| 269 |
cy.get("#agreement_license_0 #license_id_0 .vs__search").type( |
| 270 |
"{enter}", |
| 234 |
{ force: true } |
271 |
{ force: true } |
| 235 |
); |
272 |
); |
| 236 |
cy.get("#agreement_license_0").contains("License 50"); |
273 |
cy.get("#agreement_license_0").contains("License 50"); |
| 237 |
|
274 |
|
| 238 |
// Re-open the dropdown, License 50 will no longer be in the dataset but the label should still show |
275 |
// Re-open the dropdown, License 50 will no longer be in the dataset but the label should still show |
|
|
276 |
// First we will click into the notes field to ensure the dropdown is closed |
| 277 |
cy.get("#license_notes_0").click(); |
| 239 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
278 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
| 240 |
statusCode: 200, |
279 |
statusCode: 200, |
| 241 |
body: pageOne, |
280 |
body: pageOne, |
|
Lines 246-258
describe("Infinite scroll", () => {
Link Here
|
| 246 |
}).as("resetDropdown"); |
285 |
}).as("resetDropdown"); |
| 247 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
286 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
| 248 |
cy.wait("@resetDropdown"); |
287 |
cy.wait("@resetDropdown"); |
| 249 |
cy.get("#agreement_licenses").click(); |
288 |
// Close the dropdown |
|
|
289 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
| 290 |
cy.get("#license_notes_0").click(); |
| 250 |
cy.get("#agreement_license_0").contains("License 50"); |
291 |
cy.get("#agreement_license_0").contains("License 50"); |
| 251 |
|
292 |
|
| 252 |
// Select a different license |
293 |
// Select a different license |
|
|
294 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
| 295 |
statusCode: 200, |
| 296 |
body: [ |
| 297 |
{ |
| 298 |
license_id: 10, |
| 299 |
name: "License " + 10, |
| 300 |
description: "A test license", |
| 301 |
type: "local", |
| 302 |
status: "active", |
| 303 |
started_on: dates["today_iso"], |
| 304 |
ended_on: dates["tomorrow_iso"], |
| 305 |
user_roles: [], |
| 306 |
}, |
| 307 |
], |
| 308 |
headers: { |
| 309 |
"X-Base-Total-Count": "20", |
| 310 |
"X-Total-Count": "20", |
| 311 |
}, |
| 312 |
}).as("secondSearchFilter"); |
| 253 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
313 |
cy.get("#license_id_0 .vs__open-indicator").click(); |
| 254 |
cy.get("#agreement_license_0 #license_id_0 .vs__search").type( |
314 |
cy.get("#agreement_license_0 #license_id_0 .vs__search").type( |
| 255 |
"License 10{enter}", |
315 |
"License 10", |
|
|
316 |
{ force: true } |
| 317 |
); |
| 318 |
cy.wait([ |
| 319 |
"@secondSearchFilter", |
| 320 |
"@secondSearchFilter", |
| 321 |
"@secondSearchFilter", |
| 322 |
"@secondSearchFilter", |
| 323 |
"@secondSearchFilter", |
| 324 |
"@secondSearchFilter", |
| 325 |
"@secondSearchFilter", |
| 326 |
"@secondSearchFilter", |
| 327 |
"@secondSearchFilter", |
| 328 |
"@secondSearchFilter", |
| 329 |
]); |
| 330 |
cy.get("#agreement_license_0 #license_id_0 .vs__search").type( |
| 331 |
"{enter}", |
| 256 |
{ force: true } |
332 |
{ force: true } |
| 257 |
); |
333 |
); |
| 258 |
cy.get("#agreement_license_0").contains("License 10"); |
334 |
cy.get("#agreement_license_0").contains("License 10"); |
| 259 |
- |
|
|