-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
866 additions
and
321 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
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
61 changes: 61 additions & 0 deletions
61
...sions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/decisions_tests.cy.js
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
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(); | ||
|
||
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() | ||
|
||
}); | ||
}); |
155 changes: 155 additions & 0 deletions
155
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/decisionPage.js
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 |
---|---|---|
@@ -0,0 +1,155 @@ | ||
export class DecisionPage { | ||
|
||
|
||
searchSchool(schoolName) { | ||
cy.get('#SearchQuery').type(schoolName); | ||
cy.get('.autocomplete__input--default').first().click(); | ||
return this; | ||
} | ||
|
||
clickContinue() { | ||
cy.get('[data-id="submit"]').click(); | ||
return this; | ||
} | ||
|
||
selectNoAndContinue() { | ||
cy.get('[data-cy="select-legal-input-no"]').click(); | ||
cy.get('[data-cy="select-common-submitbutton"]').click(); | ||
return this; | ||
} | ||
|
||
assertSchoolDetails(schoolName, urn, localAuthority, schoolType) { | ||
cy.get('[data-cy="school-name"]').should('contain', schoolName); | ||
cy.get('.govuk-summary-list__value').eq(1).should('contain', urn); | ||
cy.get('.govuk-summary-list__value').eq(3).should('contain', localAuthority); | ||
cy.get('.govuk-summary-list__value').eq(5).should('contain', schoolType) | ||
return this; | ||
} | ||
|
||
clickOnFirstProject() { | ||
cy.get('[data-cy="select-projectlist-filter-title"]').type('Manchester Academy'); | ||
cy.get('[data-cy="select-projectlist-filter-apply"]').click(); | ||
cy.get('[data-cy="trust-name-Manchester Academy-0"]').click(); | ||
return this; | ||
} | ||
|
||
clickRecordDecisionMenu() { | ||
cy.get('[data-cy="record_decision_menu"]').click(); | ||
return this; | ||
} | ||
|
||
clickRecordDecision() { | ||
cy.get('[data-cy="record_decision_btn"]').click(); | ||
return this; | ||
} | ||
|
||
makeDecision(decision) { | ||
cy.get(`#${decision}-radio`).click(); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
decsionMaker(grade) { | ||
cy.get(`#${grade}-radio`).click(); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
enterDecisionMakerName(name) { | ||
cy.get('#decision-maker-name').type(name); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
selectNoConditions() { | ||
cy.get('#no-radio').click(); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
enterDecisionDate(day, month, year) { | ||
cy.get('#decision-date-day').type(day); | ||
cy.get('#decision-date-month').type(month); | ||
cy.get('#decision-date-year').type(year); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
dateAOWasSent(day, month, year) { | ||
cy.get('#academy-order-date-day').type(day); | ||
cy.get('#academy-order-date-month').type(month); | ||
cy.get('#academy-order-date-year').type(year); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
verifyDecisionDetails(decision, grade, name, conditions, date) { | ||
cy.get('#decision').should('contain', decision); | ||
cy.get('#decision-made-by').eq(0).should('contain', grade); | ||
cy.get('#decision-maker-name').should('contain', name); | ||
cy.get('#condition-set').should('contain', conditions); | ||
cy.get('#decision-date').should('contain', date); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
verifyDecisionDetailsBeforeChanging(decision, name, conditions, date) { | ||
cy.get('#decision').should('contain', decision); | ||
cy.get('#decision-maker-name').should('contain', name); | ||
cy.get('#condition-set').should('contain', conditions); | ||
cy.get('#decision-date').should('contain', date); | ||
return this; | ||
} | ||
|
||
verifyDecisionDetailsAfterChanging(decision, name, date) { | ||
cy.get('#decision').should('contain', decision); | ||
cy.get('#decision-made-by').should('contain', name); | ||
console.log('Date:', date); | ||
cy.get('#decision-date').should('contain', date); | ||
return this; | ||
} | ||
|
||
changeDecisionDetails() { | ||
cy.get('[data-cy="record_decision_menu"]').click(); | ||
this.verifyDecisionDetailsBeforeChanging('Approved', 'Fahad Darwish', 'No', '12 December 2023'); | ||
cy.get('#record-decision-link').click(); | ||
cy.get('#declined-radio').click(); | ||
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(); | ||
|
||
//change the date to 12th November 2023 | ||
cy.get('#decision-date-day').clear(); | ||
cy.get('#decision-date-day').type('12'); | ||
cy.get('#decision-date-month').clear(); | ||
cy.get('#decision-date-month').type('11'); | ||
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(); |
Oops, something went wrong.