Skip to content

Commit

Permalink
patient pagination test (#8614)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Sep 24, 2024
1 parent 499e918 commit ea57831
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
42 changes: 42 additions & 0 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import PatientHome from "../../pageobject/Patient/PatientHome";

describe("Patient Homepage present functionalities", () => {
const loginPage = new LoginPage();
const patientHome = new PatientHome();

before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/patients");
});

it("Verify the functionality of the patient tab pagination", () => {
let firstPatientPageOne: string;
cy.get('[data-cy="patient"]')
.first()
.invoke("text")
.then((patientOne: string) => {
firstPatientPageOne = patientOne.trim();
patientHome.clickNextPage();
patientHome.verifySecondPageUrl();
cy.get('[data-cy="patient"]')
.first()
.invoke("text")
.then((patientTwo: string) => {
const firstPatientPageTwo = patientTwo.trim();
expect(firstPatientPageOne).not.to.eq(firstPatientPageTwo);
patientHome.clickPreviousPage();
});
});
});

afterEach(() => {
cy.saveLocalStorage();
});
});
14 changes: 14 additions & 0 deletions cypress/pageobject/Patient/PatientHome.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class PatientHome {
clickNextPage() {
cy.get("#next-pages").click();
}

verifySecondPageUrl() {
cy.url().should("include", "/patients?page=2");
}

clickPreviousPage() {
cy.get("#prev-pages").click();
}
}
export default PatientHome;

0 comments on commit ea57831

Please sign in to comment.