|
Lines 264-328
describe("kohaTable (using REST API)", () => {
Link Here
|
| 264 |
); |
264 |
); |
| 265 |
cy.get(`#${table_id} th`).contains("Name"); |
265 |
cy.get(`#${table_id} th`).contains("Name"); |
| 266 |
cy.get(`#${table_id} th`).contains("Code"); |
266 |
cy.get(`#${table_id} th`).contains("Code"); |
| 267 |
|
|
|
| 268 |
// Close the 'Columns' list |
| 269 |
cy.get(".dt-button-background").click(); |
| 270 |
cy.get(".dt-button-background").should("not.exist"); |
| 271 |
cy.wait(500); // ensure the animation completes, random failures? |
| 272 |
|
| 273 |
// Copy the shareable link (Name and Code shown) |
| 274 |
cy.window().focus(); |
| 275 |
cy.get( |
| 276 |
`#${table_id}_wrapper .copyConditions_controls` |
| 277 |
).click({ force: true }); |
| 278 |
cy.get(".tooltip").contains("Copied!"); |
| 279 |
}); |
267 |
}); |
| 280 |
|
268 |
|
| 281 |
cy.window().then(win => { |
269 |
cy.window().then(win => { |
| 282 |
// Retrieve the content of the clipboard |
270 |
// Copy the shareable link (Name and Code shown) |
| 283 |
win.navigator.clipboard.readText().then(url => { |
271 |
const url = win.build_url_with_state( |
| 284 |
expect(url).to.match( |
272 |
win.libraries_table.DataTable(), |
| 285 |
/branches.pl\?DataTables_admin_libraries_libraries_state=/ |
273 |
win.table_settings |
|
|
274 |
); |
| 275 |
expect(url).to.match( |
| 276 |
/branches.pl\?DataTables_admin_libraries_libraries_state=/ |
| 277 |
); |
| 278 |
|
| 279 |
// Remove localStorage |
| 280 |
win.localStorage.clear(); |
| 281 |
|
| 282 |
// Use it |
| 283 |
cy.visit(url); |
| 284 |
|
| 285 |
// Code is shown whereas it is hidden in the config |
| 286 |
cy.get("@columns").then(columns => { |
| 287 |
cy.get(`#${table_id} th`).should( |
| 288 |
"have.length", |
| 289 |
columns.length |
| 290 |
); |
| 291 |
cy.get(`#${table_id} th`).contains("Name"); |
| 292 |
cy.get(`#${table_id} th`).contains("Code"); |
| 293 |
|
| 294 |
// Hide "Name" |
| 295 |
cy.get(`#${table_id}_wrapper .buttons-colvis`).click(); |
| 296 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 297 |
.contains("Name") |
| 298 |
.click(); |
| 299 |
}); |
| 300 |
|
| 301 |
// Go to the shareable link |
| 302 |
// but do not remove localStorage! |
| 303 |
cy.visit(url); |
| 304 |
|
| 305 |
// Name is hidden and Code is shown |
| 306 |
cy.get("@columns").then(columns => { |
| 307 |
cy.get(`#${table_id} th`).should( |
| 308 |
"have.length", |
| 309 |
columns.length |
| 286 |
); |
310 |
); |
| 287 |
|
311 |
|
| 288 |
// Remove localStorage |
312 |
cy.get(`#${table_id} th`).contains("Name"); |
| 289 |
win.localStorage.clear(); |
313 |
cy.get(`#${table_id} th`).contains("Code"); |
| 290 |
|
|
|
| 291 |
// Use it |
| 292 |
cy.visit(url); |
| 293 |
|
| 294 |
// Code is shown whereas it is hidden in the config |
| 295 |
cy.get("@columns").then(columns => { |
| 296 |
cy.get(`#${table_id} th`).should( |
| 297 |
"have.length", |
| 298 |
columns.length |
| 299 |
); |
| 300 |
cy.get(`#${table_id} th`).contains("Name"); |
| 301 |
cy.get(`#${table_id} th`).contains("Code"); |
| 302 |
|
| 303 |
// Hide "Name" |
| 304 |
cy.get( |
| 305 |
`#${table_id}_wrapper .buttons-colvis` |
| 306 |
).click(); |
| 307 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 308 |
.contains("Name") |
| 309 |
.click(); |
| 310 |
}); |
| 311 |
|
| 312 |
// Go to the shareable link |
| 313 |
// but do not remove localStorage! |
| 314 |
cy.visit(url); |
| 315 |
|
| 316 |
// Name is hidden and Code is shown |
| 317 |
cy.get("@columns").then(columns => { |
| 318 |
cy.get(`#${table_id} th`).should( |
| 319 |
"have.length", |
| 320 |
columns.length |
| 321 |
); |
| 322 |
|
| 323 |
cy.get(`#${table_id} th`).contains("Name"); |
| 324 |
cy.get(`#${table_id} th`).contains("Code"); |
| 325 |
}); |
| 326 |
}); |
314 |
}); |
| 327 |
}); |
315 |
}); |
| 328 |
}); |
316 |
}); |
| 329 |
- |
|
|