From fd56a5d919a2b508a5b63002078d263bccdea18a Mon Sep 17 00:00:00 2001 From: arrow2nd <44780846+arrow2nd@users.noreply.github.com> Date: Sun, 3 Nov 2024 20:44:34 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20VRT=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/vrt/poem-card.spec.ts | 84 ++++++++++--------------------------- 1 file changed, 21 insertions(+), 63 deletions(-) diff --git a/tests/vrt/poem-card.spec.ts b/tests/vrt/poem-card.spec.ts index 5f322b7..e3ea9d5 100644 --- a/tests/vrt/poem-card.spec.ts +++ b/tests/vrt/poem-card.spec.ts @@ -1,77 +1,35 @@ -import { Poem } from "types/poem"; import { expect, test } from "../fixtures"; import { getWaveMask } from "./mask"; -const poems: Poem[] = [ +const poems = [ // 句点で改行 - { - id: "ShinySummer_SakuragiMano", - idolName: "櫻木真乃", - clothesTitle: "シャイニーサマー", - clothesName: "シャイニーサマー", - text: "1stシーズンの水着。めぐるちゃんとお揃い柄♪" - }, + "ShinySummer_SakuragiMano", // 最初の句点で改行 - { - id: "One_Day_Officer", - idolName: "櫻木真乃", - clothesTitle: "ワンデイシリーズ", - clothesName: "ワンデイオフィサー", - text: "勤務回想録。敬礼。みなさんの元へ急行しますっ" - }, + "One_Day_Officer", // "!"で改行 - { - id: "DressUpParfum_SakuragiMano", - idolName: "櫻木真乃", - clothesTitle: "ドレスアップパルファム", - clothesName: "ドレスアップパルファム", - text: "Cheers! 泡沫の間の輝き" - }, + "DressUpParfum_SakuragiMano", // "!"で改行 - { - id: "FashionableSummer_SakuragiMano", - idolName: "櫻木真乃", - clothesTitle: "ファッショナブルサマー", - clothesName: "ファッショナブルサマー", - text: "サマーダイブ!とうめいな空と海で遊ぶ" - }, + "FashionableSummer_SakuragiMano", // 改行なし - { - id: "BaitwudeiRestaurant_SakuragiMano", - idolName: "櫻木真乃", - clothesTitle: "バイトゥデイレストラント", - clothesName: "バイトゥデイレストラント", - text: "いらっしゃいませ、輝ける場所へ" - } + "BaitwudeiRestaurant_SakuragiMano" ]; -test("カードのレイアウトが変化していない @desktop", async ({ shinyPoems }) => { - const { page } = shinyPoems; +for (const poem of poems) { + test(`カードのレイアウトが変化していない (${poem}) @desktop`, async ({ + shinyPoems + }) => { + const { page } = shinyPoems; - // 検索結果を上書き - await page.route("/", async (route, req) => { - if (req.method() !== "POST") { - return route.continue(); - } + await page.goto(`/?id=${poem}`); - const response = await route.fetch(); - const body = `0:["$@1",["development",null]] -1:{"poems":${JSON.stringify(poems)}} -`; + await shinyPoems.page + .getByTestId("poem-card-text") + .first() + .waitFor({ state: "visible" }); - return route.fulfill({ response, body }); + await expect(page).toHaveScreenshot({ + fullPage: true, + mask: getWaveMask(page) + }); }); - - await page.goto("/"); - await shinyPoems.searchByQuery("test"); - - await shinyPoems.page - .getByTestId("poem-card-text") - .first() - .waitFor({ state: "visible" }); - - await expect(page).toHaveScreenshot({ - fullPage: true, - mask: getWaveMask(page) - }); -}); +}