Skip to content

Commit

Permalink
Existing Cypress POM Conversion | Page Navigation | User Tab (#6511)
Browse files Browse the repository at this point in the history
* cypress new test for advance filter

* convert navigation to POM

* Delete package-lock.json
  • Loading branch information
nihal467 authored Oct 30, 2023
1 parent c074144 commit d1d863e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
8 changes: 0 additions & 8 deletions cypress/e2e/users_spec/user_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ describe("User management", () => {
.contains("Facility - User Already has permission to this facility");
});

it("Next/Previous Page", () => {
// only works for desktop mode
cy.get("button#next-pages").click();
cy.url().should("include", "page=2");
cy.get("button#prev-pages").click();
cy.url().should("include", "page=1");
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
7 changes: 7 additions & 0 deletions cypress/e2e/users_spec/user_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ describe("User Homepage", () => {
userPage.checkUsernameText(currentuser);
});

it("Next/Previous Page Navigation", () => {
userPage.navigateToNextPage();
userPage.verifyCurrentPageNumber(2);
userPage.navigateToPreviousPage();
userPage.verifyCurrentPageNumber(1);
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
12 changes: 12 additions & 0 deletions cypress/pageobject/Users/UserSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,16 @@ export class UserPage {
verifyDataTestIdNotVisible(testId: string) {
cy.get(`[data-testid="${testId}"]`).should("not.be.visible");
}

navigateToNextPage() {
cy.get("button#next-pages").click();
}

navigateToPreviousPage() {
cy.get("button#prev-pages").click();
}

verifyCurrentPageNumber(pageNumber: number) {
cy.url().should("include", `page=${pageNumber}`);
}
}

0 comments on commit d1d863e

Please sign in to comment.