diff --git a/cypress/e2e/users_spec/user_crud.cy.ts b/cypress/e2e/users_spec/user_crud.cy.ts index dbe19485359..91104af518f 100644 --- a/cypress/e2e/users_spec/user_crud.cy.ts +++ b/cypress/e2e/users_spec/user_crud.cy.ts @@ -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(); }); diff --git a/cypress/e2e/users_spec/user_homepage.cy.ts b/cypress/e2e/users_spec/user_homepage.cy.ts index c8100f7d83d..060132105e6 100644 --- a/cypress/e2e/users_spec/user_homepage.cy.ts +++ b/cypress/e2e/users_spec/user_homepage.cy.ts @@ -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(); }); diff --git a/cypress/pageobject/Users/UserSearch.ts b/cypress/pageobject/Users/UserSearch.ts index 681144b742e..6be0603be43 100644 --- a/cypress/pageobject/Users/UserSearch.ts +++ b/cypress/pageobject/Users/UserSearch.ts @@ -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}`); + } }