Skip to content

Commit

Permalink
Merge pull request #1080 from DFE-Digital/decisions_Cypress_Tests
Browse files Browse the repository at this point in the history
change title log for DAO (Directive Academy Order) revoked - DAOTest
  • Loading branch information
FahadDarw authored Jun 6, 2024
2 parents 4eee932 + dd19445 commit b9a0393
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,60 @@ import projectTaskList from "../../pages/projectTaskList";
import { decisionPage } from '../../pages/decisionPage';
import { Logger } from '../../support/logger'

describe('Decisions Tests', () => {
beforeEach(() => {
Logger.log("Visit the homepage before each test");
projectTaskList.getHomePage();
});

it('Creating a conversion project and recording a new decision then editing the decision', () => {
Logger.log("Go to the home page then click create new conversion");
projectTaskList.clickCreateNewConversionBtn();

describe('Decisions Tests', () => {
beforeEach(() => {
Logger.log("Visit the homepage before each test");
projectTaskList.getHomePage();
});

it('Creating a conversion project and recording a new decision then editting the decision', () => {
Logger.log("Go to the home page then click create new conversion");
projectTaskList.getCreateNewConversion();

Logger.log("Click on create new conversion button on the next page");
projectTaskList.getCreateNewConversion();

Logger.log("Search and select the school, then click continue");
decisionPage.searchSchool('Manchester Academy (134224)').clickContinue();

Logger.log("Select no and continue on the next 3 pages regarding the school");
decisionPage.selectNoAndContinue();
decisionPage.selectNoAndContinue();
decisionPage.selectNoAndContinue();

Logger.log("Verify the selected school details");
decisionPage.assertSchoolDetails(
'Manchester Academy',
'134224',
'Manchester',
'Academy'
);

Logger.log("Click school details are correct, click continue");
decisionPage.clickContinue();

Logger.log("Search for the created project then select first one on the list");
decisionPage.clickOnFirstProject();

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 sucessfully then change the decision details, verify the changes");
decisionPage.changeDecisionDetails();
});
Logger.log("Click on create new conversion button on the next page");
projectTaskList.clickCreateNewConversionBtn();

Logger.log("Search and select the school, then click continue");
decisionPage.searchSchool('Manchester Academy (134224)').clickContinue();

Logger.log("Select no and continue on the next 3 pages regarding the school");
decisionPage.selectNoAndContinue();
decisionPage.selectNoAndContinue();
decisionPage.selectNoAndContinue();

Logger.log("Verify the selected school details");
decisionPage.assertSchoolDetails(
'Manchester Academy',
'134224',
'Manchester',
'Academy'
);

Logger.log("Click school details are correct, click continue");
decisionPage.clickContinue();

Logger.log("Search for the created project then select first one on the list");
decisionPage.clickOnFirstProject();

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()

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class DecisionPage {
cy.get(`#${grade}-radio`).click();
cy.get('#submit-btn').click();
return this;
}
}

enterDecisionMakerName(name) {
cy.get('#decision-maker-name').type(name);
Expand Down Expand Up @@ -131,10 +131,25 @@ export class DecisionPage {
cy.get('#decision-date-year').clear();
cy.get('#decision-date-year').type('2023');
cy.get('#submit-btn').click();

this.verifyDecisionDetailsAfterChanging('Declined', 'Director General', '12 November 2023');
cy.get('#submit-btn').click();
return this;
}
changeDecisionDAODetails() {
cy.get('[data-cy="record_decision_menu"]').click();
cy.get('#record-decision-link').click();
cy.get('#daorevoked-radio').click();
cy.get('#submit-btn').click();
cy.get('#submit-btn').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('#submit-btn').click();
this.verifyDecisionDetailsAfterChanging('DAO', 'Director General', '12 November 2023');
return this;
}
}


export const decisionPage = new DecisionPage();
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default class ProjectTaskList extends BasePage {
cy.get(this.selectors.keyStageLink(keyStageNumber)).click()
}

static getCreateNewConversion() {
static clickCreateNewConversionBtn() {
cy.get(this.selectors.createNewConversionButton).click();
return this;
}
Expand Down

0 comments on commit b9a0393

Please sign in to comment.