-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:theopensystemslab/planx-new into je…
…ss/data-field-autocomplete
- Loading branch information
Showing
33 changed files
with
1,046 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { expect, Page } from "@playwright/test"; | ||
import { setupOSMockResponse } from "../mocks/osPlacesResponse"; | ||
|
||
export async function answerFindProperty(page: Page) { | ||
await setupOSMockResponse(page); | ||
await page.getByLabel("Postcode").fill("SW1 1AA"); | ||
await page.getByLabel("Select an address").click(); | ||
await page.getByRole("option").first().click(); | ||
} | ||
|
||
export const userChallengesPlanningConstraint = async (page: Page) => { | ||
const thisDoesNotApplyConstraintButton = page.getByRole("button", { | ||
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 applies to this property", | ||
}); | ||
await constraintDoesNotApplyDialog.isVisible(); | ||
|
||
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", | ||
); | ||
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(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { expect, Page } from "@playwright/test"; | ||
import { mockRoadData } from "./geospatialMocks"; | ||
import propertyConstraintsResponse from "./propertyConstraintResponse.json"; | ||
|
||
export async function setupGISMockResponse(page: Page) { | ||
const gisDigitalLandEndpoint = "**/gis/E2E?geom*"; | ||
await page.route(gisDigitalLandEndpoint, async (route, request) => { | ||
const urlContainsConstraints = checkGISMockRequestUrl(request.url()); | ||
expect(urlContainsConstraints).toEqual(true); | ||
await route.fulfill({ | ||
status: 200, | ||
body: JSON.stringify(propertyConstraintsResponse), | ||
}); | ||
}); | ||
} | ||
|
||
export function checkGISMockRequestUrl(url: string) { | ||
const splitUrl = url.split("/").pop()?.split("%2C"); | ||
return ( | ||
!splitUrl?.includes("designated.conservationArea") && | ||
splitUrl?.includes("listed") | ||
); | ||
} | ||
|
||
export async function setupRoadsMockResponse(page: Page) { | ||
const gisRoadsEndpoint = new RegExp(/\/roads\?.*/); | ||
await page.route(gisRoadsEndpoint, async (route) => { | ||
await route.fulfill({ | ||
status: 200, | ||
body: JSON.stringify(mockRoadData), | ||
}); | ||
}); | ||
} | ||
|
||
export const planningConstraintHeadersMock = [ | ||
"Planning constraints", | ||
"These are the planning constraints we think apply to this property", | ||
"Heritage and conservation", | ||
"General policy", | ||
"Heritage and conservation", | ||
"Flooding", | ||
"Ecology", | ||
"Trees", | ||
]; |
Oops, something went wrong.