Skip to content

Commit

Permalink
reinstate some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter York committed Nov 3, 2023
1 parent 28bca1f commit 87a1705
Showing 1 changed file with 104 additions and 104 deletions.
208 changes: 104 additions & 104 deletions tests/pipeline_sketching.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,110 +12,110 @@ test.beforeEach(async () => {
await clearExistingInterventions(page);
});

// test("creating a new point in pipeline mode opens a form", async () => {
// await page.getByRole("button", { name: "New point" }).click();
// await clickMap(page, 500, 500);

// await expect(page.getByLabel("Description")).toBeVisible();
// });

// test("creating a new freehand polygon and canceling doesn't save anything", async () => {
// await page.getByRole("button", { name: "New polygon (freehand)" }).click();
// await clickMap(page, 500, 500);
// await clickMap(page, 400, 500);
// await clickMap(page, 400, 600);

// await page.getByRole("button", { name: "Cancel" }).click();
// await page.getByText("Untitled Subscheme").click();

// await expect(
// page.getByRole("button", { name: "Delete subscheme" })
// ).toBeVisible();
// await expect(
// page.getByRole("link", { name: "Untitled area" })
// ).not.toBeVisible();
// await page.getByText("Untitled Subscheme").click();
// });

// test("deleting the last subscheme", async () => {
// await page.getByText("Untitled Subscheme").click();

// await expect(
// page.getByRole("button", { name: "Delete subscheme" })
// ).toBeVisible();
// await expect(
// page.getByRole("button", { name: "Delete subscheme" })
// ).not.toBeEnabled();
// await page.getByText("Untitled Subscheme").click();
// });

// test("deleting an empty subscheme", async () => {
// await page.getByRole("button", { name: "Add Subscheme" }).click();
// await page.getByText("Unnamed Scheme 1").click();
// await expect(
// page.getByRole("button", { name: "Delete subscheme" })
// ).toBeVisible();
// await page.getByRole("button", { name: "Delete subscheme" }).click();
// await page
// .getByRole("button", {
// name: "Delete this subscheme and related interventions",
// })
// .click();

// await expect(page.getByText("Unnamed Scheme 1")).not.toBeVisible();
// });

// test("deleting a non-empty subscheme", async () => {
// await page.getByRole("button", { name: "Add Subscheme" }).click();

// await drawPoint(page);
// await drawPoint(page, "Unnamed Scheme 1");

// await page.getByText("Untitled Subscheme").click();

// await expect(
// page.getByRole("button", { name: "Delete subscheme" })
// ).toBeVisible();
// await page.getByRole("button", { name: "Delete subscheme" }).click();
// await page
// .getByRole("button", {
// name: "Delete this subscheme and related interventions",
// })
// .click();

// await expect(page.getByText("Untitled Subscheme")).not.toBeVisible();
// });

// test("split route within subscheme", async () => {
// await page.getByRole("button", { name: "Add Subscheme" }).click();

// await page.getByRole("button", { name: "New route" }).click();
// await clickMap(page, 522, 468);
// await clickMap(page, 192, 513);
// await page.getByRole("button", { name: "Finish" }).click();
// await page.getByLabel("Subscheme Name").selectOption("Unnamed Scheme 1");
// await page.getByRole("button", { name: "Save" }).click();

// await page.getByText("Unnamed Scheme 1").click();
// await expect(
// page.getByRole("link", {
// name: "Route from ",
// })
// ).toHaveCount(1);
// await page.getByText("Unnamed Scheme 1").click();

// await page.getByRole("button", { name: "Split route" }).click();
// await clickMap(page, 512, 468);
// await page.getByRole("button", { name: "Finish" }).click();

// await page.getByText("Unnamed Scheme 1").click();
// await expect(
// page.getByRole("link", {
// name: "Route from ",
// })
// ).toHaveCount(2);
// await page.getByText("Unnamed Scheme 1").click();
// });
test("creating a new point in pipeline mode opens a form", async () => {
await page.getByRole("button", { name: "New point" }).click();
await clickMap(page, 500, 500);

await expect(page.getByLabel("Description")).toBeVisible();
});

test("creating a new freehand polygon and canceling doesn't save anything", async () => {
await page.getByRole("button", { name: "New polygon (freehand)" }).click();
await clickMap(page, 500, 500);
await clickMap(page, 400, 500);
await clickMap(page, 400, 600);

await page.getByRole("button", { name: "Cancel" }).click();
await page.getByText("Untitled Subscheme").click();

await expect(
page.getByRole("button", { name: "Delete subscheme" })
).toBeVisible();
await expect(
page.getByRole("link", { name: "Untitled area" })
).not.toBeVisible();
await page.getByText("Untitled Subscheme").click();
});

test("deleting the last subscheme", async () => {
await page.getByText("Untitled Subscheme").click();

await expect(
page.getByRole("button", { name: "Delete subscheme" })
).toBeVisible();
await expect(
page.getByRole("button", { name: "Delete subscheme" })
).not.toBeEnabled();
await page.getByText("Untitled Subscheme").click();
});

test("deleting an empty subscheme", async () => {
await page.getByRole("button", { name: "Add Subscheme" }).click();
await page.getByText("Unnamed Scheme 1").click();
await expect(
page.getByRole("button", { name: "Delete subscheme" })
).toBeVisible();
await page.getByRole("button", { name: "Delete subscheme" }).click();
await page
.getByRole("button", {
name: "Delete this subscheme and related interventions",
})
.click();

await expect(page.getByText("Unnamed Scheme 1")).not.toBeVisible();
});

test("deleting a non-empty subscheme", async () => {
await page.getByRole("button", { name: "Add Subscheme" }).click();

await drawPoint(page);
await drawPoint(page, "Unnamed Scheme 1");

await page.getByText("Untitled Subscheme").click();

await expect(
page.getByRole("button", { name: "Delete subscheme" })
).toBeVisible();
await page.getByRole("button", { name: "Delete subscheme" }).click();
await page
.getByRole("button", {
name: "Delete this subscheme and related interventions",
})
.click();

await expect(page.getByText("Untitled Subscheme")).not.toBeVisible();
});

test("split route within subscheme", async () => {
await page.getByRole("button", { name: "Add Subscheme" }).click();

await page.getByRole("button", { name: "New route" }).click();
await clickMap(page, 522, 468);
await clickMap(page, 192, 513);
await page.getByRole("button", { name: "Finish" }).click();
await page.getByLabel("Subscheme Name").selectOption("Unnamed Scheme 1");
await page.getByRole("button", { name: "Save" }).click();

await page.getByText("Unnamed Scheme 1").click();
await expect(
page.getByRole("link", {
name: "Route from ",
})
).toHaveCount(1);
await page.getByText("Unnamed Scheme 1").click();

await page.getByRole("button", { name: "Split route" }).click();
await clickMap(page, 512, 468);
await page.getByRole("button", { name: "Finish" }).click();

await page.getByText("Unnamed Scheme 1").click();
await expect(
page.getByRole("link", {
name: "Route from ",
})
).toHaveCount(2);
await page.getByText("Unnamed Scheme 1").click();
});

test("renaming a subscheme which contains features", async () => {
await page.getByRole("button", { name: "Add Subscheme" }).click();
Expand Down

0 comments on commit 87a1705

Please sign in to comment.