From e4ac6849f12f8f6b55e7e3356e63baf09de5ac82 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 27 Aug 2026 14:32:48 -0700 Subject: [PATCH 1/6] test: cover post-first-run continuation handoff --- .../onboarding/first_run_tour_contract.json | 49 ++++++++ .../components/FirstRunContinuation.ts | 9 ++ .../fixtures/components/FirstRunNudge.ts | 19 +++ browser_tests/fixtures/data/postFirstRun.ts | 98 +++++++++++++++ .../fixtures/helpers/PostFirstRunHelper.ts | 76 ++++++++++++ browser_tests/fixtures/postFirstRunFixture.ts | 34 +++++ .../postFirstRunContinuations.spec.ts | 117 ++++++++++++++++++ 7 files changed, 402 insertions(+) create mode 100644 browser_tests/assets/onboarding/first_run_tour_contract.json create mode 100644 browser_tests/fixtures/components/FirstRunContinuation.ts create mode 100644 browser_tests/fixtures/components/FirstRunNudge.ts create mode 100644 browser_tests/fixtures/data/postFirstRun.ts create mode 100644 browser_tests/fixtures/helpers/PostFirstRunHelper.ts create mode 100644 browser_tests/fixtures/postFirstRunFixture.ts create mode 100644 browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts diff --git a/browser_tests/assets/onboarding/first_run_tour_contract.json b/browser_tests/assets/onboarding/first_run_tour_contract.json new file mode 100644 index 00000000000..c6880e640a9 --- /dev/null +++ b/browser_tests/assets/onboarding/first_run_tour_contract.json @@ -0,0 +1,49 @@ +{ + "last_node_id": 27, + "last_link_id": 0, + "nodes": [ + { + "id": 27, + "type": "CLIPTextEncode", + "pos": [80, 120], + "size": [425, 180], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [{ "name": "clip", "type": "CLIP", "link": null }], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": null, + "slot_index": 0 + } + ], + "properties": { "Node name for S&R": "CLIPTextEncode" }, + "widgets_values": ["A bright landscape"] + }, + { + "id": 9, + "type": "SaveImage", + "pos": [700, 120], + "size": [315, 100], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [{ "name": "images", "type": "IMAGE", "link": null }], + "outputs": [], + "properties": { "Node name for S&R": "SaveImage" }, + "widgets_values": ["ComfyUI"] + } + ], + "links": [], + "groups": [], + "config": {}, + "extra": { + "ds": { + "offset": [0, 0], + "scale": 1 + } + }, + "version": 0.4 +} diff --git a/browser_tests/fixtures/components/FirstRunContinuation.ts b/browser_tests/fixtures/components/FirstRunContinuation.ts new file mode 100644 index 00000000000..b350ef3f943 --- /dev/null +++ b/browser_tests/fixtures/components/FirstRunContinuation.ts @@ -0,0 +1,9 @@ +import type { Page } from '@playwright/test' + +export class FirstRunContinuation { + constructor(private readonly page: Page) {} + + get outputImage() { + return this.page.locator('[data-node-id="10"] img') + } +} diff --git a/browser_tests/fixtures/components/FirstRunNudge.ts b/browser_tests/fixtures/components/FirstRunNudge.ts new file mode 100644 index 00000000000..edd9bce1ff2 --- /dev/null +++ b/browser_tests/fixtures/components/FirstRunNudge.ts @@ -0,0 +1,19 @@ +import type { Locator, Page } from '@playwright/test' + +import type { FirstRunNudgeAction } from '@e2e/fixtures/data/postFirstRun' + +export class FirstRunNudge { + public readonly root: Locator + public readonly actions: Locator + + constructor(private readonly page: Page) { + this.root = page.getByTestId('first-run-nudge') + this.actions = this.root.getByTestId( + /^first-run-nudge-(animate|upscale|restyle)$/ + ) + } + + action(id: FirstRunNudgeAction): Locator { + return this.page.getByTestId(`first-run-nudge-${id}`) + } +} diff --git a/browser_tests/fixtures/data/postFirstRun.ts b/browser_tests/fixtures/data/postFirstRun.ts new file mode 100644 index 00000000000..515e6cea923 --- /dev/null +++ b/browser_tests/fixtures/data/postFirstRun.ts @@ -0,0 +1,98 @@ +import type { PromptResponse } from '@comfyorg/ingest-types' + +import type { AssetResponse } from '@/platform/assets/schemas/assetSchema' +import type { RemoteConfig } from '@/platform/remoteConfig/types' +import type { BillingStatusResponse } from '@/platform/workspace/api/workspaceApi' +import type { ResultItem } from '@/schemas/apiSchema' + +import { makeTemplate } from '@e2e/fixtures/data/templateFixtures' + +export const FIRST_RUN_START_TEMPLATE_ID = 'image_z_image_turbo' +export const FIRST_RUN_JOB_ID = 'post-first-run-continuation' + +export const FIRST_RUN_NUDGE_ACTIONS = [ + { + id: 'animate', + title: 'Animate it', + templateId: 'video_minimax_h3_i2v_continuation' + }, + { + id: 'upscale', + title: 'Upscale it', + templateId: 'utility_seedvr2_7b_int8_upscale_image' + }, + { + id: 'restyle', + title: 'Restyle with Nano Banana', + templateId: 'api_google_nano_banana2_image_edit_continuation' + } +] as const + +export type FirstRunNudgeAction = (typeof FIRST_RUN_NUDGE_ACTIONS)[number]['id'] + +const continuationInput = { + nodeId: 10, + nodeType: 'LoadImage', + file: 'example.png', + mediaType: 'image' +} + +export const FIRST_RUN_TEMPLATES = [ + makeTemplate({ + name: FIRST_RUN_START_TEMPLATE_ID, + title: 'Z-Image Turbo' + }), + ...FIRST_RUN_NUDGE_ACTIONS.map(({ templateId, title }) => + makeTemplate({ + name: templateId, + title, + io: { inputs: [continuationInput] } + }) + ) +] + +export const FIRST_RUN_FEATURE_FLAGS = { + onboarding_tour_enabled: true, + subscription_required: true +} satisfies RemoteConfig + +export const ACTIVE_FIRST_RUN_SUBSCRIPTION = { + is_active: true, + max_seats: 1, + occupied_seats: 1, + team_credit_stop: null, + subscription_tier: 'PRO', + subscription_duration: 'MONTHLY', + renewal_date: '2099-01-01', + has_funds: true +} satisfies BillingStatusResponse + +export const QUEUED_FIRST_RUN_PROMPT = { + prompt_id: FIRST_RUN_JOB_ID, + number: 1, + node_errors: {} +} satisfies PromptResponse + +export const FIRST_RUN_OUTPUT = { + filename: 'first-run-output.webp', + subfolder: '', + type: 'output' +} satisfies ResultItem + +export const FIRST_RUN_ASSETS = { + assets: [ + { + id: 'first-run-output', + name: 'First run output.webp', + hash: FIRST_RUN_OUTPUT.filename, + mime_type: 'image/webp', + tags: ['output'], + created_at: '2026-08-27T12:00:00Z', + updated_at: '2026-08-27T12:00:00Z' + } + ], + total: 1, + has_more: false +} satisfies AssetResponse + +export const FIRST_RUN_OUTPUT_WIDGET_VALUE = 'first-run-output.webp [output]' diff --git a/browser_tests/fixtures/helpers/PostFirstRunHelper.ts b/browser_tests/fixtures/helpers/PostFirstRunHelper.ts new file mode 100644 index 00000000000..929c3c7d29b --- /dev/null +++ b/browser_tests/fixtures/helpers/PostFirstRunHelper.ts @@ -0,0 +1,76 @@ +import { expect } from '@playwright/test' + +import enMessages from '@/locales/en/main.json' with { type: 'json' } + +import type { ComfyPage } from '@e2e/fixtures/ComfyPage' +import type { OnboardingCoachmarks } from '@e2e/fixtures/components/Tour' +import { + FIRST_RUN_JOB_ID, + FIRST_RUN_OUTPUT, + FIRST_RUN_START_TEMPLATE_ID, + QUEUED_FIRST_RUN_PROMPT +} from '@e2e/fixtures/data/postFirstRun' +import type { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' +import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' + +const { firstRun } = enMessages.onboardingCoachmarks + +/** Drives the complete first-success path that precedes a continuation. */ +export class PostFirstRunHelper { + constructor( + private readonly comfyPage: ComfyPage, + private readonly onboarding: OnboardingCoachmarks, + private readonly execution: ExecutionHelper + ) {} + + async completeTourWithImage(): Promise { + const { page } = this.comfyPage + const gettingStarted = page.getByRole('dialog', { + name: enMessages.gettingStarted.title + }) + + await page.route( + '**/api/prompt', + (route) => route.fulfill(jsonRoute(QUEUED_FIRST_RUN_PROMPT)), + { times: 1 } + ) + + await expect(gettingStarted).toBeVisible() + await page + .getByTestId(`getting-started-card-${FIRST_RUN_START_TEMPLATE_ID}`) + .click() + + await expect(gettingStarted).toBeHidden() + await expect(this.onboarding.spotlight).toBeVisible() + await expect(this.onboarding.card).toContainText('Step 1 of 3') + + await this.onboarding.cardNextButton.click() + await expect( + this.onboarding.card.getByText(firstRun.run.title) + ).toBeVisible() + + await this.comfyPage.runButton.click() + await expect( + this.onboarding.card.getByText(firstRun.result.generating.title) + ).toBeVisible({ timeout: 15_000 }) + + this.execution.executionStart(FIRST_RUN_JOB_ID) + this.execution.executed(FIRST_RUN_JOB_ID, '9', { + images: [FIRST_RUN_OUTPUT] + }) + this.execution.executionSuccess(FIRST_RUN_JOB_ID) + + await expect( + this.onboarding.card.getByText(firstRun.result.image.title) + ).toBeVisible({ timeout: 15_000 }) + await this.onboarding.cardDoneButton.click() + await expect(this.onboarding.card).toBeHidden() + } + + async loadedContinuationInput(): Promise { + const loadImages = + await this.comfyPage.nodeOps.getNodeRefsByType('LoadImage') + if (loadImages.length !== 1) return null + return (await loadImages[0].getWidget(0)).getValue() + } +} diff --git a/browser_tests/fixtures/postFirstRunFixture.ts b/browser_tests/fixtures/postFirstRunFixture.ts new file mode 100644 index 00000000000..2285f7aea8c --- /dev/null +++ b/browser_tests/fixtures/postFirstRunFixture.ts @@ -0,0 +1,34 @@ +import { mergeTests } from '@playwright/test' + +import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' +import { FirstRunContinuation } from '@e2e/fixtures/components/FirstRunContinuation' +import { FirstRunNudge } from '@e2e/fixtures/components/FirstRunNudge' +import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' +import { PostFirstRunHelper } from '@e2e/fixtures/helpers/PostFirstRunHelper' +import { templateApiFixture } from '@e2e/fixtures/templateApiFixture' +import { onboardingFixture } from '@e2e/fixtures/tourFixture' +import { webSocketFixture } from '@e2e/fixtures/ws' + +const base = mergeTests( + comfyPageFixture, + onboardingFixture, + templateApiFixture, + webSocketFixture +) + +export const postFirstRunFixture = base.extend<{ + firstRunContinuation: FirstRunContinuation + firstRunNudge: FirstRunNudge + postFirstRun: PostFirstRunHelper +}>({ + firstRunContinuation: async ({ page }, use) => { + await use(new FirstRunContinuation(page)) + }, + firstRunNudge: async ({ page }, use) => { + await use(new FirstRunNudge(page)) + }, + postFirstRun: async ({ comfyPage, getWebSocket, onboarding }, use) => { + const execution = new ExecutionHelper(comfyPage, await getWebSocket()) + await use(new PostFirstRunHelper(comfyPage, onboarding, execution)) + } +}) diff --git a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts new file mode 100644 index 00000000000..7edee3da366 --- /dev/null +++ b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts @@ -0,0 +1,117 @@ +import { expect } from '@playwright/test' + +import { + ACTIVE_FIRST_RUN_SUBSCRIPTION, + FIRST_RUN_ASSETS, + FIRST_RUN_FEATURE_FLAGS, + FIRST_RUN_NUDGE_ACTIONS, + FIRST_RUN_OUTPUT, + FIRST_RUN_OUTPUT_WIDGET_VALUE, + FIRST_RUN_START_TEMPLATE_ID, + FIRST_RUN_TEMPLATES +} from '@e2e/fixtures/data/postFirstRun' +import { withTemplates } from '@e2e/fixtures/helpers/TemplateHelper' +import { postFirstRunFixture as test } from '@e2e/fixtures/postFirstRunFixture' +import { assetPath } from '@e2e/fixtures/utils/paths' +import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' +import { mockViewFiles } from '@e2e/fixtures/utils/viewFileMocks' + +/** + * Covers the frontend handoff contract with a synthetic LoadImage workflow. + * Published template graphs and their runtime execution are separate gates. + */ +test.describe( + 'Post-first-run continuations', + { tag: ['@cloud', '@ui'] }, + () => { + test.describe.configure({ timeout: 60_000 }) + + test.use({ + initialSettings: { + 'Comfy.Assets.UseAssetAPI': true, + 'Comfy.TutorialCompleted': false, + 'Comfy.OnboardingCoachmarks.Seen': ['appMode'], + 'Comfy.VueNodes.Enabled': true + }, + initialFeatureFlags: { onboarding_tour_enabled: true } + }) + + test.beforeEach(async ({ page, templateApi }) => { + templateApi.configure(withTemplates([...FIRST_RUN_TEMPLATES])) + await templateApi.mock() + + await page.route('**/api/features', (route) => + route.fulfill(jsonRoute(FIRST_RUN_FEATURE_FLAGS)) + ) + await page.route('**/api/billing/status', (route) => + route.fulfill(jsonRoute(ACTIVE_FIRST_RUN_SUBSCRIPTION)) + ) + await page.route('**/api/assets**', (route) => + route.fulfill(jsonRoute(FIRST_RUN_ASSETS)) + ) + await page.route('**/internal/files/output**', (route) => + route.fulfill(jsonRoute([FIRST_RUN_OUTPUT_WIDGET_VALUE])) + ) + await page.route( + `**/templates/${FIRST_RUN_START_TEMPLATE_ID}.json`, + (route) => + route.fulfill({ + contentType: 'application/json', + // Synthetic graph matching the tour's pinned prompt and output roles. + path: assetPath('onboarding/first_run_tour_contract.json') + }) + ) + for (const { templateId } of FIRST_RUN_NUDGE_ACTIONS) { + await page.route(`**/templates/${templateId}.json`, (route) => + route.fulfill({ + contentType: 'application/json', + path: assetPath('widgets/load_image_widget.json') + }) + ) + } + await mockViewFiles(page, { + [FIRST_RUN_OUTPUT.filename]: { + contentType: 'image/webp', + path: assetPath('image64x64.webp') + }, + [FIRST_RUN_OUTPUT_WIDGET_VALUE]: { + contentType: 'image/webp', + path: assetPath('image64x64.webp') + } + }) + }) + + for (const action of FIRST_RUN_NUDGE_ACTIONS) { + test(`passes the first output to the ${action.title} template contract`, async ({ + comfyPage, + firstRunContinuation, + firstRunNudge, + page, + postFirstRun + }) => { + test.slow() + + await postFirstRun.completeTourWithImage() + + await expect(firstRunNudge.root).toBeVisible({ timeout: 10_000 }) + await expect(firstRunNudge.actions).toHaveCount(3) + await expect(firstRunNudge.action(action.id)).toContainText( + action.title + ) + + const requestedTemplate = page.waitForRequest( + `**/templates/${action.templateId}.json` + ) + await firstRunNudge.action(action.id).click() + await requestedTemplate + + await expect(firstRunNudge.root).toBeHidden() + await expect.poll(() => comfyPage.nodeOps.getNodeCount()).toBe(1) + await expect + .poll(() => postFirstRun.loadedContinuationInput()) + .toBe(FIRST_RUN_OUTPUT_WIDGET_VALUE) + await expect(firstRunContinuation.outputImage).toBeVisible() + }) + } + } +) From d85a6a6a4167c8080fc6783e75129d84a0532c9d Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 27 Aug 2026 15:39:18 -0700 Subject: [PATCH 2/6] test: reuse first-run tour fixtures across onboarding suites Shares the billing, remote-config, asset and queued-prompt mocks the two first-run suites had each declared, sources nudge copy from the locale the card renders from, and walks to the Run step instead of pinning a step count. --- .../components/FirstRunContinuation.ts | 9 -- .../fixtures/components/FirstRunNudge.ts | 17 ++-- browser_tests/fixtures/components/Tour.ts | 8 ++ browser_tests/fixtures/data/assetFixtures.ts | 13 ++- browser_tests/fixtures/data/cloudWorkspace.ts | 18 ++++ browser_tests/fixtures/data/firstRunTour.ts | 88 +++++++++++++++++ browser_tests/fixtures/data/postFirstRun.ts | 98 ------------------- .../fixtures/helpers/PostFirstRunHelper.ts | 68 ++++++++++--- browser_tests/fixtures/postFirstRunFixture.ts | 5 - .../gettingStartedTour.spec.ts | 66 ++++--------- .../postFirstRunContinuations.spec.ts | 59 +++++++---- 11 files changed, 247 insertions(+), 202 deletions(-) delete mode 100644 browser_tests/fixtures/components/FirstRunContinuation.ts create mode 100644 browser_tests/fixtures/data/firstRunTour.ts delete mode 100644 browser_tests/fixtures/data/postFirstRun.ts rename browser_tests/tests/{ => onboarding}/gettingStartedTour.spec.ts (90%) diff --git a/browser_tests/fixtures/components/FirstRunContinuation.ts b/browser_tests/fixtures/components/FirstRunContinuation.ts deleted file mode 100644 index b350ef3f943..00000000000 --- a/browser_tests/fixtures/components/FirstRunContinuation.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Page } from '@playwright/test' - -export class FirstRunContinuation { - constructor(private readonly page: Page) {} - - get outputImage() { - return this.page.locator('[data-node-id="10"] img') - } -} diff --git a/browser_tests/fixtures/components/FirstRunNudge.ts b/browser_tests/fixtures/components/FirstRunNudge.ts index edd9bce1ff2..01930226d06 100644 --- a/browser_tests/fixtures/components/FirstRunNudge.ts +++ b/browser_tests/fixtures/components/FirstRunNudge.ts @@ -1,19 +1,24 @@ import type { Locator, Page } from '@playwright/test' -import type { FirstRunNudgeAction } from '@e2e/fixtures/data/postFirstRun' +import { FIRST_RUN_NUDGE_ACTIONS } from '@e2e/fixtures/data/firstRunTour' +import type { FirstRunNudgeAction } from '@e2e/fixtures/data/firstRunTour' +const ACTION_TEST_IDS = new RegExp( + `^first-run-nudge-(${FIRST_RUN_NUDGE_ACTIONS.map(({ id }) => id).join('|')})$` +) + +/** Post-first-run discovery card (FirstRunTourNudge.vue). */ export class FirstRunNudge { public readonly root: Locator + /** The continuation actions only — the browse-all button is not one. */ public readonly actions: Locator - constructor(private readonly page: Page) { + constructor(page: Page) { this.root = page.getByTestId('first-run-nudge') - this.actions = this.root.getByTestId( - /^first-run-nudge-(animate|upscale|restyle)$/ - ) + this.actions = this.root.getByTestId(ACTION_TEST_IDS) } action(id: FirstRunNudgeAction): Locator { - return this.page.getByTestId(`first-run-nudge-${id}`) + return this.root.getByTestId(`first-run-nudge-${id}`) } } diff --git a/browser_tests/fixtures/components/Tour.ts b/browser_tests/fixtures/components/Tour.ts index 9c1569cc8e2..544120b0c74 100644 --- a/browser_tests/fixtures/components/Tour.ts +++ b/browser_tests/fixtures/components/Tour.ts @@ -1,3 +1,4 @@ +import { expect } from '@playwright/test' import type { Locator, Page } from '@playwright/test' import { TOUR_SEEN_SETTING } from '@/platform/onboarding/onboardingTours' @@ -9,6 +10,13 @@ const TOUR_REPLAY_BUTTONS: Record = { appMode: 'Take a tour of App Mode' } +/** How many steps the card says the tour has, once it says anything. */ +export async function tourStepCount(card: Locator): Promise { + await expect(card).toContainText(/Step \d+ of \d+/) + const label = await card.textContent() + return Number(/Step \d+ of (\d+)/.exec(label ?? '')?.[1]) +} + /** Coach-mark overlay (src/platform/onboarding/TourOverlay.vue). */ export class OnboardingCoachmarks { public readonly landing: Locator diff --git a/browser_tests/fixtures/data/assetFixtures.ts b/browser_tests/fixtures/data/assetFixtures.ts index 745cb0eb57d..9761ef1117e 100644 --- a/browser_tests/fixtures/data/assetFixtures.ts +++ b/browser_tests/fixtures/data/assetFixtures.ts @@ -1,6 +1,9 @@ import type { Asset } from '@comfyorg/ingest-types' -import type { AssetItem } from '@/platform/assets/schemas/assetSchema' +import type { + AssetItem, + AssetResponse +} from '@/platform/assets/schemas/assetSchema' /** * Core-native asset shape: the ingest Asset plus the `loader_path` contract @@ -59,6 +62,14 @@ function createOutputAsset( ...overrides } } + +/** A backend serving nothing, for specs that only need the call not to escape. */ +export const EMPTY_ASSET_RESPONSE: AssetResponse = { + assets: [], + total: 0, + has_more: false +} + export const STABLE_CHECKPOINT: Asset = createModelAsset({ id: 'test-checkpoint-001', name: 'sd_xl_base_1.0.safetensors', diff --git a/browser_tests/fixtures/data/cloudWorkspace.ts b/browser_tests/fixtures/data/cloudWorkspace.ts index 03fb46ea8f1..f2de5f675f4 100644 --- a/browser_tests/fixtures/data/cloudWorkspace.ts +++ b/browser_tests/fixtures/data/cloudWorkspace.ts @@ -25,6 +25,24 @@ export const LEGACY_PERSONAL_BILLING_STATUS = { team_credit_stop: null } satisfies IngestBillingStatusResponse +/** A funded, subscribed personal workspace, so `canRunWorkflows` holds. */ +export const ACTIVE_PERSONAL_BILLING_STATUS = { + is_active: true, + max_seats: 1, + occupied_seats: 1, + team_credit_stop: null, + subscription_tier: 'PRO', + subscription_duration: 'MONTHLY', + renewal_date: '2099-01-01', + has_funds: true +} satisfies IngestBillingStatusResponse + +/** Remote config for a subscription-gated install with the first-run tour on. */ +export const ONBOARDING_TOUR_REMOTE_CONFIG = { + onboarding_tour_enabled: true, + subscription_required: true +} satisfies RemoteConfig + export const EMPTY_BILLING_BALANCE = { amount_micros: 0, currency: 'usd', diff --git a/browser_tests/fixtures/data/firstRunTour.ts b/browser_tests/fixtures/data/firstRunTour.ts new file mode 100644 index 00000000000..17bf88459e2 --- /dev/null +++ b/browser_tests/fixtures/data/firstRunTour.ts @@ -0,0 +1,88 @@ +import type { PromptResponse } from '@comfyorg/ingest-types' + +import enMessages from '@/locales/en/main.json' with { type: 'json' } +import type { SupportedTemplateId } from '@/renderer/extensions/firstRunTour/roles/tourRolePins' + +import type { TemplateMediaInfo } from '@/platform/workflow/templates/types/template' +import type { ResultItem } from '@/schemas/apiSchema' + +import { makeTemplate } from '@e2e/fixtures/data/templateFixtures' + +const { nudge } = enMessages.onboardingCoachmarks.firstRun + +/** + * The template both first-run suites tour. Typed against the pin table so + * dropping it from `TOUR_ROLE_PINS` fails to compile rather than leaving the + * suites waiting on a tour that can no longer resolve any roles. + */ +export const FIRST_RUN_START_TEMPLATE_ID: SupportedTemplateId = + 'image_z_image_turbo' + +export const FIRST_RUN_JOB_ID = 'post-first-run-continuation' + +/** A prompt the queue accepts, so a walk does not depend on the backend's models. */ +export function queuedPrompt(jobId: string) { + return { + prompt_id: jobId, + number: 1, + node_errors: {} + } satisfies PromptResponse +} + +/** + * The continuations the discovery card offers. Titles come from the locale the + * card renders from, so a copy change moves both together. + */ +export const FIRST_RUN_NUDGE_ACTIONS = [ + { + id: 'animate', + title: nudge.animate.title, + templateId: 'video_minimax_h3_i2v_continuation' + }, + { + id: 'upscale', + title: nudge.upscale.title, + templateId: 'utility_seedvr2_7b_int8_upscale_image' + }, + { + id: 'restyle', + title: nudge.restyle.title, + templateId: 'api_google_nano_banana2_image_edit_continuation' + } +] as const + +export type FirstRunNudgeAction = (typeof FIRST_RUN_NUDGE_ACTIONS)[number]['id'] + +/** + * The image input each continuation declares, pointing at the node the + * `widgets/load_image_widget` asset carries so the seeded value is readable + * off the loaded graph. + */ +export const CONTINUATION_INPUT = { + nodeId: 10, + nodeType: 'LoadImage', + file: 'example.png', + mediaType: 'image' +} satisfies TemplateMediaInfo + +export const FIRST_RUN_TEMPLATES = [ + makeTemplate({ + name: FIRST_RUN_START_TEMPLATE_ID, + title: 'Z-Image Turbo' + }), + ...FIRST_RUN_NUDGE_ACTIONS.map(({ templateId, title }) => + makeTemplate({ + name: templateId, + title, + io: { inputs: [CONTINUATION_INPUT] } + }) + ) +] + +export const FIRST_RUN_OUTPUT = { + filename: 'first-run-output.webp', + subfolder: '', + type: 'output' +} satisfies ResultItem + +export const FIRST_RUN_OUTPUT_WIDGET_VALUE = 'first-run-output.webp [output]' diff --git a/browser_tests/fixtures/data/postFirstRun.ts b/browser_tests/fixtures/data/postFirstRun.ts deleted file mode 100644 index 515e6cea923..00000000000 --- a/browser_tests/fixtures/data/postFirstRun.ts +++ /dev/null @@ -1,98 +0,0 @@ -import type { PromptResponse } from '@comfyorg/ingest-types' - -import type { AssetResponse } from '@/platform/assets/schemas/assetSchema' -import type { RemoteConfig } from '@/platform/remoteConfig/types' -import type { BillingStatusResponse } from '@/platform/workspace/api/workspaceApi' -import type { ResultItem } from '@/schemas/apiSchema' - -import { makeTemplate } from '@e2e/fixtures/data/templateFixtures' - -export const FIRST_RUN_START_TEMPLATE_ID = 'image_z_image_turbo' -export const FIRST_RUN_JOB_ID = 'post-first-run-continuation' - -export const FIRST_RUN_NUDGE_ACTIONS = [ - { - id: 'animate', - title: 'Animate it', - templateId: 'video_minimax_h3_i2v_continuation' - }, - { - id: 'upscale', - title: 'Upscale it', - templateId: 'utility_seedvr2_7b_int8_upscale_image' - }, - { - id: 'restyle', - title: 'Restyle with Nano Banana', - templateId: 'api_google_nano_banana2_image_edit_continuation' - } -] as const - -export type FirstRunNudgeAction = (typeof FIRST_RUN_NUDGE_ACTIONS)[number]['id'] - -const continuationInput = { - nodeId: 10, - nodeType: 'LoadImage', - file: 'example.png', - mediaType: 'image' -} - -export const FIRST_RUN_TEMPLATES = [ - makeTemplate({ - name: FIRST_RUN_START_TEMPLATE_ID, - title: 'Z-Image Turbo' - }), - ...FIRST_RUN_NUDGE_ACTIONS.map(({ templateId, title }) => - makeTemplate({ - name: templateId, - title, - io: { inputs: [continuationInput] } - }) - ) -] - -export const FIRST_RUN_FEATURE_FLAGS = { - onboarding_tour_enabled: true, - subscription_required: true -} satisfies RemoteConfig - -export const ACTIVE_FIRST_RUN_SUBSCRIPTION = { - is_active: true, - max_seats: 1, - occupied_seats: 1, - team_credit_stop: null, - subscription_tier: 'PRO', - subscription_duration: 'MONTHLY', - renewal_date: '2099-01-01', - has_funds: true -} satisfies BillingStatusResponse - -export const QUEUED_FIRST_RUN_PROMPT = { - prompt_id: FIRST_RUN_JOB_ID, - number: 1, - node_errors: {} -} satisfies PromptResponse - -export const FIRST_RUN_OUTPUT = { - filename: 'first-run-output.webp', - subfolder: '', - type: 'output' -} satisfies ResultItem - -export const FIRST_RUN_ASSETS = { - assets: [ - { - id: 'first-run-output', - name: 'First run output.webp', - hash: FIRST_RUN_OUTPUT.filename, - mime_type: 'image/webp', - tags: ['output'], - created_at: '2026-08-27T12:00:00Z', - updated_at: '2026-08-27T12:00:00Z' - } - ], - total: 1, - has_more: false -} satisfies AssetResponse - -export const FIRST_RUN_OUTPUT_WIDGET_VALUE = 'first-run-output.webp [output]' diff --git a/browser_tests/fixtures/helpers/PostFirstRunHelper.ts b/browser_tests/fixtures/helpers/PostFirstRunHelper.ts index 929c3c7d29b..73f59e1bf87 100644 --- a/browser_tests/fixtures/helpers/PostFirstRunHelper.ts +++ b/browser_tests/fixtures/helpers/PostFirstRunHelper.ts @@ -2,19 +2,30 @@ import { expect } from '@playwright/test' import enMessages from '@/locales/en/main.json' with { type: 'json' } +import { TOUR_ROLE_PINS } from '@/renderer/extensions/firstRunTour/roles/tourRolePins' + import type { ComfyPage } from '@e2e/fixtures/ComfyPage' import type { OnboardingCoachmarks } from '@e2e/fixtures/components/Tour' +import { tourStepCount } from '@e2e/fixtures/components/Tour' import { + CONTINUATION_INPUT, FIRST_RUN_JOB_ID, FIRST_RUN_OUTPUT, FIRST_RUN_START_TEMPLATE_ID, - QUEUED_FIRST_RUN_PROMPT -} from '@e2e/fixtures/data/postFirstRun' + queuedPrompt +} from '@e2e/fixtures/data/firstRunTour' import type { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' const { firstRun } = enMessages.onboardingCoachmarks +/** + * The roles the tour reads off the synthetic graph. The graph asset carries + * these ids by hand, so the run addresses the sink through the pin rather than + * a literal — a renumbered pin then moves both together. + */ +const START_PINS = TOUR_ROLE_PINS[FIRST_RUN_START_TEMPLATE_ID] + /** Drives the complete first-success path that precedes a continuation. */ export class PostFirstRunHelper { constructor( @@ -31,7 +42,7 @@ export class PostFirstRunHelper { await page.route( '**/api/prompt', - (route) => route.fulfill(jsonRoute(QUEUED_FIRST_RUN_PROMPT)), + (route) => route.fulfill(jsonRoute(queuedPrompt(FIRST_RUN_JOB_ID))), { times: 1 } ) @@ -41,36 +52,61 @@ export class PostFirstRunHelper { .click() await expect(gettingStarted).toBeHidden() - await expect(this.onboarding.spotlight).toBeVisible() - await expect(this.onboarding.card).toContainText('Step 1 of 3') - - await this.onboarding.cardNextButton.click() await expect( - this.onboarding.card.getByText(firstRun.run.title) + this.onboarding.spotlight, + `the tour has to start, which needs the synthetic graph to carry ${FIRST_RUN_START_TEMPLATE_ID}'s pinned roles: ${JSON.stringify(START_PINS)}` ).toBeVisible() + await this.walkToRunStep() + await this.comfyPage.runButton.click() await expect( - this.onboarding.card.getByText(firstRun.result.generating.title) + this.onboarding.card.getByText(firstRun.result.generating.title), + 'the run outlives its step, so the click moves the tour on and Result reports it' ).toBeVisible({ timeout: 15_000 }) this.execution.executionStart(FIRST_RUN_JOB_ID) - this.execution.executed(FIRST_RUN_JOB_ID, '9', { + this.execution.executed(FIRST_RUN_JOB_ID, String(START_PINS.sink.id), { images: [FIRST_RUN_OUTPUT] }) this.execution.executionSuccess(FIRST_RUN_JOB_ID) await expect( - this.onboarding.card.getByText(firstRun.result.image.title) + this.onboarding.card.getByText(firstRun.result.image.title), + 'the run produced an image, so Result has to stop saying it is still coming' ).toBeVisible({ timeout: 15_000 }) await this.onboarding.cardDoneButton.click() await expect(this.onboarding.card).toBeHidden() } - async loadedContinuationInput(): Promise { - const loadImages = - await this.comfyPage.nodeOps.getNodeRefsByType('LoadImage') - if (loadImages.length !== 1) return null - return (await loadImages[0].getWidget(0)).getValue() + /** Steps forward until the tour parks on Run, whatever its sequence is. */ + private async walkToRunStep(): Promise { + const { card, cardNextButton } = this.onboarding + const runTitle = card.getByText(firstRun.run.title) + const totalSteps = await tourStepCount(card) + + for (let step = 1; step < totalSteps; step++) { + await expect(card).toContainText(`Step ${step} of ${totalSteps}`) + if (await runTitle.isVisible()) break + await cardNextButton.click() + } + + await expect( + runTitle, + 'the tour ran out of steps before reaching the one that runs the workflow' + ).toBeVisible() + } + + /** + * The value the continuation's declared image input is carrying, or null + * while the graph swap has yet to settle on exactly one such node. + */ + async loadedContinuationInput(): Promise { + const inputs = await this.comfyPage.nodeOps.getNodeRefsByType( + CONTINUATION_INPUT.nodeType + ) + if (inputs.length !== 1) return null + const value = await (await inputs[0].getWidget(0)).getValue() + return typeof value === 'string' ? value : null } } diff --git a/browser_tests/fixtures/postFirstRunFixture.ts b/browser_tests/fixtures/postFirstRunFixture.ts index 2285f7aea8c..0b2dae9e5a8 100644 --- a/browser_tests/fixtures/postFirstRunFixture.ts +++ b/browser_tests/fixtures/postFirstRunFixture.ts @@ -1,7 +1,6 @@ import { mergeTests } from '@playwright/test' import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' -import { FirstRunContinuation } from '@e2e/fixtures/components/FirstRunContinuation' import { FirstRunNudge } from '@e2e/fixtures/components/FirstRunNudge' import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' import { PostFirstRunHelper } from '@e2e/fixtures/helpers/PostFirstRunHelper' @@ -17,13 +16,9 @@ const base = mergeTests( ) export const postFirstRunFixture = base.extend<{ - firstRunContinuation: FirstRunContinuation firstRunNudge: FirstRunNudge postFirstRun: PostFirstRunHelper }>({ - firstRunContinuation: async ({ page }, use) => { - await use(new FirstRunContinuation(page)) - }, firstRunNudge: async ({ page }, use) => { await use(new FirstRunNudge(page)) }, diff --git a/browser_tests/tests/gettingStartedTour.spec.ts b/browser_tests/tests/onboarding/gettingStartedTour.spec.ts similarity index 90% rename from browser_tests/tests/gettingStartedTour.spec.ts rename to browser_tests/tests/onboarding/gettingStartedTour.spec.ts index 1fc67ab9f69..5abe17351d7 100644 --- a/browser_tests/tests/gettingStartedTour.spec.ts +++ b/browser_tests/tests/onboarding/gettingStartedTour.spec.ts @@ -5,13 +5,20 @@ import enMessages from '@/locales/en/main.json' with { type: 'json' } import { TOUR_ROLE_PINS } from '@/renderer/extensions/firstRunTour/roles/tourRolePins' import type { SupportedTemplateId } from '@/renderer/extensions/firstRunTour/roles/tourRolePins' -import type { PromptResponse } from '@comfyorg/ingest-types' - -import type { AssetResponse } from '@/platform/assets/schemas/assetSchema' -import type { RemoteConfig } from '@/platform/remoteConfig/types' import type { BillingStatusResponse } from '@/platform/workspace/api/workspaceApi' import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' +import { FirstRunNudge } from '@e2e/fixtures/components/FirstRunNudge' +import { tourStepCount } from '@e2e/fixtures/components/Tour' +import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' +import { + ACTIVE_PERSONAL_BILLING_STATUS, + ONBOARDING_TOUR_REMOTE_CONFIG +} from '@e2e/fixtures/data/cloudWorkspace' +import { + FIRST_RUN_START_TEMPLATE_ID, + queuedPrompt +} from '@e2e/fixtures/data/firstRunTour' import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' import { onboardingFixture } from '@e2e/fixtures/tourFixture' import type { Position } from '@e2e/fixtures/types' @@ -33,30 +40,6 @@ const CARD_TESTID_PREFIX = 'getting-started-card-' /** The prompt id the tour's run is queued under, so WS events can address it. */ const TOUR_JOB_ID = 'first-run-tour-prompt' -const LINKED_TEMPLATE_ID: SupportedTemplateId = 'image_z_image_turbo' - -/** A prompt the queue accepts, so the walk does not depend on the backend's models. */ -const QUEUED_PROMPT: PromptResponse = { - prompt_id: TOUR_JOB_ID, - number: 1, - node_errors: {} -} - -const TOUR_FEATURE_FLAGS: RemoteConfig = { - onboarding_tour_enabled: true, - subscription_required: true -} - -const ACTIVE_SUBSCRIPTION: BillingStatusResponse = { - is_active: true, - max_seats: 1, - occupied_seats: 1, - team_credit_stop: null, - subscription_tier: 'PRO', - subscription_duration: 'MONTHLY', - renewal_date: '2099-01-01', - has_funds: true -} const INACTIVE_SUBSCRIPTION: BillingStatusResponse = { is_active: false, @@ -68,23 +51,10 @@ const INACTIVE_SUBSCRIPTION: BillingStatusResponse = { has_funds: false } -const NO_ASSETS: AssetResponse = { - assets: [], - total: 0, - has_more: false -} - function isPinned(id: string): id is SupportedTemplateId { return Object.hasOwn(TOUR_ROLE_PINS, id) } -/** How many steps the card says the tour has, once it says anything. */ -async function tourLength(card: Locator): Promise { - await expect(card).toContainText(/Step \d+ of \d+/) - const label = await card.textContent() - return Number(/Step \d+ of (\d+)/.exec(label ?? '')?.[1]) -} - async function clearWorkflowHistory(page: Page) { await page.evaluate(() => { for (const key of Object.keys(localStorage)) @@ -215,13 +185,13 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { test.beforeEach(async ({ page }) => { await page.route('**/api/features', (route) => - route.fulfill(jsonRoute(TOUR_FEATURE_FLAGS)) + route.fulfill(jsonRoute(ONBOARDING_TOUR_REMOTE_CONFIG)) ) await page.route('**/api/billing/status', (route) => - route.fulfill(jsonRoute(ACTIVE_SUBSCRIPTION)) + route.fulfill(jsonRoute(ACTIVE_PERSONAL_BILLING_STATUS)) ) await page.route('**/api/assets**', (route) => - route.fulfill(jsonRoute(NO_ASSETS)) + route.fulfill(jsonRoute(EMPTY_ASSET_RESPONSE)) ) }) @@ -237,7 +207,7 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { const card = page.getByTestId('coach-card') await page.route('**/api/prompt', (route) => - route.fulfill(jsonRoute(QUEUED_PROMPT)) + route.fulfill(jsonRoute(queuedPrompt(TOUR_JOB_ID))) ) await expect(screen).toBeVisible() @@ -253,7 +223,7 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { const next = card.getByRole('button', { name: 'Next' }) const runTitle = card.getByText(RUN_STEP_TITLE) - const totalSteps = await tourLength(card) + const totalSteps = await tourStepCount(card) for (let step = 1; step < totalSteps; step++) { await expect(card).toContainText(`Step ${step} of ${totalSteps}`) @@ -343,7 +313,7 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { test.slow() const { page } = comfyPage const { spotlight } = await tourToRunStep(page) - const nudge = page.getByTestId('first-run-nudge') + const nudge = new FirstRunNudge(page).root const upgradeDialog = page.getByTestId('dialog-overlay') await page.getByTestId('subscribe-to-run-button').click() @@ -383,7 +353,7 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { await clearWorkflowHistory(comfyPage.page) await comfyPage.setup({ clearStorage: false, - url: `/?template=${LINKED_TEMPLATE_ID}` + url: `/?template=${FIRST_RUN_START_TEMPLATE_ID}` }) }) diff --git a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts index 7edee3da366..a810a861ec0 100644 --- a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts +++ b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts @@ -1,19 +1,22 @@ import { expect } from '@playwright/test' +import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' import { - ACTIVE_FIRST_RUN_SUBSCRIPTION, - FIRST_RUN_ASSETS, - FIRST_RUN_FEATURE_FLAGS, + ACTIVE_PERSONAL_BILLING_STATUS, + ONBOARDING_TOUR_REMOTE_CONFIG +} from '@e2e/fixtures/data/cloudWorkspace' +import { + CONTINUATION_INPUT, FIRST_RUN_NUDGE_ACTIONS, FIRST_RUN_OUTPUT, FIRST_RUN_OUTPUT_WIDGET_VALUE, FIRST_RUN_START_TEMPLATE_ID, FIRST_RUN_TEMPLATES -} from '@e2e/fixtures/data/postFirstRun' +} from '@e2e/fixtures/data/firstRunTour' import { withTemplates } from '@e2e/fixtures/helpers/TemplateHelper' import { postFirstRunFixture as test } from '@e2e/fixtures/postFirstRunFixture' -import { assetPath } from '@e2e/fixtures/utils/paths' import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' +import { assetPath } from '@e2e/fixtures/utils/paths' import { mockViewFiles } from '@e2e/fixtures/utils/viewFileMocks' /** @@ -24,11 +27,11 @@ test.describe( 'Post-first-run continuations', { tag: ['@cloud', '@ui'] }, () => { - test.describe.configure({ timeout: 60_000 }) + // A template load, camera flights, a queued run and a graph swap do not fit the default budget. + test.describe.configure({ timeout: 120_000 }) test.use({ initialSettings: { - 'Comfy.Assets.UseAssetAPI': true, 'Comfy.TutorialCompleted': false, 'Comfy.OnboardingCoachmarks.Seen': ['appMode'], 'Comfy.VueNodes.Enabled': true @@ -41,13 +44,13 @@ test.describe( await templateApi.mock() await page.route('**/api/features', (route) => - route.fulfill(jsonRoute(FIRST_RUN_FEATURE_FLAGS)) + route.fulfill(jsonRoute(ONBOARDING_TOUR_REMOTE_CONFIG)) ) await page.route('**/api/billing/status', (route) => - route.fulfill(jsonRoute(ACTIVE_FIRST_RUN_SUBSCRIPTION)) + route.fulfill(jsonRoute(ACTIVE_PERSONAL_BILLING_STATUS)) ) await page.route('**/api/assets**', (route) => - route.fulfill(jsonRoute(FIRST_RUN_ASSETS)) + route.fulfill(jsonRoute(EMPTY_ASSET_RESPONSE)) ) await page.route('**/internal/files/output**', (route) => route.fulfill(jsonRoute([FIRST_RUN_OUTPUT_WIDGET_VALUE])) @@ -84,17 +87,20 @@ test.describe( for (const action of FIRST_RUN_NUDGE_ACTIONS) { test(`passes the first output to the ${action.title} template contract`, async ({ comfyPage, - firstRunContinuation, firstRunNudge, page, postFirstRun }) => { - test.slow() - await postFirstRun.completeTourWithImage() - await expect(firstRunNudge.root).toBeVisible({ timeout: 10_000 }) - await expect(firstRunNudge.actions).toHaveCount(3) + await expect( + firstRunNudge.root, + 'every tour ending has to leave the user somewhere to go next' + ).toBeVisible({ timeout: 10_000 }) + await expect( + firstRunNudge.actions, + 'the served catalog carries every continuation, so none are filtered out' + ).toHaveCount(FIRST_RUN_NUDGE_ACTIONS.length) await expect(firstRunNudge.action(action.id)).toContainText( action.title ) @@ -105,12 +111,27 @@ test.describe( await firstRunNudge.action(action.id).click() await requestedTemplate - await expect(firstRunNudge.root).toBeHidden() - await expect.poll(() => comfyPage.nodeOps.getNodeCount()).toBe(1) + await expect( + firstRunNudge.root, + 'the card only closes once the continuation actually loaded' + ).toBeHidden() await expect - .poll(() => postFirstRun.loadedContinuationInput()) + .poll(() => comfyPage.nodeOps.getNodeCount(), { + message: 'the continuation never replaced the tour workflow' + }) + .toBe(1) + await expect + .poll(() => postFirstRun.loadedContinuationInput(), { + message: + 'the first output never reached the metadata-declared image input' + }) .toBe(FIRST_RUN_OUTPUT_WIDGET_VALUE) - await expect(firstRunContinuation.outputImage).toBeVisible() + await expect( + comfyPage.vueNodes + .getNodeLocator(String(CONTINUATION_INPUT.nodeId)) + .locator('img'), + 'the seeded value has to resolve to an image the node can show' + ).toBeVisible() }) } } From 5726523d2e00ab1ad53bae48dfbf9138f2474e31 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 27 Aug 2026 16:13:55 -0700 Subject: [PATCH 3/6] refactor: lift first-run nudge suggestions into a shared module The card's suggestion table lived inside the SFC, so every suite covering it retyped the ids and template ids. Moving it beside the component lets the unit test parametrise over the real table and lets the e2e fixtures read the ids the card actually renders. --- .../nudge/FirstRunTourNudge.test.ts | 62 ++++++++----------- .../firstRunTour/nudge/FirstRunTourNudge.vue | 53 +++------------- .../nudge/firstRunNudgeSuggestions.ts | 44 +++++++++++++ 3 files changed, 79 insertions(+), 80 deletions(-) create mode 100644 src/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions.ts diff --git a/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts b/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts index b546fd6c47b..6a3513a4edb 100644 --- a/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts +++ b/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts @@ -7,6 +7,8 @@ import { createI18n } from 'vue-i18n' import enMessages from '@/locales/en/main.json' with { type: 'json' } import FirstRunTourNudge from './FirstRunTourNudge.vue' +import { FIRST_RUN_SUGGESTIONS } from './firstRunNudgeSuggestions' +import type { FirstRunSuggestionId } from './firstRunNudgeSuggestions' const APPEAR_DELAY_MS = 1500 const CATALOG_WAIT_MS = 3000 @@ -15,12 +17,15 @@ const FIRST_OUTPUT = { subfolder: 'tour', type: 'output' as const } -type SuggestionId = 'animate' | 'upscale' | 'restyle' -const SUGGESTION_TITLES: Record = { - animate: enMessages.onboardingCoachmarks.firstRun.nudge.animate.title, - upscale: enMessages.onboardingCoachmarks.firstRun.nudge.upscale.title, - restyle: enMessages.onboardingCoachmarks.firstRun.nudge.restyle.title +function suggestion(id: FirstRunSuggestionId) { + const found = FIRST_RUN_SUGGESTIONS.find((entry) => entry.id === id) + if (!found) throw new Error(`No such suggestion: ${id}`) + return found +} + +function suggestionTitle(id: FirstRunSuggestionId): string { + return i18n.global.t(suggestion(id).titleKey) } type Deferred = { @@ -36,11 +41,9 @@ function createDeferred(): Deferred { return { promise, resolve } } -const CATALOG_TEMPLATE_IDS = [ - 'video_minimax_h3_i2v_continuation', - 'utility_seedvr2_7b_int8_upscale_image', - 'api_google_nano_banana2_image_edit_continuation' -] +const CATALOG_TEMPLATE_IDS = FIRST_RUN_SUGGESTIONS.map( + ({ templateId }) => templateId +) /** Stands in for what the install's template package actually serves. */ function catalogEntry(name: string, withIo: boolean) { @@ -153,9 +156,9 @@ function nudge() { return screen.queryByTestId('first-run-nudge') } -function suggestionButton(id: SuggestionId) { +function suggestionButton(id: FirstRunSuggestionId) { return screen.getByRole('button', { - name: new RegExp(SUGGESTION_TITLES[id], 'i') + name: new RegExp(suggestionTitle(id), 'i') }) } @@ -190,7 +193,7 @@ describe('FirstRunTourNudge', () => { ).toBeTruthy() expect(mocks.trackOnboardingTour).toHaveBeenCalledWith('nudge_shown', { tour: 'firstRun', - suggestion_count: 3 + suggestion_count: FIRST_RUN_SUGGESTIONS.length }) }) @@ -221,20 +224,7 @@ describe('FirstRunTourNudge', () => { expect(mocks.dismissNudge).toHaveBeenCalledTimes(2) }) - it.for([ - { - id: 'animate', - templateId: 'video_minimax_h3_i2v_continuation' - }, - { - id: 'upscale', - templateId: 'utility_seedvr2_7b_int8_upscale_image' - }, - { - id: 'restyle', - templateId: 'api_google_nano_banana2_image_edit_continuation' - } - ] as const)( + it.for(FIRST_RUN_SUGGESTIONS)( 'continues the first output through $id', async ({ id, templateId }) => { const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime }) @@ -251,7 +241,7 @@ describe('FirstRunTourNudge', () => { 'nudge_suggestion_clicked', { tour: 'firstRun', - suggestion_count: 3, + suggestion_count: FIRST_RUN_SUGGESTIONS.length, suggestion: id, loaded: true } @@ -282,7 +272,7 @@ describe('FirstRunTourNudge', () => { expect(suggestionButton('animate')).toBeTruthy() expect(mocks.trackOnboardingTour).toHaveBeenCalledWith('nudge_shown', { tour: 'firstRun', - suggestion_count: 3 + suggestion_count: FIRST_RUN_SUGGESTIONS.length }) }) @@ -313,7 +303,7 @@ describe('FirstRunTourNudge', () => { expect( screen.queryByRole('button', { - name: new RegExp(SUGGESTION_TITLES.animate, 'i') + name: new RegExp(suggestionTitle('animate'), 'i') }), 'the catalog deadline already decided what the card showed and reported' ).toBeNull() @@ -354,13 +344,13 @@ describe('FirstRunTourNudge', () => { }) it('offers only the continuations the install actually serves', async () => { - mocks.catalog.value = ['utility_seedvr2_7b_int8_upscale_image'] + mocks.catalog.value = [suggestion('upscale').templateId] await showNudge() expect(suggestionButton('upscale')).toBeTruthy() expect( screen.queryByRole('button', { - name: new RegExp(SUGGESTION_TITLES.animate, 'i') + name: new RegExp(suggestionTitle('animate'), 'i') }), 'this build knows the id, but the pinned template package does not serve it' ).toBeNull() @@ -382,7 +372,7 @@ describe('FirstRunTourNudge', () => { expect( screen.queryByRole('button', { - name: new RegExp(SUGGESTION_TITLES.animate, 'i') + name: new RegExp(suggestionTitle('animate'), 'i') }), 'every action would be a dead end found by clicking it' ).toBeNull() @@ -410,7 +400,7 @@ describe('FirstRunTourNudge', () => { ).toBeTruthy() expect( screen.queryByRole('button', { - name: new RegExp(SUGGESTION_TITLES.animate, 'i') + name: new RegExp(suggestionTitle('animate'), 'i') }), 'there is nothing to seed a continuation with' ).toBeNull() @@ -475,7 +465,7 @@ describe('FirstRunTourNudge', () => { 'nudge_suggestion_clicked', { tour: 'firstRun', - suggestion_count: 3, + suggestion_count: FIRST_RUN_SUGGESTIONS.length, suggestion: 'animate', loaded: false } @@ -495,7 +485,7 @@ describe('FirstRunTourNudge', () => { expect(mocks.showTemplates).toHaveBeenCalledWith('first_run_nudge') expect(mocks.trackOnboardingTour).toHaveBeenCalledWith( 'explore_templates_clicked', - { tour: 'firstRun', suggestion_count: 3 } + { tour: 'firstRun', suggestion_count: FIRST_RUN_SUGGESTIONS.length } ) expect(mocks.dismissNudge).toHaveBeenCalled() }) diff --git a/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.vue b/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.vue index a4f9d2e2eb5..737a061c73e 100644 --- a/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.vue +++ b/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.vue @@ -108,6 +108,11 @@ import { acceptsTemplateImageInput } from '@/platform/workflow/templates/utils/t import { useDialogStore } from '@/stores/dialogStore' import { useFirstRunTourController } from '../tour/useFirstRunTourController' +import { FIRST_RUN_SUGGESTIONS } from './firstRunNudgeSuggestions' +import type { + FirstRunSuggestion, + FirstRunSuggestionId +} from './firstRunNudgeSuggestions' const APPEAR_DELAY_MS = 1500 @@ -118,46 +123,6 @@ const APPEAR_DELAY_MS = 1500 */ const CATALOG_WAIT_MS = 3000 -type SuggestionId = 'animate' | 'upscale' | 'restyle' - -interface Suggestion { - id: SuggestionId - templateId: string - titleKey: string - detailKey: string - icon: string - /** A qualifier on the action itself, such as the upscale's multiplier. */ - badgeKey?: string - /** Marks the action a paid plan is required to run, so the card says so. */ - paid?: boolean -} - -const SUGGESTIONS: Suggestion[] = [ - { - id: 'animate', - templateId: 'video_minimax_h3_i2v_continuation', - titleKey: 'onboardingCoachmarks.firstRun.nudge.animate.title', - detailKey: 'onboardingCoachmarks.firstRun.nudge.animate.detail', - icon: 'icon-[lucide--film]' - }, - { - id: 'upscale', - templateId: 'utility_seedvr2_7b_int8_upscale_image', - titleKey: 'onboardingCoachmarks.firstRun.nudge.upscale.title', - detailKey: 'onboardingCoachmarks.firstRun.nudge.upscale.detail', - icon: 'icon-[lucide--maximize-2]', - badgeKey: 'onboardingCoachmarks.firstRun.nudge.upscale.badge' - }, - { - id: 'restyle', - templateId: 'api_google_nano_banana2_image_edit_continuation', - titleKey: 'onboardingCoachmarks.firstRun.nudge.restyle.title', - detailKey: 'onboardingCoachmarks.firstRun.nudge.restyle.detail', - icon: 'icon-[ph--swatches]', - paid: true - } -] - const { t } = useI18n() const toast = useToast() const { nudgeArmed, nudgeOutput, dismissNudge } = useFirstRunTourController() @@ -167,9 +132,9 @@ const dialogStore = useDialogStore() const telemetry = useTelemetry() const titleId = useId() const subtitleId = useId() -const loadingSuggestionId = ref(null) +const loadingSuggestionId = ref(null) const delayElapsed = ref(false) -const decidedSuggestions = ref(null) +const decidedSuggestions = ref(null) let reported = false /** @@ -181,7 +146,7 @@ let reported = false const catalogSuggestions = computed(() => nudgeOutput.value === null ? [] - : SUGGESTIONS.filter(({ templateId }) => { + : FIRST_RUN_SUGGESTIONS.filter(({ templateId }) => { const template = templatesStore.getTemplateByName(templateId) return ( template?.sourceModule === 'default' && @@ -281,7 +246,7 @@ watch(onScreen, (visible) => { }) }) -async function onSuggestion(suggestion: Suggestion) { +async function onSuggestion(suggestion: FirstRunSuggestion) { const input = nudgeOutput.value if (!input || loadingSuggestionId.value) return diff --git a/src/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions.ts b/src/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions.ts new file mode 100644 index 00000000000..9603b67205a --- /dev/null +++ b/src/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions.ts @@ -0,0 +1,44 @@ +export type FirstRunSuggestionId = 'animate' | 'upscale' | 'restyle' + +export interface FirstRunSuggestion { + id: FirstRunSuggestionId + templateId: string + titleKey: string + detailKey: string + icon: string + /** A qualifier on the action itself, such as the upscale's multiplier. */ + badgeKey?: string + /** Marks the action a paid plan is required to run, so the card says so. */ + paid?: boolean +} + +/** + * The continuations the discovery card offers, in the order it lists them. + * Kept beside the card rather than inside it so the suites covering the card + * read the ids it actually renders instead of retyping them. + */ +export const FIRST_RUN_SUGGESTIONS: readonly FirstRunSuggestion[] = [ + { + id: 'animate', + templateId: 'video_minimax_h3_i2v_continuation', + titleKey: 'onboardingCoachmarks.firstRun.nudge.animate.title', + detailKey: 'onboardingCoachmarks.firstRun.nudge.animate.detail', + icon: 'icon-[lucide--film]' + }, + { + id: 'upscale', + templateId: 'utility_seedvr2_7b_int8_upscale_image', + titleKey: 'onboardingCoachmarks.firstRun.nudge.upscale.title', + detailKey: 'onboardingCoachmarks.firstRun.nudge.upscale.detail', + icon: 'icon-[lucide--maximize-2]', + badgeKey: 'onboardingCoachmarks.firstRun.nudge.upscale.badge' + }, + { + id: 'restyle', + templateId: 'api_google_nano_banana2_image_edit_continuation', + titleKey: 'onboardingCoachmarks.firstRun.nudge.restyle.title', + detailKey: 'onboardingCoachmarks.firstRun.nudge.restyle.detail', + icon: 'icon-[ph--swatches]', + paid: true + } +] From de4ea4b0fc21eb66b026db157fd0fe5959e69758 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 27 Aug 2026 16:14:18 -0700 Subject: [PATCH 4/6] test: tighten the continuation handoff suite - one walk instead of three: the per-action id-to-template mapping is already covered in FirstRunTourNudge.test.ts, so re-proving it through a full tour per action bought nothing for 3x the cloud budget - read the suggestion ids off the shared table rather than retyping them - name the test from the id, not from translatable copy - share the step walk with the sibling suite via OnboardingCoachmarks - drop the unused /internal/files/output mock - read the seeded LoadImage widget by name --- .../fixtures/components/FirstRunNudge.ts | 8 +- browser_tests/fixtures/components/Tour.ts | 35 ++++-- browser_tests/fixtures/data/firstRunTour.ts | 36 ++---- .../fixtures/helpers/PostFirstRunHelper.ts | 23 +--- .../onboarding/gettingStartedTour.spec.ts | 54 ++++----- .../postFirstRunContinuations.spec.ts | 105 +++++++++--------- 6 files changed, 118 insertions(+), 143 deletions(-) diff --git a/browser_tests/fixtures/components/FirstRunNudge.ts b/browser_tests/fixtures/components/FirstRunNudge.ts index 01930226d06..88cd1ea25d5 100644 --- a/browser_tests/fixtures/components/FirstRunNudge.ts +++ b/browser_tests/fixtures/components/FirstRunNudge.ts @@ -1,10 +1,10 @@ import type { Locator, Page } from '@playwright/test' -import { FIRST_RUN_NUDGE_ACTIONS } from '@e2e/fixtures/data/firstRunTour' -import type { FirstRunNudgeAction } from '@e2e/fixtures/data/firstRunTour' +import { FIRST_RUN_SUGGESTIONS } from '@/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions' +import type { FirstRunSuggestionId } from '@/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions' const ACTION_TEST_IDS = new RegExp( - `^first-run-nudge-(${FIRST_RUN_NUDGE_ACTIONS.map(({ id }) => id).join('|')})$` + `^first-run-nudge-(${FIRST_RUN_SUGGESTIONS.map(({ id }) => id).join('|')})$` ) /** Post-first-run discovery card (FirstRunTourNudge.vue). */ @@ -18,7 +18,7 @@ export class FirstRunNudge { this.actions = this.root.getByTestId(ACTION_TEST_IDS) } - action(id: FirstRunNudgeAction): Locator { + action(id: FirstRunSuggestionId): Locator { return this.root.getByTestId(`first-run-nudge-${id}`) } } diff --git a/browser_tests/fixtures/components/Tour.ts b/browser_tests/fixtures/components/Tour.ts index 544120b0c74..0c6d57a1714 100644 --- a/browser_tests/fixtures/components/Tour.ts +++ b/browser_tests/fixtures/components/Tour.ts @@ -10,13 +10,6 @@ const TOUR_REPLAY_BUTTONS: Record = { appMode: 'Take a tour of App Mode' } -/** How many steps the card says the tour has, once it says anything. */ -export async function tourStepCount(card: Locator): Promise { - await expect(card).toContainText(/Step \d+ of \d+/) - const label = await card.textContent() - return Number(/Step \d+ of (\d+)/.exec(label ?? '')?.[1]) -} - /** Coach-mark overlay (src/platform/onboarding/TourOverlay.vue). */ export class OnboardingCoachmarks { public readonly landing: Locator @@ -53,6 +46,34 @@ export class OnboardingCoachmarks { return this.card.filter({ hasText: new RegExp(`Step ${step} of `) }) } + /** How many steps the card says the tour has, once it says anything. */ + async stepCount(): Promise { + await expect(this.card).toContainText(/Step \d+ of \d+/) + const label = await this.card.textContent() + return Number(/Step \d+ of (\d+)/.exec(label ?? '')?.[1]) + } + + /** + * Steps forward until the card parks on the step carrying `title`, whatever + * the sequence is, and reports how many steps the tour said it had. + */ + async walkToStep(title: string): Promise { + const target = this.card.getByText(title) + const totalSteps = await this.stepCount() + + for (let step = 1; step < totalSteps; step++) { + await expect(this.card).toContainText(`Step ${step} of ${totalSteps}`) + if (await target.isVisible()) break + await this.cardNextButton.click() + } + + await expect( + target, + `the tour ran out of steps before reaching "${title}"` + ).toBeVisible() + return totalSteps + } + /** * Clears the pre-seeded seen-flag (so dismissal assertions observe it being * set again) and clicks the tour's replay button, which must be mounted. diff --git a/browser_tests/fixtures/data/firstRunTour.ts b/browser_tests/fixtures/data/firstRunTour.ts index 17bf88459e2..731d90668c6 100644 --- a/browser_tests/fixtures/data/firstRunTour.ts +++ b/browser_tests/fixtures/data/firstRunTour.ts @@ -1,6 +1,6 @@ import type { PromptResponse } from '@comfyorg/ingest-types' -import enMessages from '@/locales/en/main.json' with { type: 'json' } +import { FIRST_RUN_SUGGESTIONS } from '@/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions' import type { SupportedTemplateId } from '@/renderer/extensions/firstRunTour/roles/tourRolePins' import type { TemplateMediaInfo } from '@/platform/workflow/templates/types/template' @@ -8,8 +8,6 @@ import type { ResultItem } from '@/schemas/apiSchema' import { makeTemplate } from '@e2e/fixtures/data/templateFixtures' -const { nudge } = enMessages.onboardingCoachmarks.firstRun - /** * The template both first-run suites tour. Typed against the pin table so * dropping it from `TOUR_ROLE_PINS` fails to compile rather than leaving the @@ -29,30 +27,6 @@ export function queuedPrompt(jobId: string) { } satisfies PromptResponse } -/** - * The continuations the discovery card offers. Titles come from the locale the - * card renders from, so a copy change moves both together. - */ -export const FIRST_RUN_NUDGE_ACTIONS = [ - { - id: 'animate', - title: nudge.animate.title, - templateId: 'video_minimax_h3_i2v_continuation' - }, - { - id: 'upscale', - title: nudge.upscale.title, - templateId: 'utility_seedvr2_7b_int8_upscale_image' - }, - { - id: 'restyle', - title: nudge.restyle.title, - templateId: 'api_google_nano_banana2_image_edit_continuation' - } -] as const - -export type FirstRunNudgeAction = (typeof FIRST_RUN_NUDGE_ACTIONS)[number]['id'] - /** * The image input each continuation declares, pointing at the node the * `widgets/load_image_widget` asset carries so the seeded value is readable @@ -65,15 +39,19 @@ export const CONTINUATION_INPUT = { mediaType: 'image' } satisfies TemplateMediaInfo +/** + * Every continuation carries the `io` metadata the card's dead-end filter + * demands, so an action missing from the card means the handoff broke rather + * than the fixture being thin. + */ export const FIRST_RUN_TEMPLATES = [ makeTemplate({ name: FIRST_RUN_START_TEMPLATE_ID, title: 'Z-Image Turbo' }), - ...FIRST_RUN_NUDGE_ACTIONS.map(({ templateId, title }) => + ...FIRST_RUN_SUGGESTIONS.map(({ templateId }) => makeTemplate({ name: templateId, - title, io: { inputs: [CONTINUATION_INPUT] } }) ) diff --git a/browser_tests/fixtures/helpers/PostFirstRunHelper.ts b/browser_tests/fixtures/helpers/PostFirstRunHelper.ts index 73f59e1bf87..f06b998d6c2 100644 --- a/browser_tests/fixtures/helpers/PostFirstRunHelper.ts +++ b/browser_tests/fixtures/helpers/PostFirstRunHelper.ts @@ -6,7 +6,6 @@ import { TOUR_ROLE_PINS } from '@/renderer/extensions/firstRunTour/roles/tourRol import type { ComfyPage } from '@e2e/fixtures/ComfyPage' import type { OnboardingCoachmarks } from '@e2e/fixtures/components/Tour' -import { tourStepCount } from '@e2e/fixtures/components/Tour' import { CONTINUATION_INPUT, FIRST_RUN_JOB_ID, @@ -57,7 +56,7 @@ export class PostFirstRunHelper { `the tour has to start, which needs the synthetic graph to carry ${FIRST_RUN_START_TEMPLATE_ID}'s pinned roles: ${JSON.stringify(START_PINS)}` ).toBeVisible() - await this.walkToRunStep() + await this.onboarding.walkToStep(firstRun.run.title) await this.comfyPage.runButton.click() await expect( @@ -79,24 +78,6 @@ export class PostFirstRunHelper { await expect(this.onboarding.card).toBeHidden() } - /** Steps forward until the tour parks on Run, whatever its sequence is. */ - private async walkToRunStep(): Promise { - const { card, cardNextButton } = this.onboarding - const runTitle = card.getByText(firstRun.run.title) - const totalSteps = await tourStepCount(card) - - for (let step = 1; step < totalSteps; step++) { - await expect(card).toContainText(`Step ${step} of ${totalSteps}`) - if (await runTitle.isVisible()) break - await cardNextButton.click() - } - - await expect( - runTitle, - 'the tour ran out of steps before reaching the one that runs the workflow' - ).toBeVisible() - } - /** * The value the continuation's declared image input is carrying, or null * while the graph swap has yet to settle on exactly one such node. @@ -106,7 +87,7 @@ export class PostFirstRunHelper { CONTINUATION_INPUT.nodeType ) if (inputs.length !== 1) return null - const value = await (await inputs[0].getWidget(0)).getValue() + const value = await (await inputs[0].getWidgetByName('image')).getValue() return typeof value === 'string' ? value : null } } diff --git a/browser_tests/tests/onboarding/gettingStartedTour.spec.ts b/browser_tests/tests/onboarding/gettingStartedTour.spec.ts index 5abe17351d7..91fb1e5997f 100644 --- a/browser_tests/tests/onboarding/gettingStartedTour.spec.ts +++ b/browser_tests/tests/onboarding/gettingStartedTour.spec.ts @@ -9,7 +9,7 @@ import type { BillingStatusResponse } from '@/platform/workspace/api/workspaceAp import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' import { FirstRunNudge } from '@e2e/fixtures/components/FirstRunNudge' -import { tourStepCount } from '@e2e/fixtures/components/Tour' +import type { OnboardingCoachmarks } from '@e2e/fixtures/components/Tour' import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' import { ACTIVE_PERSONAL_BILLING_STATUS, @@ -201,10 +201,11 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { * paywalled branches part. The run is queued under a known id, so whoever * goes on to click Run can address it over the websocket. */ - async function tourToRunStep(page: Page) { + async function tourToRunStep( + page: Page, + onboarding: OnboardingCoachmarks + ): Promise { const screen = page.getByRole('dialog', { name: GETTING_STARTED_TITLE }) - const spotlight = page.getByTestId('coach-spotlight') - const card = page.getByTestId('coach-card') await page.route('**/api/prompt', (route) => route.fulfill(jsonRoute(queuedPrompt(TOUR_JOB_ID))) @@ -217,63 +218,54 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { await expect(screen).toBeHidden() await expect( - spotlight, + onboarding.spotlight, 'picking a template must spotlight the graph it loaded' ).toBeVisible() - const next = card.getByRole('button', { name: 'Next' }) - const runTitle = card.getByText(RUN_STEP_TITLE) - const totalSteps = await tourStepCount(card) - - for (let step = 1; step < totalSteps; step++) { - await expect(card).toContainText(`Step ${step} of ${totalSteps}`) - if (await runTitle.isVisible()) break - await next.click() - } + const totalSteps = await onboarding.walkToStep(RUN_STEP_TITLE) - await expect(runTitle).toBeVisible() await expect( - next, + onboarding.cardNextButton, 'the Run step must offer no way forward except running' ).toBeHidden() - return { spotlight, card, totalSteps } + return totalSteps } /** Clicks Run and waits for the Result step to admit the run is in flight. */ async function runFromTourStep( page: Page, - card: Locator, + onboarding: OnboardingCoachmarks, totalSteps: number ) { await page.getByTestId('queue-button').click() await expect( - card.getByText(GENERATING_TITLE), + onboarding.card.getByText(GENERATING_TITLE), 'the run outlives its step, so the click moves the tour on and Result reports it' ).toBeVisible({ timeout: 15_000 }) await expect( - card, + onboarding.card, 'Run hands over to the last step, the one spotlighting where output lands' ).toContainText(`Step ${totalSteps} of ${totalSteps}`) } wstest( 'guides a first-run user from a template to a finished result', - async ({ comfyPage, getWebSocket }) => { + async ({ comfyPage, getWebSocket, onboarding }) => { // A template load, three camera flights and a queued run do not fit the default budget. test.slow() const { page } = comfyPage const execution = new ExecutionHelper(comfyPage, await getWebSocket()) - const { card, totalSteps } = await tourToRunStep(page) - await runFromTourStep(page, card, totalSteps) + const totalSteps = await tourToRunStep(page, onboarding) + await runFromTourStep(page, onboarding, totalSteps) execution.executionStart(TOUR_JOB_ID) execution.executionSuccess(TOUR_JOB_ID) await expect( - card.getByText(RESULT_IMAGE_TITLE), + onboarding.card.getByText(RESULT_IMAGE_TITLE), 'the run finished, so the Result step has to stop saying it is still coming' ).toBeVisible({ timeout: 15_000 }) } @@ -281,19 +273,19 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { wstest( 'tells a first-run user when the run produced nothing', - async ({ comfyPage, getWebSocket }) => { + async ({ comfyPage, getWebSocket, onboarding }) => { test.slow() const { page } = comfyPage const execution = new ExecutionHelper(comfyPage, await getWebSocket()) - const { card, totalSteps } = await tourToRunStep(page) - await runFromTourStep(page, card, totalSteps) + const totalSteps = await tourToRunStep(page, onboarding) + await runFromTourStep(page, onboarding, totalSteps) execution.executionStart(TOUR_JOB_ID) execution.executionError(TOUR_JOB_ID, '1', 'the run blew up') await expect( - card.getByText(RESULT_FAILED_TITLE), + onboarding.card.getByText(RESULT_FAILED_TITLE), 'announcing a result that does not exist is the bug D2 filed' ).toBeVisible({ timeout: 15_000 }) } @@ -308,11 +300,13 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { }) test('leaves the nudge until the upgrade dialog closes', async ({ - comfyPage + comfyPage, + onboarding }) => { test.slow() const { page } = comfyPage - const { spotlight } = await tourToRunStep(page) + await tourToRunStep(page, onboarding) + const { spotlight } = onboarding const nudge = new FirstRunNudge(page).root const upgradeDialog = page.getByTestId('dialog-overlay') diff --git a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts index a810a861ec0..64521377168 100644 --- a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts +++ b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts @@ -1,5 +1,7 @@ import { expect } from '@playwright/test' +import { FIRST_RUN_SUGGESTIONS } from '@/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions' + import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' import { ACTIVE_PERSONAL_BILLING_STATUS, @@ -7,7 +9,6 @@ import { } from '@e2e/fixtures/data/cloudWorkspace' import { CONTINUATION_INPUT, - FIRST_RUN_NUDGE_ACTIONS, FIRST_RUN_OUTPUT, FIRST_RUN_OUTPUT_WIDGET_VALUE, FIRST_RUN_START_TEMPLATE_ID, @@ -19,6 +20,14 @@ import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' import { assetPath } from '@e2e/fixtures/utils/paths' import { mockViewFiles } from '@e2e/fixtures/utils/viewFileMocks' +/** + * Which continuation the walk clicks does not matter here: the id-to-template + * mapping is covered per action in `FirstRunTourNudge.test.ts`, and what this + * suite adds is the wiring underneath it — a fetched graph replacing the tour + * workflow with the first output seeded into its declared input. + */ +const CONTINUATION = FIRST_RUN_SUGGESTIONS[0] + /** * Covers the frontend handoff contract with a synthetic LoadImage workflow. * Published template graphs and their runtime execution are separate gates. @@ -52,9 +61,6 @@ test.describe( await page.route('**/api/assets**', (route) => route.fulfill(jsonRoute(EMPTY_ASSET_RESPONSE)) ) - await page.route('**/internal/files/output**', (route) => - route.fulfill(jsonRoute([FIRST_RUN_OUTPUT_WIDGET_VALUE])) - ) await page.route( `**/templates/${FIRST_RUN_START_TEMPLATE_ID}.json`, (route) => @@ -64,7 +70,7 @@ test.describe( path: assetPath('onboarding/first_run_tour_contract.json') }) ) - for (const { templateId } of FIRST_RUN_NUDGE_ACTIONS) { + for (const { templateId } of FIRST_RUN_SUGGESTIONS) { await page.route(`**/templates/${templateId}.json`, (route) => route.fulfill({ contentType: 'application/json', @@ -84,55 +90,50 @@ test.describe( }) }) - for (const action of FIRST_RUN_NUDGE_ACTIONS) { - test(`passes the first output to the ${action.title} template contract`, async ({ - comfyPage, - firstRunNudge, - page, - postFirstRun - }) => { - await postFirstRun.completeTourWithImage() + test('passes the first output to the continuation it loads', async ({ + comfyPage, + firstRunNudge, + page, + postFirstRun + }) => { + await postFirstRun.completeTourWithImage() - await expect( - firstRunNudge.root, - 'every tour ending has to leave the user somewhere to go next' - ).toBeVisible({ timeout: 10_000 }) - await expect( - firstRunNudge.actions, - 'the served catalog carries every continuation, so none are filtered out' - ).toHaveCount(FIRST_RUN_NUDGE_ACTIONS.length) - await expect(firstRunNudge.action(action.id)).toContainText( - action.title - ) + await expect( + firstRunNudge.root, + 'every tour ending has to leave the user somewhere to go next' + ).toBeVisible({ timeout: 10_000 }) + await expect( + firstRunNudge.actions, + 'the served catalog carries every continuation, so none are filtered out' + ).toHaveCount(FIRST_RUN_SUGGESTIONS.length) - const requestedTemplate = page.waitForRequest( - `**/templates/${action.templateId}.json` - ) - await firstRunNudge.action(action.id).click() - await requestedTemplate + const requestedTemplate = page.waitForRequest( + `**/templates/${CONTINUATION.templateId}.json` + ) + await firstRunNudge.action(CONTINUATION.id).click() + await requestedTemplate - await expect( - firstRunNudge.root, - 'the card only closes once the continuation actually loaded' - ).toBeHidden() - await expect - .poll(() => comfyPage.nodeOps.getNodeCount(), { - message: 'the continuation never replaced the tour workflow' - }) - .toBe(1) - await expect - .poll(() => postFirstRun.loadedContinuationInput(), { - message: - 'the first output never reached the metadata-declared image input' - }) - .toBe(FIRST_RUN_OUTPUT_WIDGET_VALUE) - await expect( - comfyPage.vueNodes - .getNodeLocator(String(CONTINUATION_INPUT.nodeId)) - .locator('img'), - 'the seeded value has to resolve to an image the node can show' - ).toBeVisible() - }) - } + await expect( + firstRunNudge.root, + 'the card only closes once the continuation actually loaded' + ).toBeHidden() + await expect + .poll(() => comfyPage.nodeOps.getNodeCount(), { + message: 'the continuation never replaced the tour workflow' + }) + .toBe(1) + await expect + .poll(() => postFirstRun.loadedContinuationInput(), { + message: + 'the first output never reached the metadata-declared image input' + }) + .toBe(FIRST_RUN_OUTPUT_WIDGET_VALUE) + await expect( + comfyPage.vueNodes + .getNodeLocator(String(CONTINUATION_INPUT.nodeId)) + .locator('img'), + 'the seeded value has to resolve to an image the node can show' + ).toBeVisible() + }) } ) From ebc551e061f40e3e8c919d4d5daaf50b99b006da Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 27 Aug 2026 16:44:53 -0700 Subject: [PATCH 5/6] test: pin continuation template ids and share the tour backend mock Parametrising the nudge suite over FIRST_RUN_SUGGESTIONS had left it asserting the component's table against itself: both the expected templateId and the mock catalog were read off the table, so repointing an action at another template passed. The expected ids are spelled out again and typed against FirstRunSuggestionId, so a new action fails to compile until its template is declared. Both onboarding suites had also copied the same three route mocks; they now share mockFirstRunTourBackend. The initialFeatureFlags seed goes with them: it writes an ff: override that getDevOverride only reads under import.meta.env.DEV, so it was inert against the production dist CI runs, and the /api/features route already carries the flag in either build. --- .../fixtures/utils/firstRunTourMocks.ts | 25 ++++++++++++++++ .../onboarding/gettingStartedTour.spec.ts | 19 ++---------- .../postFirstRunContinuations.spec.ts | 22 +++----------- .../nudge/FirstRunTourNudge.test.ts | 29 +++++++++++-------- 4 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 browser_tests/fixtures/utils/firstRunTourMocks.ts diff --git a/browser_tests/fixtures/utils/firstRunTourMocks.ts b/browser_tests/fixtures/utils/firstRunTourMocks.ts new file mode 100644 index 00000000000..e265b5dba97 --- /dev/null +++ b/browser_tests/fixtures/utils/firstRunTourMocks.ts @@ -0,0 +1,25 @@ +import type { Page } from '@playwright/test' + +import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' +import { + ACTIVE_PERSONAL_BILLING_STATUS, + ONBOARDING_TOUR_REMOTE_CONFIG +} from '@e2e/fixtures/data/cloudWorkspace' +import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' + +/** + * The install the first-run tour needs: the tour flag on, a workspace funded + * enough to run, and a backend serving no assets. Both onboarding suites enter + * through here, so neither can drift from the other. + */ +export async function mockFirstRunTourBackend(page: Page) { + await page.route('**/api/features', (route) => + route.fulfill(jsonRoute(ONBOARDING_TOUR_REMOTE_CONFIG)) + ) + await page.route('**/api/billing/status', (route) => + route.fulfill(jsonRoute(ACTIVE_PERSONAL_BILLING_STATUS)) + ) + await page.route('**/api/assets**', (route) => + route.fulfill(jsonRoute(EMPTY_ASSET_RESPONSE)) + ) +} diff --git a/browser_tests/tests/onboarding/gettingStartedTour.spec.ts b/browser_tests/tests/onboarding/gettingStartedTour.spec.ts index 91fb1e5997f..14dd1f06924 100644 --- a/browser_tests/tests/onboarding/gettingStartedTour.spec.ts +++ b/browser_tests/tests/onboarding/gettingStartedTour.spec.ts @@ -10,11 +10,6 @@ import type { BillingStatusResponse } from '@/platform/workspace/api/workspaceAp import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' import { FirstRunNudge } from '@e2e/fixtures/components/FirstRunNudge' import type { OnboardingCoachmarks } from '@e2e/fixtures/components/Tour' -import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' -import { - ACTIVE_PERSONAL_BILLING_STATUS, - ONBOARDING_TOUR_REMOTE_CONFIG -} from '@e2e/fixtures/data/cloudWorkspace' import { FIRST_RUN_START_TEMPLATE_ID, queuedPrompt @@ -23,6 +18,7 @@ import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' import { onboardingFixture } from '@e2e/fixtures/tourFixture' import type { Position } from '@e2e/fixtures/types' import { mockBilling } from '@e2e/fixtures/utils/cloudBillingMocks' +import { mockFirstRunTourBackend } from '@e2e/fixtures/utils/firstRunTourMocks' import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' import { VueNodeFixture } from '@e2e/fixtures/utils/vueNodeFixtures' import { webSocketFixture } from '@e2e/fixtures/ws' @@ -179,20 +175,11 @@ test.describe('First-run tour', { tag: ['@cloud', '@ui'] }, () => { 'Comfy.TutorialCompleted': false, 'Comfy.OnboardingCoachmarks.Seen': ['appMode'], 'Comfy.VueNodes.Enabled': true - }, - initialFeatureFlags: { onboarding_tour_enabled: true } + } }) test.beforeEach(async ({ page }) => { - await page.route('**/api/features', (route) => - route.fulfill(jsonRoute(ONBOARDING_TOUR_REMOTE_CONFIG)) - ) - await page.route('**/api/billing/status', (route) => - route.fulfill(jsonRoute(ACTIVE_PERSONAL_BILLING_STATUS)) - ) - await page.route('**/api/assets**', (route) => - route.fulfill(jsonRoute(EMPTY_ASSET_RESPONSE)) - ) + await mockFirstRunTourBackend(page) }) /** diff --git a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts index 64521377168..1c23cf1197f 100644 --- a/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts +++ b/browser_tests/tests/onboarding/postFirstRunContinuations.spec.ts @@ -2,11 +2,6 @@ import { expect } from '@playwright/test' import { FIRST_RUN_SUGGESTIONS } from '@/renderer/extensions/firstRunTour/nudge/firstRunNudgeSuggestions' -import { EMPTY_ASSET_RESPONSE } from '@e2e/fixtures/data/assetFixtures' -import { - ACTIVE_PERSONAL_BILLING_STATUS, - ONBOARDING_TOUR_REMOTE_CONFIG -} from '@e2e/fixtures/data/cloudWorkspace' import { CONTINUATION_INPUT, FIRST_RUN_OUTPUT, @@ -16,7 +11,7 @@ import { } from '@e2e/fixtures/data/firstRunTour' import { withTemplates } from '@e2e/fixtures/helpers/TemplateHelper' import { postFirstRunFixture as test } from '@e2e/fixtures/postFirstRunFixture' -import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' +import { mockFirstRunTourBackend } from '@e2e/fixtures/utils/firstRunTourMocks' import { assetPath } from '@e2e/fixtures/utils/paths' import { mockViewFiles } from '@e2e/fixtures/utils/viewFileMocks' @@ -44,23 +39,14 @@ test.describe( 'Comfy.TutorialCompleted': false, 'Comfy.OnboardingCoachmarks.Seen': ['appMode'], 'Comfy.VueNodes.Enabled': true - }, - initialFeatureFlags: { onboarding_tour_enabled: true } + } }) test.beforeEach(async ({ page, templateApi }) => { - templateApi.configure(withTemplates([...FIRST_RUN_TEMPLATES])) + templateApi.configure(withTemplates(FIRST_RUN_TEMPLATES)) await templateApi.mock() - await page.route('**/api/features', (route) => - route.fulfill(jsonRoute(ONBOARDING_TOUR_REMOTE_CONFIG)) - ) - await page.route('**/api/billing/status', (route) => - route.fulfill(jsonRoute(ACTIVE_PERSONAL_BILLING_STATUS)) - ) - await page.route('**/api/assets**', (route) => - route.fulfill(jsonRoute(EMPTY_ASSET_RESPONSE)) - ) + await mockFirstRunTourBackend(page) await page.route( `**/templates/${FIRST_RUN_START_TEMPLATE_ID}.json`, (route) => diff --git a/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts b/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts index 6a3513a4edb..818757dc3f9 100644 --- a/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts +++ b/src/renderer/extensions/firstRunTour/nudge/FirstRunTourNudge.test.ts @@ -18,14 +18,21 @@ const FIRST_OUTPUT = { type: 'output' as const } -function suggestion(id: FirstRunSuggestionId) { - const found = FIRST_RUN_SUGGESTIONS.find((entry) => entry.id === id) - if (!found) throw new Error(`No such suggestion: ${id}`) - return found -} +/** + * The template each action continues into, spelled out rather than read off + * `FIRST_RUN_SUGGESTIONS`, so repointing an action at another template fails + * here instead of being asserted against itself. + */ +const CONTINUATION_TEMPLATE_IDS = { + animate: 'video_minimax_h3_i2v_continuation', + upscale: 'utility_seedvr2_7b_int8_upscale_image', + restyle: 'api_google_nano_banana2_image_edit_continuation' +} as const satisfies Record function suggestionTitle(id: FirstRunSuggestionId): string { - return i18n.global.t(suggestion(id).titleKey) + const found = FIRST_RUN_SUGGESTIONS.find((entry) => entry.id === id) + if (!found) throw new Error(`No such suggestion: ${id}`) + return i18n.global.t(found.titleKey) } type Deferred = { @@ -41,9 +48,7 @@ function createDeferred(): Deferred { return { promise, resolve } } -const CATALOG_TEMPLATE_IDS = FIRST_RUN_SUGGESTIONS.map( - ({ templateId }) => templateId -) +const CATALOG_TEMPLATE_IDS = Object.values(CONTINUATION_TEMPLATE_IDS) /** Stands in for what the install's template package actually serves. */ function catalogEntry(name: string, withIo: boolean) { @@ -226,14 +231,14 @@ describe('FirstRunTourNudge', () => { it.for(FIRST_RUN_SUGGESTIONS)( 'continues the first output through $id', - async ({ id, templateId }) => { + async ({ id }) => { const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime }) await showNudge() await user.click(suggestionButton(id)) expect(mocks.loadWorkflowTemplate).toHaveBeenCalledWith( - templateId, + CONTINUATION_TEMPLATE_IDS[id], 'default', { input: FIRST_OUTPUT } ) @@ -344,7 +349,7 @@ describe('FirstRunTourNudge', () => { }) it('offers only the continuations the install actually serves', async () => { - mocks.catalog.value = [suggestion('upscale').templateId] + mocks.catalog.value = [CONTINUATION_TEMPLATE_IDS.upscale] await showNudge() expect(suggestionButton('upscale')).toBeTruthy() From 8cb707f18a4dbd8a75d0adafd8cc5e0e7407585a Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 27 Aug 2026 17:03:43 -0700 Subject: [PATCH 6/6] test: keep tour card locator stable across states --- browser_tests/fixtures/components/Tour.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser_tests/fixtures/components/Tour.ts b/browser_tests/fixtures/components/Tour.ts index 0c6d57a1714..cc434f7d1e2 100644 --- a/browser_tests/fixtures/components/Tour.ts +++ b/browser_tests/fixtures/components/Tour.ts @@ -15,7 +15,7 @@ export class OnboardingCoachmarks { public readonly landing: Locator public readonly landingStartButton: Locator public readonly landingSkipButton: Locator - /** The current spotlight step card (the dialog carrying a "Step N of M" label). */ + /** The current spotlight card, including non-step result states. */ public readonly spotlight: Locator public readonly card: Locator public readonly cardNextButton: Locator @@ -31,7 +31,7 @@ export class OnboardingCoachmarks { exact: true }) this.spotlight = page.getByTestId('coach-spotlight') - this.card = page.getByRole('dialog').filter({ hasText: /Step \d+ of \d+/ }) + this.card = page.getByTestId('coach-card') this.cardNextButton = this.card.getByRole('button', { name: 'Next' }) this.cardDoneButton = this.card.getByRole('button', { name: 'Done' }) }