From a6e5ccf10d761946cecb34157e90eeb7708437a0 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Mon, 2 Dec 2024 11:37:18 +0000 Subject: [PATCH 1/9] add prop info to e2e tests add geoJson mock and types lint fix --- e2e/tests/ui-driven/package.json | 1 + e2e/tests/ui-driven/pnpm-lock.yaml | 7 ++++ .../src/create-flow-with-geospatial.spec.ts | 15 +++++++++ .../ui-driven/src/helpers/addComponent.ts | 13 ++++++++ .../ui-driven/src/helpers/geospatialChecks.ts | 14 ++++++++ e2e/tests/ui-driven/src/mocks/geoJsonMock.ts | 32 +++++++++++++++++++ e2e/tests/ui-driven/src/pages/Editor.ts | 5 +++ 7 files changed, 87 insertions(+) create mode 100644 e2e/tests/ui-driven/src/helpers/geospatialChecks.ts create mode 100644 e2e/tests/ui-driven/src/mocks/geoJsonMock.ts diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index 91c2c8e9db..b5aaa364e3 100644 --- a/e2e/tests/ui-driven/package.json +++ b/e2e/tests/ui-driven/package.json @@ -22,6 +22,7 @@ "packageManager": "pnpm@8.6.6", "devDependencies": { "@playwright/test": "^1.49.0", + "@types/geojson": "^7946.0.14", "@types/node": "18.16.1", "eslint-plugin-playwright": "^0.20.0" } diff --git a/e2e/tests/ui-driven/pnpm-lock.yaml b/e2e/tests/ui-driven/pnpm-lock.yaml index 4e3fc3e0fe..75407766b7 100644 --- a/e2e/tests/ui-driven/pnpm-lock.yaml +++ b/e2e/tests/ui-driven/pnpm-lock.yaml @@ -40,6 +40,9 @@ devDependencies: '@playwright/test': specifier: ^1.49.0 version: 1.49.0 + '@types/geojson': + specifier: ^7946.0.14 + version: 7946.0.14 '@types/node': specifier: 18.16.1 version: 18.16.1 @@ -647,6 +650,10 @@ packages: resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} dev: false + /@types/geojson@7946.0.14: + resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} + dev: true + /@types/json-schema@7.0.15: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: false diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index 38cb922659..87e04ff21b 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -15,6 +15,8 @@ import { } from "./helpers/navigateAndPublish"; import { TestContext } from "./helpers/types"; import { serviceProps } from "./helpers/serviceData"; +import { mockMapGeoJson } from "./mocks/geoJsonMock"; +import { checkGeoJsonContent } from "./helpers/geospatialChecks"; test.describe("Flow creation, publish and preview", () => { let context: TestContext = { @@ -48,6 +50,8 @@ test.describe("Flow creation, publish and preview", () => { await editor.createFindProperty(); await expect(editor.nodeList).toContainText(["Find property"]); + await editor.createPropertyInformation(); + await expect(editor.nodeList).toContainText(["About the property"]); await editor.createInternalPortal(); await editor.populateInternalPortal(); await page.getByRole("link", { name: "start" }).click(); // return to main flow @@ -105,6 +109,17 @@ test.describe("Flow creation, publish and preview", () => { await answerFindProperty(page); await clickContinue({ page }); + await expect( + page.getByRole("heading", { name: "About the property" }), + ).toBeVisible(); + + // Check map component has geoJson content + await checkGeoJsonContent(page, mockMapGeoJson); + + // Check property info is being shown + await expect(page.getByText("Test Street, Testville")).toBeVisible(); + await clickContinue({ page }); + await expect( page.locator("h1", { hasText: "A notice inside a portal!" }), ).toBeVisible(); diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 61c0f8ca4e..28dd28b52d 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -81,6 +81,8 @@ const createBaseComponent = async ( break; case ComponentType.FindProperty: break; + case ComponentType.PropertyInformation: + break; case ComponentType.PlanningConstraints: break; case ComponentType.DrawBoundary: @@ -275,6 +277,17 @@ export const createFindProperty = async (page: Page, locatingNode: Locator) => { await createBaseComponent(page, locatingNode, ComponentType.FindProperty); }; +export const createPropertyInformation = async ( + page: Page, + locatingNode: Locator, +) => { + await createBaseComponent( + page, + locatingNode, + ComponentType.PropertyInformation, + ); +}; + export const createPlanningConstraints = async ( page: Page, locatingNode: Locator, diff --git a/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts b/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts new file mode 100644 index 0000000000..1ef7fa36c8 --- /dev/null +++ b/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts @@ -0,0 +1,14 @@ +import { expect, Page } from "@playwright/test"; +import { Feature } from "geojson"; + +export const checkGeoJsonContent = async (page: Page, geoJson: Feature) => { + // Wait for the map component to be present using the id + const mapComponent = await page.waitForSelector( + "my-map#property-information-map", + ); + + // Get the geojsonData attribute + const geojsonData = await mapComponent.getAttribute("geojsondata"); + + expect(JSON.parse(geojsonData!)).toEqual(geoJson); +}; diff --git a/e2e/tests/ui-driven/src/mocks/geoJsonMock.ts b/e2e/tests/ui-driven/src/mocks/geoJsonMock.ts new file mode 100644 index 0000000000..34cc06d02d --- /dev/null +++ b/e2e/tests/ui-driven/src/mocks/geoJsonMock.ts @@ -0,0 +1,32 @@ +import { Feature } from "geojson"; + +export const mockMapGeoJson: Feature = { + geometry: { + type: "MultiPolygon", + coordinates: [ + [ + [ + [-0.633498, 51.605485], + [-0.633455, 51.605606], + [-0.633788, 51.605643], + [-0.634429, 51.605799], + [-0.634429, 51.605767], + [-0.633498, 51.605485], + ], + ], + ], + }, + type: "Feature", + properties: { + "entry-date": "2024-05-06", + "start-date": "2010-05-12", + "end-date": "", + entity: 12000041468, + name: "", + dataset: "title-boundary", + typology: "geography", + reference: "45211072", + prefix: "title-boundary", + "organisation-entity": "13", + }, +}; diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index d19ae67146..1dc68e28f4 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -20,6 +20,7 @@ import { createNotice, createNumberInput, createPlanningConstraints, + createPropertyInformation, createQuestionWithOptions, createResult, createReview, @@ -168,6 +169,10 @@ export class PlaywrightEditor { await createFindProperty(this.page, this.getNextNode()); } + async createPropertyInformation() { + await createPropertyInformation(this.page, this.getNextNode()); + } + async createDrawBoundary() { await createDrawBoundary(this.page, this.getNextNode()); } From c948b8fdd5b331e8f6f4c5b04e2d1e1c7a4d1585 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Mon, 2 Dec 2024 14:25:23 +0000 Subject: [PATCH 2/9] simplify geoJson check --- e2e/tests/ui-driven/src/helpers/geospatialChecks.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts b/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts index 1ef7fa36c8..908be43c1f 100644 --- a/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts +++ b/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts @@ -2,10 +2,8 @@ import { expect, Page } from "@playwright/test"; import { Feature } from "geojson"; export const checkGeoJsonContent = async (page: Page, geoJson: Feature) => { - // Wait for the map component to be present using the id - const mapComponent = await page.waitForSelector( - "my-map#property-information-map", - ); + // Wait for the map component to be present + const mapComponent = await page.waitForSelector("my-map",); // Get the geojsonData attribute const geojsonData = await mapComponent.getAttribute("geojsondata"); From 110a3739403c35afd03b5f82af3b4b7e6c608343 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Mon, 2 Dec 2024 14:44:00 +0000 Subject: [PATCH 3/9] Add change button coverage lint:fix remove unused import --- .../ui-driven/src/create-flow-with-geospatial.spec.ts | 8 ++++++++ e2e/tests/ui-driven/src/helpers/addComponent.ts | 1 + e2e/tests/ui-driven/src/helpers/geospatialChecks.ts | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index 87e04ff21b..ec9a11679d 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -118,6 +118,14 @@ test.describe("Flow creation, publish and preview", () => { // Check property info is being shown await expect(page.getByText("Test Street, Testville")).toBeVisible(); + await expect(page.getByText("Residential - Semi Detached")).toBeVisible(); + const changeButton = page.getByRole("button", { + name: "Change your Property type", + }); + + await changeButton.click(); + + await expect(page.getByText("Unknown")).toBeVisible(); await clickContinue({ page }); await expect( diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 28dd28b52d..06de049349 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -82,6 +82,7 @@ const createBaseComponent = async ( case ComponentType.FindProperty: break; case ComponentType.PropertyInformation: + await page.getByLabel("Show users a 'change' link to").click(); break; case ComponentType.PlanningConstraints: break; diff --git a/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts b/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts index 908be43c1f..7b55e01997 100644 --- a/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts +++ b/e2e/tests/ui-driven/src/helpers/geospatialChecks.ts @@ -3,7 +3,7 @@ import { Feature } from "geojson"; export const checkGeoJsonContent = async (page: Page, geoJson: Feature) => { // Wait for the map component to be present - const mapComponent = await page.waitForSelector("my-map",); + const mapComponent = await page.waitForSelector("my-map"); // Get the geojsonData attribute const geojsonData = await mapComponent.getAttribute("geojsondata"); From b12147b5ea58f7342ded79a1fdfc997a5ba71786 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 3 Dec 2024 12:22:28 +0000 Subject: [PATCH 4/9] add property.type to geospatial --- .../src/create-flow-with-geospatial.spec.ts | 25 ++++++++++++++-- .../ui-driven/src/helpers/addComponent.ts | 29 +++++++++++++++++++ e2e/tests/ui-driven/src/helpers/types.ts | 2 ++ .../src/mocks/serviceComponentMocks.ts | 6 ++++ e2e/tests/ui-driven/src/pages/Editor.ts | 19 ++++++++++++ 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index ec9a11679d..782f53ec35 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -6,7 +6,11 @@ import { } from "./helpers/context"; import { getTeamPage } from "./helpers/getPage"; import { createAuthenticatedSession } from "./helpers/globalHelpers"; -import { answerFindProperty, clickContinue } from "./helpers/userActions"; +import { + answerFindProperty, + answerQuestion, + clickContinue, +} from "./helpers/userActions"; import { PlaywrightEditor } from "./pages/Editor"; import { navigateToService, @@ -17,6 +21,7 @@ import { TestContext } from "./helpers/types"; import { serviceProps } from "./helpers/serviceData"; import { mockMapGeoJson } from "./mocks/geoJsonMock"; import { checkGeoJsonContent } from "./helpers/geospatialChecks"; +import { mockPropertyTypeOptions } from "./mocks/serviceComponentMocks"; test.describe("Flow creation, publish and preview", () => { let context: TestContext = { @@ -50,6 +55,14 @@ test.describe("Flow creation, publish and preview", () => { await editor.createFindProperty(); await expect(editor.nodeList).toContainText(["Find property"]); + // Find property will automate past this question at first + await editor.createQuestionWithDataFieldOptions( + "Assign property type", + mockPropertyTypeOptions, + "property.type", + ); + await expect(editor.nodeList).toContainText(["Assign property type"]); + // but property info "change" button will navigate back to it await editor.createPropertyInformation(); await expect(editor.nodeList).toContainText(["About the property"]); await editor.createInternalPortal(); @@ -103,6 +116,7 @@ test.describe("Flow creation, publish and preview", () => { await page.goto( `/${context.team.slug}/${serviceProps.slug}/published?analytics=false`, ); + await expect( page.locator("h1", { hasText: "Find the property" }), ).toBeVisible(); @@ -125,7 +139,14 @@ test.describe("Flow creation, publish and preview", () => { await changeButton.click(); - await expect(page.getByText("Unknown")).toBeVisible(); + // change button navigates the user back thro the service so we need to continue twice + await answerQuestion({ + page: page, + title: "Assign property type", + answer: "Commercial", + }); + + await clickContinue({ page }); await clickContinue({ page }); await expect( diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 06de049349..d6d523b0fa 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -2,6 +2,7 @@ import { ComponentType } from "@opensystemslab/planx-core/types"; import { expect, Locator, Page } from "@playwright/test"; import { contextDefaults } from "./context"; import { externalPortalServiceProps } from "./serviceData"; +import { OptionWithDataValues } from "./types"; const createBaseComponent = async ( page: Page, @@ -156,6 +157,21 @@ export const createQuestionWithOptions = async ( ); }; +export const createQuestionWithDataFieldOptions = async ( + page: Page, + locatingNode: Locator, + questionText: string, + options: OptionWithDataValues[], + dataField: string, +) => { + await locatingNode.click(); + await page.getByRole("dialog").waitFor(); + await page.getByPlaceholder("Text").fill(questionText); + await page.getByPlaceholder("Data Field").fill(dataField); + await createComponentOptionsWithDataValues(page, options); + await page.locator('button[form="modal"][type="submit"]').click(); +}; + export const createNotice = async ( page: Page, locatingNode: Locator, @@ -345,6 +361,19 @@ async function createComponentOptions( } } +async function createComponentOptionsWithDataValues( + page: Page, + options: OptionWithDataValues[], +) { + let index = 0; + for (const option of options) { + await page.locator("button").filter({ hasText: "add new" }).click(); + await page.getByPlaceholder("Option").nth(index).fill(option.optionText); + await page.getByPlaceholder("Data Value").nth(index).fill(option.dataValue); + index++; + } +} + export const createList = async ( page: Page, locatingNode: Locator, diff --git a/e2e/tests/ui-driven/src/helpers/types.ts b/e2e/tests/ui-driven/src/helpers/types.ts index 25c3bff286..b76bb5dd9e 100644 --- a/e2e/tests/ui-driven/src/helpers/types.ts +++ b/e2e/tests/ui-driven/src/helpers/types.ts @@ -21,3 +21,5 @@ export interface TestContext { externalPortalFlow?: Flow; sessionIds?: string[]; } + +export type OptionWithDataValues = { optionText: string; dataValue: string }; diff --git a/e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts b/e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts new file mode 100644 index 0000000000..6d956d2ca3 --- /dev/null +++ b/e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts @@ -0,0 +1,6 @@ +import { OptionWithDataValues } from "../helpers/types"; + +export const mockPropertyTypeOptions: OptionWithDataValues[] = [ + { optionText: "Residential", dataValue: "residential" }, + { optionText: "Commercial", dataValue: "commercial" }, +]; diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index 1dc68e28f4..0439cd71ce 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -21,6 +21,7 @@ import { createNumberInput, createPlanningConstraints, createPropertyInformation, + createQuestionWithDataFieldOptions, createQuestionWithOptions, createResult, createReview, @@ -28,6 +29,7 @@ import { createTextInput, createUploadAndLabel, } from "../helpers/addComponent"; +import { OptionWithDataValues } from "../helpers/types"; export class PlaywrightEditor { readonly page: Page; @@ -82,6 +84,23 @@ export class PlaywrightEditor { ).toBeVisible(); } + async createQuestionWithDataFieldOptions( + title: string, + answers: OptionWithDataValues[], + dataField: string, + ) { + await createQuestionWithDataFieldOptions( + this.page, + this.getNextNode(), + title, + answers, + dataField, + ); + await expect( + this.page.locator("a").filter({ hasText: title }), + ).toBeVisible(); + } + async createNoticeOnEachBranch() { // Add a notice to the "Yes" path await createNotice( From baaf27de7acf50faabf955dc1a4a058ffe948a9a Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 3 Dec 2024 12:24:10 +0000 Subject: [PATCH 5/9] refine mock file naming --- .../ui-driven/src/create-flow-with-geospatial.spec.ts | 6 ++++-- .../src/mocks/{geoJsonMock.ts => geospatialMocks.ts} | 7 +++++++ e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts | 6 ------ 3 files changed, 11 insertions(+), 8 deletions(-) rename e2e/tests/ui-driven/src/mocks/{geoJsonMock.ts => geospatialMocks.ts} (74%) delete mode 100644 e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index 782f53ec35..67418c9145 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -19,9 +19,11 @@ import { } from "./helpers/navigateAndPublish"; import { TestContext } from "./helpers/types"; import { serviceProps } from "./helpers/serviceData"; -import { mockMapGeoJson } from "./mocks/geoJsonMock"; import { checkGeoJsonContent } from "./helpers/geospatialChecks"; -import { mockPropertyTypeOptions } from "./mocks/serviceComponentMocks"; +import { + mockMapGeoJson, + mockPropertyTypeOptions, +} from "./mocks/geospatialMocks"; test.describe("Flow creation, publish and preview", () => { let context: TestContext = { diff --git a/e2e/tests/ui-driven/src/mocks/geoJsonMock.ts b/e2e/tests/ui-driven/src/mocks/geospatialMocks.ts similarity index 74% rename from e2e/tests/ui-driven/src/mocks/geoJsonMock.ts rename to e2e/tests/ui-driven/src/mocks/geospatialMocks.ts index 34cc06d02d..fb26308b1d 100644 --- a/e2e/tests/ui-driven/src/mocks/geoJsonMock.ts +++ b/e2e/tests/ui-driven/src/mocks/geospatialMocks.ts @@ -1,3 +1,10 @@ +import { OptionWithDataValues } from "../helpers/types"; + +export const mockPropertyTypeOptions: OptionWithDataValues[] = [ + { optionText: "Residential", dataValue: "residential" }, + { optionText: "Commercial", dataValue: "commercial" }, +]; + import { Feature } from "geojson"; export const mockMapGeoJson: Feature = { diff --git a/e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts b/e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts deleted file mode 100644 index 6d956d2ca3..0000000000 --- a/e2e/tests/ui-driven/src/mocks/serviceComponentMocks.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { OptionWithDataValues } from "../helpers/types"; - -export const mockPropertyTypeOptions: OptionWithDataValues[] = [ - { optionText: "Residential", dataValue: "residential" }, - { optionText: "Commercial", dataValue: "commercial" }, -]; From 30abe04cee9aa32eccb54a511a880dd5d64b4304 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 3 Dec 2024 13:33:46 +0000 Subject: [PATCH 6/9] add a check to ensure val changes when changing prop type --- e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index 67418c9145..d4a67b6396 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -149,6 +149,8 @@ test.describe("Flow creation, publish and preview", () => { }); await clickContinue({ page }); + await expect(page.getByText("Commercial")).toBeVisible(); + await clickContinue({ page }); await expect( From d2c708430ec04b7c5dc19ec38fc0e601820d10b1 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 3 Dec 2024 16:28:20 +0000 Subject: [PATCH 7/9] add radio checked on back nav and comments --- .../src/create-flow-with-geospatial.spec.ts | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index d4a67b6396..fa2b128d3b 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -59,18 +59,19 @@ test.describe("Flow creation, publish and preview", () => { await expect(editor.nodeList).toContainText(["Find property"]); // Find property will automate past this question at first await editor.createQuestionWithDataFieldOptions( - "Assign property type", + "What type of property is it?", mockPropertyTypeOptions, "property.type", ); - await expect(editor.nodeList).toContainText(["Assign property type"]); + await expect(editor.nodeList).toContainText([ + "What type of property is it?", + ]); // but property info "change" button will navigate back to it await editor.createPropertyInformation(); await expect(editor.nodeList).toContainText(["About the property"]); await editor.createInternalPortal(); await editor.populateInternalPortal(); await page.getByRole("link", { name: "start" }).click(); // return to main flow - await editor.createFilter(); await editor.createUploadAndLabel(); // TODO: editor.createPropertyInfo() await editor.createDrawBoundary(); @@ -80,7 +81,6 @@ test.describe("Flow creation, publish and preview", () => { await expect(editor.nodeList).toContainText([ "Find property", "an internal portalEdit Portal", - "Filter - Planning permissionImmuneMissing informationPermission neededPrior approvalNoticePermitted developmentNot developmentNo flag result", "Upload and label", "Confirm your location plan", "Planning constraints", @@ -141,14 +141,26 @@ test.describe("Flow creation, publish and preview", () => { await changeButton.click(); + // ensure residential is selected on back nav to test previouslySubmittedData is working + await expect( + page.getByRole("radio", { name: "Residential", checked: true }), + ).toBeVisible(); + // change button navigates the user back thro the service so we need to continue twice await answerQuestion({ page: page, - title: "Assign property type", + title: "What type of property is it?", answer: "Commercial", }); + // navigate back to Property Info page await clickContinue({ page }); + await expect( + page.getByRole("heading", { name: "About the property" }), + ).toBeVisible(); + + // Ensure we've successfully changed property type + await expect(page.getByText("Residential - Semi Detached")).toBeHidden(); await expect(page.getByText("Commercial")).toBeVisible(); await clickContinue({ page }); @@ -158,7 +170,6 @@ test.describe("Flow creation, publish and preview", () => { ).toBeVisible(); await clickContinue({ page }); - // TODO: answer filter? // TODO: answer uploadAndLabel // TODO: answerPropertyInfo, answerDrawBoundary, answerPlanningConstraints }); From e3319d5708ddb97d6393788258e0a5173f821bbc Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 3 Dec 2024 16:46:07 +0000 Subject: [PATCH 8/9] remove redundant comment --- e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index fa2b128d3b..20523708a0 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -145,8 +145,7 @@ test.describe("Flow creation, publish and preview", () => { await expect( page.getByRole("radio", { name: "Residential", checked: true }), ).toBeVisible(); - - // change button navigates the user back thro the service so we need to continue twice + await answerQuestion({ page: page, title: "What type of property is it?", From 6fe2bb4c32175350ba5b16f4de32434485cfdf37 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 3 Dec 2024 17:02:18 +0000 Subject: [PATCH 9/9] lint:fix --- e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index 20523708a0..8bc6fe181b 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -145,7 +145,7 @@ test.describe("Flow creation, publish and preview", () => { await expect( page.getByRole("radio", { name: "Residential", checked: true }), ).toBeVisible(); - + await answerQuestion({ page: page, title: "What type of property is it?",