Skip to content

Commit

Permalink
テキスト追加・削除のe2eテスト実装 (#1477)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
stmtk1 and Hiroshiba authored Aug 5, 2023
1 parent 480cb2d commit a200d73
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/e2e/browser/テキスト追加・削除.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { test, expect } from "@playwright/test";

import { navigateToMain } from "../navigators";

test.beforeEach(async ({ page }) => {
const BASE_URL = "http://localhost:5173/#/home";
await page.setViewportSize({ width: 800, height: 600 });
await page.goto(BASE_URL);
});

test("+ボタンを押したら行が追加され、ゴミ箱のボタンを押したら行が削除される", async ({
page,
}) => {
await navigateToMain(page);
await expect(
page.getByRole("button").filter({ hasText: "add" })
).toBeVisible();
expect(await page.locator(".audio-cell").count()).toBe(1);
await page.getByRole("button").filter({ hasText: "add" }).click();
await page.getByRole("button").filter({ hasText: "add" }).click();
await page.getByRole("button").filter({ hasText: "add" }).click();
expect(await page.locator(".audio-cell").count()).toBe(4);
await (await page.locator(".audio-cell").all())[0].hover();
await (
await page.getByRole("button").filter({ hasText: "delete_outline" }).all()
)[0].click();
expect(await page.locator(".audio-cell").count()).toBe(3);
});

0 comments on commit a200d73

Please sign in to comment.