Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Jul 14, 2023
1 parent 4b16635 commit 45c07aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/lib/sidebar/Instructions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
<div class="govuk-prose">
<h2>Drawing {noun} on the map</h2>
<p>
Use the tools on right to sketch new {noun} on the map. Each tool has
instructions that appear when you click on its icon.
Use the tools on right to sketch new {noun} on the map. Each tool has instructions
that appear when you click on its icon.
</p>
<p>
Modify existing {noun} on the map using <b>Edit geometry</b> and clicking
something.
Modify existing {noun} on the map using <b>Edit geometry</b> and clicking something.
</p>

<h2>Filling out data</h2>
Expand Down
18 changes: 9 additions & 9 deletions tests/modes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test("creating a new point opens a form", async () => {
await clickMap(page, 500, 500);

await page.getByRole("button", { name: "1) Untitled point" }).isVisible();
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();
});

test("creating a new freehand polygon opens a form", async () => {
Expand All @@ -51,7 +51,7 @@ test("creating a new freehand polygon opens a form", async () => {
await page.getByRole("button", { name: "Finish" }).click();

await page.getByRole("button", { name: "1) Untitled area" }).isVisible();
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();
});

test("creating a new freehand polygon and switching modes doesn't lose changes", async () => {
Expand All @@ -64,7 +64,7 @@ test("creating a new freehand polygon and switching modes doesn't lose changes",
await page.getByRole("button", { name: "New point" }).click();

await page.getByRole("button", { name: "1) Untitled area" }).click();
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();
});

test("creating a new freehand polygon and canceling doesn't save anything", async () => {
Expand All @@ -87,7 +87,7 @@ test("creating a new snapped polygon opens a form", async () => {
await page.getByRole("button", { name: "Finish" }).click();

await page.getByRole("button", { name: "1) Untitled area" }).isVisible();
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();
});

test("creating a new route opens a form, and auto-fill sets its name", async () => {
Expand All @@ -97,7 +97,7 @@ test("creating a new route opens a form, and auto-fill sets its name", async ()
await page.getByRole("button", { name: "Finish" }).click();

await page.getByRole("button", { name: "1) Untitled route" }).isVisible();
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();

// This button only works after RouteInfo is loaded. And note because the
// button is located inside a label, getByRole doesn't seem to work.
Expand All @@ -112,21 +112,21 @@ test("creating a new route opens a form, and auto-fill sets its name", async ()
test("editing geometry of a polygon works", async () => {
// Create a polygon
await page.getByRole("button", { name: "New polygon (snapped)" }).click();
await clickMap(page, 241, 579);
await clickMap(page, 241, 509);
await clickMap(page, 235, 431);
await clickMap(page, 465, 459);
await page.getByRole("button", { name: "Finish" }).click();
await page.getByRole("button", { name: "1) Untitled area" }).isVisible();
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();

// Click off the polygon to close the form
await clickMap(page, 284, 284);
// Make sure the form is closed
await expect(page.getByLabel("Description:")).not.toBeVisible();
await expect(page.getByLabel("Description")).not.toBeVisible();

// Click the polygon to open the form
await clickMap(page, 312, 501);
await page.getByLabel("Description:").click();
await page.getByLabel("Description").click();

// Edit geometry, and click the polygon again
await page.getByRole("button", { name: "Edit geometry" }).click();
Expand Down

0 comments on commit 45c07aa

Please sign in to comment.