Skip to content

Commit

Permalink
Fix Blazor configuration and startup issues in functional tests for A…
Browse files Browse the repository at this point in the history
…B#16875 (#6392)

* Fix configuration error for AB#16875.

* Fix assertions on empty check for AB#16875.
  • Loading branch information
BrianMaki authored Dec 24, 2024
1 parent f3f862f commit a8a269d
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@ function setupGetUserAccessAlias() {
cy.intercept("GET", "**/BetaFeature/UserAccess*").as("getUserAccess");
}

function setupPutUserAccessAlias() {
cy.intercept("PUT", "**/UserAccess").as("putUserAccess");
}

function waitForGetUserAccess() {
cy.wait("@getUserAccess", { timeout: defaultTimeout });
}

function waitForPutUserAccess() {
cy.wait("@putUserAccess", { timeout: defaultTimeout });
}

describe("Beta feature access", () => {
beforeEach(() => {
cy.login(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const dependentExceedingAgeCutoff = { phn: "9735353315" };
const defaultTimeout = 60000;

function performSearch(phn) {
cy.intercept("GET", "**/Delegation/").as("getDelegation");
cy.intercept("GET", "**/Delegation*").as("getDelegation");
cy.get("[data-testid=query-input]").clear().type(phn);
cy.get("[data-testid=search-button]").click();
cy.wait("@getDelegation", { timeout: defaultTimeout });
Expand All @@ -31,10 +31,17 @@ describe("Delegation Search", () => {
getTableRows("[data-testid=dependent-table]")
.should("have.length", 1)
.within((_$rows) => {
cy.get("[data-testid=dependent-name]").should("not.be.empty");
cy.get("[data-testid=dependent-dob]").should("not.be.empty");
cy.get("[data-testid=dependent-name]").should(
"not.have.text",
""
);
cy.get("[data-testid=dependent-dob]").should(
"not.have.text",
""
);
cy.get("[data-testid=dependent-address]").should(
"not.be.empty"
"not.have.text",
""
);
cy.get("[data-testid=dependent-protected-switch]").should(
"not.be.checked"
Expand All @@ -50,10 +57,17 @@ describe("Delegation Search", () => {
getTableRows("[data-testid=dependent-table]")
.should("have.length", 1)
.within((_$rows) => {
cy.get("[data-testid=dependent-name]").should("not.be.empty");
cy.get("[data-testid=dependent-dob]").should("not.be.empty");
cy.get("[data-testid=dependent-name]").should(
"not.have.text",
""
);
cy.get("[data-testid=dependent-dob]").should(
"not.have.text",
""
);
cy.get("[data-testid=dependent-address]").should(
"not.be.empty"
"not.have.text",
""
);
cy.get("[data-testid=dependent-protected-switch]").should(
"not.be.checked"
Expand All @@ -67,16 +81,19 @@ describe("Delegation Search", () => {
.eq(0)
.within((_$row) => {
cy.get("[data-testid=delegate-name]").should(
"not.be.empty"
"not.have.text",
""
);
cy.get("[data-testid=delegate-phn]").contains(
dependentWithGuardian.guardianPhn
);
cy.get("[data-testid=delegate-dob]").should(
"not.be.empty"
"not.have.text",
""
);
cy.get("[data-testid=delegate-address]").should(
"not.be.empty"
"not.have.text",
""
);
cy.get("[data-testid=delegate-status]").contains(
"Added"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ describe("Delegation Protect", () => {
cy.get("[data-testid=save-button]").click();

// Protect reason input is empty
cy.get("[data-testid=audit-reason-input]").should("be.empty");
cy.get("[data-testid=audit-reason-input]")
.should("exist")
.should("be.visible")
.should("have.value", "");

// Cancel confirmation dialog
cy.get("[data-testid=audit-cancel-button]").click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ describe("Patient details page as admin user", () => {
cy.get("[data-testid=dependent-dob]").contains("2005-01-01");
cy.get("[data-testid=dependent-phn]").contains("9874307215");
cy.get("[data-testid=dependent-address]").should(
"not.be.empty"
"not.have.text",
""
);
cy.get("[data-testid=dependent-expiry-date]")
.invoke("text")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ describe("Support", () => {
verifySupportTableResults(hdid, phn, 2);
cy.get("[data-testid=clear-btn]").click();
cy.get("[data-testid=query-type-select]").should("have.value", "Sms");
cy.get("[data-testid=query-input]").should("be.empty");
cy.get("[data-testid=query-input]")
.should("exist")
.should("be.visible")
.should("have.value", "");
cy.get("[data-testid=user-table]").should("not.exist");
});
});
15 changes: 15 additions & 0 deletions Apps/Admin/Tests/Functional/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Cypress.Commands.add("login", (username, password, path) => {
cy.log(`Visiting ${path}`);
setupStandardAliases(path);

cy.disableServiceWorker();

cy.visit(path, { timeout: 60000 });
waitForInitialDataLoad(path);

Expand Down Expand Up @@ -145,3 +147,16 @@ Cypress.Commands.add("validateTableLoad", (tableSelector) => {
.find(".mud-table-loading-progress")
.should("not.exist");
});

Cypress.Commands.add("disableServiceWorker", () => {
cy.log("Unregistering ServiceWorker.");
cy.window().then((win) => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.getRegistrations().then((registrations) => {
registrations.forEach((registration) => {
registration.unregister();
});
});
}
});
});
4 changes: 2 additions & 2 deletions Tools/Pipelines/pipelines/FunctionalTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- "Admin_Seed"
- "Admin_Authentication_Tests"
strategy:
parallel: 3
parallel: 9
timeoutInMinutes: 15
steps:
- task: Bash@3
Expand All @@ -120,7 +120,7 @@ jobs:
- "Admin_Seed"
- "Admin_Read_Tests"
strategy:
parallel: 3
parallel: 5
timeoutInMinutes: 15
steps:
- task: Bash@3
Expand Down

0 comments on commit a8a269d

Please sign in to comment.