mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-18 11:30:39 +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)
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { TopUpCreditsDialog } from '@e2e/fixtures/components/TopUpCreditsDialog'
|
|
|
|
test.describe('TopUpCredits dialog', { tag: '@ui' }, () => {
|
|
let dialog: TopUpCreditsDialog
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
dialog = new TopUpCreditsDialog(comfyPage.page)
|
|
})
|
|
|
|
test('displays dialog with heading and preset amounts', async () => {
|
|
await dialog.open()
|
|
|
|
await expect(dialog.heading).toBeVisible()
|
|
await expect(dialog.preset10).toBeVisible()
|
|
await expect(dialog.preset25).toBeVisible()
|
|
await expect(dialog.preset50).toBeVisible()
|
|
await expect(dialog.preset100).toBeVisible()
|
|
})
|
|
|
|
test('displays insufficient credits message when opened with flag', async () => {
|
|
await dialog.open({ isInsufficientCredits: true })
|
|
|
|
await expect(dialog.insufficientHeading).toBeVisible()
|
|
await expect(dialog.root).toContainText(
|
|
"You don't have enough credits to run this workflow"
|
|
)
|
|
})
|
|
|
|
test('selecting a preset amount updates the pay amount', async () => {
|
|
await dialog.open()
|
|
|
|
// Default preset is $50, click $10 instead
|
|
await dialog.preset10.click()
|
|
|
|
await expect(dialog.payAmountInput).toHaveValue('10')
|
|
})
|
|
|
|
test('close button dismisses dialog', async () => {
|
|
await dialog.open()
|
|
|
|
await dialog.closeButton.click()
|
|
await expect(dialog.root).toBeHidden()
|
|
})
|
|
|
|
test('pricing details link points to docs pricing page', async () => {
|
|
await dialog.open()
|
|
|
|
await expect(dialog.pricingLink).toBeVisible()
|
|
await expect(dialog.pricingLink).toHaveAttribute(
|
|
'href',
|
|
/partner-nodes\/pricing/
|
|
)
|
|
await expect(dialog.pricingLink).toHaveAttribute('target', '_blank')
|
|
})
|
|
})
|