From bd19bcb8a93bb16a44ed2027eb6446a37ffa25e5 Mon Sep 17 00:00:00 2001 From: Jacob John Jeevan <40040905+Jacobjeevan@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:33:31 +0530 Subject: [PATCH] Users Manage Test Fix (#9368) --- cypress/e2e/users_spec/UsersManage.cy.ts | 5 +++-- cypress/pageobject/Users/ManageUserPage.ts | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index 120eb551f57..39075b8b96f 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -34,6 +34,7 @@ describe("Manage User", () => { beforeEach(() => { cy.restoreLocalStorage(); + cy.viewport(1280, 720); cy.clearLocalStorage(/filters--.+/); cy.awaitUrl("/users"); }); @@ -233,7 +234,7 @@ describe("Manage User", () => { cy.wait(500); manageUserPage.verifyLinkedSkillsTabPage(); manageUserPage.selectSkillFromDropdown(linkedskill); - manageUserPage.clickAddSkillButton(); + manageUserPage.clickAddSkillButton(usernameforworkinghour); cy.wait(500); manageUserPage.assertSkillInAddedUserSkills(linkedskill); cy.wait(500); @@ -268,7 +269,7 @@ describe("Manage User", () => { manageUserPage.clickLinkedSkillTab(); manageUserPage.verifyLinkedSkillsTabPage(); manageUserPage.selectSkillFromDropdown(linkedskill); - manageUserPage.clickAddSkillButton(); + manageUserPage.clickAddSkillButton(usernameToLinkSkill); cy.verifyNotification("Skill added successfully"); cy.closeNotification(); manageUserPage.assertSkillInAddedUserSkills(linkedskill); diff --git a/cypress/pageobject/Users/ManageUserPage.ts b/cypress/pageobject/Users/ManageUserPage.ts index f5bbce7e95b..92e2008bfd8 100644 --- a/cypress/pageobject/Users/ManageUserPage.ts +++ b/cypress/pageobject/Users/ManageUserPage.ts @@ -127,6 +127,7 @@ export class ManageUserPage { } clearProfessionalInfo() { + cy.get("input[name='weekly_working_hours']").scrollIntoView(); cy.get("input[name='weekly_working_hours']").click().clear(); cy.get("input[name='video_connect_link']").click().clear(); } @@ -180,6 +181,7 @@ export class ManageUserPage { } typeInWeeklyWorkingHours(hours: string) { + cy.get("input[name='weekly_working_hours']").scrollIntoView(); cy.get("input[name='weekly_working_hours']").click().type(hours); } @@ -191,6 +193,7 @@ export class ManageUserPage { } verifyWorkingHours(expectedHours: string) { + cy.get("input[name='weekly_working_hours']").scrollIntoView(); cy.get("input[name='weekly_working_hours']").should("be.visible"); cy.get("input[name='weekly_working_hours']").should( "have.value", @@ -359,8 +362,8 @@ export class ManageUserPage { cy.get("[data-testid='user-delete-button']").click(); } - clickAddSkillButton() { - cy.intercept("GET", "**/api/v1/skill/**").as("getSkills"); + clickAddSkillButton(username: string) { + cy.intercept("GET", `**/api/v1/users/${username}/skill/**`).as("getSkills"); cy.get("#add-skill-button").click(); cy.wait("@getSkills").its("response.statusCode").should("eq", 200); }