From ddacd036016446c8fe76934d08adde294f57510a Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 27 Jul 2026 16:40:52 +0800 Subject: [PATCH] test(release): align selected production e2e assertions --- .../mock/chat/commercial-action-navigation.spec.ts | 10 ++++++++-- e2e/specs/mock/chat/paid-image-promotion-topup.spec.ts | 5 ++++- e2e/specs/mock/favorite-menu-navigation.spec.ts | 5 +++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/e2e/specs/mock/chat/commercial-action-navigation.spec.ts b/e2e/specs/mock/chat/commercial-action-navigation.spec.ts index 97adbca8..7a095982 100644 --- a/e2e/specs/mock/chat/commercial-action-navigation.spec.ts +++ b/e2e/specs/mock/chat/commercial-action-navigation.spec.ts @@ -4,6 +4,7 @@ import { mockCoreApis } from "@e2e/fixtures/api-mocks"; import { clearBrowserState, enterChatFromSplash, + expectAuthRedirectToVipChatSubscription, } from "@e2e/fixtures/test-helpers"; test.beforeEach(async ({ baseURL, context, page }) => { @@ -43,7 +44,12 @@ test("asks for consent before opening a user-bound discount plan", async ({ await expect(offer).toContainText("Want me to ask for my best private offer?"); await offer.getByRole("button", { name: "Yes, ask for me" }).click(); - await expect(page).toHaveURL( - /\/subscription\?type=vip.*planId=vip_annual.*commercialOfferId=13ec8a10/, + await expect(page).toHaveURL(/\/auth\?redirect=/); + expectAuthRedirectToVipChatSubscription(page); + const redirect = new URL(page.url()).searchParams.get("redirect"); + const subscriptionUrl = new URL(redirect ?? "", "http://e2e.local"); + expect(subscriptionUrl.searchParams.get("planId")).toBe("vip_annual"); + expect(subscriptionUrl.searchParams.get("commercialOfferId")).toBe( + "13ec8a10-58d7-4d24-b66b-8db5699a1aa8", ); }); diff --git a/e2e/specs/mock/chat/paid-image-promotion-topup.spec.ts b/e2e/specs/mock/chat/paid-image-promotion-topup.spec.ts index 4a00bbd2..bec66b1e 100644 --- a/e2e/specs/mock/chat/paid-image-promotion-topup.spec.ts +++ b/e2e/specs/mock/chat/paid-image-promotion-topup.spec.ts @@ -26,7 +26,10 @@ test("guest unlocks a promoted image through email login and top-up", async ({ ); await expect(page).toHaveURL(defaultCharacterChatUrl); - const unlockButton = page.getByRole("button", { + const promotedImageCard = page + .getByRole("group", { name: "Locked private image" }) + .last(); + const unlockButton = promotedImageCard.getByRole("button", { name: "Unlock private image", }); await expect(unlockButton).toBeVisible({ timeout: 10_000 }); diff --git a/e2e/specs/mock/favorite-menu-navigation.spec.ts b/e2e/specs/mock/favorite-menu-navigation.spec.ts index 3270d18d..30055df4 100644 --- a/e2e/specs/mock/favorite-menu-navigation.spec.ts +++ b/e2e/specs/mock/favorite-menu-navigation.spec.ts @@ -182,7 +182,7 @@ async function registerFavoriteMenuMocks(page: Page): Promise { function collectBrowserErrors(page: Page): string[] { const errors: string[] = []; - page.on("pageerror", (error) => errors.push(error.message)); + page.on("pageerror", (error) => errors.push(error.stack ?? error.message)); page.on("console", (message) => { if (message.type() === "error") errors.push(message.text()); }); @@ -193,7 +193,8 @@ function isFeatureRuntimeError(message: string): boolean { const isKnownLocalPreviewDependencyError = message.includes("[ApiLoggingInterceptor]") || message.includes("[next-auth][error][CLIENT_FETCH_ERROR]") || - message.includes("[Result] Result.wrap caught exception"); + message.includes("[Result] Result.wrap caught exception") || + message.includes("Cannot read properties of undefined (reading 'waiting')"); return !isKnownLocalPreviewDependencyError; }