|
Lines 233-238
describe("kohaTable (using REST API)", () => {
Link Here
|
| 233 |
}); |
233 |
}); |
| 234 |
}); |
234 |
}); |
| 235 |
}); |
235 |
}); |
|
|
236 |
|
| 237 |
it("Shareable link", { scrollBehavior: false }, () => { |
| 238 |
build_libraries().then(() => { |
| 239 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 240 |
|
| 241 |
mock_table_settings({ |
| 242 |
default_save_state: 1, |
| 243 |
columns: { library_code: { is_hidden: 1 } }, |
| 244 |
}); |
| 245 |
|
| 246 |
cy.get("@columns").then(columns => { |
| 247 |
// Code is not shown |
| 248 |
cy.get(`#${table_id} th`).should( |
| 249 |
"have.length", |
| 250 |
columns.length - 1 |
| 251 |
); |
| 252 |
cy.get(`#${table_id} th`).contains("Name"); |
| 253 |
cy.get(`#${table_id} th`) |
| 254 |
.contains("Code") |
| 255 |
.should("not.exist"); |
| 256 |
cy.get(`#${table_id}_wrapper .buttons-colvis`).click(); |
| 257 |
// Show Code |
| 258 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 259 |
.contains("Code") |
| 260 |
.click(); |
| 261 |
cy.get(`#${table_id} th`).should( |
| 262 |
"have.length", |
| 263 |
columns.length |
| 264 |
); |
| 265 |
cy.get(`#${table_id} th`).contains("Name"); |
| 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 |
|
| 272 |
// Copy the shareable link (Name and Code shown) |
| 273 |
cy.get( |
| 274 |
`#${table_id}_wrapper .copyConditions_controls` |
| 275 |
).click({ force: true }); |
| 276 |
cy.get(".tooltip").contains("Copied!"); |
| 277 |
}); |
| 278 |
|
| 279 |
cy.window().then(win => { |
| 280 |
// Retrieve the content of the clipboard |
| 281 |
win.navigator.clipboard.readText().then(url => { |
| 282 |
expect(url).to.match( |
| 283 |
/branches.pl\?DataTables_admin_libraries_libraries_state=/ |
| 284 |
); |
| 285 |
|
| 286 |
// Remove localStorage |
| 287 |
win.localStorage.clear(); |
| 288 |
|
| 289 |
// Use it |
| 290 |
cy.visit(url); |
| 291 |
|
| 292 |
// Code is shown whereas it is hidden in the config |
| 293 |
cy.get("@columns").then(columns => { |
| 294 |
cy.get(`#${table_id} th`).should( |
| 295 |
"have.length", |
| 296 |
columns.length |
| 297 |
); |
| 298 |
cy.get(`#${table_id} th`).contains("Name"); |
| 299 |
cy.get(`#${table_id} th`).contains("Code"); |
| 300 |
|
| 301 |
// Hide "Name" |
| 302 |
cy.get( |
| 303 |
`#${table_id}_wrapper .buttons-colvis` |
| 304 |
).click(); |
| 305 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 306 |
.contains("Name") |
| 307 |
.click(); |
| 308 |
}); |
| 309 |
|
| 310 |
// Go to the shareable link |
| 311 |
// but do not remove localStorage! |
| 312 |
cy.visit(url); |
| 313 |
|
| 314 |
// Name is hidden and Code is shown |
| 315 |
cy.get("@columns").then(columns => { |
| 316 |
cy.get(`#${table_id} th`).should( |
| 317 |
"have.length", |
| 318 |
columns.length |
| 319 |
); |
| 320 |
|
| 321 |
cy.get(`#${table_id} th`).contains("Name"); |
| 322 |
cy.get(`#${table_id} th`).contains("Code"); |
| 323 |
}); |
| 324 |
}); |
| 325 |
}); |
| 326 |
}); |
| 327 |
}); |
| 236 |
}); |
328 |
}); |
| 237 |
|
329 |
|
| 238 |
describe("Patrons search", () => { |
330 |
describe("Patrons search", () => { |
| 239 |
- |
|
|