Skip to content

Commit

Permalink
added a test for exerciseSplit creation
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyAsh5114 committed Dec 28, 2023
1 parent 498d27d commit f67e9d3
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/exerciseSplits/create.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { test, expect } from "../fixtures";

test.beforeEach(async ({ page }) => {
await page.goto("/");
await page.getByRole("link", { name: "Exercise splits" }).click();
});

test("show no splits created", async ({ page }) => {
await expect(page.getByRole("main")).toContainText("No splits created");
await expect(page.getByRole("main")).toContainText("Create one by clicking the button below");
});

test("create split from UI", async ({ page }) => {
await page.getByRole("link", { name: "Create new split" }).click();
await page.getByRole("link", { name: "Start from scratch Create a" }).click();
await page.getByRole("link", { name: "new exercise split" }).click();

await page.getByPlaceholder("Type here").fill("Full body");
await page.locator("#day1-workout-name").fill("Full body");
await page.locator("#mark-day2-as-rest").check();
await page.locator("#mark-day3-as-rest").check();
await page.locator("#day4-workout-name").fill("Full body");
await page.locator("#mark-day5-as-rest").check();
await page.locator("#mark-day6-as-rest").check();
await page.locator("#mark-day7-as-rest").check();
await page.getByRole("button", { name: "Select exercises" }).click();

await page.getByRole("button", { name: "Add exercise", exact: true }).click();
await page.getByLabel("Exercise name").fill("Exercise 1");
await page.getByLabel("Muscle group Select a muscle").selectOption("Chest");
await page.getByLabel("Sets", { exact: true }).fill("1");
await page.getByPlaceholder("From").fill("1");
await page.getByPlaceholder("To").fill("2");
await page.getByRole("button", { name: "add exercise", exact: true }).click();
await page.getByRole("button", { name: "Copy" }).click();
await page.getByLabel("Full body").nth(1).check();
await page.getByRole("button", { name: "Paste" }).click();
await page.getByRole("button", { name: "Create exercise split" }).click();
await expect(page.locator("#Success")).toContainText(
"✕ Success Exercise split created successfully"
);
await page.locator("#Success").getByTestId("close-modal-button").click();
await expect(page.getByRole("main")).toContainText("Full body");
});

0 comments on commit f67e9d3

Please sign in to comment.