diff --git a/e2e/tests/ui-driven/src/create-flow.spec.ts b/e2e/tests/ui-driven/src/create-flow.spec.ts index 8a17b5deb9..94c6bee879 100644 --- a/e2e/tests/ui-driven/src/create-flow.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow.spec.ts @@ -73,6 +73,7 @@ test.describe("Flow creation, publish and preview", () => { await editor.createResult(); await editor.createNextSteps(); await editor.createReview(); + await editor.createFeedback(); await editor.createConfirmation(); await expect(editor.nodeList).toContainText([ @@ -91,6 +92,7 @@ test.describe("Flow creation, publish and preview", () => { "Planning permission", // default result flag "Next steps", "Check your answers before sending your application", + "Tell us what you think", "Confirmation", ]); }); @@ -290,6 +292,10 @@ test.describe("Flow creation, publish and preview", () => { ).toBeVisible(); await clickContinue({ page }); + await expect( + page.locator("h1", { hasText: "Tell us what you think" }), + ).toBeVisible(); + await clickContinue({ page }); await expect( page.locator("h1", { hasText: "Application sent" }), ).toBeVisible(); diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 9b41eacf4e..003567d4db 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -1,5 +1,5 @@ import { ComponentType } from "@opensystemslab/planx-core/types"; -import { Locator, Page } from "@playwright/test"; +import { expect, Locator, Page } from "@playwright/test"; const createBaseComponent = async ( page: Page, @@ -10,7 +10,10 @@ const createBaseComponent = async ( ) => { await locatingNode.click(); await page.getByRole("dialog").waitFor(); - await page.locator("select").selectOption({ value: type.toString() }); + const headerSelect = page.getByRole("heading", { name: "Question close" }); + await headerSelect.locator("select").selectOption({ value: type.toString() }); + + await expect(page.getByTestId("header-select")).toHaveValue(type.toString()); switch (type) { case ComponentType.Question: @@ -23,7 +26,7 @@ const createBaseComponent = async ( await page.getByPlaceholder("Notice").fill(title || ""); break; case ComponentType.Checklist: - await page.getByPlaceholder("Text").fill(title || ""); + await page.getByPlaceholder("Text").fill(title || "text"); if (options) { await createComponentOptions(options, "add new option", page); } @@ -114,6 +117,7 @@ const createBaseComponent = async ( .fill(options?.[0] || ""); break; case ComponentType.Filter: + case ComponentType.Feedback: break; case ComponentType.InternalPortal: await page.getByPlaceholder("Portal name").fill(title || ""); @@ -386,3 +390,7 @@ export const createInternalPortal = async ( portalName, ); }; + +export const createFeedback = async (page: Page, locatingNode: Locator) => { + await createBaseComponent(page, locatingNode, ComponentType.Feedback); +}; diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index eeda650d88..bb581c1386 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -9,6 +9,7 @@ import { createContent, createDateInput, createDrawBoundary, + createFeedback, createFileUpload, createFilter, createFindProperty, @@ -240,4 +241,8 @@ export class PlaywrightEditor { .fill("A notice inside a portal!"); await this.page.locator('button[form="modal"][type="submit"]').click(); } + + async createFeedback() { + await createFeedback(this.page, this.getNextNode()); + } } diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor/Editor.tsx index 8f0a9fbb6c..450c13a4d5 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor/Editor.tsx @@ -1,11 +1,5 @@ -import { - ComponentType as TYPES, -} from "@opensystemslab/planx-core/types"; -import { - parsePay, - Pay, - validationSchema, -} from "@planx/components/Pay/model"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; +import { parsePay, Pay, validationSchema } from "@planx/components/Pay/model"; import { Form, Formik } from "formik"; import React from "react"; import { ComponentTagSelect } from "ui/editor/ComponentTagSelect"; @@ -20,13 +14,13 @@ import { Switch } from "ui/shared/Switch"; import { ICONS } from "../../shared/icons"; import { EditorProps } from "../../shared/types"; +import { FeeBreakdownSection } from "./FeeBreakdownSection"; import { GovPayMetadataSection } from "./GovPayMetadataSection"; import { InviteToPaySection } from "./InviteToPaySection"; export type Props = EditorProps; const Component: React.FC = (props: Props) => { - const onSubmit = (newValues: Pay) => { if (props.handleSubmit) { props.handleSubmit({ type: TYPES.Pay, data: newValues }); @@ -41,11 +35,7 @@ const Component: React.FC = (props: Props) => { validateOnChange={true} validateOnBlur={true} > - {({ - values, - handleChange, - setFieldValue, - }) => ( + {({ values, handleChange, setFieldValue }) => (