Bug 40345: Use then to prevent async issues
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 022cbe9e67)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
5989073a1e
commit
7f19ee1cbb
|
|
@ -1,35 +1,43 @@
|
|||
describe("opac-readingrecord", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginOpac();
|
||||
let objects_to_cleanup = [];
|
||||
cy.task("apiGet", {
|
||||
endpoint: "/api/v1/patrons/51",
|
||||
}).then(patron => {
|
||||
[...Array(51)].forEach(() => {
|
||||
cy.task("insertSampleCheckout", {
|
||||
patron: patron,
|
||||
}).then(objects_checkout => {
|
||||
cy.task("query", {
|
||||
sql: "INSERT INTO old_issues SELECT * FROM issues WHERE issue_id=?",
|
||||
values: [objects_checkout.checkout.checkout_id],
|
||||
})
|
||||
.then(patron => {
|
||||
[...Array(51)].forEach(() => {
|
||||
cy.task("insertSampleCheckout", {
|
||||
patron: patron,
|
||||
}).then(objects_checkout => {
|
||||
cy.task("query", {
|
||||
sql: "INSERT INTO old_issues SELECT * FROM issues WHERE issue_id=?",
|
||||
values: [objects_checkout.checkout.checkout_id],
|
||||
})
|
||||
.then(() => {
|
||||
cy.task("query", {
|
||||
sql: "DELETE FROM issues WHERE issue_id=?",
|
||||
values: [
|
||||
objects_checkout.checkout.checkout_id,
|
||||
],
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
objects_checkout.old_checkout =
|
||||
objects_checkout.checkout;
|
||||
delete objects_checkout.checkout;
|
||||
objects_to_cleanup.push(objects_checkout);
|
||||
});
|
||||
});
|
||||
cy.task("query", {
|
||||
sql: "DELETE FROM issues WHERE issue_id=?",
|
||||
values: [objects_checkout.checkout.checkout_id],
|
||||
});
|
||||
objects_checkout.old_checkout = objects_checkout.checkout;
|
||||
delete objects_checkout.checkout;
|
||||
objects_to_cleanup.push(objects_checkout);
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
cy.wrap(objects_to_cleanup).as("objects_to_cleanup");
|
||||
});
|
||||
|
||||
cy.wrap(objects_to_cleanup).as("objects_to_cleanup");
|
||||
});
|
||||
|
||||
cy.loginOpac();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
cy.task("deleteSampleObjects", [this.objects_to_cleanup]);
|
||||
cy.task("deleteSampleObjects", this.objects_to_cleanup);
|
||||
});
|
||||
|
||||
it("50 items should be displayed by default", function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue