Skip to content

Commit

Permalink
Cypress refactor added DAO revoke fix and deleted end point
Browse files Browse the repository at this point in the history
  • Loading branch information
FahadDarw committed Jun 21, 2024
1 parent 8355eae commit 8138acc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,33 @@ describe('Decisions Tests', () => {
Logger.log("Search for the created project then select first one on the list");
decisionPage.clickOnFirstProject();

Logger.log("Capture the projectId dynamically from the URL");
cy.url().then((url) => {
Logger.log("Capture the projectId dynamically from the URL");
cy.url().then((url) => {
projectId = url.match(/task-list\/(\d+)/)[1];
Logger.log(`Project ID: ${projectId}`);
});

Logger.log("Click on record a decision menubar button");
decisionPage.clickRecordDecisionMenu();

Logger.log("Click on record a decision button");
decisionPage.clickRecordDecision();

Logger.log("Record the decision with the necessary details");
decisionPage.makeDecision("approved")
.decsionMaker("grade6")
.enterDecisionMakerName('Fahad Darwish')
.selectNoConditions()
.enterDecisionDate('12', '12', '2023')
.verifyDecisionDetails('Approved', 'Grade 6', 'Fahad Darwish', 'No', '12 December 2023');

Logger.log("Verify that decision was recoded successfully then change the decision details, verify the changes");
decisionPage.changeDecisionDetails();

Logger.log("Change the current decision to DAO (Directive Academy Order) revoked and verify the changes");
decisionPage.changeDecisionDAODetails();

Logger.log("Delete the project and verify that it was deleted successfully");
decisionPage.deleteProject(projectId);
}).then(() => {
Logger.log("Click on record a decision menubar button");
decisionPage.clickRecordDecisionMenu();


Logger.log("Click on record a decision button");
decisionPage.clickRecordDecision();

Logger.log("Record the decision with the necessary details");
decisionPage.makeDecision("approved")
.decsionMaker("grade6")
.selectNoConditions()
.enterDecisionMakerName('Fahad Darwish')
.enterDecisionDate('12', '12', '2023')
.verifyDecisionDetails('Approved', 'Grade 6', 'Fahad Darwish', 'No', '12 December 2023');

Logger.log("Verify that decision was recorded successfully then change the decision details, verify the changes");
decisionPage.changeDecisionDetails();

Logger.log("Change the current decision to DAO (Directive Academy Order) revoked and verify the changes");
decisionPage.changeDecisionDAODetails();

Logger.log("Delete the project and verify that it was deleted successfully - Project ID: " + projectId);
decisionPage.deleteProject(projectId);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ export class DecisionPage {
cy.get('#submit-btn').click();
cy.get('#directorgeneral-radio').click();
cy.get('#submit-btn').click();
//decision maker name will stay as name Fahad Darwish then click continue
cy.get('#submit-btn').click();
cy.get('#declined-reasons-finance').click();
cy.get('#reason-finance').type('Fahads Cypress Reason is Finance');
cy.get('#submit-btn').click();
//decision maker name will stay as name Fahad Darwish then click continue
cy.get('#submit-btn').click();

//change the date to 12th November 2023
cy.get('#decision-date-day').clear();
Expand All @@ -142,19 +143,24 @@ export class DecisionPage {
cy.get('#submit-btn').click();
cy.get('#submit-btn').click();
cy.get('#submit-btn').click();
cy.get('#MinisterApproval').click();
cy.get('#LetterSent').click();
cy.get('#LetterSaved').click();
cy.get('#submit-btn').click();
cy.get('#schoolclosedorclosing-checkbox').click();
cy.get('#schoolclosedorclosing-txtarea').type('Cypress Test Fahad - Reason school is closing');
cy.get('#submit-btn').click();
cy.get('#decision-maker-name').clear();
cy.get('#decision-maker-name').type('Fahad Darwish');
cy.get('#submit-btn').click();
cy.get('#submit-btn').click();
this.verifyDecisionDetailsAfterChanging('DAO', 'Director General', '12 November 2023');
this.verifyDecisionDetailsAfterChanging('DAO', 'Minister', '12 November 2023');
return this;
}
deleteProject(projectId) {
const deleteUrl = `http://s184d01-acacdnendpoint-ata0dwfremepeff8.z01.azurefd.net/conversion-project/${projectId}/Delete`;
cy.request('DELETE', deleteUrl).then((response) => {
expect(response.status).to.eq(200); // Verify the response status
cy.callAcademisationApi("DELETE", `/conversion-project/${projectId}/Delete`).then((response) => {
expect(response.status).to.eq(200);
});
return this;
}
}

Expand Down

0 comments on commit 8138acc

Please sign in to comment.