Skip to content

Commit

Permalink
Merge pull request #883 from DFE-Digital/test/update-smoke-test
Browse files Browse the repository at this point in the history
Updated smoke test for Test env.
  • Loading branch information
sukhybhullar-nimble authored Oct 8, 2024
2 parents bf9e916 + 1bebd85 commit 0654f76
Show file tree
Hide file tree
Showing 2 changed files with 214 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
import { Logger } from "cypress/common/logger";
import { ProjectRecordCreator } from "cypress/constants/cypressConstants";
import dataGenerator from "cypress/fixtures/dataGenerator";
import createProjectPage from "cypress/pages/createProject/createProjectPage";
import homePage from "cypress/pages/homePage";
import summaryPage from "cypress/pages/task-summary-base";

describe("Smoke Test Create an individual Central project - (Up Until Check your answers Page)", () => {
beforeEach(() => {
cy.login({ role: ProjectRecordCreator });
cy.visit('/');
});

it("Should create a central project up until Check your answers page", () => {
const applicationNumber = dataGenerator.generateTemporaryId(10);
const applicationWave = dataGenerator.generateTemporaryId(10);
const temporaryProjectId = dataGenerator.generateTemporaryId(25);
const schoolName = dataGenerator.generateSchoolName();
const TestTrn = "TR00111";

homePage.createNewProjects();

Logger.log("Check method required");
cy.executeAccessibilityTests();

createProjectPage
.selectOption("Central")
.continue();

Logger.log("Enter application number");
createProjectPage
.titleIs("What is the application number?")
.enterApplicationNumber(applicationNumber)
.continue()

Logger.log("Enter application wave ");
createProjectPage
.titleIs("What is the application wave?")
.enterApplicationWave(applicationWave)
.continue()

cy.executeAccessibilityTests();

Logger.log("Enter Valid project ID");
createProjectPage
.enterProjectId(temporaryProjectId)
.continue();

cy.executeAccessibilityTests();
Logger.log("Enter school name");

createProjectPage
.enterSchoolName(schoolName)
.continue();

createProjectPage
.titleIs("What is the region of the school?")
.continue()
.errorMessage("Select the region")

cy.executeAccessibilityTests();

Logger.log("Select East of England");
createProjectPage
.selectOption("East of England")
.continue();

Logger.log("Check local authority required");
createProjectPage
.titleIs("What is the local authority?")
.continue()
.errorMessage("Select the local authority");

cy.executeAccessibilityTests();

Logger.log("Select Local authority");
createProjectPage
.selectOption("Luton")
.continue();

Logger.log("Enter valid trust");
createProjectPage
.enterTRN(TestTrn)
.continue();

Logger.log("Confirm trust validation");
createProjectPage
.titleIs("Confirm the trust")
.continue()
.errorMessage("Select yes if the trust is correct");

cy.executeAccessibilityTests();

Logger.log("Selecting No returns to previous page");
createProjectPage
.selectOption("No")
.continue()
.titleIs("Search for a trust by TRN")
.enterTRN(TestTrn)
.continue();

createProjectPage
.titleIs("Confirm the trust")
.back()
.titleIs("Search for a trust by TRN")
.enterTRN(TestTrn)
.continue();

createProjectPage
.titleIs("Confirm the trust")
.hasCorrectTrustName("Aurora Academies Trust")
.hasCorrectTrustType("MAT (multi-academy trust)")
.selectOption("Yes")
.continue();

Logger.log("Selecting Mainstream school type");
createProjectPage
.selectOption("Mainstream")
.continue();

Logger.log("Set class types");
createProjectPage
.titleIs("Will it have any of these provisions?")
.setNurseryTo("Yes")
.setSixthFormTo("Yes")
.setResidentialOrBoarding("Yes")
.setAlternativeProvisionTo("Yes")
.setSpecialEducationNeedsTo("No")
.setResidentialOrBoarding("Yes")
.continue();

Logger.log("Selecting Secondary school phase");
createProjectPage
.titleIs("What is the school phase?")
.selectOption("Secondary")
.continue();

//enter valid age-range values
createProjectPage
.enterAgeRangeFrom("2")
.enterAgeRangeTo("7")
.continue();

Logger.log("Enter valid capacity");
createProjectPage
.enterNurseryCapacity("200")
.enterReceptionToYear6("0")
.enterYear7ToYear11("400")
.enterYear12ToYear14("150")
.continue();

Logger.log("Select Designation");
createProjectPage
.selectOption("Designation")
.continue();

cy.executeAccessibilityTests();

Logger.log("Select Greek Orthodox");
createProjectPage
.selectOption("Greek Orthodox")
.continue()

Logger.log("Enter valid provisional opening date");
createProjectPage
.setProvisionalOpeningDate("1", "10", "2035")
.continue();
cy.executeAccessibilityTests();

Logger.log("Set email");
createProjectPage
.enterProjectAssignedToName("joe bloggs")
.enterProjectAssignedToEmail("[email protected]")
.continue();

Logger.log("Check answers");
summaryPage.inOrder()
.summaryShows("Project type").HasValue("Central").HasChangeLink()
.summaryShows("Application number").HasValue(applicationNumber).HasChangeLink()
.summaryShows("Application wave").HasValue(applicationWave).HasChangeLink()
.summaryShows("Temporary Project ID").HasValue(temporaryProjectId).HasChangeLink()
.summaryShows("Current free school name").HasValue(schoolName).HasChangeLink()
.summaryShows("Region").HasValue("East of England").HasChangeLink()
.summaryShows("Local authority").HasValue("Luton").HasChangeLink()
.summaryShows("Trust").HasValue("Aurora Academies Trust").HasChangeLink()
.summaryShows("School type").HasValue("Mainstream").HasChangeLink()
.summaryShows("Nursery").HasValue("Yes").HasChangeLink()
.summaryShows("Sixth form").HasValue("Yes").HasChangeLink()
.summaryShows("Residential or boarding").HasValue("Yes").HasChangeLink()
.summaryShows("Alternative provision").HasValue("Yes").HasChangeLink()
.summaryShows("Special educational needs").HasValue("No").HasChangeLink()
.summaryShows("School phase").HasValue("Secondary").HasChangeLink()
.summaryShows("Age range").HasValue("2-7").HasChangeLink()
.summaryShows("Nursery capacity").HasValue("200").HasChangeLink()
.summaryShows("Reception to year 6 capacity").HasValue("0").HasChangeLink()
.summaryShows("Year 7 to year 11 capacity").HasValue("400").HasChangeLink()
.summaryShows("Year 12 to year 14 capacity").HasValue("150").HasChangeLink()
.summaryShows("Faith status").HasValue("Designation").HasChangeLink()
.summaryShows("Faith type").HasValue("Greek Orthodox").HasChangeLink()
.summaryShows("Provisional opening date agreed with trust").HasValue("1 October 2035").HasChangeLink()
.summaryShows("Project assigned to").HasValue("joe bloggs").HasChangeLink()
.summaryShows("Email").HasValue("[email protected]").HasChangeLink();

Logger.log("Create Project button is visible");
summaryPage
.createProjectbutton('Create project')

cy.executeAccessibilityTests();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import createProjectPage from "cypress/pages/createProject/createProjectPage";
import homePage from "cypress/pages/homePage";
import summaryPage from "cypress/pages/task-summary-base";

describe("Smoke Test Create an individual project - (Up Until Check your answers Page)", () => {
describe("Smoke Test Create an individual Presumption project - (Up Until Check your answers Page)", () => {
beforeEach(() => {
cy.login({ role: ProjectRecordCreator });
cy.visit('/');
});

it("Should Smoke Test go through create a project wizard happy path up until Check your answers page", { tags: ['smoke'] }, () => {
it("Should create a presumption project, up until Check your answers page", { tags: ['smoke'] }, () => {
const temporaryProjectId = dataGenerator.generateTemporaryId(25);
const schoolName = dataGenerator.generateSchoolName();
const TestTrn = "TR00111";
Expand All @@ -23,7 +23,7 @@ import summaryPage from "cypress/pages/task-summary-base";
cy.executeAccessibilityTests();

createProjectPage
.selectOption("Create one project")
.selectOption("Presumption")
.continue();

cy.executeAccessibilityTests();
Expand Down Expand Up @@ -150,6 +150,7 @@ import summaryPage from "cypress/pages/task-summary-base";

Logger.log("Check answers");
summaryPage.inOrder()
.summaryShows("Project type").HasValue("Presumption").HasChangeLink()
.summaryShows("Temporary Project ID").HasValue(temporaryProjectId).HasChangeLink()
.summaryShows("Current free school name").HasValue(schoolName).HasChangeLink()
.summaryShows("Region").HasValue("East of England").HasChangeLink()
Expand Down

0 comments on commit 0654f76

Please sign in to comment.