diff --git a/apps/billing-web/e2e/checkout.spec.ts b/apps/billing-web/e2e/checkout.spec.ts index afbcb61d3ac..e63221faeaf 100644 --- a/apps/billing-web/e2e/checkout.spec.ts +++ b/apps/billing-web/e2e/checkout.spec.ts @@ -363,9 +363,13 @@ test('reloading on the result page while pending recovers it and shows the settl await signIn(entryPath('result')) + await expect( + page.getByRole('link', { name: 'Return to ComfyUI' }) + ).toHaveAttribute('href', /billing_ref=op_pending/) + await expect(page.getByText('Checking on your payment…')).toBeVisible() await expect( page.getByRole('heading', { name: 'Review payment' }) - ).toBeVisible() + ).toHaveCount(0) await expect( page.getByRole('region', { name: 'Payment complete' }) ).toHaveCount(0) diff --git a/apps/billing-web/src/views/ResultView.test.ts b/apps/billing-web/src/views/ResultView.test.ts index 9ce9d5b66fa..e112bad8a5c 100644 --- a/apps/billing-web/src/views/ResultView.test.ts +++ b/apps/billing-web/src/views/ResultView.test.ts @@ -48,7 +48,7 @@ async function renderResult(options: FakeBillingClientOptions = {}) { } describe('ResultView', () => { - it('recovers what the scope is waiting on and shows where it stands', async () => { + it('recovers what the scope is waiting on and says it is still checking while the server settles', async () => { const fake = await renderResult({ recover: { status: 'ok', @@ -56,15 +56,17 @@ describe('ResultView', () => { } }) - const step = await screen.findByRole('region', { name: 'Review payment' }) - expect(fake.recover).toHaveBeenCalledOnce() - expect(step).toHaveAttribute('data-billing-step', 'preview') - expect( - screen.getByRole('link', { name: 'Return to ComfyUI' }) - ).toHaveAttribute( - 'href', - 'https://testcloud.comfy.org/?billing_result=pending&billing_ref=op_1' + await vi.waitFor(() => + expect( + screen.getByRole('link', { name: 'Return to ComfyUI' }) + ).toHaveAttribute( + 'href', + 'https://testcloud.comfy.org/?billing_result=pending&billing_ref=op_1' + ) ) + expect(fake.recover).toHaveBeenCalledOnce() + expect(screen.getByText('Checking on your payment…')).toBeInTheDocument() + expect(screen.queryByRole('region', { name: 'Review payment' })).toBeNull() }) it('says the recovery failed rather than that no payment exists', async () => { diff --git a/apps/billing-web/src/views/ResultView.vue b/apps/billing-web/src/views/ResultView.vue index c6c7f1fef38..3c474e51b64 100644 --- a/apps/billing-web/src/views/ResultView.vue +++ b/apps/billing-web/src/views/ResultView.vue @@ -70,6 +70,13 @@ const outcome = computed(() => { } }) +// No confirm form here: an operation in the preview step awaits the server. +const awaitingServer = computed( + () => + checkout.operation.value !== undefined && + checkout.projection.value.step === 'preview' +) + const returnResult = computed(() => ({ result: outcome.value, reference: checkout.projection.value.operationId @@ -78,7 +85,10 @@ const returnResult = computed(() => ({