test(e2e): cover chat limit payment flow
This commit is contained in:
@@ -3,12 +3,14 @@ import type { Page } from "@playwright/test";
|
||||
import {
|
||||
apiEnvelope,
|
||||
chatSendResponse,
|
||||
createPaymentOrderResponse,
|
||||
createChatSendResponse,
|
||||
createWeeklyLimitChatSendResponse,
|
||||
e2eEmailUser,
|
||||
emptyChatHistoryResponse,
|
||||
emailLoginResponse,
|
||||
guestLoginResponse,
|
||||
paidPaymentOrderStatusResponse,
|
||||
paymentPlansResponse,
|
||||
userEntitlementsResponse,
|
||||
vipStatusResponse,
|
||||
@@ -66,6 +68,14 @@ export async function mockCoreApis(
|
||||
await route.fulfill({ json: apiEnvelope(paymentPlansResponse) });
|
||||
});
|
||||
|
||||
await page.route("**/api/payment/create-order", async (route) => {
|
||||
await route.fulfill({ json: apiEnvelope(createPaymentOrderResponse) });
|
||||
});
|
||||
|
||||
await page.route("**/api/payment/order-status**", async (route) => {
|
||||
await route.fulfill({ json: apiEnvelope(paidPaymentOrderStatusResponse) });
|
||||
});
|
||||
|
||||
await page.route("**/api/payment/vip-status**", async (route) => {
|
||||
await route.fulfill({ json: apiEnvelope(vipStatusResponse) });
|
||||
});
|
||||
|
||||
@@ -165,6 +165,23 @@ export const paymentPlansResponse = {
|
||||
],
|
||||
};
|
||||
|
||||
export const paymentOrderId = "order_e2e_vip_monthly";
|
||||
|
||||
export const createPaymentOrderResponse = {
|
||||
orderId: paymentOrderId,
|
||||
payParams: {
|
||||
provider: "stripe",
|
||||
clientSecret: "pi_e2e_secret_mock",
|
||||
},
|
||||
};
|
||||
|
||||
export const paidPaymentOrderStatusResponse = {
|
||||
orderId: paymentOrderId,
|
||||
status: "paid",
|
||||
orderType: "vip_monthly",
|
||||
planId: "vip_monthly",
|
||||
};
|
||||
|
||||
export const vipStatusResponse = {
|
||||
isVip: false,
|
||||
expiresAt: null,
|
||||
|
||||
Reference in New Issue
Block a user