|
Line 0
Link Here
|
| 0 |
- |
1 |
describe("opac-readingrecord", () => { |
|
|
2 |
beforeEach(() => { |
| 3 |
let objects_to_cleanup = []; |
| 4 |
cy.task("apiGet", { |
| 5 |
endpoint: "/api/v1/patrons/51", |
| 6 |
}).then(patron => { |
| 7 |
[...Array(51)].forEach(() => { |
| 8 |
cy.task("insertSampleCheckout", { |
| 9 |
patron: patron, |
| 10 |
}).then(objects_checkout => { |
| 11 |
objects_to_cleanup.push(objects_checkout); |
| 12 |
cy.task("query", { |
| 13 |
sql: "INSERT INTO old_issues SELECT * FROM issues WHERE issue_id=?", |
| 14 |
values: [objects_checkout.checkout.checkout_id], |
| 15 |
}); |
| 16 |
cy.task("query", { |
| 17 |
sql: "DELETE FROM issues WHERE issue_id=?", |
| 18 |
values: [objects_checkout.checkout.checkout_id], |
| 19 |
}); |
| 20 |
}); |
| 21 |
}); |
| 22 |
|
| 23 |
cy.wrap(objects_to_cleanup).as("objects_to_cleanup"); |
| 24 |
}); |
| 25 |
|
| 26 |
cy.loginOpac(); |
| 27 |
}); |
| 28 |
|
| 29 |
afterEach(function () { |
| 30 |
cy.task("deleteSampleObjects", [this.objects_to_cleanup]); |
| 31 |
}); |
| 32 |
|
| 33 |
it("50 items should be displayed by default", function () { |
| 34 |
cy.visitOpac("/cgi-bin/koha/opac-readingrecord.pl"); |
| 35 |
|
| 36 |
cy.contains("Showing 1 to 50 of 50 entries"); |
| 37 |
cy.get("table#readingrec tbody tr").should("have.length", 50); |
| 38 |
|
| 39 |
cy.contains("Show all items").click(); |
| 40 |
cy.contains("Showing 1 to 51 of 51 entries"); |
| 41 |
cy.get("table#readingrec tbody tr").should("have.length", 51); |
| 42 |
}); |
| 43 |
}); |