Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project group cypress tests #1170

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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();

});
});

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types ='Cypress'/>


import BasePage from "./BasePage"

export default class ProjectTaskList extends BasePage {
Expand All @@ -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()
}

Expand All @@ -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()
}

Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<dt class="govuk-summary-list__key">
URN
</dt>
<dd class="govuk-summary-list__value">
<dd class="govuk-summary-list__value" data-cy="UKPRN">
@project.Urn
</dd>
</div>
Expand Down Expand Up @@ -92,7 +92,7 @@
<input type="hidden" asp-for="Ukprn" value="@Model.Ukprn"/>
<input type="hidden" asp-for="GroupId" value="@Model.GroupId" />
<input type="hidden" asp-for="ConversionProjects" value="@Model.ConversionProjects"/>
<button class="govuk-button" type="submit" data-id="submit">Confirm and continue</button>
<button class="govuk-button" type="submit" data-id="submit" data-cy="submit-btn" >Confirm and continue</button>
</form>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dt class="govuk-summary-list__key">
UKPRN
</dt>
<dd class="govuk-summary-list__value">
<dd class="govuk-summary-list__value" data-cy="UKPRN">
@Model.Trust.Ukprn
</dd>
<dd class="govuk-summary-list__actions">
Expand Down Expand Up @@ -76,7 +76,7 @@
{
<form method="post" data-id="form">
<input type="hidden" asp-for="Ukprn" value="@Model.Trust.Ukprn"/>
<button class="govuk-button" type="submit" data-id="submit">Continue</button>
<button class="govuk-button" type="submit" data-id="submit" data-cy="submit-btn">Continue</button>
</form>
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<li>exist in Prepare</li>
<li>have an incoming trust</li>
</ul>
<a asp-page="@Links.ProjectGroups.WhichTrustWillTheGroupJoin.Page" draggable="false" class="govuk-button" data-module="govuk-button">
<a asp-page="@Links.ProjectGroups.WhichTrustWillTheGroupJoin.Page" data-cy="create-group-btn" draggable="false" class="govuk-button" data-module="govuk-button">
Create a group
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<a id="@("school-name-" + projectRow.Index)" class="govuk-link" asp-page="@link" asp-route-id="@projectRow.Item.Id" asp-route-returnToFormAMatMenu="True">@projectRow.Item.SchoolName</a>
</strong>
</dt>
<dd class="govuk-summary-list__value prepare-text-align-right">
<dd class="govuk-summary-list__value prepare-text-align-right" data-cy="remove-link">
<a class="govuk-link govuk-!-text-align-right" asp-page="@Links.ProjectGroups.ConfirmToRemoveConversion.Page" asp-route-projectGroupId="@Model.Id" asp-route-id="@projectRow.Item.Id" asp-route-urn="@projectRow.Item.SchoolURN" asp-route-schoolName="@projectRow.Item.SchoolName">Remove</a>
</dd>
</div>
Expand Down Expand Up @@ -167,7 +167,7 @@
<p>There are currently no schools or academies in this group</p>
<span class="govuk-!-margin-right-2">
<a class="govuk-link govuk-button pt-3" asp-page="@Links.ProjectGroups.ConfirmToDeleteGroup.Page"
data-cy="tes" asp-route-id="@Model.Id" asp-route-urn="@Model.ProjectGroup.ReferenceNumber"
data-cy="delete-btn" asp-route-id="@Model.Id" asp-route-urn="@Model.ProjectGroup.ReferenceNumber"
asp-route-trustName="@Model.ProjectGroup.TrustName">Delete this group</a>
</span>
</div>
Expand Down
Loading