forked from ohcnetwork/care_fe
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into issue/9398/search_bar_loses_focus
- Loading branch information
Showing
30 changed files
with
1,227 additions
and
2,162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,21 @@ | ||
import FacilityHome from "pageobject/Facility/FacilityHome"; | ||
import ManageUserPage from "pageobject/Users/ManageUserPage"; | ||
import UserProfilePage from "pageobject/Users/UserProfilePage"; | ||
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers"; | ||
|
||
import FacilityPage from "../../pageobject/Facility/FacilityCreation"; | ||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||
import { ManageUserPage } from "../../pageobject/Users/ManageUserPage"; | ||
import { UserCreationPage } from "../../pageobject/Users/UserCreation"; | ||
import { UserPage } from "../../pageobject/Users/UserSearch"; | ||
import { | ||
generateEmergencyPhoneNumber, | ||
generatePhoneNumber, | ||
} from "../../pageobject/utils/constants"; | ||
import { generatePhoneNumber } from "../../pageobject/utils/constants"; | ||
|
||
describe("User Creation", () => { | ||
const userPage = new UserPage(); | ||
const loginPage = new LoginPage(); | ||
const userProfilePage = new UserProfilePage(); | ||
const manageUserPage = new ManageUserPage(); | ||
const userCreationPage = new UserCreationPage(); | ||
const manageUserPage = new ManageUserPage(); | ||
const facilityPage = new FacilityPage(); | ||
const facilityHome = new FacilityHome(); | ||
const phoneNumber = generatePhoneNumber(); | ||
const emergencyPhoneNumber = generateEmergencyPhoneNumber(); | ||
const fillFacilityName = "Dummy Facility 40"; | ||
const makeId = (length: number) => { | ||
let result = ""; | ||
|
@@ -54,14 +48,6 @@ describe("User Creation", () => { | |
"Please select the local body", | ||
]; | ||
|
||
const EXPECTED_PROFILE_ERROR_MESSAGES = [ | ||
"This field is required", | ||
"This field is required", | ||
"Please enter valid phone number", | ||
]; | ||
const userName = "devdistrictadmin"; | ||
const firstName = "District Editted"; | ||
const lastName = "Cypress"; | ||
const gender = "Male"; | ||
const email = "[email protected]"; | ||
const password = "Test@123"; | ||
|
@@ -74,9 +60,6 @@ describe("User Creation", () => { | |
const district = "Ernakulam"; | ||
const role = "Doctor"; | ||
const homeFacility = "Dummy Shifting Center"; | ||
const weeklyWorkingHrs = "14"; | ||
const dob = "01011998"; | ||
const formattedDob = "01/01/1998"; | ||
const newUserDob = "25081999"; | ||
|
||
before(() => { | ||
|
@@ -90,55 +73,6 @@ describe("User Creation", () => { | |
cy.awaitUrl("/users"); | ||
}); | ||
|
||
it("Update the existing user profile and verify its reflection", () => { | ||
manageUserPage.navigateToProfile(); | ||
cy.verifyContentPresence("#username-profile-details", [userName]); | ||
userProfilePage.clickEditProfileButton(); | ||
userCreationPage.clearFirstName(); | ||
userCreationPage.typeFirstName(firstName); | ||
userCreationPage.clearLastName(); | ||
userCreationPage.typeLastName(lastName); | ||
userProfilePage.selectGender(gender); | ||
userProfilePage.clearPhoneNumber(); | ||
userProfilePage.typePhoneNumber(phoneNumber); | ||
userProfilePage.clearAltPhoneNumber(); | ||
userProfilePage.typeWhatsappNumber(emergencyPhoneNumber); | ||
userProfilePage.clearEmail(); | ||
userProfilePage.typeEmail(email); | ||
userProfilePage.clearWorkingHours(); | ||
userProfilePage.typeWorkingHours(weeklyWorkingHrs); | ||
userProfilePage.typeDateOfBirth(dob); | ||
userProfilePage.interceptUpdateUsers(); | ||
userProfilePage.clickUpdateButton(); | ||
userProfilePage.verifyUpdateUsersResponse(); | ||
cy.verifyContentPresence("#contactno-profile-details", [ | ||
"+91" + phoneNumber, | ||
]); | ||
cy.verifyContentPresence("#whatsapp-profile-details", [ | ||
"+91" + emergencyPhoneNumber, | ||
]); | ||
cy.verifyContentPresence("#firstname-profile-details", [firstName]); | ||
cy.verifyContentPresence("#lastname-profile-details", [lastName]); | ||
cy.verifyContentPresence("#date_of_birth-profile-details", [formattedDob]); | ||
cy.verifyContentPresence("#emailid-profile-details", [email]); | ||
cy.verifyContentPresence("#gender-profile-details", [gender]); | ||
cy.verifyContentPresence("#averageworkinghour-profile-details", [ | ||
weeklyWorkingHrs, | ||
]); | ||
}); | ||
|
||
it("Update the existing user profile Form Mandatory File Error", () => { | ||
manageUserPage.navigateToProfile(); | ||
userProfilePage.clickEditProfileButton(); | ||
userCreationPage.clearFirstName(); | ||
userCreationPage.clearLastName(); | ||
userProfilePage.clearPhoneNumber(); | ||
userProfilePage.clearAltPhoneNumber(); | ||
userProfilePage.clearWorkingHours(); | ||
userProfilePage.clickUpdateButton(); | ||
cy.verifyErrorMessages(EXPECTED_PROFILE_ERROR_MESSAGES); | ||
}); | ||
|
||
it("create new user and verify reflection", () => { | ||
userCreationPage.clickAddUserButton(); | ||
userCreationPage.selectFacility(homeFacility); | ||
|
@@ -147,14 +81,14 @@ describe("User Creation", () => { | |
userCreationPage.typeConfirmPassword(password); | ||
userCreationPage.selectHomeFacility(homeFacility); | ||
userPage.typeInPhoneNumber(phoneNumber); | ||
userProfilePage.typeDateOfBirth(newUserDob); | ||
manageUserPage.editDateOfBirth(newUserDob); | ||
userCreationPage.selectUserType(role); | ||
userProfilePage.typeQualification(qualification); | ||
userProfilePage.typeDoctorYoE(experience); | ||
userProfilePage.typeMedicalCouncilRegistration(regNo); | ||
manageUserPage.editQualification(qualification, false); | ||
manageUserPage.editDoctorYoE(experience, false); | ||
manageUserPage.editMedicalCouncilRegistration(regNo, false); | ||
userPage.typeInFirstName(newUserFirstName); | ||
userPage.typeInLastName(newUserLastName); | ||
userProfilePage.typeEmail(email); | ||
manageUserPage.editEmail(email, false); | ||
userCreationPage.selectGender(gender); | ||
userCreationPage.selectState(state); | ||
userCreationPage.selectDistrict(district); | ||
|
@@ -178,6 +112,7 @@ describe("User Creation", () => { | |
}); | ||
|
||
it("view user redirection from facility page", () => { | ||
loginPage.ensureLoggedIn(); | ||
facilityHome.navigateToFacilityHomepage(); | ||
facilityHome.typeFacilitySearch(fillFacilityName); | ||
advanceFilters.verifyFilterBadgePresence( | ||
|
Oops, something went wrong.