Bug 41368: Fix ManageMarcImport Cypress test timing issue
Replace the no-op `#job_callback` existence check with a recursive
`cy.wait('@jobPoll')` that loops through each `/api/v1/jobs/*` poll
response (arriving every ~1s) until it sees `status: finished`. This
avoids any fixed timeout — the test proceeds as soon as the API signals
completion, however long that takes on a given machine.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c513dee502)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
parent
fb1fcea011
commit
0af06dc5f3
|
|
@ -68,9 +68,17 @@ describe("loads the manage MARC import page", () => {
|
|||
.select("ignore", { force: true })
|
||||
.should("have.value", "ignore");
|
||||
|
||||
cy.intercept("GET", "/api/v1/jobs/*").as("jobPoll");
|
||||
cy.get("#mainformsubmit").click();
|
||||
|
||||
cy.get("#job_callback").should("exist");
|
||||
const waitForJobFinished = () => {
|
||||
cy.wait("@jobPoll").then(interception => {
|
||||
if (interception.response?.body?.status !== "finished") {
|
||||
waitForJobFinished();
|
||||
}
|
||||
});
|
||||
};
|
||||
waitForJobFinished();
|
||||
|
||||
cy.get("#job_callback").contains("View batch").click();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue