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

[wip] test: 音声書き出しe2eテスト #2473

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.11.0
20
54 changes: 54 additions & 0 deletions tests/e2e/browser/音声書き出し.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os from "node:os";
import fs from "node:fs";
import path from "node:path";
import { test, expect } from "@playwright/test";

import { gotoHome, navigateToMain } from "../navigators";
import { getQuasarMenu } from "../locators";

// 書き出し先用のディレクトリを作る
let tempDir: string;
test.beforeAll(async () => {
tempDir = fs.mkdtempSync(os.tmpdir() + "/");
});
test.afterAll(async () => {
fs.rmSync(tempDir, { recursive: true });
});

test.beforeEach(gotoHome);

test.describe("音声書き出し", () => {
test.beforeEach(async ({ page }) => {
// テキスト欄を適当に3行ほど埋める
await navigateToMain(page);

const accentPhrase = page.locator(".accent-phrase");

await page.getByRole("textbox", { name: "1行目" }).click();
await page.getByRole("textbox", { name: "1行目" }).fill("1行目");
await page.getByRole("textbox", { name: "1行目" }).press("Enter");
await expect(accentPhrase).not.toHaveCount(0);

await page.getByRole("button").filter({ hasText: "add" }).click();
await page.getByRole("textbox", { name: "2行目" }).click();
await page.getByRole("textbox", { name: "2行目" }).fill("2行目");
await page.getByRole("textbox", { name: "2行目" }).press("Enter");
await expect(accentPhrase).not.toHaveCount(0);

await page.getByRole("button").filter({ hasText: "add" }).click();
await page.getByRole("textbox", { name: "3行目" }).click();
await page.getByRole("textbox", { name: "3行目" }).fill("3行目");
await page.getByRole("textbox", { name: "3行目" }).press("Enter");
await expect(accentPhrase).not.toHaveCount(0);
});

test("選択中の音声を書き出し", async ({ page }) => {
const fileChooserPromise = page.waitForEvent("filechooser");

await page.getByRole("button", { name: "ファイル" }).click();
await getQuasarMenu(page, "選択音声を書き出し").click();

const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(path.join(tempDir, "output.wav"));
});
});
Loading