Skip to content

Commit

Permalink
Intercept calls before loading the page in fee list test
Browse files Browse the repository at this point in the history
Otherwise it doesn't properly get interrupted.
  • Loading branch information
Adamik10 committed Apr 23, 2024
1 parent 03c7f9d commit d9a4bc0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/apps/fee-list/fee-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ describe("Fee list", () => {
cy.intercept("GET", "**/v1/user/**", {
statusCode: 200,
body: digitalLoansData
}).as("digital loans");
}).as("digital_loans");
});

it("Fee list basics (physical loans)", () => {
cy.visit("/iframe.html?path=/story/apps-fee-list--fee-list-entry");
cy.wait(["@fees"]);
cy.wait(["@digital loans"]);
});
cy.wait(["@digital_loans"]);

it("Fee list basics (physical loans)", () => {
// Wait for element not in skeleton screen to prevent testing prematurely.
cy.get(".status-label").should("be.visible");

Expand Down Expand Up @@ -182,21 +182,25 @@ describe("Fee list", () => {
});

it("Should show a warning bar if user has overdue loans", () => {
cy.intercept("GET", "**/external/agencyid/patrons/patronid/loans/v2**", {
cy.intercept("GET", "**/external/agencyid/patrons/patronid/loans/v2", {
statusCode: 200,
body: physicalLoansDataWithOverdue
}).as("physical loans with overdue");
cy.visit("/iframe.html?path=/story/apps-fee-list--fee-list-entry");
cy.wait(["@digital_loans"]);
cy.wait(["@physical loans with overdue"]);

cy.getBySel("warning-bar").should("be.visible");
});

it("Shouldn't render warning bar if user has no overdue loans", () => {
cy.intercept("GET", "**/external/agencyid/patrons/patronid/loans/v2**", {
cy.intercept("GET", "**/external/agencyid/patrons/patronid/loans/v2", {
statusCode: 200,
body: physicalLoansDataNoOverdue
}).as("physical loans no overdue");
cy.wait(["@physical loans no overdue"]);
}).as("physical_loans_no_overdue");
cy.visit("/iframe.html?path=/story/apps-fee-list--fee-list-entry");
cy.wait(["@digital_loans"]);
cy.wait(["@physical_loans_no_overdue"]);

cy.getBySel("warning-bar").should("be.visible");
});
Expand Down

0 comments on commit d9a4bc0

Please sign in to comment.