Skip to content

Commit 0785ab3

Browse files
dante01yoonampagent
andcommitted
test: preserve cloud fixture billing behavior
Amp-Thread-ID: https://ampcode.com/threads/T-019fbba1-3994-7630-a20c-19b9965b4fd2 Co-authored-by: Amp <amp@ampcode.com>
1 parent 8ad17bb commit 0785ab3

3 files changed

Lines changed: 41 additions & 1 deletion

File tree

browser_tests/fixtures/ComfyPage.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import MCR from 'monocart-coverage-reports'
66
import { COVERAGE_OUTPUT_DIR } from '@e2e/coverageConfig'
77
import { TOURS, TOUR_SEEN_SETTING } from '@/platform/onboarding/onboardingTours'
88
import { NodeBadgeMode } from '@/types/nodeSource'
9+
import {
10+
EMPTY_BILLING_BALANCE,
11+
EMPTY_BILLING_PLANS,
12+
LEGACY_PERSONAL_BILLING_STATUS
13+
} from '@e2e/fixtures/data/cloudWorkspace'
914
import { ComfyActionbar } from '@e2e/fixtures/components/Actionbar'
1015
import { ComfyTemplates } from '@e2e/fixtures/components/Templates'
1116
import { ComfyMouse } from '@e2e/fixtures/ComfyMouse'
@@ -566,6 +571,15 @@ export const comfyPageFixture = base.extend<{
566571
await context.route('**/api/auth/session', (route) =>
567572
route.fulfill({ status: 204 })
568573
)
574+
await context.route('**/api/billing/status', (route) =>
575+
route.fulfill({ json: LEGACY_PERSONAL_BILLING_STATUS })
576+
)
577+
await context.route('**/api/billing/balance', (route) =>
578+
route.fulfill({ json: EMPTY_BILLING_BALANCE })
579+
)
580+
await context.route('**/api/billing/plans', (route) =>
581+
route.fulfill({ json: EMPTY_BILLING_PLANS })
582+
)
569583
await mockWorkspace(context, workspace('personal', 'owner'), [])
570584
await comfyPage.cloudAuth.mockAuth()
571585
}

browser_tests/fixtures/data/cloudWorkspace.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { BillingStatusResponse as IngestBillingStatusResponse } from '@comfyorg/ingest-types'
1+
import type {
2+
BillingBalanceResponse,
3+
BillingPlansResponse,
4+
BillingStatusResponse as IngestBillingStatusResponse
5+
} from '@comfyorg/ingest-types'
26

37
import type {
48
Member,
@@ -9,6 +13,26 @@ import type { RemoteConfig } from '@/platform/remoteConfig/types'
913

1014
export const CLOUD_REMOTE_CONFIG: RemoteConfig = {}
1115

16+
export const LEGACY_PERSONAL_BILLING_STATUS = {
17+
billing_rail: 'legacy_stripe',
18+
billing_status: 'inactive',
19+
has_funds: true,
20+
is_active: false,
21+
subscription_status: 'ended',
22+
subscription_tier: 'FREE',
23+
team_credit_stop: null
24+
} satisfies IngestBillingStatusResponse
25+
26+
export const EMPTY_BILLING_BALANCE = {
27+
amount_micros: 0,
28+
currency: 'usd',
29+
effective_balance_micros: 0
30+
} satisfies BillingBalanceResponse
31+
32+
export const EMPTY_BILLING_PLANS = {
33+
plans: []
34+
} satisfies BillingPlansResponse
35+
1236
export const TEAM_WORKSPACE: WorkspaceWithRole = {
1337
id: 'ws-team',
1438
name: 'Team Comfy',

browser_tests/fixtures/utils/cloudBootMocks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { RemoteConfig } from '@/platform/remoteConfig/types'
55
import { mockSystemStats } from '@e2e/fixtures/data/systemStats'
66
import { CloudAuthHelper } from '@e2e/fixtures/helpers/CloudAuthHelper'
77
import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute'
8+
import { mockWorkspace, workspace } from '@e2e/fixtures/utils/workspaceMocks'
89

910
interface CloudBootOptions {
1011
/** Remote-config payload for `/api/features` (enables the flags under test). */
@@ -47,6 +48,7 @@ export async function mockCloudBoot(
4748
await page.route('**/api/auth/session', (r) =>
4849
r.fulfill(jsonRoute({ token: 'mock-workspace-token' }))
4950
)
51+
await mockWorkspace(page, workspace('personal', 'owner'), [])
5052
await page.route('**/releases**', (r) => r.fulfill(jsonRoute([])))
5153
}
5254

0 commit comments

Comments
 (0)