diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/project_group_test.cy.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/project_group_test.cy.js new file mode 100644 index 000000000..bafc16fd8 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/project_group_test.cy.js @@ -0,0 +1,83 @@ +import projectTaskList from "../../pages/projectTaskList"; +import { decisionPage } from '../../pages/decisionPage'; +import { Logger } from '../../support/logger'; + +describe('Groups Tests', () => { + + let projectId; + + 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' + ); + + + }); +}); + + +describe('Group Creation Tests', () => { + + let groupId; + + beforeEach(() => { + Logger.log("Visit the homepage before each test"); + projectTaskList.getHomePage(); + }); + + it('Creating a new group and linking schools to an existing trust', () => { + Logger.log("Go to the Groups page"); + cy.visit(`${Cypress.env('url')}/groups/project-list`); + projectTaskList.clickGroupsLink(); + + Logger.log("Click on create new group"); + projectTaskList.clickCreateNewGroupBtn(); + + Logger.log("Click on create a group"); + projectTaskList.clickCreateGroupBtn(); + + Logger.log("Entering the trust details for the group to join"); + cy.get('.autocomplete__wrapper > #SearchQuery').type('Greater Manchester Academies Trust (10058252)') + cy.get('.autocomplete__wrapper > #SearchQuery').type('{enter}') + + Logger.log("check urn") + projectTaskList.checkURNAndContinue('10058252'); + + Logger.log("Select conversion") + projectTaskList.selectConversion(); + + Logger.log("click continue"); + projectTaskList.clickContinue(); + + Logger.log("remove the school from the group"); + projectTaskList.removeSchoolFromGroup(); + + Logger.log("delete the group"); + projectTaskList.deleteGroup(); + + }); +}); + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js index ee0dd1ba6..1ff736cfc 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js @@ -1,5 +1,6 @@ /// + import BasePage from "./BasePage" export default class ProjectTaskList extends BasePage { @@ -26,53 +27,62 @@ export default class ProjectTaskList extends BasePage { createNewConversionButton: '[data-cy="create_new_conversion_btn"]', recordDecisionButton: '[data-cy="record_decision_btn"]', schoolName: '[data-cy="school-name"]', - urn: '[data-cy="urn"]' - } - - static path = 'task-list' + urn: '[data-cy="urn"]', + groupsLink: '.dfe-header__navigation-link[href*="/groups/project-list"]', // Selector for Groups link in the navigation menu + createNewGroupButton: 'a.govuk-button[href*="/groups/create-a-new-group"]', // Selector for Create New Group button + createGroupButton: '[data-cy="create-group-btn"]', // Selector for Create Group button + urnField: '[data-cy="UKPRN"]', + continueButton: '[data-cy="submit-btn"]', + conversionSelection: '[id="available-conversion-\\[0\\]"]', + confirmAndContinue: '[data-cy="select-common-submitbutton"]' + + } + + static taskListPath = 'task-list'; + static groupsProjectListPath = 'groups/project-list'; static selectAssignProject() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.assignProjectButton).click() } static getAssignedUser() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.assignedUser) } static getNotificationMessage() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.notificationMessage) } static selectSchoolOverview() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.schoolOverviewLink).click() } static getSchoolOverviewStatus() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.schoolOverviewStatus) } static selectBudget() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.budgetLink).click() } static getBudgetStatus() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.budgetStatus) } static selectPupilForecast() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.pupilForecastLink).click() } static selectConversionDetails() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.conversionDetailsLink).click() } @@ -81,47 +91,47 @@ export default class ProjectTaskList extends BasePage { } static getConversionDetailsStatus() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.conversionDetailsStatus) } static selectRationale() { - cy.checkPath(this.path) + cy.checkPath(this.pataskListPathth) cy.get(this.selectors.rationaleLink).click() } static getRationaleStatus() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.rationaleStatus) } static selectRisksAndIssues() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.riskAndIssuesLink).click() } static getRisksAndIssuesStatus() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.riskAndIssuesStatus) } static selectLA() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.LALink).click() } static getLAStatus() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) return cy.get(this.selectors.LAStatus) } static selectOfsted() { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.ofstedLink).click() } static selectKeyStage(keyStageNumber) { - cy.checkPath(this.path) + cy.checkPath(this.taskListPath) cy.get(this.selectors.keyStageLink(keyStageNumber)).click() } @@ -140,6 +150,49 @@ export default class ProjectTaskList extends BasePage { cy.get(this.selectors.urn).should('contain', urn); return this; } -} + static clickGroupsLink() { + cy.checkPath(this.groupsProjectListPath); + cy.get(this.selectors.groupsLink).click(); + return this; + } + + static clickCreateNewGroupBtn() { + cy.get(this.selectors.createNewGroupButton).click(); + return this; + } + static clickCreateGroupBtn() { + cy.get(this.selectors.createGroupButton).click(); + return this; + } + + static checkURNAndContinue(expectedURN) { + cy.get(this.selectors.urnField).should('contain', expectedURN); + cy.get(this.selectors.continueButton).click(); + return this; + } + + static selectConversion() { + cy.get(this.selectors.conversionSelection).click(); + cy.get(this.selectors.confirmAndContinue).click(); + return this; + } + + static clickContinue() { + cy.get(this.selectors.continueButton).click(); + return this; + } + + static removeSchoolFromGroup() { + cy.get('[data-cy="remove-link"] > .govuk-link').click(); + cy.get('#remove-conversion-confirmation').click(); + return this; + } + + static deleteGroup() { + cy.get('[data-cy="delete-btn"]').click(); + cy.get('#delete-group-confirmation').click(); + return this; + } +} diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckConversionDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckConversionDetails.cshtml index 00d38b165..b6c921e68 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckConversionDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckConversionDetails.cshtml @@ -53,7 +53,7 @@
URN
-
+
@project.Urn
@@ -92,7 +92,7 @@ - + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckIncomingTrustsDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckIncomingTrustsDetails.cshtml index 7ec7f5049..2e5e5a934 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckIncomingTrustsDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CheckIncomingTrustsDetails.cshtml @@ -33,7 +33,7 @@
UKPRN
-
+
@Model.Trust.Ukprn
@@ -76,7 +76,7 @@ {
- +
} else diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CreateANewGroup.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CreateANewGroup.cshtml index 2f004a7b1..4ab4a609a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CreateANewGroup.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/CreateANewGroup.cshtml @@ -20,7 +20,7 @@
  • exist in Prepare
  • have an incoming trust
  • - + Create a group diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/ProjectGroupIndex.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/ProjectGroupIndex.cshtml index 3a3bd536b..ce653fd30 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/ProjectGroupIndex.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Groups/ProjectGroupIndex.cshtml @@ -114,7 +114,7 @@ @projectRow.Item.SchoolName -
    +
    Remove
    @@ -167,7 +167,7 @@

    There are currently no schools or academies in this group

    Delete this group