From 19a2fc45561afe5c03a0b238a80d1bc0016e6297 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 12 Nov 2024 13:50:24 +0000 Subject: [PATCH 1/8] add specific error message for Demo team --- .../src/@planx/components/Send/Public.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index 22cf28488d..a8cdb4f94e 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -9,6 +9,7 @@ import { useAsync } from "react-use"; import { AsyncState } from "react-use/lib/useAsyncFn"; import Card from "../shared/Preview/Card"; +import { ErrorSummaryContainer } from "../shared/Preview/ErrorSummaryContainer"; import { WarningContainer } from "../shared/Preview/WarningContainer"; import { PublicProps } from "../shared/types"; import { DEFAULT_DESTINATION, getCombinedEventsPayload, Send } from "./model"; @@ -31,6 +32,8 @@ const SendComponent: React.FC = ({ window.location.pathname.endsWith("/preview") ) { return ; + } else if (window.location.pathname.split("/")[1] === "demo") { + return ; } else { return ; } @@ -52,6 +55,20 @@ const SkipSendWarning: React.FC = (props) => ( ); +const DemoTeamWarning: React.FC = () => ( + + + + The send component is not configured for the Demo team + + + Integrations need to be configured to allow submissions to be sent from + PlanX + + + +); + const CreateSendEvents: React.FC = ({ destinations = [DEFAULT_DESTINATION], ...props From fc0e23562ff1ad04862e072ac86733c6dda3d4bc Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 12 Nov 2024 15:01:13 +0000 Subject: [PATCH 2/8] add demo slug condition to buttons on pay someonee else copy refinement on pay comp copy refinement on pay comp copy refinement on pay comp --- .../components/Pay/Public/InviteToPayForm.tsx | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx index b3c0e4637c..65e1940077 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx @@ -8,6 +8,7 @@ import type { PaymentStatus, } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; +import { ErrorSummaryContainer } from "@planx/components/shared/Preview/ErrorSummaryContainer"; import SaveResumeButton from "@planx/components/shared/Preview/SaveResumeButton"; import { WarningContainer } from "@planx/components/shared/Preview/WarningContainer"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; @@ -86,7 +87,11 @@ const InviteToPayForm: React.FC = ({ yourDetailsLabel, paymentStatus, }) => { - const [sessionId, path] = useStore((state) => [state.sessionId, state.path]); + const [sessionId, path, teamSlug] = useStore((state) => [ + state.sessionId, + state.path, + state.teamSlug, + ]); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(false); const isSaveReturn = path === ApplicationPath.SaveAndReturn; @@ -252,15 +257,16 @@ const InviteToPayForm: React.FC = ({ no longer be able to make changes. - {error ? ( - + {teamSlug !== "demo" && + (error ? ( + + + + ) : ( - - ) : ( - - )} + ))} + + {teamSlug === "demo" && ( + + + GOV.UK Pay is not configured for the Demo team + + + You can click "I want to pay for this application myself" to + continue your application + + + )} {isSaveReturn && } ); From 19b2bcfd9c6347c48504aee159e8634628fb6fda Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 12 Nov 2024 15:25:11 +0000 Subject: [PATCH 3/8] copy refinement scroll to view warning message revert scroll view and simplify demo user screens refine boolean code and remove redundant space copy refinement on send component --- .../components/Pay/Public/InviteToPayForm.tsx | 36 +++++-------------- .../src/@planx/components/Pay/Public/Pay.tsx | 21 ++++++----- .../src/@planx/components/Send/Public.tsx | 12 +++---- 3 files changed, 27 insertions(+), 42 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx index 65e1940077..b3c0e4637c 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/InviteToPayForm.tsx @@ -8,7 +8,6 @@ import type { PaymentStatus, } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; -import { ErrorSummaryContainer } from "@planx/components/shared/Preview/ErrorSummaryContainer"; import SaveResumeButton from "@planx/components/shared/Preview/SaveResumeButton"; import { WarningContainer } from "@planx/components/shared/Preview/WarningContainer"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; @@ -87,11 +86,7 @@ const InviteToPayForm: React.FC = ({ yourDetailsLabel, paymentStatus, }) => { - const [sessionId, path, teamSlug] = useStore((state) => [ - state.sessionId, - state.path, - state.teamSlug, - ]); + const [sessionId, path] = useStore((state) => [state.sessionId, state.path]); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(false); const isSaveReturn = path === ApplicationPath.SaveAndReturn; @@ -257,16 +252,15 @@ const InviteToPayForm: React.FC = ({ no longer be able to make changes. - {teamSlug !== "demo" && - (error ? ( - - - - ) : ( + {error ? ( + - ))} + + ) : ( + + )} - - {teamSlug === "demo" && ( - - - GOV.UK Pay is not configured for the Demo team - - - You can click "I want to pay for this application myself" to - continue your application - - - )} {isSaveReturn && } ); diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index f9f4a4398c..9466b24783 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -41,8 +41,7 @@ enum Action { Success, } -export const PAY_API_ERROR_UNSUPPORTED_TEAM = - "GOV.UK Pay is not enabled for this local authority"; +export const PAY_API_ERROR_UNSUPPORTED_TEAM = "GOV.UK Pay is not enabled for"; function Component(props: Props) { const [ @@ -76,6 +75,11 @@ function Component(props: Props) { const metadata = [...(props.govPayMetadata || []), ...defaultMetadata]; + const errorMessage = + teamSlug !== "demo" + ? "GOV.UK Pay is not enabled for this local authority" + : "GOV.UK Pay is not enabled for the Demo team"; + // Handles UI states const reducer = (_state: ComponentState, action: Action): ComponentState => { switch (action) { @@ -114,6 +118,10 @@ function Component(props: Props) { const handleError = useErrorHandler(); + const isTeamSupported = + state.status !== "unsupported_team" && teamSlug !== "demo"; + const showPayOptions = props.allowInviteToPay && !props.hidePay; + useEffect(() => { // Auto-skip component when fee=0 if (fee <= 0) { @@ -294,17 +302,12 @@ function Component(props: Props) { : "Retry payment" } error={ - (state.status === "unsupported_team" && - "GOV.UK Pay is not enabled for this local authority") || + (state.status === "unsupported_team" && errorMessage) || (state.status === "undefined_fee" && "We are unable to calculate your fee right now") || undefined } - showInviteToPay={ - props.allowInviteToPay && - !props.hidePay && - state.status !== "unsupported_team" - } + showInviteToPay={showPayOptions && isTeamSupported} paymentStatus={govUkPayment?.state?.status} hidePay={props.hidePay} /> diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index a8cdb4f94e..868a27cb88 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -33,7 +33,7 @@ const SendComponent: React.FC = ({ ) { return ; } else if (window.location.pathname.split("/")[1] === "demo") { - return ; + return ; } else { return ; } @@ -55,15 +55,15 @@ const SkipSendWarning: React.FC = (props) => ( ); -const DemoTeamWarning: React.FC = () => ( - +const DemoTeamWarning: React.FC = (props) => ( + - The send component is not configured for the Demo team + Send is disabled for the Demo team - Integrations need to be configured to allow submissions to be sent from - PlanX + Team integrations need to be configured to allow submissions to be sent + from PlanX From 5cf819c27e9ccb4914937420acbae9aca0dcf60f Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Wed, 13 Nov 2024 18:06:19 +0000 Subject: [PATCH 4/8] add refine messaging on errors --- .../src/@planx/components/Pay/Public/Pay.tsx | 2 +- .../components/PlanningConstraints/Public.tsx | 19 +++++++++++++++++++ .../src/@planx/components/Send/Public.tsx | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index 9466b24783..97f61230fc 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -78,7 +78,7 @@ function Component(props: Props) { const errorMessage = teamSlug !== "demo" ? "GOV.UK Pay is not enabled for this local authority" - : "GOV.UK Pay is not enabled for the Demo team"; + : "GOV.UK Pay is not enabled for services created in the Demo team"; // Handles UI states const reducer = (_state: ComponentState, action: Action): ComponentState => { diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx index f622093b59..e5ad42ad10 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx @@ -1,3 +1,4 @@ +import Typography from "@mui/material/Typography"; import type { EnhancedGISResponse, GISResponse, @@ -13,6 +14,7 @@ import useSWR, { Fetcher } from "swr"; import { stringify } from "wkt"; import { SiteAddress } from "../FindProperty/model"; +import { ErrorSummaryContainer } from "../shared/Preview/ErrorSummaryContainer"; import { type IntersectingConstraints, type PlanningConstraints, @@ -209,6 +211,23 @@ function Component(props: Props) { }); }; + if (teamSlug === "demo") { + return ( + + + + Planning Constraints are not enabled for services created in the + Demo team + + + Click continue to skip planning constraints and proceed with your + application for testing + + + + ); + } + const isLoading = isValidating || isValidatingRoads; if (isLoading) return ( diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index 868a27cb88..4f079092b3 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -59,7 +59,7 @@ const DemoTeamWarning: React.FC = (props) => ( - Send is disabled for the Demo team + Send is not enabled for services created in the Demo team Team integrations need to be configured to allow submissions to be sent From 023761b0e0037227984ab45694d5e0e6e2f0cf96 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Thu, 14 Nov 2024 13:35:41 +0000 Subject: [PATCH 5/8] update error message copy --- editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx | 2 +- .../src/@planx/components/PlanningConstraints/Public.tsx | 5 ++--- editor.planx.uk/src/@planx/components/Send/Public.tsx | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index 97f61230fc..342b6d2ac4 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -78,7 +78,7 @@ function Component(props: Props) { const errorMessage = teamSlug !== "demo" ? "GOV.UK Pay is not enabled for this local authority" - : "GOV.UK Pay is not enabled for services created in the Demo team"; + : "GOV.UK Pay is not enabled demo users"; // Handles UI states const reducer = (_state: ComponentState, action: Action): ComponentState => { diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx index e5ad42ad10..124ac91f13 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx @@ -216,12 +216,11 @@ function Component(props: Props) { - Planning Constraints are not enabled for services created in the - Demo team + Planning Constraints are not enabled for demo users. Click continue to skip planning constraints and proceed with your - application for testing + application for testing. diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index 4f079092b3..9676b98daf 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -62,8 +62,8 @@ const DemoTeamWarning: React.FC = (props) => ( Send is not enabled for services created in the Demo team - Team integrations need to be configured to allow submissions to be sent - from PlanX + Click continue to skip send and proceed with your application for + testing. From 5716f0971d5a6c7d512b25d787c20b9ae463abd5 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Thu, 14 Nov 2024 17:04:48 +0000 Subject: [PATCH 6/8] add unit tests and fix typo simplify pay error and add tests remove unused variables remove it.only alter state val on unit test --- .../src/@planx/components/Pay/Editor.tsx | 6 +-- .../@planx/components/Pay/Public/Pay.test.tsx | 28 +++++++++++ .../src/@planx/components/Pay/Public/Pay.tsx | 10 ++-- .../PlanningConstraints/Public.test.tsx | 46 ++++++++++++++++++- .../@planx/components/Send/Public.test.tsx | 42 +++++++++++++++++ .../src/@planx/components/Send/Public.tsx | 3 +- 6 files changed, 122 insertions(+), 13 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index 173e206437..b9be3cff16 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -1,6 +1,5 @@ import DataObjectIcon from "@mui/icons-material/DataObject"; import Box from "@mui/material/Box"; -import FormControlLabel from "@mui/material/FormControlLabel"; import Link from "@mui/material/Link"; import Typography from "@mui/material/Typography"; import { @@ -352,10 +351,7 @@ const Component: React.FC = (props: Props) => { - setFieldValue( - "allowInviteToPay", - !values.allowInviteToPay, - ) + setFieldValue("allowInviteToPay", !values.allowInviteToPay) } label="Allow applicants to invite someone else to pay" /> diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx index b58c3774c1..14f6d42c37 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx @@ -450,3 +450,31 @@ describe("Confirm component in information-only mode", () => { expect(results).toHaveNoViolations(); }); }); + +describe("the demo user view", () => { + beforeEach(() => { + act(() => + setState({ + teamSlug: "demo", + }), + ); + }); + it("should render an error when teamSlug is demo", async () => { + const handleSubmit = vi.fn(); + const { queryByText } = setup( + , + ); + const errorHeader = queryByText("GOV.UK Pay is not enabled for demo users"); + const errorGuidance = queryByText( + "Click continue to skip payment and proceed with your application for testing.", + ); + + expect(errorGuidance).toBeInTheDocument(); + expect(errorHeader).toBeInTheDocument(); + }); +}); diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index 342b6d2ac4..7b2c6e67c0 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -75,11 +75,6 @@ function Component(props: Props) { const metadata = [...(props.govPayMetadata || []), ...defaultMetadata]; - const errorMessage = - teamSlug !== "demo" - ? "GOV.UK Pay is not enabled for this local authority" - : "GOV.UK Pay is not enabled demo users"; - // Handles UI states const reducer = (_state: ComponentState, action: Action): ComponentState => { switch (action) { @@ -302,7 +297,10 @@ function Component(props: Props) { : "Retry payment" } error={ - (state.status === "unsupported_team" && errorMessage) || + (teamSlug === "demo" && + "GOV.UK Pay is not enabled for demo users") || + (state.status === "unsupported_team" && + "GOV.UK Pay is not enabled for this local authority") || (state.status === "undefined_fee" && "We are unable to calculate your fee right now") || undefined diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx index eb3e1e4a11..d77e738b67 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx @@ -40,7 +40,7 @@ vi.mock("swr", () => ({ })); describe("error state", () => { - it("renders an error if no addres is present in the passport", async () => { + it("renders an error if no address is present in the passport", async () => { const { getByRole, getByTestId } = setup( { expect(getByRole("heading", { name: /Ecology/ })).toBeVisible(); }); }); + +describe("demo state", () => { + beforeEach(() => { + act(() => + setState({ + breadcrumbs: simpleBreadcrumbs, + flow: simpleFlow, + teamIntegrations: { + hasPlanningData: false, + }, + teamSlug: "demo", + }), + ); + }); + it("should render an error when teamSlug is demo", async () => { + const handleSubmit = vi.fn(); + const { queryByText, queryByRole, user, getByTestId } = setup( + + + , + ); + + const errorMessage = queryByText( + "Planning Constraints are not enabled for demo users.", + ); + expect(errorMessage).toBeVisible(); + + // Check planning constraints has not rendered + expect( + queryByRole("heading", { name: "Planning constraints" }), + ).not.toBeInTheDocument(); + + // Ensure a demo user can continue on in the application + await user.click(getByTestId("continue-button")); + + expect(handleSubmit).toHaveBeenCalled(); + }); +}); diff --git a/editor.planx.uk/src/@planx/components/Send/Public.test.tsx b/editor.planx.uk/src/@planx/components/Send/Public.test.tsx index da34e1765b..7feb633b89 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.test.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.test.tsx @@ -210,3 +210,45 @@ it("should not have any accessibility violations", async () => { const results = await axe(container); expect(results).toHaveNoViolations(); }); + +describe("demo state", () => { + beforeEach(() => { + act(() => + setState({ + teamSlug: "demo", + }), + ); + }); + it("should render an error when teamSlug is demo", async () => { + const { queryByText } = setup( + , + ); + + const errorHeader = queryByText( + "Send is not enabled for services created in the Demo team", + ); + const errorGuidance = queryByText( + "Click continue to skip send and proceed with your application for testing.", + ); + + expect(errorHeader).toBeInTheDocument(); + expect(errorGuidance).toBeInTheDocument(); + }); + it("should allow the user to continue with their application", async () => { + const handleSubmit = vi.fn(); + + const { findByRole, user } = setup( + , + ); + + const continueButton = await findByRole("button", { name: "Continue" }); + expect(continueButton).toBeInTheDocument(); + + await user.click(continueButton); + expect(handleSubmit).toHaveBeenCalled(); + }); +}); diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index 9676b98daf..0e76de5287 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -26,13 +26,14 @@ const SendComponent: React.FC = ({ destinations = [DEFAULT_DESTINATION], ...props }) => { + const teamSlug = useStore().teamSlug; const fullProps = { destinations: destinations, ...props }; if ( window.location.pathname.endsWith("/draft") || window.location.pathname.endsWith("/preview") ) { return ; - } else if (window.location.pathname.split("/")[1] === "demo") { + } else if (teamSlug === "demo") { return ; } else { return ; From 5a8cb43993b8e0f58aaad47293c8e37b550f9128 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 19 Nov 2024 17:21:28 +0000 Subject: [PATCH 7/8] add requested changes: --- .../@planx/components/PlanningConstraints/Public.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx index 124ac91f13..22cb6cd2fd 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx @@ -214,13 +214,17 @@ function Component(props: Props) { if (teamSlug === "demo") { return ( + - Planning Constraints are not enabled for demo users. + Planning Constraints are not enabled for demo users - Click continue to skip planning constraints and proceed with your - application for testing. + Since we cannot automatically check constraints, you might be asked + additional questions about your project. + + + Click continue to proceed with your application. From 46547f99143ba37ff4463effd3013abbfbea9990 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 19 Nov 2024 17:40:06 +0000 Subject: [PATCH 8/8] fix planning constraints tests --- .../@planx/components/PlanningConstraints/Public.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx index d77e738b67..78d9ad3bcf 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.test.tsx @@ -269,13 +269,17 @@ describe("demo state", () => { ); const errorMessage = queryByText( - "Planning Constraints are not enabled for demo users.", + "Planning Constraints are not enabled for demo users", ); expect(errorMessage).toBeVisible(); // Check planning constraints has not rendered + // reused positive constraints from basic layout test expect( - queryByRole("heading", { name: "Planning constraints" }), + queryByRole("heading", { name: /These are the planning constraints/ }), + ).not.toBeInTheDocument(); + expect( + queryByRole("button", { name: /Parks and gardens/ }), ).not.toBeInTheDocument(); // Ensure a demo user can continue on in the application