test(chat): enforce locked image URL masking
Docker Image / Build and Push Docker Image (push) Successful in 2m15s
Docker Image / Build and Push Docker Image (push) Successful in 2m15s
This commit is contained in:
@@ -75,13 +75,13 @@ export const paidImageChatSendResponse = {
|
||||
messageId: paidImageMessageId,
|
||||
isGuest: true,
|
||||
timestamp: 1_782_180_725_000,
|
||||
image: { type: "elio_schedule", url: paidImageUrl },
|
||||
image: { type: "elio_schedule", url: null },
|
||||
lockDetail: { locked: true, showContent: true, showUpgrade: true, reason: "image", hint: "Activate VIP to unlock the full photo.", detail: null },
|
||||
};
|
||||
|
||||
export function createPaidImageHistoryResponse(unlocked: boolean) {
|
||||
return {
|
||||
messages: [{ role: "assistant", type: "image", content: unlocked ? "" : paidImageChatSendResponse.reply, id: paidImageMessageId, created_at: "2026-06-30T00:00:00.000Z", audioUrl: null, image: { type: "elio_schedule", url: paidImageUrl }, lockDetail: unlocked ? { locked: false, showContent: true, showUpgrade: false, reason: null, hint: null, detail: null } : paidImageChatSendResponse.lockDetail }],
|
||||
messages: [{ role: "assistant", type: "image", content: unlocked ? "" : paidImageChatSendResponse.reply, id: paidImageMessageId, created_at: "2026-06-30T00:00:00.000Z", audioUrl: null, image: { type: "elio_schedule", url: unlocked ? paidImageUrl : null }, lockDetail: unlocked ? { locked: false, showContent: true, showUpgrade: false, reason: null, hint: null, detail: null } : paidImageChatSendResponse.lockDetail }],
|
||||
total: 1, limit: 50, offset: 0, isVip: unlocked, privateFreeLimit: 0, privateUsedToday: 0, privateCanViewFree: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
export async function completeVipPayment(page: Page) {
|
||||
const checkoutButton = page.getByRole("button", { name: "Pay and Top Up" });
|
||||
await expect(checkoutButton).toBeDisabled();
|
||||
await page.getByRole("button", { name: /Monthly,/i }).click();
|
||||
const renewalDialog = page.getByRole("dialog", {
|
||||
name: "Automatic Renewal Confirmation",
|
||||
});
|
||||
await expect(renewalDialog).toBeVisible();
|
||||
await renewalDialog.getByRole("button", { name: "Confirm" }).click();
|
||||
await expect(checkoutButton).toBeEnabled();
|
||||
|
||||
const createOrderRequestPromise = page.waitForRequest("**/api/payment/create-order");
|
||||
const orderStatusRequestPromise = page.waitForRequest("**/api/payment/order-status**");
|
||||
await page.getByRole("button", { name: /Pay and Activ/i }).click();
|
||||
await checkoutButton.click();
|
||||
const createOrderRequest = await createOrderRequestPromise;
|
||||
expect(createOrderRequest.postDataJSON()).toMatchObject({ planId: "vip_monthly", payChannel: "stripe" });
|
||||
await orderStatusRequestPromise;
|
||||
|
||||
Reference in New Issue
Block a user