mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
test: assert cancel dialog billing request
This commit is contained in:
@@ -2,6 +2,7 @@ import type { Page } from '@playwright/test'
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import type { WorkspaceStore } from '@e2e/types/globals'
|
||||
import type { operations } from '@/types/comfyRegistryTypes'
|
||||
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
||||
|
||||
async function openCancelSubscriptionDialog(page: Page, cancelAt?: string) {
|
||||
@@ -57,6 +58,20 @@ test.describe('CancelSubscription dialog', { tag: '@ui' }, () => {
|
||||
comfyPage
|
||||
}) => {
|
||||
const { page } = comfyPage
|
||||
const mockBillingPortalResponse: NonNullable<
|
||||
operations['AccessBillingPortal']['responses']['200']['content']['application/json']
|
||||
> = {
|
||||
billing_portal_url: 'https://billing.stripe.com/test'
|
||||
}
|
||||
let billingRequestCount = 0
|
||||
let billingRequestMethod: string | null = null
|
||||
|
||||
await page.route('**/customers/billing', async (route) => {
|
||||
billingRequestCount += 1
|
||||
billingRequestMethod = route.request().method()
|
||||
|
||||
await route.fulfill({ json: mockBillingPortalResponse })
|
||||
})
|
||||
|
||||
await openCancelSubscriptionDialog(page)
|
||||
|
||||
@@ -71,7 +86,8 @@ test.describe('CancelSubscription dialog', { tag: '@ui' }, () => {
|
||||
|
||||
await cancelBtn.click()
|
||||
|
||||
// Clicking triggers the cancellation flow which closes the dialog
|
||||
await expect.poll(() => billingRequestCount).toBe(1)
|
||||
expect(billingRequestMethod).toBe('POST')
|
||||
await expect(dialog).toBeHidden()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user