-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |