|
Lines 282-285
describe("Institutions", () => {
Link Here
|
| 282 |
//Make sure we return to list after deleting from show |
282 |
//Make sure we return to list after deleting from show |
| 283 |
cy.get("#institutions_list table tbody tr:first"); |
283 |
cy.get("#institutions_list table tbody tr:first"); |
| 284 |
}); |
284 |
}); |
|
|
285 |
|
| 286 |
it("Delete institution with accounts linked", () => { |
| 287 |
let institution = cy.getSIP2Institution(); |
| 288 |
let institutions = [institution]; |
| 289 |
|
| 290 |
// Delete from list |
| 291 |
// Click the 'Delete' button from the list |
| 292 |
cy.intercept("GET", "/api/v1/sip2/institutions*", { |
| 293 |
statusCode: 200, |
| 294 |
body: institutions, |
| 295 |
headers: { |
| 296 |
"X-Base-Total-Count": "1", |
| 297 |
"X-Total-Count": "1", |
| 298 |
}, |
| 299 |
}); |
| 300 |
cy.intercept("GET", "/api/v1/sip2/institutions/*", institution); |
| 301 |
cy.visit("/cgi-bin/koha/sip2/institutions"); |
| 302 |
|
| 303 |
let linked_account_loginid = "my_login"; |
| 304 |
cy.intercept("GET", "/api/v1/sip2/accounts**", [ |
| 305 |
{ login_id: linked_account_loginid }, |
| 306 |
]); |
| 307 |
|
| 308 |
cy.intercept("DELETE", "/api/v1/sip2/institutions/*", { |
| 309 |
statusCode: 204, |
| 310 |
body: null, |
| 311 |
}); |
| 312 |
|
| 313 |
cy.get("#institutions_list table tbody tr:first") |
| 314 |
.contains("Delete") |
| 315 |
.click(); |
| 316 |
cy.get(".confirmation.modal.show .modal-body").contains( |
| 317 |
"It has 1 associated accounts" |
| 318 |
); |
| 319 |
cy.contains(linked_account_loginid); |
| 320 |
|
| 321 |
cy.get(".alert-warning.confirmation h1").contains( |
| 322 |
"remove this institution" |
| 323 |
); |
| 324 |
cy.contains("Yes, delete").click(); |
| 325 |
cy.get("main div[class='alert alert-info']") |
| 326 |
.contains("Institution") |
| 327 |
.contains("deleted"); |
| 328 |
}); |
| 285 |
}); |
329 |
}); |
| 286 |
- |
|
|