Skip to content

Commit

Permalink
check upload doc navigation and drawgeojson
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Dec 9, 2024
1 parent e317656 commit e0772d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
23 changes: 19 additions & 4 deletions e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test.describe("Flow creation, publish and preview", () => {
).toBeVisible();

// Check map component has geoJson content
await checkGeoJsonContent(page, mockMapGeoJson);
await checkGeoJsonContent(page, "geojsondata" ,mockMapGeoJson);

// Check property info is being shown
await expect(page.getByText("Test Street, Testville")).toBeVisible();
Expand Down Expand Up @@ -167,11 +167,26 @@ test.describe("Flow creation, publish and preview", () => {
).toBeVisible();
await clickContinue({ page });

await expect(page.getByRole('heading', { name: 'Confirm your location plan' })).toBeVisible()
const drawBoundaryTitle = page.getByRole('heading', { name: 'Confirm your location plan' })
await expect(drawBoundaryTitle).toBeVisible()

await expect(page.getByTestId('upload-file-button')).toBeVisible()
await expect(page.getByText("490.37")).toBeVisible()
const uploadButton = page.getByTestId('upload-file-button')

await expect(uploadButton).toBeVisible()
await expect(page.getByText("490.37"),"Checking for area text").toBeVisible()

await checkGeoJsonContent(page, "drawgeojsondata" ,mockMapGeoJson);

await uploadButton.click()
await expect(page.getByRole('heading', { name: 'Upload a location plan' }), "Ensure we can navigate to upload location plan").toBeVisible()

// const uploadFileButton = page.getByRole('button', { name: 'Drop file here or choose' })
const useMapButton = page.getByTestId('use-map-button')

await useMapButton.click()

await expect(drawBoundaryTitle, "Ensure we've navigated back to the map component").toBeVisible()

// TODO: answer uploadAndLabel
// TODO: answerPropertyInfo, answerPlanningConstraints
});
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/ui-driven/src/helpers/geospatialChecks.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { expect, Page } from "@playwright/test";
import { Feature } from "geojson";

export const checkGeoJsonContent = async (page: Page, geoJson: Feature) => {
export const checkGeoJsonContent = async (page: Page, attribute:"geojsondata" | "drawgeojsondata", geoJson: Feature) => {
// 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");
const geojsonData = await mapComponent.getAttribute(attribute);

expect(JSON.parse(geojsonData!)).toEqual(geoJson);
};

0 comments on commit e0772d5

Please sign in to comment.