Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/billing-web/e2e/checkout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 11 additions & 9 deletions apps/billing-web/src/views/ResultView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,25 @@ 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',
value: pendingOperation()
}
})

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 () => {
Expand Down
12 changes: 11 additions & 1 deletion apps/billing-web/src/views/ResultView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ const outcome = computed<BillingOutcome>(() => {
}
})

// 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'
)

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
const returnResult = computed(() => ({
result: outcome.value,
reference: checkout.projection.value.operationId
Expand All @@ -78,7 +85,10 @@ const returnResult = computed(() => ({

<template>
<HostedSurface :return-result="returnResult">
<p v-if="recovering" class="m-0 text-sm text-muted-foreground">
<p
v-if="recovering || awaitingServer"
class="m-0 text-sm text-muted-foreground"
>
{{ t('hosted.result.recovering') }}
</p>
<p
Expand Down
Loading