test(release): align selected production e2e assertions
This commit is contained in:
@@ -4,6 +4,7 @@ import { mockCoreApis } from "@e2e/fixtures/api-mocks";
|
|||||||
import {
|
import {
|
||||||
clearBrowserState,
|
clearBrowserState,
|
||||||
enterChatFromSplash,
|
enterChatFromSplash,
|
||||||
|
expectAuthRedirectToVipChatSubscription,
|
||||||
} from "@e2e/fixtures/test-helpers";
|
} from "@e2e/fixtures/test-helpers";
|
||||||
|
|
||||||
test.beforeEach(async ({ baseURL, context, page }) => {
|
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 expect(offer).toContainText("Want me to ask for my best private offer?");
|
||||||
await offer.getByRole("button", { name: "Yes, ask for me" }).click();
|
await offer.getByRole("button", { name: "Yes, ask for me" }).click();
|
||||||
|
|
||||||
await expect(page).toHaveURL(
|
await expect(page).toHaveURL(/\/auth\?redirect=/);
|
||||||
/\/subscription\?type=vip.*planId=vip_annual.*commercialOfferId=13ec8a10/,
|
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",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ test("guest unlocks a promoted image through email login and top-up", async ({
|
|||||||
);
|
);
|
||||||
await expect(page).toHaveURL(defaultCharacterChatUrl);
|
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",
|
name: "Unlock private image",
|
||||||
});
|
});
|
||||||
await expect(unlockButton).toBeVisible({ timeout: 10_000 });
|
await expect(unlockButton).toBeVisible({ timeout: 10_000 });
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ async function registerFavoriteMenuMocks(page: Page): Promise<void> {
|
|||||||
|
|
||||||
function collectBrowserErrors(page: Page): string[] {
|
function collectBrowserErrors(page: Page): string[] {
|
||||||
const errors: 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) => {
|
page.on("console", (message) => {
|
||||||
if (message.type() === "error") errors.push(message.text());
|
if (message.type() === "error") errors.push(message.text());
|
||||||
});
|
});
|
||||||
@@ -193,7 +193,8 @@ function isFeatureRuntimeError(message: string): boolean {
|
|||||||
const isKnownLocalPreviewDependencyError =
|
const isKnownLocalPreviewDependencyError =
|
||||||
message.includes("[ApiLoggingInterceptor]") ||
|
message.includes("[ApiLoggingInterceptor]") ||
|
||||||
message.includes("[next-auth][error][CLIENT_FETCH_ERROR]") ||
|
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;
|
return !isKnownLocalPreviewDependencyError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user