mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-11 16:30:57 +00:00
## Summary - Add Playwright E2E tests for `CancelSubscriptionDialogContent` and `TopUpCreditsDialogContentLegacy` - CancelSubscription tests: dialog display with date formatting, keep subscription dismiss, confirm cancel with mocked API, error handling on API failure - TopUpCredits tests: dialog display with preset amounts, insufficient credits variant, preset selection, close button dismiss, pricing link visibility Part of the FixIt Burndown test coverage initiative (Untested Dialogs). ## Test plan - [ ] Verify tests pass in CI against OSS build - [ ] `pnpm test:browser:local -- browser_tests/tests/dialogs/cancelSubscriptionDialog.spec.ts` - [ ] `pnpm test:browser:local -- browser_tests/tests/dialogs/topUpCreditsDialog.spec.ts` ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10969-test-add-E2E-tests-for-billing-dialogs-CancelSubscription-TopUpCredits-33c6d73d36508164b268c08c99464ca1) by [Unito](https://www.unito.io)
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { CancelSubscriptionDialog } from '@e2e/fixtures/components/CancelSubscriptionDialog'
|
|
|
|
test.describe('CancelSubscription dialog', { tag: '@ui' }, () => {
|
|
let dialog: CancelSubscriptionDialog
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
dialog = new CancelSubscriptionDialog(comfyPage.page)
|
|
})
|
|
|
|
test('displays dialog with title and formatted date', async () => {
|
|
await dialog.open('2025-12-31T12:00:00Z')
|
|
|
|
await expect(dialog.heading).toBeVisible()
|
|
await expect(dialog.root).toContainText('December 31, 2025')
|
|
})
|
|
|
|
test('"Keep subscription" button closes dialog', async () => {
|
|
await dialog.open()
|
|
|
|
await dialog.keepSubscriptionButton.click()
|
|
await expect(dialog.root).toBeHidden()
|
|
})
|
|
|
|
test('Escape key closes dialog', async ({ comfyPage }) => {
|
|
await dialog.open()
|
|
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
await expect(dialog.root).toBeHidden()
|
|
})
|
|
|
|
test('"Cancel subscription" button initiates cancellation flow', async () => {
|
|
await dialog.open()
|
|
|
|
await expect(dialog.confirmCancelButton).toBeEnabled()
|
|
|
|
await dialog.confirmCancelButton.click()
|
|
|
|
// Next state: dialog closes once the cancellation flow completes
|
|
await expect(dialog.root).toBeHidden()
|
|
})
|
|
})
|