From 529c58e952f898a103bb919e56107df3e6a7f5e9 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sun, 5 Jan 2025 00:23:10 +0900 Subject: [PATCH 1/2] =?UTF-8?q?wip-=E9=9F=B3=E5=A3=B0=E6=9B=B8=E3=81=8D?= =?UTF-8?q?=E5=87=BA=E3=81=97e2e=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .node-version | 2 +- ...3\201\215\345\207\272\343\201\227.spec.ts" | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 "tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" diff --git a/.node-version b/.node-version index 7af24b7ddb..209e3ef4b6 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -22.11.0 +20 diff --git "a/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" "b/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" new file mode 100644 index 0000000000..dc2f7102c5 --- /dev/null +++ "b/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" @@ -0,0 +1,40 @@ +import { test, expect } from "@playwright/test"; + +import { gotoHome, navigateToMain } from "../navigators"; +import { getQuasarMenu } from "../locators"; + +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 }) => { + await page.getByRole("button", { name: "ファイル" }).click(); + await getQuasarMenu(page, "選択音声を書き出し").click(); + + // FileChooserでいけるかも + // https://playwright.dev/docs/api/class-filechooser + }); +}); From 6c559a62babc3bf29191fda02b0490358a0783a5 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sun, 5 Jan 2025 01:02:42 +0900 Subject: [PATCH 2/2] =?UTF-8?q?filechooser=E3=81=AF=E7=99=BA=E7=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=AA=E3=81=84=E3=81=A3=E3=81=BD=E3=81=84=E3=80=82?= =?UTF-8?q?=E4=BB=95=E6=A7=98=E3=82=92=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F=E3=83=80?= =?UTF-8?q?=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E3=81=AB=E6=9B=B8?= =?UTF-8?q?=E3=81=8D=E6=8F=9B=E3=81=88=E3=82=8B=E3=81=AE=E3=81=8C=E8=89=AF?= =?UTF-8?q?=E3=81=95=E3=81=9D=E3=81=86=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...43\201\215\345\207\272\343\201\227.spec.ts" | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git "a/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" "b/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" index dc2f7102c5..e5a9a2e011 100644 --- "a/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" +++ "b/tests/e2e/browser/\351\237\263\345\243\260\346\233\270\343\201\215\345\207\272\343\201\227.spec.ts" @@ -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("音声書き出し", () => { @@ -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")); }); });