Skip to content

Commit

Permalink
filechooserは発火しないっぽい。仕様をファイル選択ではなくダウンロードに書き換えるのが良さそう?
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Jan 4, 2025
1 parent 529c58e commit 6c559a6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/e2e/browser/音声書き出し.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
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("音声書き出し", () => {
Expand Down Expand Up @@ -31,10 +43,12 @@ test.describe("音声書き出し", () => {
});

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

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

// FileChooserでいけるかも
// https://playwright.dev/docs/api/class-filechooser
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(path.join(tempDir, "output.wav"));
});
});

0 comments on commit 6c559a6

Please sign in to comment.