Repository navigation
fix(agent): say Add credits does not start a Cloud plan on the agent paywall #22979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
50b38c8
fix(agent): say Add credits does not start a Cloud plan on the agent …
christian-byrne eb5db31
test(agent): assert the full plan-note text on the agent paywall e2e
christian-byrne 7a72aec
fix(agent): offer Subscribe with the no-plan note, and show it on the…
christian-byrne 8ff93b4
test(agent): add the agent paywall plan-note baseline from CI
christian-byrne b491e64
test(agent): pin the zero-free-runs plan note in the agent paywall e2e
christian-byrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import type { BillingStatusResponse } from '@comfyorg/ingest-types' | ||
|
|
||
| import { zAgentAdmissionError } from '@/workbench/extensions/agent/schemas/agentApiSchema' | ||
|
|
||
| export const AGENT_NO_FUNDS_ERROR = zAgentAdmissionError.parse({ | ||
| error: { | ||
| message: | ||
| 'This workspace is out of funds. Add credits or subscribe to keep going.', | ||
| reason: 'no_funds', | ||
| type: 'PAYMENT_REQUIRED' | ||
| } | ||
| }) | ||
|
|
||
| export const NEVER_SUBSCRIBED_BILLING_STATUS = { | ||
| billing_rail: 'stripe', | ||
| billing_status: 'inactive', | ||
| has_funds: false, | ||
| is_active: false, | ||
| max_seats: 1, | ||
| occupied_seats: 1, | ||
| scoped_effective_has_funds: { agent: false }, | ||
| scoped_has_funds: { agent: false }, | ||
| scheduled_change: null, | ||
| next_charge: null, | ||
| subscription_state: 'never_subscribed', | ||
| subscription_tier: 'FREE', | ||
| ended_at: null, | ||
| team_credit_stop: null | ||
| } satisfies BillingStatusResponse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { expect } from '@playwright/test' | ||
|
|
||
| import enMessages from '@/locales/en/main.json' with { type: 'json' } | ||
|
|
||
| import { waitForCloudApp } from '@e2e/fixtures/cloudAppFixture' | ||
| import { | ||
| AGENT_NO_FUNDS_ERROR, | ||
| NEVER_SUBSCRIBED_BILLING_STATUS | ||
| } from '@e2e/fixtures/data/agent/agentPaywallPlanNote' | ||
| import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' | ||
| import { expectElementScreenshot } from '@e2e/fixtures/utils/screenshotRegion' | ||
| import { AGENT_COMPOSER_LABEL } from '@e2e/fixtures/utils/agentComposerLabel' | ||
| import { agentTest } from '@e2e/tests/agent/agentPanelMocks' | ||
|
|
||
| agentTest.describe( | ||
| 'Agent paywall for an account without a plan', | ||
| { tag: ['@cloud', '@ui'] }, | ||
| () => { | ||
| agentTest.beforeEach(async ({ page, agentPanel }) => { | ||
| await page.route('**/api/billing/status', (route) => | ||
| route.fulfill(jsonRoute(NEVER_SUBSCRIBED_BILLING_STATUS)) | ||
| ) | ||
| await page.route('**/api/agent/threads/*/messages', (route) => | ||
| route.request().method() === 'POST' | ||
| ? route.fulfill({ ...jsonRoute(AGENT_NO_FUNDS_ERROR), status: 402 }) | ||
| : route.fallback() | ||
| ) | ||
| await page.reload() | ||
| await waitForCloudApp(page) | ||
| await agentPanel.open() | ||
| }) | ||
|
|
||
| agentTest( | ||
| 'says buying credits does not start a Cloud plan', | ||
| { tag: '@screenshot' }, | ||
| async ({ page }) => { | ||
| const panel = page.locator('#agent-panel-root') | ||
| await panel | ||
| .getByRole('button', { name: enMessages.agent.switchWorkflow }) | ||
| .click() | ||
| await page | ||
| .getByRole('menuitemradio', { name: 'Unsaved Workflow', exact: true }) | ||
| .click() | ||
| await panel | ||
| .getByRole('textbox', { name: AGENT_COMPOSER_LABEL }) | ||
| .fill('Make a red fox in the snow') | ||
| await panel.getByRole('button', { name: enMessages.agent.send }).click() | ||
|
|
||
| const card = panel | ||
| .getByRole('alert') | ||
| .filter({ hasText: enMessages.agent.paywall.title }) | ||
| await expect(card).toBeVisible() | ||
| await expect( | ||
| card.getByRole('button', { | ||
| name: enMessages.agent.paywall.addCredits | ||
| }) | ||
| ).toBeVisible() | ||
| await expect( | ||
| card.getByRole('button', { | ||
| name: enMessages.agent.paywall.subscribe, | ||
| exact: true | ||
| }) | ||
| ).toBeVisible() | ||
| await expect(card.getByTestId('agent-paywall-plan-note')).toHaveText( | ||
| enMessages.credits.topUp.planRequiredSubscribe | ||
| ) | ||
| await expectElementScreenshot(card, 'agent-paywall-plan-note.png') | ||
| } | ||
| ) | ||
| } | ||
| ) | ||
Binary file added
BIN
+11.8 KB
.../agentPaywallPlanNote.spec.ts-snapshots/agent-paywall-plan-note-cloud-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.