@@ -4,7 +4,6 @@ import type { Page, Request } from '@playwright/test'
44import type { RemoteConfig } from '@/platform/remoteConfig/types'
55import type {
66 BillingOpStatusResponse ,
7- BillingStatusResponse ,
87 CreateTopupResponse
98} from '@/platform/workspace/api/workspaceApi'
109
@@ -29,8 +28,8 @@ import {
2928 * shared `comfyPage` fixture can't boot (it expects the OSS devtools backend).
3029 * Instead this drives a raw page: mock Firebase auth + every boot endpoint so
3130 * the cloud app initializes against fully stubbed data. The facade routes a
32- * personal workspace through the workspace `/api/billing/ *` endpoints (mocked
33- * with an active Pro subscription). The tile
31+ * personal workspace through the legacy `/customers/ *` endpoints (mocked with
32+ * an active Pro subscription). The tile
3433 * should then render its total / progress bar / monthly+additional breakdown /
3534 * add-credits.
3635 */
@@ -42,8 +41,6 @@ const jsonRoute = (body: unknown) => ({
4241 body : JSON . stringify ( body )
4342} )
4443
45- // Legacy `/customers/balance` and workspace `/api/billing/balance` share the
46- // same response shape, so one body fulfills both endpoints.
4744const balanceRoute = ( balance : {
4845 amount : number
4946 monthly : number
@@ -60,14 +57,6 @@ const balanceRoute = (balance: {
6057// 6000 -> 12,660 total; 5000 -> 10,550 monthly remaining; 1000 -> 2,110 extra.
6158const DEFAULT_BALANCE = { amount : 6000 , monthly : 5000 , prepaid : 1000 }
6259
63- const mockBillingStatus : BillingStatusResponse = {
64- is_active : true ,
65- subscription_tier : 'PRO' ,
66- subscription_duration : 'MONTHLY' ,
67- renewal_date : '2099-02-20T12:00:00Z' ,
68- has_funds : true
69- }
70-
7160async function mockCloudBoot ( page : Page , billingControlEnabled = true ) {
7261 // Frontend-origin boot endpoints (proxied to the backend in production).
7362 // `/api/features` is the remote-config source for the billing UX rollout.
@@ -125,7 +114,7 @@ async function mockCloudBoot(page: Page, billingControlEnabled = true) {
125114 )
126115 )
127116
128- // Legacy billing (flag-off path, api.comfy.org/customers/*).
117+ // Legacy account billing (api.comfy.org/customers/*).
129118 await page . route ( '**/customers/cloud-subscription-status' , ( r ) =>
130119 r . fulfill (
131120 jsonRoute ( {
@@ -140,32 +129,16 @@ async function mockCloudBoot(page: Page, billingControlEnabled = true) {
140129 await page . route ( '**/customers/balance' , ( r ) =>
141130 r . fulfill ( balanceRoute ( DEFAULT_BALANCE ) )
142131 )
143-
144- // Workspace billing (flag-on path) — a personal workspace now routes through
145- // `/api/billing/*`.
146- await page . route ( '**/api/billing/status' , ( r ) =>
147- r . fulfill ( jsonRoute ( mockBillingStatus ) )
148- )
149- await page . route ( '**/api/billing/balance' , ( r ) =>
150- r . fulfill ( balanceRoute ( DEFAULT_BALANCE ) )
151- )
152- await page . route ( '**/api/billing/plans' , ( r ) =>
153- r . fulfill ( jsonRoute ( { plans : [ ] } ) )
154- )
155132}
156133
157134async function mockBalance (
158135 page : Page ,
159136 balance : { amount : number ; monthly : number ; prepaid : number }
160137) {
161138 await page . unroute ( '**/customers/balance' )
162- await page . unroute ( '**/api/billing/balance' )
163139 await page . route ( '**/customers/balance' , ( r ) =>
164140 r . fulfill ( balanceRoute ( balance ) )
165141 )
166- await page . route ( '**/api/billing/balance' , ( r ) =>
167- r . fulfill ( balanceRoute ( balance ) )
168- )
169142}
170143
171144async function openSettings ( page : Page ) {
0 commit comments