-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3cd7b7
commit 50af4ae
Showing
2 changed files
with
40 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { resetSketch, getLocalStorage, clickMap } from "./shared.js"; | ||
|
||
test("v2 forms work", async ({ page }) => { | ||
let filename = await resetSketch(page, "v2"); | ||
|
||
await page.getByRole("button", { name: "New point" }).click(); | ||
await clickMap(page, 500, 500); | ||
|
||
await page.getByLabel("Modal Filter").check(); | ||
await page.getByLabel("Is this for cyclists?").check(); | ||
await page.getByLabel("Something completely new").check(); | ||
await page.getByLabel("Description").fill("Bus gate"); | ||
|
||
await page.getByRole("button", { name: "Finish" }).click(); | ||
|
||
// Check the data in local storage | ||
let json = await getLocalStorage(page, `sketch/LAD_Adur/${filename}`); | ||
let feature = json.features[0] as any; | ||
expect(feature.properties.v2).toEqual({ | ||
intervention_type: "modal filter", | ||
for_cycling: true, | ||
for_walking_wheeling: false, | ||
work_type: "new", | ||
}); | ||
expect(feature.properties.description).toEqual("Bus gate"); | ||
|
||
// Edit the point and make sure the forms are still there | ||
await page.getByRole("link", { name: "Untitled point" }).click(); | ||
await page.getByLabel("Improvements to something already existing").check(); | ||
await page.getByRole("button", { name: "Finish" }).click(); | ||
|
||
// Check the edit | ||
await page.getByRole("link", { name: "Untitled point" }).click(); | ||
await expect( | ||
page.getByLabel("Improvements to something already existing"), | ||
).toBeChecked(); | ||
}); |