From d1d863ea795d203089e85245075e1a5fd375b607 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:24:34 +0530 Subject: [PATCH] Existing Cypress POM Conversion | Page Navigation | User Tab (#6511) * cypress new test for advance filter * convert navigation to POM * Delete package-lock.json --- cypress/e2e/users_spec/user_crud.cy.ts | 8 -------- cypress/e2e/users_spec/user_homepage.cy.ts | 7 +++++++ cypress/pageobject/Users/UserSearch.ts | 12 ++++++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) 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}`); + } }