Skip to content

Commit

Permalink
add changes from comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Dec 18, 2024
1 parent e371275 commit a43684e
Show file tree
Hide file tree
Showing 6 changed files with 628 additions and 31 deletions.
4 changes: 3 additions & 1 deletion e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ test.describe("Flow creation, publish and preview", () => {
"The correct value for area comes from the map properties ",
).toBeVisible();

await clickContinue({ page });

await expect(
page.locator("h1", { hasText: "Planning constraints" }),
).toBeVisible();
Expand All @@ -244,7 +246,7 @@ test.describe("Flow creation, publish and preview", () => {
).toBeVisible();

const listedBuildingConstraintRowItem = page.getByRole("button", {
name: "is, or is within, a Listed",
name: "Listed building outlines",
});

await expect(listedBuildingConstraintRowItem).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/src/helpers/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function setUpTestContext(
// has_planning_data needs to be altered manually for geospatial tests
await $admin.client.request(
gql`
mutation AddPlanningData($teamId: Int) {
mutation TogglePlanningData($teamId: Int) {
update_team_integrations(
where: { team_id: { _eq: $teamId } }
_set: { has_planning_data: true }
Expand Down
21 changes: 14 additions & 7 deletions e2e/tests/ui-driven/src/helpers/geoSpatialUserActions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from "@playwright/test";
import { expect, Page } from "@playwright/test";
import { setupOSMockResponse } from "../mocks/osPlacesResponse";

export async function answerFindProperty(page: Page) {
Expand All @@ -10,24 +10,31 @@ export async function answerFindProperty(page: Page) {

export const userChallengesPlanningConstraint = async (page: Page) => {
const thisDoesNotApplyConstraintButton = page.getByRole("button", {
name: "I don't think this constraint",
name: "I don't think this constraint applies to this property",
});

await thisDoesNotApplyConstraintButton.click();

const constraintDoesNotApplyDialog = page.getByRole("heading", {
name: "I don't think this constraint",
name: "I don't think this constraint applies to this property",
});
constraintDoesNotApplyDialog.isVisible();
await constraintDoesNotApplyDialog.isVisible();

const noAddressSuppliedButton = page.getByTestId("42103309");
noAddressSuppliedButton.click();
const noAddressSuppliedButton = page.getByTestId("entity-checkbox-42103309");
await noAddressSuppliedButton.click();

const tellUsWhyText = page.getByRole("textbox");
await tellUsWhyText.fill("This is the reason why");

const submitConstraintChallenge = page.getByTestId(
"override-modal-submit-button",
);
submitConstraintChallenge.click();
await submitConstraintChallenge.click();

await expect(
page.getByTestId("error-message-checklist-error-inaccurate-entities"),
).toBeHidden();
await expect(
page.getByTestId("error-message-input-error-inaccurate-entities"),
).toBeHidden();
};
24 changes: 3 additions & 21 deletions e2e/tests/ui-driven/src/mocks/geospatialMocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { OptionWithDataValues } from "../helpers/types";
import { Feature, Polygon } from "geojson";
import propertyConstraintsMetadata from "./propertyConstraintMetadata.json";

type ChangeHandlerProperties = {
label: string;
Expand Down Expand Up @@ -65,29 +66,9 @@ export const mockChangedMapGeoJson: GeoJsonChangeHandler = {
},
};

export const mockChangedMapGeoJson: GeoJsonChangeHandler = {
type: "Feature",
geometry: {
type: "Polygon",
coordinates: [
[
[-0.6341888375038146, 51.60562241658701],
[-0.6341217822784424, 51.605580770520504],
[-0.63405472705307, 51.605580770520504],
[-0.6341888375038146, 51.60562241658701],
],
],
},
properties: {
label: "1",
"area.squareMetres": 10.72,
"area.hectares": 0.001072,
},
};

export const mockPropertyConstraints = {
sourceRequest:
"https://www.planning.data.gov.uk/entity.json?entries=current&geometry=POINT%28-0.1151501+51.4745098%29&geometry_relation=intersects&exclude_field=geometry%2Cpoint&limit=100&dataset=article-4-direction-area&dataset=central-activities-zone&dataset=brownfield-land&dataset=brownfield-site&dataset=area-of-outstanding-natural-beauty&dataset=conservation-area&dataset=green-belt&dataset=national-park&dataset=world-heritage-site&dataset=world-heritage-site-buffer-zone&dataset=flood-risk-zone&dataset=listed-building&dataset=listed-building-outline&dataset=scheduled-monument&dataset=ancient-woodland&dataset=ramsar&dataset=special-area-of-conservation&dataset=special-protection-area&dataset=site-of-special-scientific-interest&dataset=park-and-garden&dataset=tree&dataset=tree-preservation-order&dataset=tree-preservation-zone",
"https://www.planning.data.gov.uk/entity.json?entries=current&geometry=POINT%28-0.1151501+51.4745098%29&geometry_relation=intersects&exclude_field=geometry%2Cpoint&limit=100&dataset=article-4-direction-area&dataset=central-activities-zone&dataset=brownfield-land&dataset=brownfield-site&dataset=area-of-outstanding-natural-beauty&dataset=green-belt&dataset=national-park&dataset=world-heritage-site&dataset=world-heritage-site-buffer-zone&dataset=flood-risk-zone&dataset=listed-building&dataset=listed-building-outline&dataset=scheduled-monument&dataset=ancient-woodland&dataset=ramsar&dataset=special-area-of-conservation&dataset=special-protection-area&dataset=site-of-special-scientific-interest&dataset=park-and-garden&dataset=tree&dataset=tree-preservation-order&dataset=tree-preservation-zone",
constraints: {
listed: {
fn: "listed",
Expand Down Expand Up @@ -225,6 +206,7 @@ export const mockPropertyConstraints = {
value: false,
},
},
metadata: propertyConstraintsMetadata,
};

export const mockRoadData = {
Expand Down
Loading

0 comments on commit a43684e

Please sign in to comment.