Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Flaky Cypress Test in the User_Manage File #6583

Merged
merged 6 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/shifting_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Shifting section filter", () => {
shiftingPage.filterByFacility(
"Dummy Shifting",
"Dummy Shifting",
"District Admin"
"District"
);

shiftingPage.facilityAssignedBadge().should("exist");
Expand Down
11 changes: 11 additions & 0 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { UserPage } from "../../pageobject/Users/UserSearch";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import { UserCreationPage } from "../../pageobject/Users/UserCreation";

describe("Manage User", () => {
const loginPage = new LoginPage();
Expand All @@ -11,6 +12,7 @@ describe("Manage User", () => {
const usernametolinkfacilitydoc2 = "dummydoctor5";
const usernametolinkfacilitydoc3 = "dummydoctor6";
const usernametolinkskill = "devdoctor";
const userCreationPage = new UserCreationPage();
const usernameforworkinghour = "devdistrictadmin";
const usernamerealname = "Dummy Doctor";
const facilitytolinkusername = "Dummy Shifting Center";
Expand All @@ -37,7 +39,16 @@ describe("Manage User", () => {
manageUserPage.selectFacilityFromDropdown(linkedskill);
manageUserPage.clickAddSkillButton();
manageUserPage.clickCloseSlideOver();
cy.wait(5000);
manageUserPage.clicklinkedskillbutton();
manageUserPage.assertSkillInAddedUserSkills(linkedskill);
manageUserPage.clickCloseSlideOver();
cy.wait(5000);
manageUserPage.navigateToProfile();
userCreationPage.verifyElementContainsText(
"username-profile-details",
usernameforworkinghour
);
manageUserPage.assertSkillInAlreadyLinkedSkills(linkedskill);
});

Expand Down
2 changes: 2 additions & 0 deletions cypress/pageobject/Users/ManageUserPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export class ManageUserPage {
}

navigateToProfile() {
cy.intercept("GET", "**/api/v1/users/**").as("getUsers");
cy.get("#profilenamelink").click();
cy.wait("@getUsers").its("response.statusCode").should("eq", 200);
}

verifyWorkingHours(expectedHours: string) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.14",
"cypress": "^13.1.0",
"cypress": "^13.5.0",
"cypress-localstorage-commands": "^2.2.3",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
Expand Down
Loading