coronasafe/care_fe

View on GitHub
cypress/pageObject/Patients/PatientCreation.ts

Summary

Maintainability
D
1 day
Test Coverage

Showing 9 of 9 total issues

PatientCreation has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

export class PatientCreation {
// Selectors
private selectors = {
patientsButton: '[data-cy="patients-button"]',
searchInput: "#patient-search",
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts - About 3 hrs to fix

Function fillPatientDetails has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

fillPatientDetails(data: PatientFormData) {
this.enterName(data.name)
.enterPhoneNumber(data.phoneNumber)
.selectGender(data.gender)
.selectBloodGroup(data.bloodGroup);
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts - About 1 hr to fix

Function fillPatientDetails has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

fillPatientDetails(data: PatientFormData) {
this.enterName(data.name)
.enterPhoneNumber(data.phoneNumber)
.selectGender(data.gender)
.selectBloodGroup(data.bloodGroup);
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts - About 35 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

selectDistrict(district: string) {
cy.get(this.selectors.districtSelect).then(($el) => {
if ($el.val() !== district) {
cy.typeAndSelectOption(this.selectors.districtSelect, district);
}
Severity: Major
Found in cypress/pageObject/Patients/PatientCreation.ts and 1 other location - About 2 hrs to fix
cypress/pageObject/Patients/PatientCreation.ts on lines 226..233

Similar blocks of code found in 2 locations. Consider refactoring.
Open

selectState(state: string) {
cy.get(this.selectors.stateSelect).then(($el) => {
if ($el.val() !== state) {
cy.typeAndSelectOption(this.selectors.stateSelect, state);
}
Severity: Major
Found in cypress/pageObject/Patients/PatientCreation.ts and 1 other location - About 2 hrs to fix
cypress/pageObject/Patients/PatientCreation.ts on lines 235..242

Similar blocks of code found in 2 locations. Consider refactoring.
Open

enterName(name: string, clearBeforeTyping: boolean = false) {
cy.typeIntoField(this.selectors.nameInput, name, { clearBeforeTyping });
return this;
}
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts and 1 other location - About 50 mins to fix
cypress/pageObject/Patients/PatientCreation.ts on lines 130..135

Similar blocks of code found in 2 locations. Consider refactoring.
Open

enterAddress(address: string, clearBeforeTyping: boolean = false) {
cy.typeIntoField(this.selectors.addressInput, address, {
clearBeforeTyping,
});
return this;
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts and 1 other location - About 50 mins to fix
cypress/pageObject/Patients/PatientCreation.ts on lines 88..91

Similar blocks of code found in 2 locations. Consider refactoring.
Open

this.enterName(data.name)
.enterPhoneNumber(data.phoneNumber)
.selectGender(data.gender)
.selectBloodGroup(data.bloodGroup);
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts and 1 other location - About 40 mins to fix
cypress/pageObject/Patients/PatientCreation.ts on lines 175..178

Similar blocks of code found in 2 locations. Consider refactoring.
Open

this.enterPincode(data.pincode)
.selectState(data.state)
.selectDistrict(data.district)
.selectLocalBody(data.localBody)
Severity: Minor
Found in cypress/pageObject/Patients/PatientCreation.ts and 1 other location - About 40 mins to fix
cypress/pageObject/Patients/PatientCreation.ts on lines 143..146
Category
Status