Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

辞書ダイアログのe2eテスト作成 #1467

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/e2e/browser/初回起動時.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ test.beforeEach(async ({ page }) => {
});

test("起動したら「利用規約に関するお知らせ」が表示される", async ({ page }) => {
await expect(page.getByText("利用規約に関するお知らせ")).toBeVisible();
await expect(page.getByText("利用規約に関するお知らせ")).toBeVisible({
timeout: 30 * 1000,
});
});
21 changes: 21 additions & 0 deletions tests/e2e/browser/辞書ダイアログ.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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 page.waitForTimeout(100);
await page.getByRole("button", { name: "設定" }).click();
await page.waitForTimeout(100);
await page.getByText("読み方&アクセント辞書").click();
await page.waitForTimeout(100);
await expect(page.getByText("読み方&アクセント辞書")).toBeVisible();
await expect(page.getByText("単語一覧")).toBeVisible();
});
4 changes: 3 additions & 1 deletion tests/e2e/navigators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { expect, Page } from "@playwright/test";
* 初回起動時の確認を完了してメイン画面に移動
*/
export async function navigateToMain(page: Page) {
await expect(page.getByText("利用規約に関するお知らせ")).toBeVisible();
await expect(page.getByText("利用規約に関するお知らせ")).toBeVisible({
timeout: 30 * 1000,
});
await page.waitForTimeout(100);
await page.getByRole("button", { name: "同意して使用開始" }).click();
await page.waitForTimeout(100);
Expand Down