-
-
-
+
+
+
+ {{ announcement(toast) }}
+
+
+
+
+ {{ announcement(toast) }}
+
+
+
+
+
+
+
+
+ {{ toast.title }}
+
+
+ {{ toast.description }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/website/src/components/auth/AuthToastMessage.vue b/apps/website/src/components/auth/AuthToastMessage.vue
deleted file mode 100644
index f582f349606..00000000000
--- a/apps/website/src/components/auth/AuthToastMessage.vue
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
-
-
-
-
-
{{ message.summary }}
-
{{ message.detail }}
-
-
-
-
-
diff --git a/apps/website/src/components/auth/useAuthSignInController.ts b/apps/website/src/components/auth/useAuthSignInController.ts
index fc25e4f689a..d8014daf0b4 100644
--- a/apps/website/src/components/auth/useAuthSignInController.ts
+++ b/apps/website/src/components/auth/useAuthSignInController.ts
@@ -29,7 +29,7 @@ import {
isAttemptInFlight,
signInErrorMessage
} from '@/config/auth-sign-in-state'
-import { addToast } from '@/config/auth-toast-state'
+import { authToast } from '@/config/auth-toast-state'
import {
isSwitchingAccount,
requestedReturnPath
@@ -211,11 +211,9 @@ export function useAuthSignInController(options: AuthSignInControllerOptions) {
})
function toastSignInFailure(classification: AuthErrorClassification) {
- const severity = severityForAuthError(classification)
- addToast({
- severity,
- summary: t(severity === 'warn' ? 'g.warning' : 'g.error'),
- detail: signInErrorMessage(classification, locale, hostname)
+ const kind = severityForAuthError(classification)
+ authToast[kind](t(`g.${kind}`), {
+ description: signInErrorMessage(classification, locale, hostname)
})
}
diff --git a/apps/website/src/config/auth-toast-state.test.ts b/apps/website/src/config/auth-toast-state.test.ts
index 7c41505745b..73bc9b69c8e 100644
--- a/apps/website/src/config/auth-toast-state.test.ts
+++ b/apps/website/src/config/auth-toast-state.test.ts
@@ -1,39 +1,32 @@
import { beforeEach, describe, expect, it } from 'vitest'
import {
- addToast,
- removeAllToasts,
- removeToast,
+ authToast,
+ dismissAllAuthToasts,
+ dismissAuthToast,
useAuthToasts
} from './auth-toast-state'
-const { messages } = useAuthToasts()
+const { toasts } = useAuthToasts()
-beforeEach(removeAllToasts)
+beforeEach(dismissAllAuthToasts)
describe('auth toast list', () => {
- it('gives each message its own id and keeps duplicates', () => {
- const first = addToast({ severity: 'error', summary: 'Error', detail: 'x' })
- const second = addToast({
- severity: 'error',
- summary: 'Error',
- detail: 'x'
- })
-
- expect(second.id).not.toBe(first.id)
- expect(
- messages.value.map((message) => message.id),
- 'PrimeVue does not de-duplicate identical toasts, so neither does this list'
- ).toEqual([first.id, second.id])
+ it('gives each toast its own id and keeps duplicates', () => {
+ const first = authToast.error('Error', { description: 'x' })
+ const second = authToast.error('Error', { description: 'x' })
+
+ expect(second).not.toBe(first)
+ expect(toasts.value.map((toast) => toast.id)).toEqual([first, second])
})
- it('removes exactly the message asked for and ignores unknown ids', () => {
- const kept = addToast({ severity: 'success', summary: 'Ok', detail: 'y' })
- const gone = addToast({ severity: 'warn', summary: 'Warn', detail: 'z' })
+ it('dismisses exactly the toast asked for and ignores unknown ids', () => {
+ const kept = authToast.success('Ok')
+ const gone = authToast.warning('Warning')
- removeToast(gone.id)
- removeToast(999_999)
+ dismissAuthToast(gone)
+ dismissAuthToast(999_999)
- expect(messages.value).toEqual([kept])
+ expect(toasts.value.map((toast) => toast.id)).toEqual([kept])
})
})
diff --git a/apps/website/src/config/auth-toast-state.ts b/apps/website/src/config/auth-toast-state.ts
index d59b238e5ab..5e5ddbed6b3 100644
--- a/apps/website/src/config/auth-toast-state.ts
+++ b/apps/website/src/config/auth-toast-state.ts
@@ -2,42 +2,55 @@
* The auth pages' toast list, shared between the host island in AuthLayout
* and whichever island raises a message. It owns the rendered list rather
* than handing messages over, so one raised before the host hydrates still
- * shows. Ids and the add/remove shape mirror PrimeVue's ToastService, which
- * the cloud app's GlobalToast sits on.
+ * shows.
*/
import { readonly, ref } from 'vue'
-export type ToastSeverity = 'success' | 'info' | 'warn' | 'error'
+export type AuthToastKind = 'error' | 'success' | 'warning'
-export interface ToastMessageInput {
- readonly severity: ToastSeverity
- readonly summary: string
- readonly detail: string
- /** Milliseconds until auto-dismiss; absent means sticky until closed. */
- readonly life?: number
+interface AuthToastOptions {
+ readonly description?: string
+ readonly duration?: number
}
-export interface ToastMessage extends ToastMessageInput {
+export interface AuthToast {
+ readonly duration: number
readonly id: number
+ readonly kind: AuthToastKind
+ readonly title: string
+ readonly description?: string
}
-const messages = ref
([])
+const toasts = ref([])
let nextId = 0
-export function addToast(message: ToastMessageInput): ToastMessage {
- const entry: ToastMessage = { ...message, id: nextId++ }
- messages.value = [...messages.value, entry]
- return entry
+function add(
+ kind: AuthToastKind,
+ title: string,
+ { description, duration = Number.POSITIVE_INFINITY }: AuthToastOptions = {}
+): number {
+ const id = nextId++
+ toasts.value = [...toasts.value, { description, duration, id, kind, title }]
+ return id
}
-export function removeToast(id: number): void {
- messages.value = messages.value.filter((message) => message.id !== id)
+export const authToast: Record<
+ AuthToastKind,
+ (title: string, options?: AuthToastOptions) => number
+> = {
+ error: (title, options) => add('error', title, options),
+ success: (title, options) => add('success', title, options),
+ warning: (title, options) => add('warning', title, options)
}
-export function removeAllToasts(): void {
- messages.value = []
+export function dismissAuthToast(id: number): void {
+ toasts.value = toasts.value.filter((toast) => toast.id !== id)
+}
+
+export function dismissAllAuthToasts(): void {
+ toasts.value = []
}
export function useAuthToasts() {
- return { messages: readonly(messages) }
+ return { toasts: readonly(toasts) }
}
diff --git a/apps/website/src/locales/en/main.json b/apps/website/src/locales/en/main.json
index 07d438e6f00..df22f965db8 100644
--- a/apps/website/src/locales/en/main.json
+++ b/apps/website/src/locales/en/main.json
@@ -726,7 +726,8 @@
"needHelp": "Need Help?"
},
"toast": {
- "close": "Close"
+ "close": "Close",
+ "viewportLabel": "Notifications ({hotkey})"
},
"hero": {
"carouselLabel": "Featured models",
diff --git a/apps/website/src/locales/ja/main.json b/apps/website/src/locales/ja/main.json
index 36df9236ff9..bf9c0b37a75 100644
--- a/apps/website/src/locales/ja/main.json
+++ b/apps/website/src/locales/ja/main.json
@@ -94,7 +94,8 @@
"troubleshooting": "一般的な原因:"
},
"toast": {
- "close": "閉じる"
+ "close": "閉じる",
+ "viewportLabel": "通知 ({hotkey})"
},
"turnstile": {
"expired": "認証の有効期限が切れました。再度チャレンジを完了してください。",
diff --git a/apps/website/src/locales/zh-CN/main.json b/apps/website/src/locales/zh-CN/main.json
index 43510d0ea72..ab145814c29 100644
--- a/apps/website/src/locales/zh-CN/main.json
+++ b/apps/website/src/locales/zh-CN/main.json
@@ -300,7 +300,8 @@
"troubleshooting": "常见原因:"
},
"toast": {
- "close": "关闭"
+ "close": "关闭",
+ "viewportLabel": "通知 ({hotkey})"
},
"turnstile": {
"expired": "验证已过期。请重新完成验证。",
diff --git a/browser_tests/README.md b/browser_tests/README.md
index 136d03fc840..4e21fdecf66 100644
--- a/browser_tests/README.md
+++ b/browser_tests/README.md
@@ -472,6 +472,13 @@ properties in methods rather than rebuilding locators.
- When multiple nodes share a title, disambiguate:
`vueNodes.getNodeByTitle(name).nth(n)` — strict mode fails on ambiguous
locators.
+- Never locate a toast by its copy with `getByText` or
+ `getByRole('alert' | 'status').filter({ hasText })`: `Toaster` repeats every
+ toast's text in live regions with those roles. Use
+ `comfyPage.toast.withText(text)` and its kind locators such as
+ `toastErrors`. Tests without `comfyPage` (`cloudAppFixture`, `agentTest`,
+ or a `page`-only test) destructure the `toast` fixture instead. Specs may
+ not construct a `ToastHelper`; lint allows only type imports.
### Node references over coordinates
diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts
index c917a346089..352477a986a 100644
--- a/browser_tests/fixtures/ComfyPage.ts
+++ b/browser_tests/fixtures/ComfyPage.ts
@@ -228,7 +228,6 @@ export class ComfyPage {
public readonly assets: AssetsHelper
public readonly modelLibrary: ModelLibraryHelper
public readonly cloudAuth: CloudAuthHelper
- public readonly visibleToasts: Locator
/** Worker index to test user ID */
public readonly userIds: string[] = []
@@ -277,7 +276,6 @@ export class ComfyPage {
this.contextMenu = new ContextMenu(page)
this.currentUserPopover = new CurrentUserPopover(page)
this.toast = new ToastHelper(page)
- this.visibleToasts = this.toast.visibleToasts
this.dragDrop = new DragDropHelper(page)
this.featureFlags = new FeatureFlagHelper(page)
this.command = new CommandHelper(page)
diff --git a/browser_tests/fixtures/components/AgentPanel.ts b/browser_tests/fixtures/components/AgentPanel.ts
index d03d2a83579..7c5d1834ebe 100644
--- a/browser_tests/fixtures/components/AgentPanel.ts
+++ b/browser_tests/fixtures/components/AgentPanel.ts
@@ -8,37 +8,37 @@ import frMessages from '@/locales/fr/main.json' with { type: 'json' }
import { TestIds } from '@e2e/fixtures/selectors'
export class AgentPanel {
- public readonly root: Locator
- public readonly dockedPanel: Locator
- public readonly openButton: Locator
+ public readonly activityRows: Locator
+ public readonly attachmentChips: Locator
public readonly closeButton: Locator
- public readonly debugHeading: Locator
- public readonly serverLogsSwitch: Locator
- public readonly settingsSwitch: Locator
- public readonly workflowSwitch: Locator
- public readonly copyReportButton: Locator
+ public readonly composer: Locator
+ public readonly composerAssetSection: Locator
+ public readonly composerPromptArea: Locator
public readonly copiedButton: Locator
- public readonly workflowPicker: Locator
+ public readonly copyReportButton: Locator
+ public readonly creditsExhaustedPaywall: Locator
+ public readonly debugHeading: Locator
+ public readonly dockedPanel: Locator
+ public readonly dockedPanelShell: Locator
public readonly fileInput: Locator
- public readonly composerAssetSection: Locator
+ public readonly nodeSelectionBanner: Locator
+ public readonly openButton: Locator
+ public readonly root: Locator
public readonly scrollAssetsRight: Locator
- public readonly attachmentChips: Locator
- public readonly composer: Locator
- public readonly composerPromptArea: Locator
public readonly sendButton: Locator
+ public readonly serverLogsSwitch: Locator
+ public readonly settingsSwitch: Locator
public readonly stopButton: Locator
- public readonly creditsExhaustedPaywall: Locator
+ public readonly workflowPicker: Locator
+ public readonly workflowSwitch: Locator
public readonly workSummary: Locator
- public readonly nodeSelectionBanner: Locator
- public readonly activityRows: Locator
constructor(private readonly page: Page) {
this.root = page.locator('#agent-panel-root')
- this.dockedPanel = page.getByTestId('docked-agent-panel')
- this.openButton = page.getByRole('button', {
- name: enMessages.agent.entryButton,
- exact: true
- })
+ this.activityRows = this.root
+ .getByTestId(TestIds.agent.activityTrace)
+ .getByRole('listitem')
+ this.attachmentChips = this.root.getByTestId('agent-attachment-chip')
this.closeButton = this.root
.locator('header')
.getByRole('button', { name: enMessages.g.close, exact: true })
@@ -48,46 +48,48 @@ export class AgentPanel {
exact: true
})
)
- this.debugHeading = this.root.getByText('CRDT debug', { exact: true })
- this.serverLogsSwitch = this.root.getByRole('switch', {
- name: 'Server logs'
- })
- this.settingsSwitch = this.root.getByRole('switch', { name: 'Settings' })
- this.workflowSwitch = this.root.getByRole('switch', {
- name: 'Workflow JSON'
- })
+ this.composer = this.root.getByRole('textbox', { name: /^Describe ideas/ })
+ this.composerAssetSection = this.root.getByTestId('composer-asset-section')
+ this.composerPromptArea = this.root.getByTestId('composer-inline-input')
+ this.copiedButton = this.root.getByRole('button', { name: 'Copied' })
this.copyReportButton = this.root.getByRole('button', {
name: 'Copy full report'
})
- this.copiedButton = this.root.getByRole('button', { name: 'Copied' })
- this.workflowPicker = this.root.getByRole('button', {
- name: enMessages.agent.switchWorkflow
+ this.creditsExhaustedPaywall = this.root.getByRole('alert').filter({
+ hasText: enMessages.agent.paywall.title
})
+ this.debugHeading = this.root.getByText('CRDT debug', { exact: true })
+ this.dockedPanel = page.getByTestId('docked-agent-panel')
+ this.dockedPanelShell = page.getByTestId('docked-agent-panel-shell')
this.fileInput = this.root.getByTestId('agent-file-input')
- this.composerAssetSection = this.root.getByTestId('composer-asset-section')
+ this.nodeSelectionBanner = page.getByTestId('node-selection-mode-banner')
+ this.openButton = page.getByRole('button', {
+ name: enMessages.agent.entryButton,
+ exact: true
+ })
this.scrollAssetsRight = this.root.getByRole('button', {
name: enMessages.g.scrollRight
})
- this.attachmentChips = this.root.getByTestId('agent-attachment-chip')
- this.composer = this.root.getByRole('textbox', { name: /^Describe ideas/ })
- this.composerPromptArea = this.root.getByTestId('composer-inline-input')
this.sendButton = this.root.getByRole('button', {
name: enMessages.agent.send
})
+ this.serverLogsSwitch = this.root.getByRole('switch', {
+ name: 'Server logs'
+ })
+ this.settingsSwitch = this.root.getByRole('switch', { name: 'Settings' })
this.stopButton = this.root.getByRole('button', {
name: enMessages.agent.stop,
exact: true
})
- this.creditsExhaustedPaywall = this.root.getByRole('alert').filter({
- hasText: enMessages.agent.paywall.title
+ this.workflowPicker = this.root.getByRole('button', {
+ name: enMessages.agent.switchWorkflow
+ })
+ this.workflowSwitch = this.root.getByRole('switch', {
+ name: 'Workflow JSON'
})
this.workSummary = this.root.getByRole('button', {
name: new RegExp(`^${escapeRegExp(enMessages.agent.worked)}`)
})
- this.nodeSelectionBanner = page.getByTestId('node-selection-mode-banner')
- this.activityRows = this.root
- .getByTestId(TestIds.agent.activityTrace)
- .getByRole('listitem')
}
async scrollAssetsToEnd(): Promise {
diff --git a/browser_tests/fixtures/components/ModelImportProgressToast.ts b/browser_tests/fixtures/components/ModelImportProgressToast.ts
index 058ff65378e..50fb766c0c2 100644
--- a/browser_tests/fixtures/components/ModelImportProgressToast.ts
+++ b/browser_tests/fixtures/components/ModelImportProgressToast.ts
@@ -1,5 +1,7 @@
import type { Locator, Page } from '@playwright/test'
+import { TestIds } from '@e2e/fixtures/selectors'
+
export class ModelImportProgressToast {
public readonly root: Locator
public readonly expandButton: Locator
@@ -7,7 +9,9 @@ export class ModelImportProgressToast {
public readonly filterOptions: Locator
constructor(page: Page) {
- this.root = page.getByRole('status').filter({ hasText: 'Importing Models' })
+ this.root = page
+ .getByTestId(TestIds.toast.panel)
+ .filter({ hasText: 'Importing Models' })
this.expandButton = this.root.getByRole('button', { name: 'Expand' })
this.filterButton = this.root.getByRole('button', {
name: /^(All|Completed|Failed)$/
diff --git a/browser_tests/fixtures/components/SidebarTab.ts b/browser_tests/fixtures/components/SidebarTab.ts
index 5c97d5e3089..08e5b049b5d 100644
--- a/browser_tests/fixtures/components/SidebarTab.ts
+++ b/browser_tests/fixtures/components/SidebarTab.ts
@@ -4,6 +4,7 @@ import { expect } from '@playwright/test'
import type { ComfyMouse } from '@e2e/fixtures/ComfyMouse'
import type { WorkspaceStore } from '@e2e/types/globals'
import { TestIds } from '@e2e/fixtures/selectors'
+import { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
export class SidebarTab {
public readonly tabButton: Locator
@@ -389,6 +390,8 @@ export class AssetsSidebarTab extends SidebarTab {
// --- Loading ---
public readonly skeletonLoaders: Locator
+ private readonly toast: ToastHelper
+
constructor(public override readonly page: Page) {
super(page, 'assets')
this.generatedTab = page.getByRole('tab', { name: 'Generated' })
@@ -447,6 +450,7 @@ export class AssetsSidebarTab extends SidebarTab {
this.skeletonLoaders = page.locator(
'.sidebar-content-container .animate-pulse'
)
+ this.toast = new ToastHelper(page)
}
emptyStateTitle(title: string) {
@@ -485,7 +489,7 @@ export class AssetsSidebarTab extends SidebarTab {
override async open({ waitForAssets = true } = {}) {
// Remove any toast notifications that may overlay the sidebar button
- await this.dismissToasts()
+ await this.toast.closeToasts()
await super.open()
await this.generatedTab.waitFor({ state: 'visible' })
if (waitForAssets) {
@@ -493,26 +497,14 @@ export class AssetsSidebarTab extends SidebarTab {
}
}
- /** Dismiss all visible toast notifications by clicking their close buttons. */
- async dismissToasts() {
- const closeButtons = this.page.locator('.p-toast-close-button')
- for (const btn of await closeButtons.all()) {
- await btn.click().catch(() => {})
- }
- // Wait for all toast elements to fully animate out and detach from DOM
- await expect(this.page.locator('.p-toast-message'))
- .toHaveCount(0)
- .catch(() => {})
- }
-
async switchToImported() {
- await this.dismissToasts()
+ await this.toast.closeToasts()
await this.importedTab.click()
await expect(this.importedTab).toHaveAttribute('aria-selected', 'true')
}
async switchToGenerated() {
- await this.dismissToasts()
+ await this.toast.closeToasts()
await this.generatedTab.click()
await expect(this.generatedTab).toHaveAttribute('aria-selected', 'true')
}
@@ -539,7 +531,7 @@ export class AssetsSidebarTab extends SidebarTab {
}
async openSettingsMenu() {
- await this.dismissToasts()
+ await this.toast.closeToasts()
await this.settingsButton.click()
await expect(
this.listViewOption
@@ -562,7 +554,7 @@ export class AssetsSidebarTab extends SidebarTab {
}
async openFilterMenu() {
- await this.dismissToasts()
+ await this.toast.closeToasts()
await this.filterButton.click()
await expect(this.mediaTypeFilterMenuItem).toBeVisible()
}
diff --git a/browser_tests/fixtures/helpers/AssetsHelper.ts b/browser_tests/fixtures/helpers/AssetsHelper.ts
index bbef403b0e1..0c055b758be 100644
--- a/browser_tests/fixtures/helpers/AssetsHelper.ts
+++ b/browser_tests/fixtures/helpers/AssetsHelper.ts
@@ -10,7 +10,10 @@ import type {
JobDetail,
RawJobListItem
} from '@/platform/remote/comfyui/jobs/jobTypes'
-import type { AssetDownloadWsMessage } from '@/platform/remote/comfyui/execution/types'
+import type {
+ AssetDownloadWsMessage,
+ AssetExportWsMessage
+} from '@/platform/remote/comfyui/execution/types'
const jobsListRoutePattern = '**/api/jobs?*'
const assetsListRoutePattern = /\/api\/assets(?:\?.*)?$/
@@ -145,6 +148,12 @@ export class AssetsHelper {
}, message)
}
+ async dispatchExport(message: AssetExportWsMessage): Promise {
+ await this.page.evaluate((assetExport) => {
+ window.app!.api.dispatchCustomEvent('asset_export', assetExport)
+ }, message)
+ }
+
async mockOutputHistory(jobs: RawJobListItem[]): Promise {
this.generatedJobs = [...jobs]
diff --git a/browser_tests/fixtures/helpers/ToastHelper.ts b/browser_tests/fixtures/helpers/ToastHelper.ts
index cfe7581bc88..f1ef9838809 100644
--- a/browser_tests/fixtures/helpers/ToastHelper.ts
+++ b/browser_tests/fixtures/helpers/ToastHelper.ts
@@ -1,19 +1,39 @@
import { expect } from '@playwright/test'
import type { Locator, Page } from '@playwright/test'
+import { TestIds } from '@e2e/fixtures/selectors'
+
+type ToastKind = 'error' | 'success' | 'warning' | 'loading'
+
+const TOAST_SELECTOR = '[data-testid="toast"]'
+
+export function toastSelector(kind: ToastKind): string {
+ return `${TOAST_SELECTOR}[data-toast-kind="${kind}"]`
+}
+
export class ToastHelper {
- public readonly visibleToasts: Locator
+ public readonly panels: Locator
public readonly toastErrors: Locator
+ public readonly toastLoadings: Locator
public readonly toastSuccesses: Locator
public readonly toastWarnings: Locator
+ public readonly visibleToasts: Locator
+
+ constructor(page: Page) {
+ this.panels = page.getByTestId(TestIds.toast.panel)
+ this.toastErrors = page.locator(toastSelector('error'))
+ this.toastLoadings = page.locator(toastSelector('loading'))
+ this.toastSuccesses = page.locator(toastSelector('success'))
+ this.toastWarnings = page.locator(toastSelector('warning'))
+ this.visibleToasts = page.locator(TOAST_SELECTOR).filter({ visible: true })
+ }
+
+ withText(text: string | RegExp): Locator {
+ return this.visibleToasts.filter({ hasText: text })
+ }
- constructor(private readonly page: Page) {
- this.visibleToasts = page.locator('.p-toast-message:visible')
- this.toastErrors = page.locator('.p-toast-message.p-toast-message-error')
- this.toastSuccesses = page.locator(
- '.p-toast-message.p-toast-message-success'
- )
- this.toastWarnings = page.locator('.p-toast-message.p-toast-message-warn')
+ async dismiss(toast: Locator): Promise {
+ await toast.getByTestId('toast-close').click()
}
async closeToasts(requireCount = 0): Promise {
@@ -23,15 +43,12 @@ export class ToastHelper {
.waitFor({ state: 'visible' })
}
- // Clear all toasts
- const toastCloseButtons = await this.page
- .locator('.p-toast-close-button')
- .all()
- for (const button of toastCloseButtons) {
- await button.click()
+ const closeButtons = this.visibleToasts.getByTestId('toast-close')
+ for (let open = await closeButtons.count(); open > 0; open--) {
+ await closeButtons.first().click()
+ await expect(closeButtons).toHaveCount(open - 1)
}
- // Assert all toasts are closed
await expect(this.visibleToasts).toHaveCount(0)
}
}
diff --git a/browser_tests/fixtures/networkIsolationFixture.ts b/browser_tests/fixtures/networkIsolationFixture.ts
index 965f19650bc..00c5a839dad 100644
--- a/browser_tests/fixtures/networkIsolationFixture.ts
+++ b/browser_tests/fixtures/networkIsolationFixture.ts
@@ -3,6 +3,7 @@ import { expect, test as base } from '@playwright/test'
import { config as dotenvConfig } from 'dotenv'
import { HERO_SLIDES } from '@/platform/cloud/onboarding/constants/heroSlides'
+import { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
import type { LiveCloudBillingConfig } from '@e2e/fixtures/utils/liveCloudBillingConfig'
import { installLiveCloudBillingRouting } from '@e2e/fixtures/utils/liveCloudBillingContext'
import {
@@ -56,8 +57,9 @@ function guardApiRequests(
}
export const networkIsolationFixture = base.extend<{
- networkPolicy: NetworkPolicy
liveCloudBillingConfig: LiveCloudBillingConfig | undefined
+ networkPolicy: NetworkPolicy
+ toast: ToastHelper
}>({
serviceWorkers: 'block',
liveCloudBillingConfig: [undefined, { option: true }],
@@ -190,5 +192,8 @@ export const networkIsolationFixture = base.extend<{
}
await use(context)
restore()
+ },
+ toast: async ({ page }, use) => {
+ await use(new ToastHelper(page))
}
})
diff --git a/browser_tests/fixtures/selectors.ts b/browser_tests/fixtures/selectors.ts
index e2c8324006d..9d26be208eb 100644
--- a/browser_tests/fixtures/selectors.ts
+++ b/browser_tests/fixtures/selectors.ts
@@ -150,6 +150,9 @@ export const TestIds = {
card: 'asset-card',
videoPreview: 'media-asset-video'
},
+ toast: {
+ panel: 'toast-panel'
+ },
subgraphEditor: {
hiddenSection: 'subgraph-editor-hidden-section',
iconEye: 'icon-eye',
diff --git a/browser_tests/fixtures/utils/errorSurfaces.ts b/browser_tests/fixtures/utils/errorSurfaces.ts
index 271032a8e24..27fa3101349 100644
--- a/browser_tests/fixtures/utils/errorSurfaces.ts
+++ b/browser_tests/fixtures/utils/errorSurfaces.ts
@@ -1,6 +1,7 @@
import type { Locator, Page } from '@playwright/test'
import { expect } from '@playwright/test'
+import { ToastHelper, toastSelector } from '@e2e/fixtures/helpers/ToastHelper'
import { TestIds } from '@e2e/fixtures/selectors'
interface VisibleError {
@@ -25,7 +26,10 @@ const visibleErrorSurfaceSelectors = [
selector: `[data-testid="${TestIds.dialogs.errorDialog}"]`
},
{ surface: 'nodeRenderErrors', selector: '.node-error' },
- { surface: 'errorToasts', selector: '.p-toast-message-error' }
+ {
+ surface: 'errorToasts',
+ selector: toastSelector('error')
+ }
]
const visibleErrorSampleIntervalMs = 100
@@ -92,7 +96,7 @@ export function errorSurfaces(page: Page): Record {
errorOverlay: page.getByTestId(TestIds.dialogs.errorOverlay),
errorDialog: page.getByTestId(TestIds.dialogs.errorDialog),
nodeRenderErrors: page.locator('.node-error'),
- errorToasts: page.locator('.p-toast-message-error')
+ errorToasts: new ToastHelper(page).toastErrors
}
}
diff --git a/browser_tests/tests/agent/agentDuplicateInsertOpaqueWidgetWrite.spec.ts b/browser_tests/tests/agent/agentDuplicateInsertOpaqueWidgetWrite.spec.ts
index 4a7c20d1739..ec6e50c530f 100644
--- a/browser_tests/tests/agent/agentDuplicateInsertOpaqueWidgetWrite.spec.ts
+++ b/browser_tests/tests/agent/agentDuplicateInsertOpaqueWidgetWrite.spec.ts
@@ -14,7 +14,6 @@ import {
} from '@e2e/fixtures/agentPanelFixture'
import { HostDoc } from '@e2e/fixtures/agentConversationHostDoc'
import { AgentPanel } from '@e2e/fixtures/components/AgentPanel'
-import { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
import { nextFrame } from '@e2e/fixtures/utils/timing'
import { VueNodeHelpers } from '@e2e/fixtures/VueNodeHelpers'
import { webSocketFixture } from '@e2e/fixtures/ws'
@@ -464,6 +463,7 @@ test.describe(
test('a rejected widget edit is reported and rolled back to the value the shared document kept', async ({
page,
+ toast,
getWebSocket
}) => {
const { host, seedInput, copyBNodeId } =
@@ -486,7 +486,7 @@ test.describe(
// and `toContainText` passes on any node in the collection, so either
// alone would accept a message the user never sees. Filter to the text
// and require it on screen.
- const rejectionToast = new ToastHelper(page).toastErrors.filter({
+ const rejectionToast = toast.toastErrors.filter({
hasText: 'Widget edit was rejected and was not saved'
})
await expect(rejectionToast).toBeVisible({ timeout: 3_000 })
diff --git a/browser_tests/tests/agent/agentPanel.spec.ts b/browser_tests/tests/agent/agentPanel.spec.ts
index 6afc2231fb0..d34bbc52474 100644
--- a/browser_tests/tests/agent/agentPanel.spec.ts
+++ b/browser_tests/tests/agent/agentPanel.spec.ts
@@ -633,7 +633,7 @@ test.describe('In-App Agent panel', { tag: '@cloud' }, () => {
buffer: Buffer.alloc(25 * 1024 * 1024)
})
await expect(
- page.getByText('too-large.mp4 is larger than 24 MB')
+ comfyPage.toast.withText('too-large.mp4 is larger than 24 MB')
).toBeVisible()
await expect(
panel.getByRole('group', { name: 'too-large.mp4' })
diff --git a/browser_tests/tests/agent/agentPanelAppMode.spec.ts b/browser_tests/tests/agent/agentPanelAppMode.spec.ts
index e32c2af432b..b632591c6f6 100644
--- a/browser_tests/tests/agent/agentPanelAppMode.spec.ts
+++ b/browser_tests/tests/agent/agentPanelAppMode.spec.ts
@@ -1,22 +1,20 @@
import { expect } from '@playwright/test'
-import { AgentPanel } from '@e2e/fixtures/components/AgentPanel'
import enMessages from '@/locales/en/main.json' with { type: 'json' }
import type { WorkspaceStore } from '@e2e/types/globals'
import { agentTest as test } from '@e2e/tests/agent/agentPanelMocks'
-const OPEN_AGENT_LABEL = enMessages.agent.entryButton
const OPEN_STORAGE_KEY = 'Comfy.AgentPanel.open'
test.describe('In-App Agent panel across view modes', { tag: '@cloud' }, () => {
test('T-16 / PM-653 / FE-1298 keeps a single docked panel root and active workflow in app mode', async ({
+ agentPanel,
comfyPage
}) => {
test.setTimeout(30_000)
const page = comfyPage.page
- const panelRoot = page.locator('#agent-panel-root')
const activeWorkflowPath = () =>
page.evaluate(
() =>
@@ -27,32 +25,41 @@ test.describe('In-App Agent panel across view modes', { tag: '@cloud' }, () => {
expect(selectedWorkflowPath).toBeTruthy()
- const openButton = page.getByRole('button', {
- name: OPEN_AGENT_LABEL,
- exact: true
- })
- await expect(openButton).toBeVisible()
- await new AgentPanel(page).open()
+ await expect(agentPanel.openButton).toBeVisible()
+ await agentPanel.open()
- await expect(panelRoot).toHaveCount(1)
- await expect(panelRoot).toBeVisible()
+ await expect(agentPanel.root).toHaveCount(1)
+ await expect(agentPanel.root).toBeVisible()
await expect
.poll(() =>
page.evaluate((key) => localStorage.getItem(key), OPEN_STORAGE_KEY)
)
.toBe('true')
+ await expect(agentPanel.dockedPanelShell).toHaveCSS(
+ 'border-left-width',
+ '0px'
+ )
+
// Enter app mode: the docked panel re-hosts under LinearView.
await comfyPage.appMode.toggleAppMode()
- await expect(panelRoot).toHaveCount(1)
- await expect(panelRoot).toBeVisible()
+ await expect(agentPanel.root).toHaveCount(1)
+ await expect(agentPanel.root).toBeVisible()
await expect.poll(activeWorkflowPath).toBe(selectedWorkflowPath)
+ await expect(agentPanel.dockedPanelShell).toHaveCSS(
+ 'border-left-width',
+ '1px'
+ )
// Return to graph mode: the docked panel re-hosts under GraphCanvas.
await comfyPage.appMode.toggleAppMode()
- await expect(panelRoot).toHaveCount(1)
- await expect(panelRoot).toBeVisible()
+ await expect(agentPanel.root).toHaveCount(1)
+ await expect(agentPanel.root).toBeVisible()
await expect.poll(activeWorkflowPath).toBe(selectedWorkflowPath)
+ await expect(agentPanel.dockedPanelShell).toHaveCSS(
+ 'border-left-width',
+ '0px'
+ )
})
test('keeps a user-closed panel hidden when toggling app mode and back', async ({
diff --git a/browser_tests/tests/agent/agentPreviewTextWidgetNotMinted.spec.ts b/browser_tests/tests/agent/agentPreviewTextWidgetNotMinted.spec.ts
index 1df4dfeb661..1e69a053b82 100644
--- a/browser_tests/tests/agent/agentPreviewTextWidgetNotMinted.spec.ts
+++ b/browser_tests/tests/agent/agentPreviewTextWidgetNotMinted.spec.ts
@@ -6,7 +6,6 @@ import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import { AgentNonValueWidgetRig } from '@e2e/fixtures/agentNonValueWidgetRig'
import type { AgentFollowerHostSocket } from '@e2e/fixtures/agentFollowerHostSocket'
import { agentTest as test } from '@e2e/fixtures/agentPanelFixture'
-import { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
/**
* `preview_text` reaches the minter through an `executed` frame, the node's
@@ -142,7 +141,8 @@ test.describe(
{ tag: ['@cloud', '@agent', '@vue-nodes', '@widget'] },
() => {
test('execution text output mints nothing and never tells the user an edit was rejected', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const rig = await AgentNonValueWidgetRig.boot(page, rigConfig)
@@ -174,7 +174,7 @@ test.describe(
})
await test.step('no rejection toast, hand edit still on screen', async () => {
- const rejectionToast = new ToastHelper(page).toastErrors.filter({
+ const rejectionToast = toast.toastErrors.filter({
hasText: 'Widget edit was rejected and was not saved'
})
await expect(rejectionToast).toHaveCount(0)
diff --git a/browser_tests/tests/agent/agentProgressTextWidgetNotMinted.spec.ts b/browser_tests/tests/agent/agentProgressTextWidgetNotMinted.spec.ts
index 82eb5ee448a..727e6fe9276 100644
--- a/browser_tests/tests/agent/agentProgressTextWidgetNotMinted.spec.ts
+++ b/browser_tests/tests/agent/agentProgressTextWidgetNotMinted.spec.ts
@@ -8,7 +8,6 @@ import {
progressTextFrame
} from '@e2e/fixtures/agentNonValueWidgetRig'
import { agentTest as test } from '@e2e/fixtures/agentPanelFixture'
-import { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
/**
* `$$node-text-preview` is a `serialize: false` widget written by binary
@@ -90,7 +89,8 @@ test.describe(
{ tag: ['@cloud', '@agent', '@vue-nodes', '@widget'] },
() => {
test('streaming execution progress mints nothing and never tells the user an edit was rejected', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const rig = await AgentNonValueWidgetRig.boot(page, rigConfig)
@@ -125,7 +125,7 @@ test.describe(
})
await test.step('no rejection toast, hand edit still on screen', async () => {
- const rejectionToast = new ToastHelper(page).toastErrors.filter({
+ const rejectionToast = toast.toastErrors.filter({
hasText: 'Widget edit was rejected and was not saved'
})
await expect(rejectionToast).toHaveCount(0)
diff --git a/browser_tests/tests/agent/agentRunModePopover.spec.ts b/browser_tests/tests/agent/agentRunModePopover.spec.ts
index 8d9ecf73259..54e5b2b08a9 100644
--- a/browser_tests/tests/agent/agentRunModePopover.spec.ts
+++ b/browser_tests/tests/agent/agentRunModePopover.spec.ts
@@ -187,7 +187,7 @@ test.describe('Agent run permissions popover', { tag: '@cloud' }, () => {
await test.step('the rejected pick keeps the menu, focus and old mode', async () => {
await expect(
- page.getByText(enMessages.agent.runModeSaveFailed)
+ comfyPage.toast.withText(enMessages.agent.runModeSaveFailed)
).toBeVisible()
await expect(autoOption).toBeFocused()
await expect(autoOption).not.toBeChecked()
diff --git a/browser_tests/tests/agent/agentUndefinedSerializeWidgetNotMinted.spec.ts b/browser_tests/tests/agent/agentUndefinedSerializeWidgetNotMinted.spec.ts
index 909b10aef97..67e898f20a6 100644
--- a/browser_tests/tests/agent/agentUndefinedSerializeWidgetNotMinted.spec.ts
+++ b/browser_tests/tests/agent/agentUndefinedSerializeWidgetNotMinted.spec.ts
@@ -5,7 +5,6 @@ import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import { AgentNonValueWidgetRig } from '@e2e/fixtures/agentNonValueWidgetRig'
import { agentTest as test } from '@e2e/fixtures/agentPanelFixture'
-import { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
/**
* The sibling `agentProgressTextWidgetNotMinted` spec covers the ephemeral
@@ -103,7 +102,8 @@ test.describe(
{ tag: ['@cloud', '@agent', '@vue-nodes', '@widget'] },
() => {
test('an ephemeral widget that leaves serialize undefined mints nothing and never tells the user an edit was rejected', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const rig = await AgentNonValueWidgetRig.boot(page, rigConfig)
@@ -156,7 +156,7 @@ test.describe(
})
await test.step('no rejection toast, hand edit still on screen', async () => {
- const rejectionToast = new ToastHelper(page).toastErrors.filter({
+ const rejectionToast = toast.toastErrors.filter({
hasText: 'Widget edit was rejected and was not saved'
})
await expect(rejectionToast).toHaveCount(0)
diff --git a/browser_tests/tests/agent/agentWorkflowSelection.spec.ts b/browser_tests/tests/agent/agentWorkflowSelection.spec.ts
index b0e852c4926..5032112e7f0 100644
--- a/browser_tests/tests/agent/agentWorkflowSelection.spec.ts
+++ b/browser_tests/tests/agent/agentWorkflowSelection.spec.ts
@@ -545,6 +545,7 @@ test.describe(
test('keeps the failed selection open and allows retry without a naming dialog', async ({
page,
+ toast,
workflowSelection
}) => {
await new AgentPanel(page).open()
@@ -564,7 +565,7 @@ test.describe(
await expect(row).toBeEnabled()
await expect(row).toBeChecked()
await expect(
- page.getByText(enMessages.shareWorkflow.saveFailedTitle)
+ toast.withText(enMessages.shareWorkflow.saveFailedTitle)
).toBeVisible()
await expect(composer).toHaveText('Keep this draft')
await row.click()
diff --git a/browser_tests/tests/authAccountSwitch.spec.ts b/browser_tests/tests/authAccountSwitch.spec.ts
index 6aab84d93b0..81866a0595e 100644
--- a/browser_tests/tests/authAccountSwitch.spec.ts
+++ b/browser_tests/tests/authAccountSwitch.spec.ts
@@ -6,6 +6,7 @@ import type { WorkspaceTokenResponse } from '@/platform/workspace/stores/workspa
import type { Page } from '@playwright/test'
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
+import { CurrentUserPopover } from '@e2e/fixtures/components/CurrentUserPopover'
import { AssetsSidebarTab } from '@e2e/fixtures/components/SidebarTab'
import {
CLOUD_REMOTE_CONFIG,
@@ -335,14 +336,13 @@ test.describe('Cloud account switch', { tag: '@cloud' }, () => {
.fill('password')
await page.getByRole('button', { name: 'Sign in' }).click()
+ const popover = new CurrentUserPopover(page)
+ await expect(popover.trigger).toBeVisible()
+ await popover.open()
await expect(
- page.getByRole('button', { name: 'Current user' })
+ popover.root.getByText(ACCOUNT_B.email, { exact: true })
).toBeVisible()
- await page.getByRole('button', { name: 'Current user' }).click()
- await expect(
- page.getByText(ACCOUNT_B.email, { exact: true })
- ).toBeVisible()
- await page.keyboard.press('Escape')
+ await popover.close()
await expect
.poll(() => workspaceMintOwners, { timeout: 15_000 })
.toContain(ACCOUNT_B.id)
diff --git a/browser_tests/tests/cloudOnboardingAuth.spec.ts b/browser_tests/tests/cloudOnboardingAuth.spec.ts
index 11ed16d7a08..4bf04a998ca 100644
--- a/browser_tests/tests/cloudOnboardingAuth.spec.ts
+++ b/browser_tests/tests/cloudOnboardingAuth.spec.ts
@@ -101,6 +101,7 @@ test.describe('Cloud onboarding — live auth', { tag: '@cloud' }, () => {
test('shows an inline error and stays on the login page on a wrong password', async ({
page,
+ toast,
cloudAuth
}) => {
await cloudAuth.mockLiveEmailSignInFailure({
@@ -114,7 +115,7 @@ test.describe('Cloud onboarding — live auth', { tag: '@cloud' }, () => {
await page.locator('#cloud-sign-in-password').blur()
await page.getByRole('button', { name: 'Sign in' }).click()
- await expect(page.getByText('Invalid login credentials')).toBeVisible()
+ await expect(toast.withText('Invalid login credentials')).toBeVisible()
await expect(page).toHaveURL(/\/cloud\/login/)
})
diff --git a/browser_tests/tests/cloudOnboardingAuthErrors.spec.ts b/browser_tests/tests/cloudOnboardingAuthErrors.spec.ts
index a37b241f1be..9a126066b33 100644
--- a/browser_tests/tests/cloudOnboardingAuthErrors.spec.ts
+++ b/browser_tests/tests/cloudOnboardingAuthErrors.spec.ts
@@ -65,6 +65,7 @@ async function openSignupEmailForm(page: Page) {
test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () => {
test('shows the same neutral copy for a nonexistent account as a wrong password', async ({
page,
+ toast,
cloudAuth
}) => {
await cloudAuth.mockLiveEmailSignInFailure({
@@ -79,12 +80,12 @@ test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () =>
await page.getByRole('button', { name: 'Sign in' }).click()
await expect(
- page.getByText('Invalid login credentials'),
+ toast.withText('Invalid login credentials'),
'the same copy as a wrong password keeps sign-in from revealing whether an email has an account'
).toBeVisible()
})
- test('reports a disabled account', async ({ page, cloudAuth }) => {
+ test('reports a disabled account', async ({ page, toast, cloudAuth }) => {
await cloudAuth.mockLiveEmailSignInFailure({
code: 400,
message: 'USER_DISABLED'
@@ -99,12 +100,13 @@ test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () =>
await page.getByRole('button', { name: 'Sign in' }).click()
await expect(
- page.getByText('This account has been disabled. Please contact support.')
+ toast.withText('This account has been disabled. Please contact support.')
).toBeVisible()
})
test('reports rate limiting after repeated failed attempts', async ({
page,
+ toast,
cloudAuth
}) => {
await cloudAuth.mockLiveEmailSignInFailure({
@@ -119,7 +121,7 @@ test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () =>
await page.getByRole('button', { name: 'Sign in' }).click()
await expect(
- page.getByText(
+ toast.withText(
'Too many login attempts. Please wait a moment and try again.'
)
).toBeVisible()
@@ -127,6 +129,7 @@ test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () =>
test('reports a duplicate email on sign-up instead of creating a second account', async ({
page,
+ toast,
cloudAuth
}) => {
await cloudAuth.mockLiveEmailSignUpFailure({
@@ -143,13 +146,14 @@ test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () =>
await page.getByRole('button', { name: 'Sign up', exact: true }).click()
await expect(
- page.getByText(enMessages.auth.errors['auth/email-already-in-use'])
+ toast.withText(enMessages.auth.errors['auth/email-already-in-use'])
).toBeVisible()
await expect(page).toHaveURL(/\/cloud\/signup/)
})
test('reports a dropped connection without claiming invalid credentials', async ({
page,
+ toast,
cloudAuth
}) => {
await cloudAuth.mockLiveEmailSignInTransportFailure()
@@ -163,7 +167,7 @@ test.describe('Cloud onboarding — auth error codes', { tag: '@cloud' }, () =>
await page.getByRole('button', { name: 'Sign in' }).click()
await expect(
- page.getByText(
+ toast.withText(
'Network error. Please check your connection and try again.'
)
).toBeVisible()
diff --git a/browser_tests/tests/cloudWorkspaceDeepLink.spec.ts b/browser_tests/tests/cloudWorkspaceDeepLink.spec.ts
index cfa4911c0ff..72317bf1248 100644
--- a/browser_tests/tests/cloudWorkspaceDeepLink.spec.ts
+++ b/browser_tests/tests/cloudWorkspaceDeepLink.spec.ts
@@ -54,7 +54,7 @@ test.describe('Cloud workspace deep link', { tag: '@cloud' }, () => {
const page = comfyPage.page
await expect(
- page.getByText(`You're still in ${PERSONAL_WORKSPACE_NAME}`)
+ comfyPage.toast.withText(`You're still in ${PERSONAL_WORKSPACE_NAME}`)
).toBeVisible()
expect(new URL(page.url()).searchParams.has('workspace')).toBe(false)
@@ -82,7 +82,7 @@ test.describe('Cloud workspace deep link', { tag: '@cloud' }, () => {
await comfyPage.waitForAppReady()
await expect(
- page.getByText(`You're still in ${PERSONAL_WORKSPACE_NAME}`)
+ comfyPage.toast.withText(`You're still in ${PERSONAL_WORKSPACE_NAME}`)
).toBeVisible()
expect(new URL(page.url()).searchParams.has('workspace')).toBe(false)
})
@@ -90,7 +90,7 @@ test.describe('Cloud workspace deep link', { tag: '@cloud' }, () => {
test('is unchanged with no workspace param', async ({ comfyPage }) => {
const page = comfyPage.page
- await expect(page.locator('.p-toast-message:visible')).toHaveCount(0)
+ await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
await page.getByRole('button', { name: 'Current user' }).click()
await expect(page.getByTestId('workspace-switcher-trigger')).toContainText(
PERSONAL_WORKSPACE_NAME
diff --git a/browser_tests/tests/customNodes/errorSurfaces.spec.ts b/browser_tests/tests/customNodes/errorSurfaces.spec.ts
index 74a7d7a914f..c15aa4afa2a 100644
--- a/browser_tests/tests/customNodes/errorSurfaces.spec.ts
+++ b/browser_tests/tests/customNodes/errorSurfaces.spec.ts
@@ -20,8 +20,8 @@ test('a persistent error toast fails carrying its visible text', async ({
page
}) => {
await page.setContent(
- 'Failed to load workspace: HTTP 502
' +
- 'Settings seed rejected
'
+ 'Failed to load workspace: HTTP 502
' +
+ 'Settings seed rejected
'
)
const failure = await expectNoVisibleErrors(page, 'at startup').then(
() => undefined,
@@ -54,7 +54,8 @@ test('a visible error toast fails after it clears before the assertion', async (
await page.evaluate(() => {
const toast = document.createElement('div')
toast.id = 't'
- toast.className = 'p-toast-message-error'
+ toast.dataset.testid = 'toast'
+ toast.dataset.toastKind = 'error'
toast.textContent = 'momentary'
document.getElementById('root')!.append(toast)
setTimeout(() => toast.remove(), 800)
@@ -68,16 +69,20 @@ test('a visible error toast fails after it clears before the assertion', async (
expect(String(failure)).toContain('momentary')
})
-test('an error class added after insertion fails after it clears', async ({
+test('error toast attributes added after insertion fail after they clear', async ({
page
}) => {
await page.setContent('late error
')
await page.evaluate(() => {
const toast = document.getElementById('t')!
- toast.classList.add('p-toast-message-error')
- setTimeout(() => toast.classList.remove('p-toast-message-error'), 800)
+ toast.dataset.testid = 'toast'
+ toast.dataset.toastKind = 'error'
+ setTimeout(() => {
+ delete toast.dataset.testid
+ delete toast.dataset.toastKind
+ }, 800)
})
- await expect(page.locator('#t')).not.toHaveClass('p-toast-message-error')
+ await expect(page.locator('#t')).not.toHaveAttribute('data-toast-kind')
const failure = await expectNoVisibleErrors(page, 'class-added').then(
() => undefined,
(error: unknown) => error
@@ -91,7 +96,7 @@ test('a hidden error fails when an ancestor mutation reveals it', async ({
}) => {
await page.setContent(
'' +
- 'revealed error
' +
+ 'revealed error
' +
''
)
await page.evaluate(() => {
diff --git a/browser_tests/tests/dialogs/billingPortalOrigin.spec.ts b/browser_tests/tests/dialogs/billingPortalOrigin.spec.ts
index 834f4066bc0..beb98bc8425 100644
--- a/browser_tests/tests/dialogs/billingPortalOrigin.spec.ts
+++ b/browser_tests/tests/dialogs/billingPortalOrigin.spec.ts
@@ -154,7 +154,8 @@ test.describe('Billing portal origin (#19892)', { tag: '@cloud' }, () => {
})
test('opens nothing and reports the refusal for a look-alike portal host', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const portalOpens = await setupRefusedPlanChange(page, LOOK_ALIKE_PORTAL)
@@ -163,7 +164,7 @@ test.describe('Billing portal origin (#19892)', { tag: '@cloud' }, () => {
// The customer still gets the server's own guidance, which is what tells
// them what to do; the rejected host never reaches a tab.
- await expect(page.getByText(PAYMENT_REQUIRED.message)).toBeVisible()
+ await expect(toast.withText(PAYMENT_REQUIRED.message)).toBeVisible()
expect(await portalOpens()).toEqual([])
})
})
diff --git a/browser_tests/tests/dialogs/billingProgressToastParity.spec.ts b/browser_tests/tests/dialogs/billingProgressToastParity.spec.ts
index c6c52ace60a..6cb65d37586 100644
--- a/browser_tests/tests/dialogs/billingProgressToastParity.spec.ts
+++ b/browser_tests/tests/dialogs/billingProgressToastParity.spec.ts
@@ -278,23 +278,27 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
for (const { name, rails } of RAIL_MATRIX) {
test.describe(`on the ${name} rail`, () => {
test('announces a processing subscribe and clears it once it settles', async ({
- page
+ page,
+ toast
}) => {
const server = await setupToastParity(page, { rails })
await confirmCreatorUpgrade(page)
- const toast = page.getByText(SUBSCRIPTION_PROCESSING)
- await expect(toast).toBeVisible()
+ const processingToast = toast.toastLoadings.filter({
+ hasText: SUBSCRIPTION_PROCESSING
+ })
+ await expect(processingToast).toBeVisible()
server.operation = SETTLED_OPERATION
await returnToTab(page)
await expect(successHeading(page)).toBeVisible()
- await expect(toast).toBeHidden()
+ await expect(processingToast).toBeHidden()
})
test('asks for verification while a subscribe waits on the hosted payment page', async ({
- page
+ page,
+ toast
}) => {
await setupToastParity(page, {
rails,
@@ -308,12 +312,15 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
await confirmCreatorUpgrade(page)
- await expect(page.getByText(SUBSCRIPTION_ACTION_REQUIRED)).toBeVisible()
- await expect(page.getByText(SUBSCRIPTION_PROCESSING)).toBeHidden()
+ await expect(
+ toast.toastWarnings.filter({ hasText: SUBSCRIPTION_ACTION_REQUIRED })
+ ).toBeVisible()
+ await expect(toast.withText(SUBSCRIPTION_PROCESSING)).toBeHidden()
})
test('stays quiet after a reload finds the subscribe parked on a payment method', async ({
- page
+ page,
+ toast
}) => {
await setupToastParity(page, {
rails,
@@ -331,8 +338,8 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
await firstRead
await operationRead(page)
- await expect(page.getByText(SUBSCRIPTION_PROCESSING)).toHaveCount(0)
- await expect(page.getByText(SUBSCRIPTION_ACTION_REQUIRED)).toHaveCount(
+ await expect(toast.withText(SUBSCRIPTION_PROCESSING)).toHaveCount(0)
+ await expect(toast.withText(SUBSCRIPTION_ACTION_REQUIRED)).toHaveCount(
0
)
})
@@ -372,7 +379,8 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
}
test('asks again for verification after a reload finds the subscribe still waiting', async ({
- page
+ page,
+ toast
}) => {
await setupToastParity(page, {
rails,
@@ -385,18 +393,20 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
}
})
+ const actionRequired = toast.withText(SUBSCRIPTION_ACTION_REQUIRED)
await page.goto(APP_URL)
await waitForCloudApp(page)
- await expect(page.getByText(SUBSCRIPTION_ACTION_REQUIRED)).toBeVisible()
+ await expect(actionRequired).toBeVisible()
await page.reload()
await waitForCloudApp(page)
- await expect(page.getByText(SUBSCRIPTION_ACTION_REQUIRED)).toBeVisible()
+ await expect(actionRequired).toBeVisible()
})
test('announces a processing top-up and clears it once it settles', async ({
- page
+ page,
+ toast
}) => {
const server = await setupToastParity(page, { rails })
await page.goto(APP_URL)
@@ -408,16 +418,18 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
.getByRole('button', { name: 'Add credits', exact: true })
.click()
await dialog.root.getByRole('button', { name: 'Pay $50.00' }).click()
- const toast = page.getByText(TOPUP_PROCESSING)
- await expect(toast).toBeVisible()
+ const processingToast = toast.toastLoadings.filter({
+ hasText: TOPUP_PROCESSING
+ })
+ await expect(processingToast).toBeVisible()
server.operation = SETTLED_OPERATION
await returnToTab(page)
- await expect(toast).toBeHidden()
+ await expect(processingToast).toBeHidden()
})
- test('raises no progress toast for a cancel', async ({ page }) => {
+ test('raises no progress toast for a cancel', async ({ page, toast }) => {
await setupToastParity(page, { rails, operation: SETTLED_OPERATION })
await page.goto(APP_URL)
await waitForCloudApp(page)
@@ -426,8 +438,8 @@ test.describe('Billing progress toast parity', { tag: '@cloud' }, () => {
await cancel.open(ACTIVE_STANDARD.renewal_date)
await cancel.confirmCancel()
- await expect(page.getByText(/Processing payment/)).toHaveCount(0)
- await expect(page.getByText(SUBSCRIPTION_ACTION_REQUIRED)).toHaveCount(
+ await expect(toast.withText(/Processing payment/)).toHaveCount(0)
+ await expect(toast.withText(SUBSCRIPTION_ACTION_REQUIRED)).toHaveCount(
0
)
})
diff --git a/browser_tests/tests/dialogs/billingRailParitySdkRail.spec.ts b/browser_tests/tests/dialogs/billingRailParitySdkRail.spec.ts
index 36a750e17e2..92aff971aad 100644
--- a/browser_tests/tests/dialogs/billingRailParitySdkRail.spec.ts
+++ b/browser_tests/tests/dialogs/billingRailParitySdkRail.spec.ts
@@ -24,6 +24,7 @@ import { TopUpCreditsDialog } from '@e2e/fixtures/components/TopUpCreditsDialog'
import { createWorkspaceBillingCapabilities } from '@e2e/fixtures/data/billingCapabilities'
import { createPlan } from '@e2e/fixtures/data/billingPlans'
import { CLOUD_SELF_EMAIL } from '@e2e/fixtures/helpers/CloudAuthHelper'
+import type { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
import { FeatureFlagHelper } from '@e2e/fixtures/helpers/FeatureFlagHelper'
import { APP_URL, setupCloudApp } from '@e2e/fixtures/utils/cloudAppSetup'
import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute'
@@ -366,10 +367,8 @@ async function returnToTab(page: Page) {
await page.evaluate(() => window.dispatchEvent(new Event('focus')))
}
-const successToast = (page: Page) =>
- page.locator('.p-toast-message-success', {
- hasText: 'Credits added successfully!'
- })
+const successToast = (toast: ToastHelper) =>
+ toast.toastSuccesses.filter({ hasText: 'Credits added successfully!' })
/** The plan summary on the success step, which names what was bought. */
const successSummary = (page: Page) =>
@@ -426,10 +425,13 @@ async function expectPortalReturnRefresh(
* Buys $50 of credits, then upgrades to Creator from Plan & Credits without
* leaving the page, and returns the panel once the success step is closed.
*/
-async function topUpThenUpgrade(page: Page): Promise {
+async function topUpThenUpgrade(
+ page: Page,
+ toast: ToastHelper
+): Promise {
await bootApp(page)
const topUp = await buyFiftyDollars(page)
- await expect(successToast(page)).toBeVisible()
+ await expect(successToast(toast)).toBeVisible()
await expect(topUp.root).toBeHidden()
// A settled purchase lands the customer on Plan & Credits.
@@ -460,7 +462,8 @@ async function topUpThenUpgrade(page: Page): Promise {
test.describe('Billing rail parity', { tag: '@cloud' }, () => {
test.describe('with only the subscription rail on', () => {
test('buys credits on the legacy transport and refreshes the balance', async ({
- page
+ page,
+ toast
}) => {
const routes = await setupParity(page, { rails: SUBSCRIPTION_RAIL_ONLY })
await bootApp(page)
@@ -468,7 +471,7 @@ test.describe('Billing rail parity', { tag: '@cloud' }, () => {
await buyFiftyDollars(page)
- await expect(successToast(page)).toBeVisible()
+ await expect(successToast(toast)).toBeVisible()
expect(routes.topupRequests).toHaveLength(1)
const [purchase] = routes.topupRequests
expect(transport(purchase)).toBe('xhr')
@@ -509,10 +512,11 @@ test.describe('Billing rail parity', { tag: '@cloud' }, () => {
})
test('completes a top-up and then a subscribe in one session, and totals both', async ({
- page
+ page,
+ toast
}) => {
const routes = await setupParity(page, { rails: SUBSCRIPTION_RAIL_ONLY })
- const panel = await topUpThenUpgrade(page)
+ const panel = await topUpThenUpgrade(page, toast)
expect(routes.topupRequests.map(transport)).toEqual(['xhr'])
expect(routes.subscribeRequests.map(transport)).toEqual(['fetch'])
diff --git a/browser_tests/tests/dialogs/billingRecoverySdkRail.spec.ts b/browser_tests/tests/dialogs/billingRecoverySdkRail.spec.ts
index 67de529f991..10fff87a57e 100644
--- a/browser_tests/tests/dialogs/billingRecoverySdkRail.spec.ts
+++ b/browser_tests/tests/dialogs/billingRecoverySdkRail.spec.ts
@@ -22,6 +22,7 @@ import {
import { createPlan } from '@e2e/fixtures/data/billingPlans'
import { makeWorkspaceTokenResponse } from '@e2e/fixtures/data/workspaceAuthFixtures'
import { CLOUD_SELF_EMAIL } from '@e2e/fixtures/helpers/CloudAuthHelper'
+import type { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
import { FeatureFlagHelper } from '@e2e/fixtures/helpers/FeatureFlagHelper'
import { APP_URL, setupCloudApp } from '@e2e/fixtures/utils/cloudAppSetup'
import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute'
@@ -234,10 +235,8 @@ async function payAndOpenVerification(page: Page, routes: TopupRoutes) {
const completeVerification = (dialog: TopUpCreditsDialog) =>
dialog.root.getByRole('button', { name: 'Complete verification' })
-const successToast = (page: Page) =>
- page
- .locator('.p-toast-message.p-toast-message-success')
- .getByText('Credits added successfully')
+const successToast = (toast: ToastHelper) =>
+ toast.toastSuccesses.filter({ hasText: 'Credits added successfully' })
function transports(requests: Request[]): string[] {
return requests.map((request) => request.resourceType())
@@ -565,7 +564,8 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
test.describe('hosted bank verification', () => {
test('offers the verification again after the customer abandons the hosted page', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(90_000)
const routes = await setupTopUp(page)
@@ -581,11 +581,12 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
await expect(completeVerification(dialog)).not.toHaveAttribute(
'aria-busy'
)
- await expect(successToast(page)).toHaveCount(0)
+ await expect(successToast(toast)).toHaveCount(0)
})
test('settles the same purchase when the customer retries the verification', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(90_000)
const routes = await setupTopUp(page)
@@ -599,7 +600,7 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
routes.setOperation(SUCCEEDED)
await returnToTab(page)
- await expect(successToast(page)).toBeVisible()
+ await expect(successToast(toast)).toBeVisible()
await expect(dialog.root).toBeHidden()
expect(routes.purchaseRequests).toHaveLength(1)
expect(operationIdsPolled(routes.pollRequests)).toEqual(
@@ -609,7 +610,8 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
})
test('does not offer the verification again once the bank has accepted it', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(90_000)
const routes = await setupTopUp(page)
@@ -630,9 +632,7 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
}
await expect(
- page
- .locator('.p-toast-message')
- .getByText('Verify your payment to add your credits')
+ toast.withText('Verify your payment to add your credits')
).toHaveCount(0)
// Shown as work in progress, not as a step the customer still owes.
await expect(completeVerification(dialog)).toBeDisabled()
@@ -645,7 +645,8 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
})
test('reports the outcome of a verified purchase after a reload', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(120_000)
const routes = await setupTopUp(page)
@@ -660,7 +661,7 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
routes.setOperation(SUCCEEDED)
await returnToTab(page)
- await expect(successToast(page)).toBeVisible({ timeout: 45_000 })
+ await expect(successToast(toast)).toBeVisible({ timeout: 45_000 })
expect(routes.purchaseRequests).toHaveLength(1)
expect(transports(routes.pollRequests)).not.toContain('xhr')
// The step was already done, so the reload has nothing to reopen.
@@ -704,7 +705,8 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
test.describe('a plan change over an operation parked by an earlier attempt', () => {
test('says the earlier payment has to finish, and issues no second subscribe', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(90_000)
const routes = await setupSubscription(page)
@@ -725,7 +727,7 @@ test.describe('Billing recovery on the SDK rails', { tag: '@cloud' }, () => {
await confirmUpgrade(page)
await expect(
- page.getByText(
+ toast.withText(
'A payment you started earlier is still going through. It has to finish before you can choose a different plan.'
)
).toBeVisible()
diff --git a/browser_tests/tests/dialogs/embeddedCheckoutSdkRail.spec.ts b/browser_tests/tests/dialogs/embeddedCheckoutSdkRail.spec.ts
index 1491b419c0d..d42f4316e9c 100644
--- a/browser_tests/tests/dialogs/embeddedCheckoutSdkRail.spec.ts
+++ b/browser_tests/tests/dialogs/embeddedCheckoutSdkRail.spec.ts
@@ -662,7 +662,8 @@ test.describe(
test.describe('Embedded top-up bank step', { tag: '@cloud' }, () => {
test('offers the in-page bank step again after a decline, and settles when it completes', async ({
- page
+ page,
+ toast
}) => {
const fake = await installFakeStripe(page)
fake.bankSteps.push('fail')
@@ -701,9 +702,7 @@ test.describe('Embedded top-up bank step', { tag: '@cloud' }, () => {
.click()
await expect(
- page
- .locator('.p-toast-message-success')
- .getByText('Credits added successfully')
+ toast.toastSuccesses.filter({ hasText: 'Credits added successfully' })
).toBeVisible()
expect(bankSteps(fake)).toEqual([
{ method: 'handleNextAction', clientSecret: BANK_STEP_SECRET },
diff --git a/browser_tests/tests/dialogs/enterpriseTierCloud.spec.ts b/browser_tests/tests/dialogs/enterpriseTierCloud.spec.ts
index 293af9da36d..2a5b35265f3 100644
--- a/browser_tests/tests/dialogs/enterpriseTierCloud.spec.ts
+++ b/browser_tests/tests/dialogs/enterpriseTierCloud.spec.ts
@@ -242,7 +242,8 @@ test.describe('Enterprise workspace billing', { tag: '@cloud' }, () => {
})
test('keeps an ended Enterprise workspace out of self-service recovery', async ({
- page
+ page,
+ toast
}) => {
const workspace = await setupSalesManagedWorkspace(
page,
@@ -283,10 +284,9 @@ test.describe('Enterprise workspace billing', { tag: '@cloud' }, () => {
await expect(
page.getByRole('heading', { name: 'Choose a Plan' })
).toHaveCount(0)
- await expect(page.locator('.p-toast-message-warn')).toContainText(
- 'Plan inactive'
- )
- await expect(page.locator('.p-toast-message-warn')).toContainText(
+ const warning = toast.toastWarnings
+ await expect(warning).toContainText('Plan inactive')
+ await expect(warning).toContainText(
'Contact your Comfy account manager to restore access.'
)
})
diff --git a/browser_tests/tests/dialogs/hostedBillingDestination.spec.ts b/browser_tests/tests/dialogs/hostedBillingDestination.spec.ts
index b0f4a721b0a..ca4444b4198 100644
--- a/browser_tests/tests/dialogs/hostedBillingDestination.spec.ts
+++ b/browser_tests/tests/dialogs/hostedBillingDestination.spec.ts
@@ -324,7 +324,8 @@ test.describe('Hosted billing destination (FE-2218)', { tag: '@cloud' }, () => {
})
test('tells the customer and mints no portal session when the hosted payment-methods tab is blocked', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const { portalRequests } = await mockCloudBoot(page)
@@ -337,7 +338,7 @@ test.describe('Hosted billing destination (FE-2218)', { tag: '@cloud' }, () => {
await content.getByRole('button', { name: 'Billing & invoices' }).click()
await expect(
- page.getByText(
+ toast.withText(
"Couldn't open the billing page. Allow pop-ups for this site and try again."
)
).toBeVisible()
@@ -345,7 +346,8 @@ test.describe('Hosted billing destination (FE-2218)', { tag: '@cloud' }, () => {
})
test('tells the customer and mints no portal session when the provider portal tab is blocked', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const { portalRequests } = await mockCloudBoot(page)
@@ -355,7 +357,7 @@ test.describe('Hosted billing destination (FE-2218)', { tag: '@cloud' }, () => {
await content.getByRole('button', { name: 'Billing & invoices' }).click()
await expect(
- page.getByText(
+ toast.withText(
"Couldn't open the billing page. Allow pop-ups for this site and try again."
)
).toBeVisible()
diff --git a/browser_tests/tests/dialogs/managerDialog.spec.ts b/browser_tests/tests/dialogs/managerDialog.spec.ts
index db4d581df11..1a86bd3dfdd 100644
--- a/browser_tests/tests/dialogs/managerDialog.spec.ts
+++ b/browser_tests/tests/dialogs/managerDialog.spec.ts
@@ -467,10 +467,10 @@ test.describe('ManagerDialog', { tag: '@ui' }, () => {
)
await expect(
- comfyPage.page.getByRole('alert').filter({ hasText: result.result })
+ comfyPage.toast.toastErrors.filter({ hasText: result.result })
).toBeVisible()
await expect(
- comfyPage.page.getByText('Failed', { exact: true })
+ comfyPage.toast.panels.getByText('Failed', { exact: true })
).toBeVisible()
await expect(
info.getByRole('button', { name: 'Install', exact: true })
diff --git a/browser_tests/tests/dialogs/memberRoleChange.spec.ts b/browser_tests/tests/dialogs/memberRoleChange.spec.ts
index 3cd215ca93c..affc9ff3aeb 100644
--- a/browser_tests/tests/dialogs/memberRoleChange.spec.ts
+++ b/browser_tests/tests/dialogs/memberRoleChange.spec.ts
@@ -168,7 +168,8 @@ test.describe('Member role change (Members tab)', { tag: '@cloud' }, () => {
})
test('promoting a member re-sorts the row under the creator and stays demotable', async ({
- page
+ page,
+ toast
}) => {
const state = await new CloudWorkspaceMockHelper(page).setup()
const members = new MembersSettingsPanel(page)
@@ -191,7 +192,7 @@ test.describe('Member role change (Members tab)', { tag: '@cloud' }, () => {
.click()
await page.getByRole('button', { name: 'Make owner' }).click()
- await expect(page.getByText('Role updated')).toBeVisible()
+ await expect(toast.withText('Role updated')).toBeVisible()
await expect(janeRow.getByText('Owner', { exact: true })).toBeVisible()
await expect(emails).toHaveText([
CREATOR.email,
@@ -245,7 +246,8 @@ test.describe('Member role change (Members tab)', { tag: '@cloud' }, () => {
})
test('failed role change keeps the dialog open with an error toast', async ({
- page
+ page,
+ toast
}) => {
await new CloudWorkspaceMockHelper(page).setup()
// Override the member route so PATCH fails after boot succeeds.
@@ -266,7 +268,11 @@ test.describe('Member role change (Members tab)', { tag: '@cloud' }, () => {
await page.getByRole('button', { name: 'Make owner' }).click()
// US10 — error toast, dialog stays open, role unchanged.
- await expect(page.getByText('Failed to update role')).toBeVisible()
+ await expect(
+ toast.toastErrors.filter({
+ hasText: 'Failed to update role'
+ })
+ ).toBeVisible()
await expect(
page.getByRole('heading', { name: 'Make Jane an owner?' })
).toBeVisible()
diff --git a/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts b/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts
index 48efa216361..b7833296d1b 100644
--- a/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts
+++ b/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts
@@ -6,6 +6,7 @@ import {
comfyExpect as expect
} from '@e2e/fixtures/ComfyPage'
import { modelImportProgressFixture } from '@e2e/fixtures/modelImportProgressFixture'
+import { TestIds } from '@e2e/fixtures/selectors'
const test = mergeTests(comfyPageFixture, modelImportProgressFixture)
@@ -31,6 +32,45 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
).toBeVisible()
})
+ test('keeps a panel reachable when expanded panels outgrow a short viewport', async ({
+ comfyPage,
+ modelImportProgress
+ }) => {
+ await comfyPage.page.setViewportSize({ width: 1280, height: 360 })
+ await comfyPage.assets.dispatchExport({
+ task_id: 'stacked-export',
+ export_name: 'outputs.zip',
+ assets_total: 4,
+ assets_attempted: 1,
+ assets_failed: 0,
+ bytes_total: 1000,
+ bytes_processed: 250,
+ progress: 0.25,
+ status: 'running'
+ })
+ const exportPanel = comfyPage.page
+ .getByTestId(TestIds.toast.panel)
+ .filter({ hasText: 'Exporting Assets' })
+
+ await modelImportProgress.expand()
+ await exportPanel.getByRole('button', { name: 'Expand' }).click()
+ await modelImportProgress.filterBy('Failed')
+ await expect(
+ modelImportProgress.job('completed-model.safetensors')
+ ).toBeHidden()
+
+ const panelBounds = await modelImportProgress.root.boundingBox()
+ const collapseBounds = await modelImportProgress.root
+ .getByRole('button', { name: 'Collapse' })
+ .boundingBox()
+ expect(panelBounds).not.toBeNull()
+ expect(collapseBounds).not.toBeNull()
+ expect(
+ collapseBounds!.y + collapseBounds!.height,
+ 'the footer must not be clipped by a squashed panel'
+ ).toBeLessThanOrEqual(panelBounds!.y + panelBounds!.height)
+ })
+
test('recovers from a premature failed status once the backend silently retries and completes it (PM-1302)', async ({
comfyPage
}) => {
@@ -49,13 +89,14 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
})
await expect(
- page.getByText('Importing Models', { exact: true })
+ comfyPage.toast.panels.getByText('Importing Models', { exact: true })
).toBeVisible()
})
- const failedFooterText = page.getByText('1 download failed', {
- exact: true
- })
+ const failedFooterText = comfyPage.toast.panels.getByText(
+ '1 download failed',
+ { exact: true }
+ )
await test.step('show the retryable failure reported by the backend', async () => {
await comfyPage.assets.dispatchDownload({
@@ -85,12 +126,14 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
await expect(failedFooterText).toBeHidden()
await expect(
- page.getByText('All downloads completed', { exact: true })
+ comfyPage.toast.panels.getByText('All downloads completed', {
+ exact: true
+ })
).toBeVisible()
})
const toast = page
- .getByRole('status')
+ .getByTestId(TestIds.toast.panel)
.filter({ hasText: 'All downloads completed' })
await expect(toast).toHaveScreenshot(
@@ -127,11 +170,11 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
})
const toast = page
- .getByRole('status')
+ .getByTestId(TestIds.toast.panel)
.filter({ hasText: '1 download failed' })
await expect(toast).toBeVisible()
await expect(
- page.getByText('1 download failed', { exact: true })
+ comfyPage.toast.panels.getByText('1 download failed', { exact: true })
).toBeVisible()
await test.step('dismiss the failed model import', async () => {
@@ -181,7 +224,9 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
})
})
- const toast = page.getByRole('status').filter({ hasText: assetName })
+ const toast = page
+ .getByTestId(TestIds.toast.panel)
+ .filter({ hasText: assetName })
await expect(toast).toBeVisible()
await test.step('cancel through user-visible controls', async () => {
@@ -244,7 +289,9 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
await route.fulfill({ status: 404, json: { detail: 'Task not found' } })
})
- const toast = page.getByRole('status').filter({ hasText: assetName })
+ const toast = page
+ .getByTestId(TestIds.toast.panel)
+ .filter({ hasText: assetName })
await test.step('cancel a running download', async () => {
await comfyPage.assets.dispatchDownload({
@@ -317,7 +364,9 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
status: 'running'
})
- const toast = page.getByRole('status').filter({ hasText: assetName })
+ const toast = page
+ .getByTestId(TestIds.toast.panel)
+ .filter({ hasText: assetName })
await expect(toast).toBeVisible()
await toast.getByRole('button', { name: 'Expand' }).click()
const cancellation = page.waitForResponse(
@@ -399,7 +448,7 @@ test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => {
})
const toast = page
- .getByRole('status')
+ .getByTestId(TestIds.toast.panel)
.filter({ hasText: '1 download failed' })
await test.step('dismiss the model import during reconciliation', async () => {
diff --git a/browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts b/browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts
index fbd917b43ee..a2b2f62e6a5 100644
--- a/browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts
+++ b/browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts
@@ -575,30 +575,27 @@ test.describe('Pricing table deep link', { tag: '@cloud' }, () => {
})
test('keeps an error toast dismissable over the open dialog', async ({
- page
+ page,
+ toast
}) => {
await setupCloudApp(page, workspace('personal', 'owner'), [])
await page.goto(`${APP_URL}/?pricing=1`)
await cloudAppExpect(pricingHeading(page)).toBeVisible()
await page.evaluate((detail) => {
- window.app!.extensionManager.toast.add({
- severity: 'error',
- summary: 'Error',
- detail,
- life: 30_000
+ window.app!.extensionManager.toast.error('Error', {
+ description: detail,
+ duration: 30_000
})
}, SUBSCRIPTION_IN_PROGRESS_DETAIL)
- const toast = page
- .locator('.p-toast-message')
- .filter({ hasText: SUBSCRIPTION_IN_PROGRESS_DETAIL })
- await expect(toast).toBeVisible()
- // Not getByRole: an open Reka modal marks the toast container aria-hidden,
- // so the close button is absent from the accessibility tree.
- await toast.locator('.p-toast-close-button').click()
+ const errorToast = toast.toastErrors.filter({
+ hasText: SUBSCRIPTION_IN_PROGRESS_DETAIL
+ })
+ await expect(errorToast).toBeVisible()
+ await toast.dismiss(errorToast)
- await expect(toast).toHaveCount(0)
+ await expect(errorToast).toHaveCount(0)
await expect(pricingHeading(page)).toBeVisible()
})
@@ -692,7 +689,8 @@ test.describe('Pricing table deep link', { tag: '@cloud' }, () => {
})
test('restores pending checkout when retrying a timed-out operation', async ({
- page
+ page,
+ toast
}) => {
const subscribeRequests: Request[] = []
const operationPollRequests: Request[] = []
@@ -749,7 +747,7 @@ test.describe('Pricing table deep link', { tag: '@cloud' }, () => {
await expect(backButton).toBeEnabled()
await expect(
- page.getByText('Subscription verification timed out', { exact: true })
+ toast.withText('Subscription verification timed out')
).toBeVisible()
const pollCountAfterTimeout = operationPollRequests.length
@@ -1123,7 +1121,8 @@ test.describe(
})
test('reconciles status and balance without polling', async ({
- page
+ page,
+ toast
}) => {
await page.goto(`${APP_URL}/?pricing=personal`)
@@ -1139,9 +1138,9 @@ test.describe(
expect((await subscribeResponse).status()).toBe(200)
expect(subscribeRequests).toHaveLength(1)
- const blockedPopupToast = page
- .locator('.p-toast-message.p-toast-message-error')
- .filter({ hasText: 'Failed to change plan' })
+ const blockedPopupToast = toast.toastErrors.filter({
+ hasText: 'Failed to change plan'
+ })
await expect(blockedPopupToast).toContainText(
"Couldn't open the payment page — please try again"
)
diff --git a/browser_tests/tests/dialogs/publishDialog.spec.ts-snapshots/publish-dialog-lg-chromium-linux.png b/browser_tests/tests/dialogs/publishDialog.spec.ts-snapshots/publish-dialog-lg-chromium-linux.png
index ff641f442f8..bf3b57193a0 100644
Binary files a/browser_tests/tests/dialogs/publishDialog.spec.ts-snapshots/publish-dialog-lg-chromium-linux.png and b/browser_tests/tests/dialogs/publishDialog.spec.ts-snapshots/publish-dialog-lg-chromium-linux.png differ
diff --git a/browser_tests/tests/dialogs/resumedSubscriptionSettle.spec.ts b/browser_tests/tests/dialogs/resumedSubscriptionSettle.spec.ts
index 8b5107df7dc..d80a5bb43c0 100644
--- a/browser_tests/tests/dialogs/resumedSubscriptionSettle.spec.ts
+++ b/browser_tests/tests/dialogs/resumedSubscriptionSettle.spec.ts
@@ -14,6 +14,7 @@ import { createWorkspaceBillingCapabilities } from '@e2e/fixtures/data/billingCa
import { createPlan } from '@e2e/fixtures/data/billingPlans'
import { CLOUD_SELF_EMAIL } from '@e2e/fixtures/helpers/CloudAuthHelper'
import { FeatureFlagHelper } from '@e2e/fixtures/helpers/FeatureFlagHelper'
+import type { ToastHelper } from '@e2e/fixtures/helpers/ToastHelper'
import { APP_URL, setupCloudApp } from '@e2e/fixtures/utils/cloudAppSetup'
import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute'
import { member, workspace } from '@e2e/fixtures/utils/workspaceMocks'
@@ -235,7 +236,11 @@ async function reloadWhileProcessing(page: Page, routes: ResumeRoutes) {
.toBeGreaterThan(pollsBeforeReload)
}
-async function expectResumedSubscribeSettles(page: Page, rail: Rail) {
+async function expectResumedSubscribeSettles(
+ page: Page,
+ toast: ToastHelper,
+ rail: Rail
+) {
const routes = await setupResume(page, rail)
await page.goto(`${APP_URL}/?pricing=creator&cycle=yearly`)
await expect(
@@ -252,9 +257,9 @@ async function expectResumedSubscribeSettles(page: Page, rail: Rail) {
await returnToTab(page)
await expect(
- page
- .getByRole('alert')
- .filter({ hasText: 'Subscription updated successfully' })
+ toast.toastSuccesses.filter({
+ hasText: 'Subscription updated successfully'
+ })
).toBeVisible({ timeout: 45_000 })
const statusReadsAfterSettle = routes.statusRequests.slice(
statusReadsBeforeSettle
@@ -271,16 +276,18 @@ async function expectResumedSubscribeSettles(page: Page, rail: Rail) {
test.describe('Resumed subscription settle', { tag: '@cloud' }, () => {
test('reports a subscribe that settles after a reload on the SDK rail', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(120_000)
- await expectResumedSubscribeSettles(page, 'sdk')
+ await expectResumedSubscribeSettles(page, toast, 'sdk')
})
test('reports a subscribe that settles after a reload on the legacy rail', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(120_000)
- await expectResumedSubscribeSettles(page, 'legacy')
+ await expectResumedSubscribeSettles(page, toast, 'legacy')
})
})
diff --git a/browser_tests/tests/dialogs/signInDialogAuth.spec.ts b/browser_tests/tests/dialogs/signInDialogAuth.spec.ts
index 3f666b73f44..dae4d5e96ec 100644
--- a/browser_tests/tests/dialogs/signInDialogAuth.spec.ts
+++ b/browser_tests/tests/dialogs/signInDialogAuth.spec.ts
@@ -1,5 +1,7 @@
import { expect } from '@playwright/test'
+import enMessages from '@/locales/en/main.json' with { type: 'json' }
+
import { SignInDialog } from '@e2e/fixtures/components/SignInDialog'
import { CLOUD_SELF_EMAIL } from '@e2e/fixtures/helpers/CloudAuthHelper'
import { localSignedOutFixture as test } from '@e2e/fixtures/localSignedOutFixture'
@@ -50,7 +52,7 @@ test.describe('Sign In dialog — live auth', () => {
await expect(dialog.root).toBeVisible()
await expect(
- comfyPage.page.getByText('Invalid login credentials')
+ comfyPage.toast.withText('Invalid login credentials')
).toBeVisible()
})
@@ -156,11 +158,11 @@ test.describe('Sign In dialog — live auth', () => {
await dialog.forgotPasswordLink.click()
await expect(
- comfyPage.page.getByText('Password reset email sent')
+ comfyPage.toast.withText('Password reset email sent')
).toBeVisible()
})
- test('warns instead of sending when the email field is empty', async ({
+ test('flags the empty email field instead of sending a reset', async ({
comfyPage
}) => {
const dialog = new SignInDialog(comfyPage.page)
@@ -168,8 +170,12 @@ test.describe('Sign In dialog — live auth', () => {
await dialog.forgotPasswordLink.click()
- await expect(comfyPage.page.getByText('Enter your email')).toBeVisible()
+ await expect(dialog.emailInput).toHaveAttribute('aria-invalid', 'true')
+ await expect(
+ dialog.root.getByText(enMessages.validation.invalidEmail)
+ ).toBeVisible()
await expect(dialog.emailInput).toBeFocused()
+ await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
})
test('reports a real transport failure on password reset without claiming success', async ({
@@ -188,13 +194,13 @@ test.describe('Sign In dialog — live auth', () => {
await resetFailed
await expect(
- comfyPage.page.getByText(
+ comfyPage.toast.withText(
'Network error. Please check your connection and try again.'
),
'a dropped connection must surface the network error, not a silent failure'
).toBeVisible()
await expect(
- comfyPage.page.getByText('Password reset email sent'),
+ comfyPage.toast.withText('Password reset email sent'),
'a real transport failure must not show the success confirmation'
).toBeHidden()
})
diff --git a/browser_tests/tests/dialogs/signInDialogAuthErrors.spec.ts b/browser_tests/tests/dialogs/signInDialogAuthErrors.spec.ts
index 2fc127a2477..c70b93989a7 100644
--- a/browser_tests/tests/dialogs/signInDialogAuthErrors.spec.ts
+++ b/browser_tests/tests/dialogs/signInDialogAuthErrors.spec.ts
@@ -32,7 +32,7 @@ test.describe('Sign In dialog — auth error codes', () => {
await expect(dialog.root).toBeVisible()
await expect(
- comfyPage.page.getByText('Invalid login credentials'),
+ comfyPage.toast.withText('Invalid login credentials'),
'the same copy as a wrong password keeps sign-in from revealing whether an email has an account'
).toBeVisible()
})
@@ -52,7 +52,7 @@ test.describe('Sign In dialog — auth error codes', () => {
await dialog.signInButton.click()
await expect(
- comfyPage.page.getByText(
+ comfyPage.toast.withText(
'This account has been disabled. Please contact support.'
)
).toBeVisible()
@@ -75,7 +75,7 @@ test.describe('Sign In dialog — auth error codes', () => {
await dialog.signInButton.click()
await expect(
- comfyPage.page.getByText(
+ comfyPage.toast.withText(
'Too many login attempts. Please wait a moment and try again.'
)
).toBeVisible()
@@ -99,7 +99,7 @@ test.describe('Sign In dialog — auth error codes', () => {
await dialog.signUpButton.click()
await expect(
- comfyPage.page.getByText(
+ comfyPage.toast.withText(
enMessages.auth.errors['auth/email-already-in-use']
)
).toBeVisible()
@@ -120,7 +120,7 @@ test.describe('Sign In dialog — auth error codes', () => {
await dialog.signInButton.click()
await expect(
- comfyPage.page.getByText(
+ comfyPage.toast.withText(
'Network error. Please check your connection and try again.'
)
).toBeVisible()
diff --git a/browser_tests/tests/dialogs/subscriptionLifecycleSdkRail.spec.ts b/browser_tests/tests/dialogs/subscriptionLifecycleSdkRail.spec.ts
index ea712dbd297..02b8aed0285 100644
--- a/browser_tests/tests/dialogs/subscriptionLifecycleSdkRail.spec.ts
+++ b/browser_tests/tests/dialogs/subscriptionLifecycleSdkRail.spec.ts
@@ -450,7 +450,8 @@ test.describe(
* reservation tells the customer why and asks neither transport.
*/
test('mints no portal session when the browser refuses the tab', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const routes = await mockCloudBoot(page, { railOnFeatures: true })
@@ -461,7 +462,7 @@ test.describe(
await panel.getByRole('button', { name: 'Billing & invoices' }).click()
await expect(
- page.getByText(
+ toast.withText(
"Couldn't open the billing page. Allow pop-ups for this site and try again."
)
).toBeVisible()
diff --git a/browser_tests/tests/dialogs/subscriptionSdkRailOutcomes.spec.ts b/browser_tests/tests/dialogs/subscriptionSdkRailOutcomes.spec.ts
index f27e2c6eb35..eda87eb7256 100644
--- a/browser_tests/tests/dialogs/subscriptionSdkRailOutcomes.spec.ts
+++ b/browser_tests/tests/dialogs/subscriptionSdkRailOutcomes.spec.ts
@@ -344,7 +344,8 @@ test.describe('Subscription rail outcomes', { tag: '@cloud' }, () => {
})
test('opens the hosted payment page once for a parked subscribe, and settles when the operation succeeds', async ({
- page
+ page,
+ toast
}) => {
let operation: BillingOpStatusResponse = PARKED_OPERATION
const routes = await setupRail(page, {
@@ -373,7 +374,7 @@ test.describe('Subscription rail outcomes', { tag: '@cloud' }, () => {
expect(routes.subscribeRequests).toHaveLength(1)
expect(transport(routes.subscribeRequests[0])).toBe('fetch')
await expect(
- page.getByText('Verify your payment to finish setting up your workspace')
+ toast.withText('Verify your payment to finish setting up your workspace')
).toBeVisible()
// A poll that still reports the same parked step must not offer it again.
@@ -395,7 +396,8 @@ test.describe('Subscription rail outcomes', { tag: '@cloud' }, () => {
})
test('shows the progress toast while a subscribe processes, and clears it when it settles', async ({
- page
+ page,
+ toast
}) => {
let operation: BillingOpStatusResponse = PROCESSING_OPERATION
await setupRail(page, {
@@ -419,7 +421,7 @@ test.describe('Subscription rail outcomes', { tag: '@cloud' }, () => {
).toBeVisible()
await page.getByRole('button', { name: 'Confirm upgrade' }).click()
- const progressToast = page.getByText(
+ const progressToast = toast.withText(
'Processing payment — setting up your workspace...'
)
await expect(progressToast).toBeVisible()
diff --git a/browser_tests/tests/dialogs/topUpNoPaymentMethod.spec.ts b/browser_tests/tests/dialogs/topUpNoPaymentMethod.spec.ts
index 5c2085bd897..c2612dd5393 100644
--- a/browser_tests/tests/dialogs/topUpNoPaymentMethod.spec.ts
+++ b/browser_tests/tests/dialogs/topUpNoPaymentMethod.spec.ts
@@ -48,9 +48,9 @@ test.describe('Top-up without a saved payment method', () => {
await topUpDialog.root.getByRole('button', { name: 'Pay $50.00' }).click()
await expect(
- page
- .locator('.p-toast-message.p-toast-message-error')
- .getByText(/Add one via Settings → Plan & Credits → Manage billing/)
+ comfyPage.toast.toastErrors.filter({
+ hasText: /Add one via Settings → Plan & Credits → Manage billing/
+ })
).toBeVisible()
})
})
diff --git a/browser_tests/tests/dialogs/topUpSdkRail.spec.ts b/browser_tests/tests/dialogs/topUpSdkRail.spec.ts
index 2dbda778a9e..4cafd44a86f 100644
--- a/browser_tests/tests/dialogs/topUpSdkRail.spec.ts
+++ b/browser_tests/tests/dialogs/topUpSdkRail.spec.ts
@@ -195,7 +195,8 @@ test.describe('Top-up rail (FE-2475)', { tag: '@cloud' }, () => {
* that has to be rewritten when it lands.
*/
test('surfaces a closed backend gate as a failed purchase, with no legacy retry', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const routes = await setupTopUp(page)
@@ -206,8 +207,6 @@ test.describe('Top-up rail (FE-2475)', { tag: '@cloud' }, () => {
await expect.poll(() => routes.purchaseRequests.length).toBe(1)
expect(transport(routes.purchaseRequests[0])).toBe('fetch')
- await expect(
- page.locator('.p-toast-message.p-toast-message-error')
- ).toBeVisible()
+ await expect(toast.toastErrors).toBeVisible()
})
})
diff --git a/browser_tests/tests/dialogs/topUpSdkRailOutcomes.spec.ts b/browser_tests/tests/dialogs/topUpSdkRailOutcomes.spec.ts
index caca6406f3d..5c160f5b5cc 100644
--- a/browser_tests/tests/dialogs/topUpSdkRailOutcomes.spec.ts
+++ b/browser_tests/tests/dialogs/topUpSdkRailOutcomes.spec.ts
@@ -206,12 +206,10 @@ async function openConfirmStep(page: Page) {
const payButton = (dialog: TopUpCreditsDialog) =>
dialog.root.getByRole('button', { name: 'Pay $50.00' })
-const successToast = (page: Page) =>
- page.locator('.p-toast-message.p-toast-message-success')
-
test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
test('sends a purchase with no saved card to the hosted page and settles it on return', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(90_000)
const routes = await setupTopUp(page, {
@@ -243,7 +241,7 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
await returnToTab(page)
await expect(
- successToast(page).getByText('Credits added successfully!')
+ toast.toastSuccesses.filter({ hasText: 'Credits added successfully!' })
).toBeVisible()
await expect(dialog.root).toBeHidden()
expect(routes.balanceRequests.length).toBeGreaterThan(
@@ -254,7 +252,8 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
})
test('fails a declined card the way the legacy rail does, without a retry', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(60_000)
const routes = await setupTopUp(page, {
@@ -273,12 +272,10 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
await payButton(dialog).click()
await expect(
- page
- .locator('.p-toast-message.p-toast-message-error')
- .getByText('Purchase Failed')
+ toast.toastErrors.filter({ hasText: 'Purchase Failed' })
).toBeVisible()
await expect(payButton(dialog)).toBeEnabled()
- await expect(successToast(page)).toHaveCount(0)
+ await expect(toast.toastSuccesses).toHaveCount(0)
// A settled purchase re-reads the balance; a declined one must not.
expect(routes.balanceRequests).toHaveLength(
routes.balanceReadsAtPurchase[0]
@@ -337,7 +334,8 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
})
test('keeps a purchase started in one workspace out of another', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(150_000)
const personal = workspace('personal', 'owner')
@@ -402,13 +400,13 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
await returnToTab(page)
expect(routes.pollRequests).toHaveLength(pollsBeforeTeam)
- await expect(successToast(page)).toHaveCount(0)
+ await expect(toast.toastSuccesses).toHaveCount(0)
expect(await operationPointerWorkspaces(page)).toEqual([personal.id])
await topUp.root.getByRole('button', { name: 'Close' }).click()
await switchWorkspace(page, personal.name)
await expect(
- successToast(page).getByText('Credits added successfully')
+ toast.toastSuccesses.filter({ hasText: 'Credits added successfully' })
).toBeVisible({ timeout: 45_000 })
expect(routes.pollRequests.length).toBeGreaterThan(pollsBeforeTeam)
await expect.poll(() => operationPointerWorkspaces(page)).toEqual([])
@@ -416,7 +414,8 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
})
test('shows a failed bank verification with its reason and does not offer it again', async ({
- page
+ page,
+ toast
}) => {
test.setTimeout(90_000)
const routes = await setupTopUp(page, {
@@ -460,7 +459,7 @@ test.describe('Top-up rail outcomes', { tag: '@cloud' }, () => {
await expect(
dialog.root.getByRole('button', { name: 'Complete verification' })
).toHaveCount(0)
- await expect(successToast(page)).toHaveCount(0)
+ await expect(toast.toastSuccesses).toHaveCount(0)
expect(routes.balanceRequests).toHaveLength(balanceReadsBeforeFailure)
expect(await routes.hostedOpens()).toEqual([HOSTED_URL])
expect(routes.purchaseRequests).toHaveLength(1)
diff --git a/browser_tests/tests/load3d/load3d.spec.ts b/browser_tests/tests/load3d/load3d.spec.ts
index 12de83412b1..b26549b38f1 100644
--- a/browser_tests/tests/load3d/load3d.spec.ts
+++ b/browser_tests/tests/load3d/load3d.spec.ts
@@ -311,9 +311,9 @@ test.describe('Load3D silent 404 on missing output model', () => {
await comfyPage.workflow.loadWorkflow('3d/load3d_missing_model')
await responsePromise
- await expect(
- comfyPage.toast.visibleToasts.filter({ hasText: 'Error loading model' })
- ).toHaveCount(0)
+ await expect(comfyPage.toast.withText('Error loading model')).toHaveCount(
+ 0
+ )
}
)
@@ -331,13 +331,9 @@ test.describe('Load3D silent 404 on missing output model', () => {
await responsePromise
await expect
- .poll(
- () =>
- comfyPage.toast.visibleToasts
- .filter({ hasText: 'Error loading model' })
- .count(),
- { timeout: 10000 }
- )
+ .poll(() => comfyPage.toast.withText('Error loading model').count(), {
+ timeout: 10000
+ })
.toBeGreaterThan(0)
}
)
@@ -366,9 +362,7 @@ test.describe('Load3D initialization failure', () => {
await comfyPage.workflow.loadWorkflow('3d/load3d_node')
await expect(
- comfyPage.toast.visibleToasts.filter({
- hasText: 'Failed to initialize 3D Viewer'
- })
+ comfyPage.toast.withText('Failed to initialize 3D Viewer')
).not.toHaveCount(0)
})
})
diff --git a/browser_tests/tests/nodeBadge.spec.ts-snapshots/node-badge-unknown-color-palette-chromium-linux.png b/browser_tests/tests/nodeBadge.spec.ts-snapshots/node-badge-unknown-color-palette-chromium-linux.png
index 1b3538d61ba..dbbc08feddd 100644
Binary files a/browser_tests/tests/nodeBadge.spec.ts-snapshots/node-badge-unknown-color-palette-chromium-linux.png and b/browser_tests/tests/nodeBadge.spec.ts-snapshots/node-badge-unknown-color-palette-chromium-linux.png differ
diff --git a/browser_tests/tests/nodeGhostPlacement.spec.ts b/browser_tests/tests/nodeGhostPlacement.spec.ts
index 0ebb95024ea..0a6033f043e 100644
--- a/browser_tests/tests/nodeGhostPlacement.spec.ts
+++ b/browser_tests/tests/nodeGhostPlacement.spec.ts
@@ -221,7 +221,7 @@ for (const mode of ['litegraph', 'vue'] as const) {
await comfyPage.command.executeCommand('Comfy.PublishSubgraph', {
name: blueprintName
})
- await expect(comfyPage.visibleToasts).toHaveCount(1, {
+ await expect(comfyPage.toast.visibleToasts).toHaveCount(1, {
timeout: 5000
})
await comfyPage.toast.closeToasts(1)
diff --git a/browser_tests/tests/nodeReplacement.spec.ts b/browser_tests/tests/nodeReplacement.spec.ts
index 7a752de7f04..fbaf00b8d16 100644
--- a/browser_tests/tests/nodeReplacement.spec.ts
+++ b/browser_tests/tests/nodeReplacement.spec.ts
@@ -187,7 +187,7 @@ test.describe('Node replacement', { tag: ['@node', '@ui'] }, () => {
.getByRole('button', { name: /replace node/i })
.click()
- await expect(comfyPage.visibleToasts.first()).toContainText(
+ await expect(comfyPage.toast.visibleToasts.first()).toContainText(
/replaced|swapped/i
)
})
diff --git a/browser_tests/tests/nodeSearchBoxV2Extended.spec.ts b/browser_tests/tests/nodeSearchBoxV2Extended.spec.ts
index 0630e42803d..8448030381c 100644
--- a/browser_tests/tests/nodeSearchBoxV2Extended.spec.ts
+++ b/browser_tests/tests/nodeSearchBoxV2Extended.spec.ts
@@ -298,7 +298,9 @@ test.describe('Node search box V2 extended', { tag: '@node' }, () => {
await comfyPage.command.executeCommand('Comfy.PublishSubgraph', {
name: blueprintName
})
- await expect(comfyPage.visibleToasts).toHaveCount(1, { timeout: 5000 })
+ await expect(comfyPage.toast.visibleToasts).toHaveCount(1, {
+ timeout: 5000
+ })
await comfyPage.toast.closeToasts(1)
const { searchBoxV2 } = comfyPage
diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts
index 9cf71e960c1..c24b5a9f724 100644
--- a/browser_tests/tests/sidebar/assets.spec.ts
+++ b/browser_tests/tests/sidebar/assets.spec.ts
@@ -716,7 +716,7 @@ test.describe('Assets sidebar - context menu', () => {
const cards = tab.assetCards
await expect.poll(() => cards.count()).toBeGreaterThanOrEqual(2)
- await tab.dismissToasts()
+ await comfyPage.toast.closeToasts()
// useKeyModifier('Control') needs keyboard events, not click modifiers.
await cards.first().click()
@@ -1056,8 +1056,7 @@ test.describe('Assets sidebar - delete confirmation', () => {
await expect(dialog).toBeHidden()
await expect(tab.assetCards).toHaveCount(initialCount - 1)
- const successToast = comfyPage.page.locator('.p-toast-message-success')
- await expect(successToast).toBeVisible()
+ await expect(comfyPage.toast.toastSuccesses).toBeVisible()
})
test('Cancelling delete preserves asset', async ({ comfyPage }) => {
diff --git a/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts b/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts
index 7275978c1e5..28b4dfe4532 100644
--- a/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts
+++ b/browser_tests/tests/sidebar/sidebarSplitterWidth.spec.ts
@@ -16,21 +16,12 @@ test.describe('Sidebar splitter width independence', () => {
}
})
- async function dismissToasts(comfyPage: ComfyPage) {
- const buttons = await comfyPage.page.locator('.p-toast-close-button').all()
- for (const btn of buttons) {
- await btn.click({ timeout: 2000 }).catch(() => {})
- }
- // Brief wait for animations
- await comfyPage.nextFrame()
- }
-
async function openSidebarAt(
comfyPage: ComfyPage,
location: 'left' | 'right'
) {
await comfyPage.settings.setSetting('Comfy.Sidebar.Location', location)
- await dismissToasts(comfyPage)
+ await comfyPage.toast.closeToasts()
await comfyPage.menu.nodeLibraryTab.open()
}
diff --git a/browser_tests/tests/subgraph/subgraphSearch.spec.ts b/browser_tests/tests/subgraph/subgraphSearch.spec.ts
index dc7635797bb..eab49612bd4 100644
--- a/browser_tests/tests/subgraph/subgraphSearch.spec.ts
+++ b/browser_tests/tests/subgraph/subgraphSearch.spec.ts
@@ -22,7 +22,7 @@ async function exitSubgraphAndPublish(
name: blueprintName
})
- await expect(comfyPage.visibleToasts).toHaveCount(1)
+ await expect(comfyPage.toast.visibleToasts).toHaveCount(1)
await comfyPage.toast.closeToasts(1)
}
diff --git a/browser_tests/tests/templates.spec.ts b/browser_tests/tests/templates.spec.ts
index 16e2ed88333..0af1474ace9 100644
--- a/browser_tests/tests/templates.spec.ts
+++ b/browser_tests/tests/templates.spec.ts
@@ -281,7 +281,7 @@ test.describe('Templates', { tag: ['@slow', '@workflow'] }, () => {
await expect(filterBar).toHaveScreenshot(
'template-filter-bar-select-components.png',
{
- mask: [comfyPage.page.locator('.p-toast')]
+ mask: [comfyPage.toast.visibleToasts]
}
)
}
diff --git a/browser_tests/tests/toastNotifications.spec.ts b/browser_tests/tests/toastNotifications.spec.ts
index 23f1483ba1b..94176ef06ba 100644
--- a/browser_tests/tests/toastNotifications.spec.ts
+++ b/browser_tests/tests/toastNotifications.spec.ts
@@ -2,30 +2,19 @@ import {
comfyPageFixture as test,
comfyExpect as expect
} from '@e2e/fixtures/ComfyPage'
+import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
test.describe('Toast Notifications', { tag: '@ui' }, () => {
- async function triggerErrorToast(comfyPage: {
- page: { evaluate: (fn: () => void) => Promise }
- nextFrame: () => Promise
- }) {
+ async function triggerErrorToast(comfyPage: ComfyPage) {
await comfyPage.page.evaluate(() => {
- window.app!.extensionManager.toast.add({
- severity: 'error',
- summary: 'Error',
- detail: 'Test execution error',
- life: 30000
+ window.app!.extensionManager.toast.error('Error', {
+ description: 'Test execution error',
+ duration: 30000
})
})
- await comfyPage.nextFrame()
}
- test('Error toast appears when triggered', async ({ comfyPage }) => {
- await triggerErrorToast(comfyPage)
-
- await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
- })
-
- test('Graph toast fallback respects the workspace inset', async ({
+ test('Toasts outside the graph fall back to the workspace inset', async ({
comfyPage
}) => {
const workspaceInset = 240
@@ -45,9 +34,7 @@ test.describe('Toast Notifications', { tag: '@ui' }, () => {
await triggerErrorToast(comfyPage)
- const graphToast = comfyPage.page
- .locator('.graph-toast .p-toast-message')
- .filter({ hasText: 'Test execution error' })
+ const graphToast = comfyPage.toast.withText('Test execution error')
await expect(graphToast).toBeVisible()
const bounds = await graphToast.boundingBox()
@@ -59,43 +46,57 @@ test.describe('Toast Notifications', { tag: '@ui' }, () => {
)
})
- test('Toast shows correct error severity class', async ({ comfyPage }) => {
- await triggerErrorToast(comfyPage)
-
- const errorToast = comfyPage.page.locator(
- '.p-toast-message.p-toast-message-error'
- )
- await expect(errorToast.first()).toBeVisible()
- })
+ test('Toasts stay clear of the open properties panel', async ({
+ comfyPage
+ }) => {
+ const { propertiesPanel } = comfyPage.menu
+ await propertiesPanel.toggleButton.click()
+ await expect(propertiesPanel.root).toBeVisible()
- test('Toast can be dismissed via close button', async ({ comfyPage }) => {
await triggerErrorToast(comfyPage)
- await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
-
- const closeButton = comfyPage.page.locator('.p-toast-close-button').first()
- await closeButton.click()
+ const graphToast = comfyPage.toast.withText('Test execution error')
+ await expect(graphToast).toBeVisible()
- await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
+ const toastBounds = await graphToast.boundingBox()
+ const panelBounds = await propertiesPanel.root.boundingBox()
+ expect(toastBounds).not.toBeNull()
+ expect(panelBounds).not.toBeNull()
+ expect(toastBounds!.x + toastBounds!.width).toBeLessThanOrEqual(
+ panelBounds!.x
+ )
})
- test('All toasts cleared via closeToasts helper', async ({ comfyPage }) => {
+ test('Toast can be dismissed via close button', async ({ comfyPage }) => {
await triggerErrorToast(comfyPage)
+ const errorToast = comfyPage.toast.toastErrors.filter({
+ hasText: 'Test execution error'
+ })
+ await expect(errorToast).toBeVisible()
- await expect(comfyPage.toast.visibleToasts.first()).toBeVisible()
-
- await comfyPage.toast.closeToasts()
+ await comfyPage.toast.dismiss(errorToast)
await expect(comfyPage.toast.visibleToasts).toHaveCount(0)
})
- test('Toast error count is accurate', async ({ comfyPage }) => {
- await triggerErrorToast(comfyPage)
+ test('Legacy extension toast messages still render', async ({
+ comfyPage
+ }) => {
+ await comfyPage.page.evaluate(() => {
+ window.app!.extensionManager.toast.add({
+ severity: 'warn',
+ summary: 'Legacy summary',
+ detail: 'Legacy detail',
+ life: 30000
+ })
+ window.app!.extensionManager.toast.addAlert('Legacy alert')
+ })
await expect(
- comfyPage.page.locator('.p-toast-message.p-toast-message-error').first()
+ comfyPage.toast.toastWarnings.filter({ hasText: 'Legacy detail' })
+ ).toBeVisible()
+ await expect(
+ comfyPage.toast.toastWarnings.filter({ hasText: 'Legacy alert' })
).toBeVisible()
-
- await expect(comfyPage.toast.toastErrors).not.toHaveCount(0)
})
})
diff --git a/browser_tests/tests/versionMismatchWarnings.spec.ts b/browser_tests/tests/versionMismatchWarnings.spec.ts
index 0e36431adf4..f455ea3c9ce 100644
--- a/browser_tests/tests/versionMismatchWarnings.spec.ts
+++ b/browser_tests/tests/versionMismatchWarnings.spec.ts
@@ -64,7 +64,7 @@ comfyPageFixture.describe('Version Mismatch Warnings', { tag: '@slow' }, () => {
}) => {
// Expect a warning toast to be shown
await expect(
- comfyPage.page.getByText('Version Compatibility Warning')
+ comfyPage.toast.withText('Version Compatibility Warning')
).toBeVisible()
})
@@ -73,7 +73,7 @@ comfyPageFixture.describe('Version Mismatch Warnings', { tag: '@slow' }, () => {
async ({ comfyPage }) => {
// Expect no warning toast to be shown
await expect(
- comfyPage.page.getByText('Version Compatibility Warning')
+ comfyPage.toast.withText('Version Compatibility Warning')
).toBeHidden()
}
)
@@ -84,12 +84,9 @@ comfyPageFixture.describe('Version Mismatch Warnings', { tag: '@slow' }, () => {
test.setTimeout(30_000)
// Locate the warning toast and dismiss it
- const warningToast = comfyPage.page.locator('.p-toast-message').filter({
- hasText: 'Version Compatibility'
- })
- await warningToast.waitFor({ state: 'visible' })
- const dismissButton = warningToast.getByRole('button', { name: 'Close' })
- await dismissButton.click()
+ const warningToast = comfyPage.toast.withText('Version Compatibility')
+ await expect(warningToast).toBeVisible()
+ await comfyPage.toast.dismiss(warningToast)
// Wait for the dismissed state to be persisted
await comfyPage.page.waitForFunction(
@@ -101,7 +98,7 @@ comfyPageFixture.describe('Version Mismatch Warnings', { tag: '@slow' }, () => {
// The same warning from same versions should not be shown to the user again
await expect(
- comfyPage.page.getByText('Version Compatibility Warning')
+ comfyPage.toast.withText('Version Compatibility Warning')
).toBeHidden()
})
})
diff --git a/browser_tests/tests/vueNodes/widgets/load/uploadWidgets.spec.ts b/browser_tests/tests/vueNodes/widgets/load/uploadWidgets.spec.ts
index 7d6615add11..317f41a4067 100644
--- a/browser_tests/tests/vueNodes/widgets/load/uploadWidgets.spec.ts
+++ b/browser_tests/tests/vueNodes/widgets/load/uploadWidgets.spec.ts
@@ -100,10 +100,9 @@ test.describe('Vue Upload Widgets', { tag: '@vue-nodes' }, () => {
await comfyPage.nodeOps.getNodeRefsByType('LoadVideo')
expect(loadVideoNode, 'Load Video node was added').toBeDefined()
const videoWidget = await loadVideoNode.getWidgetByName('file')
- const rejectionToasts = comfyPage.page.getByText(
- enMessages.g.videoFilenameExtensionRequired,
- { exact: true }
- )
+ const rejectionToasts = comfyPage.toast.toastWarnings.filter({
+ hasText: enMessages.g.videoFilenameExtensionRequired
+ })
let uploadRequests = 0
await comfyPage.page.route('**/upload/image', async (route) => {
uploadRequests += 1
diff --git a/browser_tests/tests/webcamCapture.spec.ts b/browser_tests/tests/webcamCapture.spec.ts
index 69eaa824b7e..c26bb425708 100644
--- a/browser_tests/tests/webcamCapture.spec.ts
+++ b/browser_tests/tests/webcamCapture.spec.ts
@@ -318,9 +318,7 @@ test.describe(
await comfyPage.runButton.click()
await expect(
- comfyPage.toast.visibleToasts
- .filter({ hasText: 'Error uploading camera image' })
- .first()
+ comfyPage.toast.withText('Error uploading camera image').first()
).toBeVisible()
})
@@ -345,9 +343,7 @@ test.describe(
await comfyPage.runButton.click()
await expect(
- comfyPage.toast.visibleToasts
- .filter({ hasText: 'No webcam image captured' })
- .first()
+ comfyPage.toast.withText('No webcam image captured').first()
).toBeVisible()
expect(uploadCalled).toBe(false)
})
diff --git a/docs/testing/vitest-patterns.md b/docs/testing/vitest-patterns.md
index c40230d5e3b..33b9488662d 100644
--- a/docs/testing/vitest-patterns.md
+++ b/docs/testing/vitest-patterns.md
@@ -50,11 +50,17 @@ Read an action from its store where it is used instead of caching it in a
suite-level `let` assigned by `beforeEach`:
```typescript
-vi.mocked(useToastStore().addAlert).mockImplementation(() => {})
-expect(useToastStore().addAlert).toHaveBeenCalledWith('Upload failed')
+expect(useToast().toasts).toEqual([
+ expect.objectContaining({ kind: 'error', title: 'Upload failed' })
+])
+expect(useToast().error).toHaveBeenCalledWith('Upload failed')
```
-Use a test-local `const store = useToastStore()` when several accesses become
+The global testing Pinia uses `stubActions: false`, so store actions run for
+real and are already spies. Prefer asserting on store state; do not mock the
+action.
+
+Use a test-local `const store = useToast()` when several accesses become
hard to read. Keep shared variables when they own a per-test resource, a
reactive fixture, or a value that teardown must restore.
@@ -121,12 +127,12 @@ Real example: [`src/components/searchbox/v2/__test__/testUtils.ts`](../../src/co
With empty messages, `t('foo.bar')` returns `'foo.bar'` (the key). Assert against the key directly — no need to mock `t`:
```typescript
-expect(toastSpy).toHaveBeenCalledWith(
- expect.objectContaining({ detail: 'mediaAsset.selection.exportStarted' })
+expect(useToast().success).toHaveBeenCalledWith(
+ 'mediaAsset.selection.exportStarted'
)
```
-For pluralization / interpolation arguments, spy on the consumer (e.g. the toast `add` fn) and inspect the captured payload, rather than spying on `t` itself.
+For pluralization / interpolation arguments, inspect the consumer's captured arguments (e.g. `useToast().success`) rather than spying on `t` itself.
## Mock Patterns
diff --git a/packages/account-core/src/firebaseAuthError.test.ts b/packages/account-core/src/firebaseAuthError.test.ts
index 935fd7b2668..d87a410b2b5 100644
--- a/packages/account-core/src/firebaseAuthError.test.ts
+++ b/packages/account-core/src/firebaseAuthError.test.ts
@@ -87,7 +87,7 @@ describe('severityForAuthError', () => {
code: 'auth/cancelled-popup-request'
}),
'the user closing a window is not an application error'
- ).toBe('warn')
+ ).toBe('warning')
for (const classification of [
{ kind: 'unauthorized-domain', code: 'auth/unauthorized-domain' },
{ kind: 'signup-blocked', code: 'auth/internal-error' },
diff --git a/packages/account-core/src/firebaseAuthError.ts b/packages/account-core/src/firebaseAuthError.ts
index c96e97667aa..dbe8b53b492 100644
--- a/packages/account-core/src/firebaseAuthError.ts
+++ b/packages/account-core/src/firebaseAuthError.ts
@@ -70,7 +70,7 @@ export function classifyAuthError(error: unknown): AuthErrorClassification {
return { kind: 'auth', code: error.code }
}
-export type AuthToastSeverity = 'error' | 'warn'
+export type AuthToastSeverity = 'error' | 'warning'
/**
* The cloud app's toast-severity policy for classified auth failures: a
@@ -80,7 +80,7 @@ export type AuthToastSeverity = 'error' | 'warn'
export function severityForAuthError(
classification: AuthErrorClassification
): AuthToastSeverity {
- return classification.kind === 'popup-dismissed' ? 'warn' : 'error'
+ return classification.kind === 'popup-dismissed' ? 'warning' : 'error'
}
/**
diff --git a/packages/design-system/src/css/style.css b/packages/design-system/src/css/style.css
index 5c74a6e15a9..fc28786282f 100644
--- a/packages/design-system/src/css/style.css
+++ b/packages/design-system/src/css/style.css
@@ -1902,15 +1902,10 @@ audio.comfy-audio.empty-audio-widget {
body-portaled overlays and makes them unclickable. PrimeVue's own Dialog
sets pointer-events inline, but Select / ColorPicker / Popover / Autocomplete
overlays do not, so they need to opt in here.
-
- Toasts opt in per message rather than on the `.p-toast` container: the
- container spans the whole stack including the margin between messages, so
- enabling it there would swallow scrim clicks in empty space beside a toast.
*/
.p-select-overlay,
.p-colorpicker-panel,
.p-popover,
-.p-autocomplete-overlay,
-.p-toast-message {
+.p-autocomplete-overlay {
pointer-events: auto;
}
diff --git a/scripts/primevue-import-allowlist.json b/scripts/primevue-import-allowlist.json
index 44a42ad3a5d..eb8ce894b5d 100644
--- a/scripts/primevue-import-allowlist.json
+++ b/scripts/primevue-import-allowlist.json
@@ -12,15 +12,8 @@
"src/components/dialog/GlobalDialog.test.ts",
"src/components/dialog/GlobalDialog.vue",
"src/components/dialog/bodyPointerEventsRestore.test.ts",
- "src/components/dialog/content/ErrorDialogContent.vue",
- "src/components/dialog/content/TopUpCreditsDialogContentLegacy.test.ts",
- "src/components/dialog/content/TopUpCreditsDialogContentLegacy.vue",
"src/components/dialog/content/setting/SettingItem.test.ts",
"src/components/dialog/content/setting/UsageLogsTable.test.ts",
- "src/components/dialog/content/signin/SignInForm.test.ts",
- "src/components/dialog/content/signin/SignInForm.vue",
- "src/components/dialog/content/subscription/CancelSubscriptionDialogContent.test.ts",
- "src/components/dialog/content/subscription/CancelSubscriptionDialogContent.vue",
"src/components/graph/GraphCanvasMenu.vue",
"src/components/graph/SelectionToolbox.test.ts",
"src/components/graph/selectionToolbox/BypassButton.test.ts",
@@ -29,8 +22,6 @@
"src/components/graph/selectionToolbox/InfoButton.test.ts",
"src/components/graph/widgets/TextPreviewWidget.test.ts",
"src/components/graph/widgets/TextPreviewWidget.vue",
- "src/components/helpcenter/HelpCenterMenuContent.test.ts",
- "src/components/helpcenter/HelpCenterMenuContent.vue",
"src/components/node/NodePreview.test.ts",
"src/components/rightSidePanel/errors/ErrorGroupList.test.ts",
"src/components/rightSidePanel/errors/ErrorNodeCard.test.ts",
@@ -41,21 +32,10 @@
"src/components/searchbox/NodeSearchBoxPopover.vue",
"src/components/sidebar/SideToolbar.test.ts",
"src/components/sidebar/SidebarIcon.test.ts",
- "src/components/sidebar/tabs/AssetsSidebarTab.test.ts",
- "src/components/sidebar/tabs/AssetsSidebarTab.vue",
- "src/components/toast/GlobalToast.test.ts",
- "src/components/toast/GlobalToast.vue",
- "src/components/toast/RerouteMigrationToast.vue",
"src/components/topbar/CurrentUserButton.vue",
"src/components/topbar/CurrentUserPopoverLegacy.vue",
"src/components/topbar/TopbarBadge.test.ts",
- "src/composables/useCopyToClipboard.test.ts",
- "src/composables/useCopyToClipboard.ts",
- "src/composables/useReconnectingNotification.test.ts",
- "src/composables/useReconnectingNotification.ts",
"src/main.ts",
- "src/platform/assets/composables/useMediaAssetActions.test.ts",
- "src/platform/assets/composables/useMediaAssetActions.ts",
"src/platform/cloud/onboarding/CloudSubscriptionRedirectView.vue",
"src/platform/cloud/onboarding/skeletons/CloudLoginViewSkeleton.vue",
"src/platform/cloud/onboarding/skeletons/CloudSurveyViewSkeleton.vue",
@@ -63,50 +43,10 @@
"src/platform/missingModel/components/MissingModelCard.test.ts",
"src/platform/nodeReplacement/components/SwapNodeGroupRow.test.ts",
"src/platform/nodeReplacement/components/SwapNodesCard.test.ts",
- "src/platform/updates/common/toastStore.ts",
"src/platform/updates/components/WhatsNewPopup.test.ts",
"src/platform/workflow/persistence/composables/useWorkflowPersistenceV2.test.ts",
- "src/platform/workflow/persistence/composables/useWorkflowPersistenceV2.ts",
- "src/platform/workflow/sharing/components/ShareWorkflowDialogContent.test.ts",
- "src/platform/workflow/sharing/components/ShareWorkflowDialogContent.vue",
- "src/platform/workflow/sharing/components/profile/ComfyHubCreateProfileForm.vue",
- "src/platform/workflow/sharing/components/publish/ComfyHubPublishDialog.test.ts",
- "src/platform/workflow/sharing/components/publish/ComfyHubPublishDialog.vue",
- "src/platform/workflow/sharing/composables/useSharedWorkflowUrlLoader.test.ts",
- "src/platform/workflow/sharing/composables/useSharedWorkflowUrlLoader.ts",
- "src/platform/workflow/templates/composables/useTemplateUrlLoader.test.ts",
- "src/platform/workflow/templates/composables/useTemplateUrlLoader.ts",
"src/platform/workspace/components/CurrentUserPopoverWorkspace.test.ts",
"src/platform/workspace/components/CurrentUserPopoverWorkspace.vue",
- "src/platform/workspace/components/InviteMembersForm.test.ts",
- "src/platform/workspace/components/InviteMembersForm.vue",
- "src/platform/workspace/components/SubscriptionPanelContentWorkspace.test.ts",
- "src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.test.ts",
- "src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.vue",
- "src/platform/workspace/components/dialogs/ChangeMemberRoleDialogContent.test.ts",
- "src/platform/workspace/components/dialogs/ChangeMemberRoleDialogContent.vue",
- "src/platform/workspace/components/dialogs/CreateWorkspaceDialogContent.vue",
- "src/platform/workspace/components/dialogs/DeleteWorkspaceDialogContent.vue",
- "src/platform/workspace/components/dialogs/DowngradeRemoveMembersDialogContent.test.ts",
- "src/platform/workspace/components/dialogs/DowngradeRemoveMembersDialogContent.vue",
- "src/platform/workspace/components/dialogs/EditWorkspaceDialogContent.vue",
- "src/platform/workspace/components/dialogs/InviteMemberDialogContent.test.ts",
- "src/platform/workspace/components/dialogs/LeaveWorkspaceDialogContent.vue",
- "src/platform/workspace/components/dialogs/RemoveMemberDialogContent.vue",
- "src/platform/workspace/components/dialogs/RevokeInviteDialogContent.vue",
- "src/platform/workspace/components/dialogs/TeamWorkspacesDialogContent.test.ts",
- "src/platform/workspace/components/dialogs/TeamWorkspacesDialogContent.vue",
- "src/platform/workspace/components/toasts/InviteAcceptedToast.vue",
- "src/platform/workspace/composables/useInviteUrlLoader.test.ts",
- "src/platform/workspace/composables/useInviteUrlLoader.ts",
- "src/platform/workspace/composables/useMembersPanel.test.ts",
- "src/platform/workspace/composables/useMembersPanel.ts",
- "src/platform/workspace/composables/useResubscribe.test.ts",
- "src/platform/workspace/composables/useResubscribe.ts",
- "src/platform/workspace/composables/useSubscriptionCheckout.test.ts",
- "src/platform/workspace/composables/useSubscriptionCheckout.ts",
- "src/platform/workspace/stores/billingOperationStore.ts",
- "src/renderer/extensions/linearMode/DropZone.test.ts",
"src/renderer/extensions/vueNodes/VideoPreview.vue",
"src/renderer/extensions/vueNodes/components/WidgetGrid.vue",
"src/renderer/extensions/vueNodes/composables/processedWidgetRenderModel.ts",
@@ -117,11 +57,8 @@
"src/renderer/extensions/vueNodes/widgets/components/WidgetRecordAudio.vue",
"src/renderer/extensions/vueNodes/widgets/components/WidgetSelect.asset-mode.test.ts",
"src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.test.ts",
- "src/renderer/extensions/vueNodes/widgets/components/audio/AudioPreviewPlayer.test.ts",
- "src/renderer/extensions/vueNodes/widgets/components/audio/AudioPreviewPlayer.vue",
"src/renderer/extensions/vueNodes/widgets/components/form/FormSelectButton.test.ts",
"src/renderer/extensions/vueNodes/widgets/components/form/dropdown/FormDropdown.test.ts",
- "src/services/dialogService.errorCatalog.test.ts",
"src/stores/dialogStore.ts",
"src/workbench/extensions/manager/components/manager/PackVersionBadge.test.ts",
"src/workbench/extensions/manager/components/manager/PackVersionSelectorPopover.test.ts",
diff --git a/src/App.vue b/src/App.vue
index dbb9d9220f9..bd850482007 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -83,17 +83,11 @@ onMounted(() => {
window.addEventListener('vite:preloadError', (event) => {
event.preventDefault()
reportPreloadError(event.payload)
- // Disabled: Third-party custom node extensions frequently trigger this toast
+ // No toast: third-party custom node extensions frequently trigger this
// (e.g., bare "vue" imports, wrong relative paths to scripts/app.js, missing
// core dependencies). These are plugin bugs, not ComfyUI core failures, but
// the generic error message alarms users and offers no actionable guidance.
// The reporter above still logs the details for developers to debug.
- // useToastStore().add({
- // severity: 'error',
- // summary: t('g.preloadErrorTitle'),
- // detail: t('g.preloadError'),
- // life: 10000
- // })
})
// Capture resource load failures (CSS, scripts) in non-localhost distributions
diff --git a/src/assets/css/style.css b/src/assets/css/style.css
index fc662b09abb..bbcfd6757fb 100644
--- a/src/assets/css/style.css
+++ b/src/assets/css/style.css
@@ -55,19 +55,6 @@
}
}
-/* Toasts teleport to . Reka's modal mode sets pointer-events: none on
- the body, which left toast close buttons painted above dialogs but
- unclickable — clicks fell through to whatever sat beneath (including the
- payment dialog's X, closing the checkout mid-payment). Keep toasts
- interactive regardless of modal state. */
-.p-toast {
- pointer-events: none;
-}
-
-.p-toast-message {
- pointer-events: auto;
-}
-
/* Use 0.001ms instead of 0s so transitionend/animationend events still fire
and JS listeners aren't broken. */
.disable-animations *,
diff --git a/src/base/common/downloadUtil.ts b/src/base/common/downloadUtil.ts
index e4a717f811d..082146ff926 100644
--- a/src/base/common/downloadUtil.ts
+++ b/src/base/common/downloadUtil.ts
@@ -4,8 +4,8 @@
import { t } from '@/i18n'
// oxlint-disable-next-line comfy/no-restricted-paths
import { isCloud } from '@/platform/distribution/types'
-// oxlint-disable-next-line comfy/no-restricted-paths
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
+import { getErrorMessage } from '@/utils/errorUtil'
// Constants
const DEFAULT_DOWNLOAD_FILENAME = 'download.png'
@@ -220,9 +220,9 @@ export async function openFileInNewTab(url: string): Promise {
} catch (error) {
tab?.close()
console.error('Failed to open image:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.errorOpenImage', {
- error: error instanceof Error ? error.message : String(error)
+ error: getErrorMessage(error) ?? t('g.unknownError')
})
)
}
diff --git a/src/components/common/BackgroundImageUpload.vue b/src/components/common/BackgroundImageUpload.vue
index 168e4020fa7..736a77c0da7 100644
--- a/src/components/common/BackgroundImageUpload.vue
+++ b/src/components/common/BackgroundImageUpload.vue
@@ -37,12 +37,16 @@
-
-
-
-
-
-
-
-
diff --git a/src/components/lightInfo/useLightInfo.test.ts b/src/components/lightInfo/useLightInfo.test.ts
index b4e1c24278f..f991b154817 100644
--- a/src/components/lightInfo/useLightInfo.test.ts
+++ b/src/components/lightInfo/useLightInfo.test.ts
@@ -1,12 +1,12 @@
import { fromAny } from '@total-typescript/shoehorn'
import { assert, beforeEach, describe, expect, it, vi } from 'vitest'
+import { useToast } from '@/components/ui/toast/toastStore'
import { LightInfoViewport } from '@/extensions/core/lightInfo/LightInfoViewport'
import type { LightInfoViewportOptions } from '@/extensions/core/lightInfo/LightInfoViewport'
import { createDefaultLight } from '@/extensions/core/lightInfo/types'
import type { LightInfoEntry } from '@/extensions/core/lightInfo/types'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useWidgetValueStore } from '@/stores/widgetValueStore'
import { toNodeId } from '@/types/nodeId'
import { widgetId } from '@/types/widgetId'
@@ -174,10 +174,10 @@ describe('useLightInfo widget boundary', () => {
useWidgetValueStore().setValue(editorId, [createDefaultLight('point')])
- expect(useToastStore().messagesToAdd).toEqual([
+ expect(useToast().toasts).toEqual([
expect.objectContaining({
- detail:
- 'Failed to initialize Light Info viewer. Try reloading the page.'
+ kind: 'warning',
+ title: 'Failed to initialize Light Info viewer. Try reloading the page.'
})
])
expect(light.lights.value).toHaveLength(0)
diff --git a/src/components/lightInfo/useLightInfo.ts b/src/components/lightInfo/useLightInfo.ts
index 33d0ca324c0..b0dc43cd6bf 100644
--- a/src/components/lightInfo/useLightInfo.ts
+++ b/src/components/lightInfo/useLightInfo.ts
@@ -1,6 +1,7 @@
import { computed, ref, toRaw, unref } from 'vue'
import type { MaybeRef } from 'vue'
+import { useToast } from '@/components/ui/toast/toastStore'
import {
createSceneHoverHandlers,
useViewportNodeWiring
@@ -24,7 +25,6 @@ import { t } from '@/i18n'
import { onGraphIntent } from '@/lib/litegraph/src/graphIntents'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import { reportError } from '@/platform/telemetry/reportError'
-import { useToastStore } from '@/platform/updates/common/toastStore'
const EDITOR_WIDGET_NAME = 'editor_state'
@@ -71,9 +71,7 @@ export function useLightInfo(nodeRef: MaybeRef) {
surface: 'graph'
})
cleanup()
- useToastStore().addAlert(
- t('toastMessages.failedToInitializeLightInfoViewer')
- )
+ useToast().warning(t('toastMessages.failedToInitializeLightInfoViewer'))
}
}
diff --git a/src/components/load3d/controls/HDRIControls.test.ts b/src/components/load3d/controls/HDRIControls.test.ts
index d6c7811dfb1..d7c4728a0eb 100644
--- a/src/components/load3d/controls/HDRIControls.test.ts
+++ b/src/components/load3d/controls/HDRIControls.test.ts
@@ -1,19 +1,13 @@
/* oxlint-disable testing-library/no-container, testing-library/no-node-access -- hidden file input has no role/label, queried by selector */
+import { describe, expect, it, vi } from 'vitest'
+import { useToast } from '@/components/ui/toast/toastStore'
import userEvent from '@testing-library/user-event'
import { render, screen } from '@testing-library/vue'
-import { beforeEach, describe, expect, it, vi } from 'vitest'
import { ref } from 'vue'
import { createI18n } from 'vue-i18n'
import HDRIControls from '@/components/load3d/controls/HDRIControls.vue'
import type { HDRIConfig } from '@/extensions/core/load3d/interfaces'
-import { useToastStore } from '@/platform/updates/common/toastStore'
-
-beforeEach(() => {
- addAlert = useToastStore().addAlert
-})
-
-let addAlert: ReturnType['addAlert']
const i18n = createI18n({
legacy: false,
@@ -170,7 +164,7 @@ describe('HDRIControls', () => {
fileInput.dispatchEvent(new Event('change'))
expect(onUpdateHdriFile).toHaveBeenCalledWith(file)
- expect(addAlert).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('rejects unsupported file extensions with a toast and no emit', async () => {
@@ -185,7 +179,12 @@ describe('HDRIControls', () => {
fileInput.dispatchEvent(new Event('change'))
expect(onUpdateHdriFile).not.toHaveBeenCalled()
- expect(addAlert).toHaveBeenCalledWith('Unsupported HDRI format')
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'Unsupported HDRI format'
+ })
+ ])
})
})
})
diff --git a/src/components/load3d/controls/HDRIControls.vue b/src/components/load3d/controls/HDRIControls.vue
index ff19a767dc5..4b803cc112a 100644
--- a/src/components/load3d/controls/HDRIControls.vue
+++ b/src/components/load3d/controls/HDRIControls.vue
@@ -91,7 +91,7 @@ import {
SUPPORTED_HDRI_EXTENSIONS_ACCEPT
} from '@/extensions/core/load3d/constants'
import type { HDRIConfig } from '@/extensions/core/load3d/interfaces'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { cn } from '@comfyorg/tailwind-utils'
const { t } = useI18n()
@@ -119,7 +119,7 @@ function onFileChange(event: Event) {
if (file) {
const ext = `.${file.name.split('.').pop()?.toLowerCase() ?? ''}`
if (!SUPPORTED_HDRI_EXTENSIONS.has(ext)) {
- useToastStore().addAlert(t('toastMessages.unsupportedHDRIFormat'))
+ useToast().warning(t('toastMessages.unsupportedHDRIFormat'))
return
}
}
diff --git a/src/components/load3d/menubar/HdriMenuGroup.vue b/src/components/load3d/menubar/HdriMenuGroup.vue
index e558f6fef70..0cdd2a6c376 100644
--- a/src/components/load3d/menubar/HdriMenuGroup.vue
+++ b/src/components/load3d/menubar/HdriMenuGroup.vue
@@ -77,7 +77,7 @@ import {
SUPPORTED_HDRI_EXTENSIONS_ACCEPT
} from '@/extensions/core/load3d/constants'
import type { LightConfig } from '@/extensions/core/load3d/interfaces'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
const { compact = false, sceneHasImage = false } = defineProps<{
compact?: boolean
@@ -107,7 +107,7 @@ function onHdriFilePicked(event: Event) {
if (file) {
const ext = `.${file.name.split('.').pop()?.toLowerCase() ?? ''}`
if (!SUPPORTED_HDRI_EXTENSIONS.has(ext)) {
- useToastStore().addAlert(t('toastMessages.unsupportedHDRIFormat'))
+ useToast().warning(t('toastMessages.unsupportedHDRIFormat'))
return
}
}
diff --git a/src/components/sidebar/tabs/AssetsSidebarTab.test.ts b/src/components/sidebar/tabs/AssetsSidebarTab.test.ts
index 3575f577528..e23dba9e463 100644
--- a/src/components/sidebar/tabs/AssetsSidebarTab.test.ts
+++ b/src/components/sidebar/tabs/AssetsSidebarTab.test.ts
@@ -82,13 +82,6 @@ vi.mock(import('@/platform/assets/composables/useMediaAssetActions'))
vi.mock(import('@/platform/assets/utils/outputAssetUtil'))
-vi.mock(
- import('primevue/usetoast'), // oxlint-disable-line comfy/no-primevue-imports
- () => ({
- useToast: () => ({ add: vi.fn() })
- })
-)
-
const i18n = createI18n({
legacy: false,
locale: 'en',
diff --git a/src/components/sidebar/tabs/AssetsSidebarTab.vue b/src/components/sidebar/tabs/AssetsSidebarTab.vue
index 7b75fa7cf60..353dd315f03 100644
--- a/src/components/sidebar/tabs/AssetsSidebarTab.vue
+++ b/src/components/sidebar/tabs/AssetsSidebarTab.vue
@@ -165,7 +165,7 @@
diff --git a/src/components/toast/RerouteMigrationToast.vue b/src/components/toast/RerouteMigrationToast.vue
deleted file mode 100644
index e807994a3f0..00000000000
--- a/src/components/toast/RerouteMigrationToast.vue
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
- {{ t('toastMessages.migrateToLitegraphReroute') }}
-
-
-
-
-
-
-
-
diff --git a/src/components/ui/toast/ToastClose.vue b/src/components/ui/toast/ToastClose.vue
new file mode 100644
index 00000000000..fa46a4a56cc
--- /dev/null
+++ b/src/components/ui/toast/ToastClose.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
diff --git a/src/components/ui/toast/ToastDescription.vue b/src/components/ui/toast/ToastDescription.vue
new file mode 100644
index 00000000000..dcffac7c399
--- /dev/null
+++ b/src/components/ui/toast/ToastDescription.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
diff --git a/src/components/ui/toast/ToastDock.test.ts b/src/components/ui/toast/ToastDock.test.ts
new file mode 100644
index 00000000000..97f6a525dac
--- /dev/null
+++ b/src/components/ui/toast/ToastDock.test.ts
@@ -0,0 +1,37 @@
+import { render, screen } from '@testing-library/vue'
+import { describe, expect, it } from 'vitest'
+import { defineComponent, nextTick, ref } from 'vue'
+
+import { vRekaZIndex } from '@/components/dialog/vRekaZIndex'
+import { useModalLiftedZIndex } from '@/composables/useModalLiftedZIndex'
+
+import ToastDock from './ToastDock.vue'
+
+const DockedPopover = defineComponent({
+ setup() {
+ return { lifted: useModalLiftedZIndex(ref(true)) }
+ },
+ template: ''
+})
+
+describe('ToastDock', () => {
+ it('stays above dialogs opened later and lifts its popovers above itself', async () => {
+ render({
+ components: { DockedPopover, ToastDock },
+ template: ''
+ })
+ render({
+ directives: { rekaZIndex: vRekaZIndex },
+ template: ''
+ })
+ await nextTick()
+
+ const dockZ = Number(screen.getByTestId('dock').style.zIndex)
+ expect(dockZ).toBeGreaterThan(
+ Number(screen.getByTestId('dialog').style.zIndex)
+ )
+ expect(Number(screen.getByTestId('popover').style.zIndex)).toBeGreaterThan(
+ dockZ
+ )
+ })
+})
diff --git a/src/components/ui/toast/ToastDock.vue b/src/components/ui/toast/ToastDock.vue
new file mode 100644
index 00000000000..ba539bfbc97
--- /dev/null
+++ b/src/components/ui/toast/ToastDock.vue
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/src/components/ui/toast/ToastPanel.stories.ts b/src/components/ui/toast/ToastPanel.stories.ts
new file mode 100644
index 00000000000..52c6419e5a0
--- /dev/null
+++ b/src/components/ui/toast/ToastPanel.stories.ts
@@ -0,0 +1,110 @@
+import type { Meta, StoryObj } from '@storybook/vue3-vite'
+import { ref } from 'vue'
+
+import ProgressToastItem from '@/components/toast/ProgressToastItem.vue'
+import Button from '@/components/ui/button/Button.vue'
+import type { AssetDownload } from '@/stores/assetDownloadStore'
+import { cn } from '@comfyorg/tailwind-utils'
+
+import ToastDock from './ToastDock.vue'
+import ToastPanel from './ToastPanel.vue'
+
+interface PanelStoryArgs {
+ expanded: boolean
+ jobs: AssetDownload[]
+ status: string
+ statusIcon: string
+}
+
+function createMockJob(overrides: Partial = {}): AssetDownload {
+ return {
+ assetId: 'asset-1',
+ assetName: 'model-v1.safetensors',
+ bytesDownloaded: 0,
+ bytesTotal: 1000000,
+ lastUpdate: Date.now(),
+ progress: 0,
+ status: 'created',
+ taskId: 'task-1',
+ ...overrides
+ }
+}
+
+const meta: Meta = {
+ title: 'Components/Toast/ToastPanel',
+ parameters: { layout: 'fullscreen' },
+ argTypes: { expanded: { control: 'boolean' } },
+ render: (args) => ({
+ components: { Button, ProgressToastItem, ToastDock, ToastPanel },
+ setup() {
+ return { args, cn, isExpanded: ref(args.expanded) }
+ },
+ template: `
+
+
+
+
Download Queue
+
+
+
+
+
+ {{ args.status }}
+
+
+
+
+
+ `
+ })
+}
+
+export default meta
+type Story = StoryObj
+
+export const InProgress: Story = {
+ args: {
+ expanded: false,
+ jobs: [
+ createMockJob({ progress: 1, status: 'completed' }),
+ createMockJob({
+ assetName: 'lora-style.safetensors',
+ progress: 0.45,
+ status: 'running',
+ taskId: 'task-2'
+ }),
+ createMockJob({ assetName: 'vae-decoder.safetensors', taskId: 'task-3' })
+ ],
+ status: 'lora-style.safetensors',
+ statusIcon:
+ 'icon-[lucide--loader-circle] motion-safe:animate-spin text-muted-foreground'
+ }
+}
+
+export const Completed: Story = {
+ args: {
+ expanded: false,
+ jobs: [
+ createMockJob({
+ bytesDownloaded: 1000000,
+ progress: 1,
+ status: 'completed'
+ })
+ ],
+ status: 'All downloads completed',
+ statusIcon: 'icon-[lucide--check-circle] text-jade-600'
+ }
+}
+
+export const WithError: Story = {
+ args: {
+ expanded: true,
+ jobs: [createMockJob({ progress: 0.23, status: 'failed' })],
+ status: '1 download failed',
+ statusIcon: 'icon-[lucide--circle-alert] text-destructive-background'
+ }
+}
diff --git a/src/components/ui/toast/ToastPanel.test.ts b/src/components/ui/toast/ToastPanel.test.ts
new file mode 100644
index 00000000000..635a99e8002
--- /dev/null
+++ b/src/components/ui/toast/ToastPanel.test.ts
@@ -0,0 +1,62 @@
+import { render, screen } from '@testing-library/vue'
+import userEvent from '@testing-library/user-event'
+import { describe, expect, it } from 'vitest'
+import { defineComponent, ref } from 'vue'
+
+import ToastPanel from './ToastPanel.vue'
+
+const PanelWithToggle = defineComponent({
+ components: { ToastPanel },
+ props: { visible: { type: Boolean, default: true } },
+ setup() {
+ return { expanded: ref(false) }
+ },
+ template: `
+
+ {{ expanded ? 'expanded' : 'collapsed' }}
+
+
+
+
+ `
+})
+
+describe('ToastPanel', () => {
+ it('renders only while visible and keeps its content out of the live region', async () => {
+ const { rerender } = render(PanelWithToggle, { props: { visible: false } })
+ expect(screen.queryByTestId('content')).not.toBeInTheDocument()
+
+ await rerender({ visible: true })
+
+ expect(screen.getByTestId('content')).toHaveTextContent('collapsed')
+ expect(screen.getByRole('status')).not.toContainElement(
+ screen.getByTestId('content')
+ )
+ })
+
+ it('announces its status politely only while visible', async () => {
+ const { rerender } = render(ToastPanel, {
+ props: { announcement: 'Importing Models', visible: false }
+ })
+ const status = screen.getByRole('status')
+ expect(status).toBeEmptyDOMElement()
+
+ await rerender({ announcement: 'Importing Models', visible: true })
+ expect(status).toHaveTextContent('Importing Models')
+
+ await rerender({ announcement: 'All downloads completed', visible: true })
+ expect(screen.getByRole('status')).toBe(status)
+ expect(status).toHaveTextContent('All downloads completed')
+ })
+
+ it('expands and collapses from the footer toggle', async () => {
+ const user = userEvent.setup()
+ render(PanelWithToggle)
+
+ await user.click(screen.getByRole('button', { name: 'Expand' }))
+ expect(screen.getByTestId('content')).toHaveTextContent('expanded')
+
+ await user.click(screen.getByRole('button', { name: 'Collapse' }))
+ expect(screen.getByTestId('content')).toHaveTextContent('collapsed')
+ })
+})
diff --git a/src/components/ui/toast/ToastPanel.vue b/src/components/ui/toast/ToastPanel.vue
new file mode 100644
index 00000000000..e8ac75dd247
--- /dev/null
+++ b/src/components/ui/toast/ToastPanel.vue
@@ -0,0 +1,50 @@
+
+
+
+
+ {{ announcement }}
+
+
+
+
+
diff --git a/src/components/ui/toast/ToastRoot.vue b/src/components/ui/toast/ToastRoot.vue
new file mode 100644
index 00000000000..c1378dca62c
--- /dev/null
+++ b/src/components/ui/toast/ToastRoot.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/ui/toast/ToastTitle.vue b/src/components/ui/toast/ToastTitle.vue
new file mode 100644
index 00000000000..7b1e15dd923
--- /dev/null
+++ b/src/components/ui/toast/ToastTitle.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
diff --git a/src/components/ui/toast/ToastViewport.vue b/src/components/ui/toast/ToastViewport.vue
new file mode 100644
index 00000000000..7f45dbd58cc
--- /dev/null
+++ b/src/components/ui/toast/ToastViewport.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
diff --git a/src/components/ui/toast/Toaster.stories.ts b/src/components/ui/toast/Toaster.stories.ts
new file mode 100644
index 00000000000..338024c7bf4
--- /dev/null
+++ b/src/components/ui/toast/Toaster.stories.ts
@@ -0,0 +1,43 @@
+import type { Meta, StoryObj } from '@storybook/vue3-vite'
+
+import Button from '@/components/ui/button/Button.vue'
+
+import Toaster from './Toaster.vue'
+import { useToast } from './toastStore'
+
+const meta: Meta = {
+ title: 'Components/Toast/Toaster',
+ component: Toaster,
+ parameters: { layout: 'fullscreen' }
+}
+
+export default meta
+type Story = StoryObj
+
+export const Kinds: Story = {
+ render: () => ({
+ components: { Button, Toaster },
+ setup() {
+ const toast = useToast()
+ toast.dismissAll()
+ toast.success('Workflow saved')
+ toast.info('Update available', { description: 'Restart to apply.' })
+ toast.loading('Uploading model.safetensors')
+ toast.warning('Pop-up blocked', {
+ action: { label: 'Try again', onClick: () => {} },
+ description: 'Allow pop-ups for this site and try again.'
+ })
+ toast.error('Save failed', {
+ description: 'ENOSPC: no space left on device, /home/user/workflows'
+ })
+ return { toast }
+ },
+ template: `
+
+
+
+
+
+ `
+ })
+}
diff --git a/src/components/ui/toast/Toaster.test.ts b/src/components/ui/toast/Toaster.test.ts
new file mode 100644
index 00000000000..4c482a5a8e6
--- /dev/null
+++ b/src/components/ui/toast/Toaster.test.ts
@@ -0,0 +1,364 @@
+import { ZIndex } from '@primeuix/utils/zindex'
+import { render, screen } from '@testing-library/vue'
+import userEvent from '@testing-library/user-event'
+import { describe, expect, it, vi } from 'vitest'
+import { nextTick } from 'vue'
+import { createI18n } from 'vue-i18n'
+
+import { MODAL_Z_BASE, vRekaZIndex } from '@/components/dialog/vRekaZIndex'
+
+import { createToastId } from '@/types/toastId'
+import type { ToastId } from '@/types/toastId'
+
+import Toaster from './Toaster.vue'
+import { useToast } from './toastStore'
+
+const i18n = createI18n({
+ legacy: false,
+ locale: 'en',
+ messages: {
+ en: {
+ g: { close: 'Close' },
+ toastMessages: {
+ notificationsLabel: 'Notification',
+ notificationsViewportLabel: 'Notifications ({hotkey})'
+ }
+ }
+ }
+})
+
+function renderToaster() {
+ return render(Toaster, { global: { plugins: [i18n] } })
+}
+
+function pressEscapePreventedUpstream() {
+ const prevent = (event: KeyboardEvent) => event.preventDefault()
+ window.addEventListener('keydown', prevent, { capture: true })
+ window.dispatchEvent(
+ new KeyboardEvent('keydown', {
+ bubbles: true,
+ cancelable: true,
+ key: 'Escape'
+ })
+ )
+ window.removeEventListener('keydown', prevent, { capture: true })
+}
+
+describe('Toaster', () => {
+ it('announces errors and warnings assertively and other notifications politely', async () => {
+ renderToaster()
+ const toast = useToast()
+
+ toast.success('Saved')
+ toast.loading('Uploading')
+ toast.error('Could not save', { description: 'Disk is full' })
+ toast.warning('Pop-up blocked', {
+ action: { label: 'Try again', onClick: vi.fn() }
+ })
+ await nextTick()
+
+ const polite = screen.getByRole('status', { name: 'Notification' })
+ const assertive = screen.getByRole('alert', { name: 'Notification' })
+ expect(polite).toHaveTextContent('SavedUploading')
+ expect(assertive).toHaveTextContent(
+ 'Could not save. Disk is fullPop-up blocked. Try again'
+ )
+ expect(polite).toHaveAttribute('aria-atomic', 'false')
+ expect(assertive).toHaveAttribute('aria-atomic', 'false')
+ })
+
+ it('does not announce a notification again after node picking ends', async () => {
+ renderToaster()
+ const toast = useToast()
+ toast.info('Uploaded')
+ await nextTick()
+ const announcement = screen.getByText('Uploaded', {
+ selector: '[role="status"] > p'
+ })
+
+ toast.held = true
+ await nextTick()
+ toast.held = false
+ await nextTick()
+
+ expect(
+ screen.getByText('Uploaded', { selector: '[role="status"] > p' })
+ ).toBe(announcement)
+ })
+
+ it('renders each notification once outside the live regions', async () => {
+ renderToaster()
+
+ useToast().error('Save failed', { description: 'Try another location' })
+ await nextTick()
+ await vi.advanceTimersByTimeAsync(1000)
+
+ expect(screen.getByTestId('toast')).toHaveAttribute('aria-live', 'off')
+ expect(document.body.textContent.match(/Save failed/g)).toHaveLength(2)
+ })
+
+ it('runs a notification action from its button', async () => {
+ const user = userEvent.setup()
+ const onClick = vi.fn()
+ renderToaster()
+
+ useToast().warning('Pop-up blocked', {
+ action: { label: 'Try again', onClick },
+ description: 'Allow pop-ups and try again'
+ })
+ await nextTick()
+ await user.click(screen.getByRole('button', { name: 'Try again' }))
+
+ expect(onClick).toHaveBeenCalledOnce()
+ expect(screen.getByTestId('toast')).toHaveTextContent(
+ 'Pop-up blockedAllow pop-ups and try again'
+ )
+ })
+
+ it('labels the notification regions in the active locale', async () => {
+ render(Toaster, {
+ global: {
+ plugins: [
+ createI18n({
+ legacy: false,
+ locale: 'fr',
+ messages: {
+ fr: {
+ g: { close: 'Fermer' },
+ toastMessages: {
+ notificationsLabel: 'Notification FR',
+ notificationsViewportLabel: 'Notifications FR ({hotkey})'
+ }
+ }
+ }
+ })
+ ]
+ }
+ })
+
+ useToast().info('Enregistré')
+ await nextTick()
+
+ expect(
+ screen.getByRole('region', { name: 'Notifications FR (F8)' })
+ ).toBeInTheDocument()
+ expect(
+ screen.getByRole('status', { name: 'Notification FR' })
+ ).toHaveTextContent('Enregistré')
+ })
+
+ it('lifts a new notification above a dialog opened after the last one', async () => {
+ renderToaster()
+ useToast().info('Uploading')
+ await nextTick()
+ render({
+ directives: { rekaZIndex: vRekaZIndex },
+ template: ''
+ })
+
+ useToast().info('Ready')
+ await nextTick()
+
+ expect(
+ Number(screen.getByTestId('toast-viewport').style.zIndex)
+ ).toBeGreaterThan(Number(screen.getByTestId('dialog').style.zIndex))
+ })
+
+ it('stays out of the modal stacking order while idle', async () => {
+ renderToaster()
+ const id = useToast().info('Ready')
+ await nextTick()
+
+ useToast().dismiss(id)
+ await nextTick()
+
+ expect(ZIndex.getCurrent('modal')).toBeLessThan(MODAL_Z_BASE)
+ expect(screen.queryByTestId('toast-viewport')).not.toBeInTheDocument()
+ })
+
+ it('drops its notifications when its layout unmounts', async () => {
+ const { unmount } = renderToaster()
+ useToast().error('Invalid login credentials')
+ await nextTick()
+
+ unmount()
+
+ expect(useToast().toasts).toEqual([])
+ })
+
+ it.for([
+ { name: 'a sticky replacement', elapsed: 0, replacement: undefined },
+ { name: 'a reissued timed notification', elapsed: 2500, replacement: 3000 }
+ ])(
+ 'gives $name of an id a fresh lifetime',
+ async ({ elapsed, replacement }) => {
+ renderToaster()
+ const toast = useToast()
+ const id = createToastId()
+ toast.info('Uploading', { duration: 3000, id })
+ await nextTick()
+ await vi.advanceTimersByTimeAsync(elapsed)
+
+ toast.error('Upload failed', { duration: replacement, id })
+ await nextTick()
+ await vi.advanceTimersByTimeAsync(3000 - elapsed + 100)
+ await nextTick()
+
+ expect(screen.getByTestId('toast')).toHaveTextContent('Upload failed')
+ }
+ )
+
+ it('automatically dismisses a timed notification', async () => {
+ renderToaster()
+
+ useToast().info('Uploaded', { duration: 1000 })
+ await nextTick()
+ expect(screen.getByTestId('toast')).toHaveTextContent('Uploaded')
+
+ await vi.advanceTimersByTimeAsync(1000)
+ await nextTick()
+
+ expect(screen.queryByTestId('toast')).not.toBeInTheDocument()
+ })
+
+ it.for([
+ {
+ name: 'the pointer closed the last notification',
+ pauseAndEmpty: async () => {
+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime })
+ await user.hover(screen.getByTestId('toast'))
+ await user.click(screen.getByRole('button', { name: 'Close' }))
+ }
+ },
+ {
+ name: 'the last notification was dismissed while the window was blurred',
+ pauseAndEmpty: async (id: ToastId) => {
+ window.dispatchEvent(new Event('blur'))
+ useToast().dismiss(id)
+ await nextTick()
+ window.dispatchEvent(new Event('focus'))
+ }
+ }
+ ])('times out later notifications after $name', async ({ pauseAndEmpty }) => {
+ renderToaster()
+ const id = useToast().loading('Waiting for payment')
+ await nextTick()
+
+ await pauseAndEmpty(id)
+ await nextTick()
+ useToast().success('Payment complete', { duration: 1000 })
+ await nextTick()
+ await vi.advanceTimersByTimeAsync(1000)
+ await nextTick()
+
+ expect(screen.queryByText('Payment complete')).not.toBeInTheDocument()
+ })
+
+ it('hides held notifications and restarts their timers when shown', async () => {
+ renderToaster()
+ const toast = useToast()
+ toast.held = true
+
+ toast.info('Uploaded', { duration: 1000 })
+ await nextTick()
+ await vi.advanceTimersByTimeAsync(5000)
+ expect(screen.queryByTestId('toast')).not.toBeInTheDocument()
+
+ toast.held = false
+ await nextTick()
+ expect(screen.getByTestId('toast')).toHaveTextContent('Uploaded')
+
+ await vi.advanceTimersByTimeAsync(1000)
+ await nextTick()
+ expect(screen.queryByTestId('toast')).not.toBeInTheDocument()
+ })
+
+ it('preserves notifications when Escape is pressed', async () => {
+ const user = userEvent.setup()
+ renderToaster()
+
+ const toast = useToast()
+ toast.info('First')
+ toast.warning('Second')
+ await nextTick()
+
+ await user.keyboard('{Escape}')
+
+ expect(
+ screen.getAllByTestId('toast').map((element) => element.textContent)
+ ).toEqual(['First', 'Second'])
+ })
+
+ it('does not prevent the default Escape behavior', async () => {
+ renderToaster()
+
+ useToast().info('Ready')
+ await nextTick()
+
+ const event = new KeyboardEvent('keydown', {
+ bubbles: true,
+ cancelable: true,
+ key: 'Escape'
+ })
+ window.dispatchEvent(event)
+
+ expect(event.defaultPrevented).toBe(false)
+ })
+
+ it('still closes from its button after an Escape handled elsewhere', async () => {
+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime })
+ renderToaster()
+ useToast().warning('Check settings')
+ await nextTick()
+
+ pressEscapePreventedUpstream()
+ await user.click(screen.getByRole('button', { name: 'Close' }))
+
+ expect(useToast().toasts).toEqual([])
+ })
+
+ it('still times out after an Escape handled elsewhere', async () => {
+ renderToaster()
+ useToast().info('Uploaded', { duration: 1000 })
+ await nextTick()
+
+ pressEscapePreventedUpstream()
+ await vi.advanceTimersByTimeAsync(1000)
+ await nextTick()
+
+ expect(useToast().toasts).toEqual([])
+ })
+
+ it('dismisses a notification from its close button', async () => {
+ const user = userEvent.setup()
+ renderToaster()
+
+ useToast().warning('Check settings')
+ await nextTick()
+ await user.click(screen.getByRole('button', { name: 'Close' }))
+
+ expect(screen.queryByText('Check settings')).not.toBeInTheDocument()
+ })
+
+ it('cannot swipe away a notification and keeps its text selectable', async () => {
+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime })
+ renderToaster()
+ useToast().error('Sticky', { closable: false })
+ await nextTick()
+ const notification = screen.getByTestId('toast')
+ notification.setPointerCapture = vi.fn()
+ notification.releasePointerCapture = vi.fn()
+ notification.hasPointerCapture = () => false
+
+ await user.pointer([
+ { coords: { x: 0, y: 0 }, keys: '[MouseLeft>]', target: notification },
+ { coords: { x: 10, y: 0 } },
+ { coords: { x: 80, y: 0 } },
+ { keys: '[/MouseLeft]' }
+ ])
+ await nextTick()
+
+ expect(screen.getByTestId('toast')).toHaveTextContent('Sticky')
+ expect(screen.getByTestId('toast').style.userSelect).not.toBe('none')
+ })
+})
diff --git a/src/components/ui/toast/Toaster.vue b/src/components/ui/toast/Toaster.vue
new file mode 100644
index 00000000000..7a2f280d5e3
--- /dev/null
+++ b/src/components/ui/toast/Toaster.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+ {{ announcement(item) }}
+
+
+
+
+ {{ announcement(item) }}
+
+
+
+
+
+
+ {{ item.title }}
+
+
+ {{ item.description }}
+
+
+
+
+
+
diff --git a/src/components/ui/toast/toastStore.test.ts b/src/components/ui/toast/toastStore.test.ts
new file mode 100644
index 00000000000..fd56d9917ec
--- /dev/null
+++ b/src/components/ui/toast/toastStore.test.ts
@@ -0,0 +1,62 @@
+import { describe, expect, expectTypeOf, it } from 'vitest'
+
+import { createToastId } from '@/types/toastId'
+import type { ToastId } from '@/types/toastId'
+
+import { useToast } from './toastStore'
+
+describe('useToast', () => {
+ it('creates persistent notifications by default and dismisses by id', () => {
+ const toast = useToast()
+ const id = toast.error('Save failed', { description: 'Disk is full' })
+
+ expect(toast.toasts).toEqual([
+ expect.objectContaining({
+ description: 'Disk is full',
+ duration: Number.POSITIVE_INFINITY,
+ id,
+ kind: 'error',
+ title: 'Save failed'
+ })
+ ])
+
+ toast.dismiss(id)
+ expect(toast.toasts).toEqual([])
+ })
+
+ it('replaces the notification that holds a caller-provided id', () => {
+ const toast = useToast()
+ const id = createToastId()
+
+ expect(toast.loading('Uploading', { id })).toBe(id)
+ toast.error('Upload failed', { id })
+
+ expect(toast.toasts).toEqual([
+ expect.objectContaining({ id, kind: 'error', title: 'Upload failed' })
+ ])
+ })
+
+ it('reports whether dismissing removed a notification', () => {
+ const toast = useToast()
+ const id = toast.info('Saved')
+
+ expect(toast.dismiss(id)).toBe(true)
+ expect(toast.dismiss(id)).toBe(false)
+ })
+
+ it('dismisses every notification at once', () => {
+ const toast = useToast()
+ toast.info('Saved')
+ toast.loading('Uploading')
+
+ toast.dismissAll()
+
+ expect(toast.toasts).toEqual([])
+ })
+
+ it('accepts only minted toast ids', () => {
+ expectTypeOf().not.toExtend()
+ expectTypeOf(useToast().info('Saved')).toEqualTypeOf()
+ expectTypeOf(useToast().dismiss).parameter(0).toEqualTypeOf()
+ })
+})
diff --git a/src/components/ui/toast/toastStore.ts b/src/components/ui/toast/toastStore.ts
new file mode 100644
index 00000000000..caa980a36c3
--- /dev/null
+++ b/src/components/ui/toast/toastStore.ts
@@ -0,0 +1,85 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+
+import { createToastId } from '@/types/toastId'
+import type { ToastId } from '@/types/toastId'
+import type { ToastAction, ToastOptions } from '@/types/extensionTypes'
+
+type ToastKind = 'error' | 'info' | 'loading' | 'success' | 'warning'
+
+export interface Toast {
+ closable: boolean
+ duration: number
+ id: ToastId
+ instance: symbol
+ kind: ToastKind
+ title: string
+ action?: ToastAction
+ description?: string
+}
+
+export const useToast = defineStore('toast', () => {
+ const toasts = ref([])
+ const held = ref(false)
+
+ function add(kind: ToastKind, title: string, options: ToastOptions = {}) {
+ const id = options.id ?? createToastId()
+ toasts.value = [
+ ...toasts.value.filter((toast) => toast.id !== id),
+ {
+ action: options.action,
+ closable: options.closable ?? true,
+ description: options.description,
+ duration: options.duration ?? Number.POSITIVE_INFINITY,
+ id,
+ instance: Symbol(),
+ kind,
+ title
+ }
+ ]
+ return id
+ }
+
+ function success(title: string, options?: ToastOptions) {
+ return add('success', title, options)
+ }
+
+ function error(title: string, options?: ToastOptions) {
+ return add('error', title, options)
+ }
+
+ function info(title: string, options?: ToastOptions) {
+ return add('info', title, options)
+ }
+
+ function warning(title: string, options?: ToastOptions) {
+ return add('warning', title, options)
+ }
+
+ function loading(title: string, options?: ToastOptions) {
+ return add('loading', title, options)
+ }
+
+ function dismiss(id: ToastId): boolean {
+ const remaining = toasts.value.filter((toast) => toast.id !== id)
+ const removed = remaining.length < toasts.value.length
+ toasts.value = remaining
+ return removed
+ }
+
+ function dismissAll() {
+ toasts.value = []
+ }
+
+ return {
+ held,
+ toasts,
+ success,
+ error,
+ info,
+ warning,
+ loading,
+ dismiss,
+ dismissAll
+ }
+})
diff --git a/src/composables/auth/useAuthActions.test.ts b/src/composables/auth/useAuthActions.test.ts
index abf2b2c1875..69c90731006 100644
--- a/src/composables/auth/useAuthActions.test.ts
+++ b/src/composables/auth/useAuthActions.test.ts
@@ -1,6 +1,6 @@
import { useDialogService } from '@/services/dialogService'
+import { useToast } from '@/components/ui/toast/toastStore'
import { SsoRequiredAuthError, useAuthStore } from '@/stores/authStore'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import { FirebaseError } from 'firebase/app'
import { AuthErrorCodes } from 'firebase/auth'
@@ -27,8 +27,6 @@ type ModifiedWorkflow = Pick
let mockAuthStore: ReturnType
-let mockToastStore: ReturnType
-
let mockWorkflowStore: ReturnType
const mockToastErrorHandler = vi.hoisted(() => vi.fn())
@@ -44,12 +42,16 @@ const firebaseCodesWithOwnMessage = Object.keys(authErrorMessages).filter(
(key) => key.startsWith('auth/')
)
-const popupPermissionCodes = [
+const popupPermissionCodes: readonly string[] = [
AuthErrorCodes.POPUP_CLOSED_BY_USER,
AuthErrorCodes.EXPIRED_POPUP_REQUEST,
AuthErrorCodes.POPUP_BLOCKED
]
+const errorCodesWithOwnMessage = firebaseCodesWithOwnMessage.filter(
+ (code) => !popupPermissionCodes.includes(code)
+)
+
const accessErrorCodes = [
'auth/unauthorized-domain',
'auth/invalid-dynamic-link-domain',
@@ -119,7 +121,6 @@ beforeEach(() => {
billingContext.isFreeTier = computed(() => true)
stubFirebaseAuthHarness()
mockAuthStore = useAuthStore()
- mockToastStore = useToastStore()
mockWorkflowStore = useWorkflowStore()
vi.mocked(mockAuthStore.initiateCreditPurchase).mockResolvedValue({
checkout_url: 'https://checkout.stripe.test'
@@ -372,7 +373,7 @@ describe('useAuthActions.logout', () => {
expect(mockAuthStore.logout).not.toHaveBeenCalled()
expect(mockClearAllWorkspaceStorage).not.toHaveBeenCalled()
- expect(mockToastStore.add).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('passes denyLabel "Sign out anyway" to the dialog', async () => {
@@ -413,10 +414,8 @@ describe('useAuthActions auth flow error telemetry', () => {
error_code: 'auth/user-not-found',
auth_action: 'email_sign_in'
})
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: 'auth.errors.auth/invalid-credential'
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: 'auth.errors.auth/invalid-credential'
})
})
@@ -450,7 +449,7 @@ describe('useAuthActions auth flow error telemetry', () => {
)
expect(mockAuthStore.logout).toHaveBeenCalledOnce()
expect(mockToastErrorHandler).not.toHaveBeenCalled()
- expect(mockToastStore.add).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('keeps the failure toast while SSO is off', async () => {
@@ -504,16 +503,20 @@ describe('useAuthActions auth flow error telemetry', () => {
})
describe('useAuthActions.reportError', () => {
- it.for(firebaseCodesWithOwnMessage)(
- 'maps %s to its own message rather than the generic fallback',
+ it.for(errorCodesWithOwnMessage)(
+ 'maps %s to its own error message rather than the generic fallback',
(code) => {
const { reportError } = useAuthActions()
reportError(new FirebaseError(code, 'raw firebase'))
- expect(mockToastStore.add).toHaveBeenCalledWith(
- expect.objectContaining({ detail: `auth.errors.${code}` })
- )
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ description: `auth.errors.${code}`,
+ kind: 'error',
+ title: 'g.error'
+ })
+ ])
expect(mockToastErrorHandler).not.toHaveBeenCalled()
}
)
@@ -525,9 +528,10 @@ describe('useAuthActions.reportError', () => {
reportError(new FirebaseError(code, 'raw firebase'))
- expect(mockToastStore.add).toHaveBeenCalledWith(
+ expect(useToast().error).toHaveBeenCalledWith(
+ 'g.error',
expect.objectContaining({
- detail: 'auth.errors.auth/invalid-credential'
+ description: 'auth.errors.auth/invalid-credential'
})
)
}
@@ -544,7 +548,7 @@ describe('useAuthActions.reportError', () => {
it('covers every popup-permission code with its own message', () => {
expect(firebaseCodesWithOwnMessage).toEqual(
- expect.arrayContaining(popupPermissionCodes)
+ expect.arrayContaining([...popupPermissionCodes])
)
})
@@ -560,10 +564,8 @@ describe('useAuthActions.reportError', () => {
)
)
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: 'auth.errors.signupBlocked'
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: 'auth.errors.signupBlocked'
})
expect(mockToastErrorHandler).not.toHaveBeenCalled()
})
@@ -575,10 +577,8 @@ describe('useAuthActions.reportError', () => {
new FirebaseError('auth/internal-error', 'rejected: SIGNUP_BLOCKED')
)
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: 'auth.errors.signupBlocked'
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: 'auth.errors.signupBlocked'
})
})
@@ -587,10 +587,8 @@ describe('useAuthActions.reportError', () => {
reportError(new FirebaseError('auth/some-new-code', 'raw firebase'))
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: 'auth.errors.generic'
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: 'auth.errors.generic'
})
expect(mockToastErrorHandler).not.toHaveBeenCalled()
})
@@ -602,10 +600,8 @@ describe('useAuthActions.reportError', () => {
new FirebaseError('app/no-app', 'Firebase: Error (app/no-app).')
)
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: 'auth.errors.generic'
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: 'auth.errors.generic'
})
expect(
mockToastErrorHandler,
@@ -620,7 +616,7 @@ describe('useAuthActions.reportError', () => {
reportError(networkError)
expect(mockToastErrorHandler).toHaveBeenCalledWith(networkError)
- expect(mockToastStore.add).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it.for(popupPermissionCodes)(
@@ -630,10 +626,8 @@ describe('useAuthActions.reportError', () => {
reportError(new FirebaseError(code, 'raw firebase'))
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'warn',
- summary: 'g.warning',
- detail: `auth.errors.${code}`
+ expect(useToast().warning).toHaveBeenCalledWith('g.warning', {
+ description: `auth.errors.${code}`
})
expect(mockToastErrorHandler).not.toHaveBeenCalled()
}
@@ -646,10 +640,8 @@ describe('useAuthActions.reportError', () => {
new FirebaseError('auth/account-exists-with-different-credential', 'raw')
)
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: 'auth.errors.auth/account-exists-with-different-credential'
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: 'auth.errors.auth/account-exists-with-different-credential'
})
expect(accessError.value).toBe(false)
})
@@ -662,10 +654,8 @@ describe('useAuthActions.reportError', () => {
reportError(new FirebaseError(code, 'raw firebase'))
expect(accessError.value).toBe(true)
- expect(mockToastStore.add).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'g.error',
- detail: `toastMessages.unauthorizedDomain:${window.location.hostname}:support@comfy.org`
+ expect(useToast().error).toHaveBeenCalledWith('g.error', {
+ description: `toastMessages.unauthorizedDomain:${window.location.hostname}:support@comfy.org`
})
}
)
diff --git a/src/composables/auth/useAuthActions.ts b/src/composables/auth/useAuthActions.ts
index b46a1d20f72..ba10f137256 100644
--- a/src/composables/auth/useAuthActions.ts
+++ b/src/composables/auth/useAuthActions.ts
@@ -20,7 +20,7 @@ import { isCloud } from '@/platform/distribution/types'
import { useTelemetry } from '@/platform/telemetry'
import type { AuthFlowAction } from '@/platform/telemetry/types'
import { PaymentPopupBlockedError } from '@/platform/telemetry/utils/billingFailureCategory'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import {
clearAllWorkspaceStorage,
prepareWorkflowLogoutTransition
@@ -59,7 +59,7 @@ export const localizedAuthErrorCopy = (): AuthErrorCopy => ({
*/
export const useAuthActions = () => {
const authStore = useAuthStore()
- const toastStore = useToastStore()
+ const toast = useToast()
const { wrapWithErrorHandlingAsync, toastErrorHandler } = useErrorHandling()
const accessError = ref(false)
@@ -89,31 +89,24 @@ export const useAuthActions = () => {
}
const classification = classifyAuthError(error)
// Ref: https://firebase.google.com/docs/auth/admin/errors
- const severity = severityForAuthError(classification)
- const summary = t(severity === 'warn' ? 'g.warning' : 'g.error')
+ const kind = severityForAuthError(classification)
+ const notify = (description: string) =>
+ toast[kind](t(`g.${kind}`), { description })
if (classification.kind === 'unauthorized-domain') {
accessError.value = true
- toastStore.add({
- severity,
- summary,
- detail: t('toastMessages.unauthorizedDomain', {
+ notify(
+ t('toastMessages.unauthorizedDomain', {
domain: window.location.hostname,
email: 'support@comfy.org'
})
- })
+ )
} else if (classification.kind !== 'unknown') {
- toastStore.add({
- severity,
- summary,
- detail: authErrorMessage(classification, localizedAuthErrorCopy())
- })
+ notify(authErrorMessage(classification, localizedAuthErrorCopy()))
} else if (error instanceof FirebaseError) {
// classifyAuthError only knows auth/ codes; an app/ or installations/
// FirebaseError still gets the localized copy, never the raw SDK text.
- toastStore.add({
- severity: 'error',
- summary: t('g.error'),
- detail: st(`auth.errors.${error.code}`, t('auth.errors.generic'))
+ toast.error(t('g.error'), {
+ description: st(`auth.errors.${error.code}`, t('auth.errors.generic'))
})
} else {
toastErrorHandler(error)
@@ -162,11 +155,9 @@ export const useAuthActions = () => {
clearAllWorkspaceStorage()
}
- toastStore.add({
- severity: 'success',
- summary: t('auth.signOut.success'),
- detail: t('auth.signOut.successDetail'),
- life: 5000
+ toast.success(t('auth.signOut.success'), {
+ description: t('auth.signOut.successDetail'),
+ duration: 5000
})
if (isCloud) {
@@ -184,11 +175,9 @@ export const useAuthActions = () => {
const sendPasswordReset = wrapWithErrorHandlingAsync(
async (email: string) => {
await authStore.sendPasswordReset(email)
- toastStore.add({
- severity: 'success',
- summary: t('auth.login.passwordResetSent'),
- detail: t('auth.login.passwordResetSentDetail'),
- life: 5000
+ toast.success(t('auth.login.passwordResetSent'), {
+ description: t('auth.login.passwordResetSentDetail'),
+ duration: 5000
})
return true
},
@@ -340,11 +329,9 @@ export const useAuthActions = () => {
const updatePassword = wrapWithErrorHandlingAsync(
async (newPassword: string) => {
await authStore.updatePassword(newPassword)
- toastStore.add({
- severity: 'success',
- summary: t('auth.passwordUpdate.success'),
- detail: t('auth.passwordUpdate.successDetail'),
- life: 5000
+ toast.success(t('auth.passwordUpdate.success'), {
+ description: t('auth.passwordUpdate.successDetail'),
+ duration: 5000
})
},
reportError,
diff --git a/src/composables/graph/useSelectionOperations.ts b/src/composables/graph/useSelectionOperations.ts
index 7dc93a7009d..6baef52e986 100644
--- a/src/composables/graph/useSelectionOperations.ts
+++ b/src/composables/graph/useSelectionOperations.ts
@@ -1,7 +1,7 @@
// import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems' // Unused for now
import { t } from '@/i18n'
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import {
useCanvasStore,
@@ -17,7 +17,7 @@ import { isSelectOnly } from '@/utils/litegraphUtil'
export function useSelectionOperations() {
// const { getSelectedNodes } = useSelectedLiteGraphItems() // Unused for now
const canvasStore = useCanvasStore()
- const toastStore = useToastStore()
+ const toast = useToast()
const dialogService = useDialogService()
const titleEditorStore = useTitleEditorStore()
const workflowStore = useWorkflowStore()
@@ -25,21 +25,17 @@ export function useSelectionOperations() {
const copySelection = () => {
const canvas = app.canvas
if (canvas.selectedItems.size === 0) {
- toastStore.add({
- severity: 'warn',
- summary: t('g.nothingToCopy'),
- detail: t('g.selectItemsToCopy'),
- life: 3000
+ toast.warning(t('g.nothingToCopy'), {
+ description: t('g.selectItemsToCopy'),
+ duration: 3000
})
return
}
canvas.copyToClipboard()
- toastStore.add({
- severity: 'success',
- summary: t('g.copied'),
- detail: t('g.itemsCopiedToClipboard'),
- life: 2000
+ toast.success(t('g.copied'), {
+ description: t('g.itemsCopiedToClipboard'),
+ duration: 2000
})
}
@@ -54,11 +50,9 @@ export function useSelectionOperations() {
const duplicateSelection = () => {
const canvas = app.canvas
if (canvas.selectedItems.size === 0) {
- toastStore.add({
- severity: 'warn',
- summary: t('g.nothingToDuplicate'),
- detail: t('g.selectItemsToDuplicate'),
- life: 3000
+ toast.warning(t('g.nothingToDuplicate'), {
+ description: t('g.selectItemsToDuplicate'),
+ duration: 3000
})
return
}
@@ -82,11 +76,9 @@ export function useSelectionOperations() {
// mode ends.
if (isSelectOnly(canvas)) return
if (canvas.selectedItems.size === 0) {
- toastStore.add({
- severity: 'warn',
- summary: t('g.nothingToDelete'),
- detail: t('g.selectItemsToDelete'),
- life: 3000
+ toast.warning(t('g.nothingToDelete'), {
+ description: t('g.selectItemsToDelete'),
+ duration: 3000
})
return
}
@@ -153,11 +145,9 @@ export function useSelectionOperations() {
return
}
- toastStore.add({
- severity: 'warn',
- summary: t('g.nothingToRename'),
- detail: t('g.selectItemsToRename'),
- life: 3000
+ toast.warning(t('g.nothingToRename'), {
+ description: t('g.selectItemsToRename'),
+ duration: 3000
})
}
diff --git a/src/composables/graph/useSubgraphOperations.test.ts b/src/composables/graph/useSubgraphOperations.test.ts
index 4c719ab4193..d4dd84d1250 100644
--- a/src/composables/graph/useSubgraphOperations.test.ts
+++ b/src/composables/graph/useSubgraphOperations.test.ts
@@ -1,9 +1,9 @@
import { fromPartial } from '@total-typescript/shoehorn'
import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { useToast } from '@/components/ui/toast/toastStore'
import type { LGraph, LGraphCanvas } from '@/lib/litegraph/src/litegraph'
import { LGraphNode, SubgraphNode } from '@/lib/litegraph/src/litegraph'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import type { LoadedComfyWorkflow } from '@/platform/workflow/management/stores/workflowStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
@@ -65,13 +65,9 @@ describe('useSubgraphOperations', () => {
})
expect(revokeSubgraphPreviews).not.toHaveBeenCalled()
expect(captureCanvasState).not.toHaveBeenCalled()
- expect(useToastStore().messagesToAdd).toEqual([
- {
- severity: 'error',
- summary: 'Error',
- detail: 'Unable to unpack the selected subgraph.'
- }
- ])
+ expect(useToast().error).toHaveBeenCalledWith('Error', {
+ description: 'Unable to unpack the selected subgraph.'
+ })
})
it('updates previews and history only for successful unpacks', () => {
diff --git a/src/composables/graph/useSubgraphOperations.ts b/src/composables/graph/useSubgraphOperations.ts
index 7b639ffa570..7058e048e28 100644
--- a/src/composables/graph/useSubgraphOperations.ts
+++ b/src/composables/graph/useSubgraphOperations.ts
@@ -1,7 +1,7 @@
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
+import { useToast } from '@/components/ui/toast/toastStore'
import { t } from '@/i18n'
import { SubgraphNode } from '@/lib/litegraph/src/litegraph'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
@@ -16,7 +16,7 @@ export function useSubgraphOperations() {
const workflowStore = useWorkflowStore()
const nodeOutputStore = useNodeOutputStore()
const subgraphStore = useSubgraphStore()
- const toastStore = useToastStore()
+ const toast = useToast()
const convertToSubgraph = () => {
const canvas = canvasStore.getCanvas()
@@ -51,10 +51,8 @@ export function useSubgraphOperations() {
changed = true
}
if (refused) {
- toastStore.add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('g.subgraphUnpackFailed')
+ toast.error(t('g.error'), {
+ description: t('g.subgraphUnpackFailed')
})
}
if (changed) {
diff --git a/src/composables/node/useNodeDragToCanvas.test.ts b/src/composables/node/useNodeDragToCanvas.test.ts
index bbfe6eb8f63..87b37ad0ceb 100644
--- a/src/composables/node/useNodeDragToCanvas.test.ts
+++ b/src/composables/node/useNodeDragToCanvas.test.ts
@@ -1,9 +1,9 @@
+import { useToast } from '@/components/ui/toast/toastStore'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
import { useNodeDragToCanvas } from './useNodeDragToCanvas'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { LGraphCanvas } from '@/lib/litegraph/src/litegraph'
import { fromPartial } from '@total-typescript/shoehorn'
@@ -302,10 +302,10 @@ describe('useNodeDragToCanvas', () => {
)
expect(mockSelectItems).toHaveBeenCalledWith([placedNode])
- expect(useToastStore().add).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
+ expect.any(String),
expect.objectContaining({
- severity: 'warn',
- detail: 'assetBrowser.failedToSetModelValue'
+ description: 'assetBrowser.failedToSetModelValue'
})
)
expect(console.error).toHaveBeenCalledWith(
@@ -333,10 +333,10 @@ describe('useNodeDragToCanvas', () => {
})
)
- expect(useToastStore().add).toHaveBeenCalledWith(
+ expect(useToast().error).toHaveBeenCalledWith(
+ expect.any(String),
expect.objectContaining({
- severity: 'error',
- detail: 'assetBrowser.failedToCreateNode'
+ description: 'assetBrowser.failedToCreateNode'
})
)
})
diff --git a/src/composables/node/useNodeDragToCanvas.ts b/src/composables/node/useNodeDragToCanvas.ts
index 65a67fe63c8..b56781b233d 100644
--- a/src/composables/node/useNodeDragToCanvas.ts
+++ b/src/composables/node/useNodeDragToCanvas.ts
@@ -4,7 +4,7 @@ import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { withNodeAddSource } from '@/platform/telemetry/nodeAdded/nodeAddSource'
import type { NodeAddSource } from '@/platform/telemetry/types'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { useLitegraphService } from '@/services/litegraphService'
import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
@@ -41,10 +41,8 @@ function applyWidgetValues(node: LGraphNode, values: WidgetValues) {
const widget = node.widgets?.find((w) => w.name === name)
if (!widget) {
console.error(`Widget ${name} not found on node ${node.type}`)
- useToastStore().add({
- severity: 'warn',
- summary: t('g.warning'),
- detail: t('assetBrowser.failedToSetModelValue')
+ useToast().warning(t('g.warning'), {
+ description: t('assetBrowser.failedToSetModelValue')
})
continue
}
@@ -80,10 +78,8 @@ function addNodeAtPosition(clientX: number, clientY: number): boolean {
)
if (!node) {
console.error(`Failed to add node to graph: ${nodeDef.name}`)
- useToastStore().add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('assetBrowser.failedToCreateNode')
+ useToast().error(t('g.error'), {
+ description: t('assetBrowser.failedToCreateNode')
})
return true
}
diff --git a/src/composables/node/useNodeImageUpload.test.ts b/src/composables/node/useNodeImageUpload.test.ts
index 2f061af660b..f89a9b9afbc 100644
--- a/src/composables/node/useNodeImageUpload.test.ts
+++ b/src/composables/node/useNodeImageUpload.test.ts
@@ -1,3 +1,4 @@
+import { useToast } from '@/components/ui/toast/toastStore'
import { fromAny } from '@total-typescript/shoehorn'
import { beforeEach, describe, expect, it, vi } from 'vitest'
@@ -6,7 +7,6 @@ import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { ResultItem } from '@/platform/remote/comfyui/execution/types'
import { api } from '@/scripts/api'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useAssetsStore } from '@/stores/assetsStore'
import type { Mock } from 'vitest'
@@ -186,9 +186,7 @@ describe('useNodeImageUpload', () => {
await capturedDragOnDrop([createFile()])
expect(t).toHaveBeenCalledWith('g.uploadFileTooLarge')
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'g.uploadFileTooLarge'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('g.uploadFileTooLarge')
})
it('shows a file-too-large toast with the limit on a 413 when the server reports one', async () => {
@@ -214,6 +212,19 @@ describe('useNodeImageUpload', () => {
})
})
+ it('shows a localized upload-failed toast when the upload throws', async () => {
+ vi.mocked(api.fetchApi).mockRejectedValueOnce(new Error('Network error'))
+
+ await capturedDragOnDrop([createFile()])
+
+ expect(t).toHaveBeenCalledWith('g.uploadFailed', {
+ reason: 'Network error'
+ })
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({ kind: 'warning', title: 'g.uploadFailed' })
+ ])
+ })
+
it('resets isUploading even when upload fails', async () => {
vi.mocked(api.fetchApi).mockRejectedValueOnce(new Error('Network error'))
@@ -233,9 +244,7 @@ describe('useNodeImageUpload', () => {
const second = await capturedDragOnDrop([createFile('b.png')])
expect(second).toEqual([])
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'g.uploadAlreadyInProgress'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('g.uploadAlreadyInProgress')
await first
})
diff --git a/src/composables/node/useNodeImageUpload.ts b/src/composables/node/useNodeImageUpload.ts
index 7f22d9b6b2d..289185bfdb0 100644
--- a/src/composables/node/useNodeImageUpload.ts
+++ b/src/composables/node/useNodeImageUpload.ts
@@ -2,13 +2,14 @@ import { useNodeDragAndDrop } from '@/composables/node/useNodeDragAndDrop'
import { useNodeFileInput } from '@/composables/node/useNodeFileInput'
import { useNodePaste } from '@/composables/node/useNodePaste'
import { t } from '@/i18n'
-import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { ServerFeatureFlag } from '@/platform/remoteConfig/serverFeatureFlag'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
+import { useToast } from '@/components/ui/toast/toastStore'
import type { ResultItem } from '@/platform/remote/comfyui/execution/types'
import type { ResultItemType } from '@/schemas/resultItemTypeSchema'
import { useAssetsStore } from '@/stores/assetsStore'
import { api } from '@/scripts/api'
+import { getErrorMessage } from '@/utils/errorUtil'
const UPLOAD_TIMEOUT_MS = 120_000
const BYTES_PER_MB = 1024 * 1024
@@ -53,7 +54,7 @@ const uploadFile = async (
})
if (resp.status !== 200) {
- useToastStore().addAlert(buildUploadErrorMessage(resp))
+ useToast().warning(buildUploadErrorMessage(resp))
return
}
@@ -104,16 +105,20 @@ export const useNodeImageUpload = (
return path
} catch (error) {
if (error instanceof DOMException && error.name === 'TimeoutError') {
- useToastStore().addAlert(t('g.uploadTimedOut'))
+ useToast().warning(t('g.uploadTimedOut'))
} else {
- useToastStore().addAlert(String(error))
+ useToast().warning(
+ t('g.uploadFailed', {
+ reason: getErrorMessage(error) ?? t('g.unknownError')
+ })
+ )
}
}
}
const handleUploadBatch = async (files: File[]) => {
if (node.isUploading) {
- useToastStore().addAlert(t('g.uploadAlreadyInProgress'))
+ useToast().warning(t('g.uploadAlreadyInProgress'))
return []
}
node.isUploading = true
diff --git a/src/composables/painter/usePainter.test.ts b/src/composables/painter/usePainter.test.ts
index c3ccfee64b2..1908194aa9f 100644
--- a/src/composables/painter/usePainter.test.ts
+++ b/src/composables/painter/usePainter.test.ts
@@ -5,6 +5,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import { defineComponent, nextTick, ref } from 'vue'
import { createI18n } from 'vue-i18n'
+import { useToast } from '@/components/ui/toast/toastStore'
import { LGraph, LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import { api } from '@/scripts/api'
@@ -486,6 +487,12 @@ describe('usePainter', () => {
await expect(
widgetOf('mask').serializeValue!(paintNode(), 0)
).rejects.toThrow(/missing 'name'/)
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'painter.uploadMissingName'
+ })
+ ])
})
it('throws when the upload response body is not valid JSON', async () => {
diff --git a/src/composables/painter/usePainter.ts b/src/composables/painter/usePainter.ts
index 0e10ce5daae..7941f2c3066 100644
--- a/src/composables/painter/usePainter.ts
+++ b/src/composables/painter/usePainter.ts
@@ -13,13 +13,14 @@ import { setNodeWidgetValue } from '@/core/graph/widgets/nodeWidgetValues'
import { hexToRgb } from '@/utils/colorUtil'
import type { Point } from '@/extensions/core/maskeditor/types'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
import { useWidgetValueStore } from '@/stores/widgetValueStore'
import type { NodeId } from '@/types/nodeId'
import { widgetId } from '@/types/widgetId'
+import { getErrorMessage } from '@/utils/errorUtil'
type PainterTool = 'brush' | 'eraser'
@@ -38,7 +39,7 @@ export function usePainter(nodeId: NodeId, options: UsePainterOptions) {
const { canvasEl, cursorEl, modelValue } = options
const { t } = useI18n()
const nodeOutputStore = useNodeOutputStore()
- const toastStore = useToastStore()
+ const toast = useToast()
const isDirty = ref(false)
@@ -631,9 +632,9 @@ export function usePainter(nodeId: NodeId, options: UsePainterOptions) {
} catch (e) {
const err = t('painter.uploadError', {
status: 0,
- statusText: e instanceof Error ? e.message : String(e)
+ statusText: getErrorMessage(e) ?? t('g.unknownError')
})
- toastStore.addAlert(err)
+ toast.warning(err)
throw new Error(err, { cause: e })
}
@@ -643,7 +644,7 @@ export function usePainter(nodeId: NodeId, options: UsePainterOptions) {
status: resp.status,
statusText: bodyText || resp.statusText || 'unknown error'
})
- toastStore.addAlert(err)
+ toast.warning(err)
throw new Error(err)
}
@@ -653,16 +654,17 @@ export function usePainter(nodeId: NodeId, options: UsePainterOptions) {
} catch (e) {
const err = t('painter.uploadError', {
status: resp.status,
- statusText: e instanceof Error ? e.message : String(e)
+ statusText: getErrorMessage(e) ?? t('g.unknownError')
})
- toastStore.addAlert(err)
+ toast.warning(err)
throw new Error(err, { cause: e })
}
if (!data.name) {
- const detail = `Painter upload succeeded (${resp.status}) but response is missing 'name'`
- toastStore.addAlert(detail)
- throw new Error(detail)
+ toast.warning(t('painter.uploadMissingName'))
+ throw new Error(
+ `Painter upload succeeded (${resp.status}) but response is missing 'name'`
+ )
}
const result = `${data.name} [input]`
diff --git a/src/composables/useCameraAngle.test.ts b/src/composables/useCameraAngle.test.ts
index c3b168fb610..cfe3329a22e 100644
--- a/src/composables/useCameraAngle.test.ts
+++ b/src/composables/useCameraAngle.test.ts
@@ -2,8 +2,8 @@ import { ref } from 'vue'
import type { Ref } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { useToast } from '@/components/ui/toast/toastStore'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
interface ViewportInstance {
@@ -157,7 +157,13 @@ describe('useCameraAngle', () => {
const camera = useCameraAngle(nodeRef(makeNode(DEFAULT_WIDGETS)))
expect(() => camera.initialize(document.createElement('div'))).not.toThrow()
- expect(useToastStore().addAlert).toHaveBeenCalledOnce()
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({
+ kind: 'warning',
+ title:
+ 'Failed to initialize Camera Angle viewer. Try reloading the page.'
+ })
+ )
})
it('writes viewport interaction results back into the widgets', () => {
diff --git a/src/composables/useCameraAngle.ts b/src/composables/useCameraAngle.ts
index 10009f74d68..7c4370b5213 100644
--- a/src/composables/useCameraAngle.ts
+++ b/src/composables/useCameraAngle.ts
@@ -30,7 +30,7 @@ import {
import type { NodeWithWidgets } from '@/extensions/core/cameraAngle/widgetBridge'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
const IMAGE_INPUT_NAME = 'image'
@@ -88,9 +88,7 @@ export function useCameraAngle(
} catch (error) {
console.error('Failed to initialize CameraAngleViewport:', error)
cleanup()
- useToastStore().addAlert(
- t('toastMessages.failedToInitializeCameraAngleViewer')
- )
+ useToast().warning(t('toastMessages.failedToInitializeCameraAngleViewer'))
}
}
diff --git a/src/composables/useCameraInfo.test.ts b/src/composables/useCameraInfo.test.ts
index 0018b9814ec..2e052b90b71 100644
--- a/src/composables/useCameraInfo.test.ts
+++ b/src/composables/useCameraInfo.test.ts
@@ -1,9 +1,9 @@
+import { useToast } from '@/components/ui/toast/toastStore'
import { ref } from 'vue'
import type { Ref } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
interface ViewportInstance {
ctorArgs: unknown[]
@@ -116,7 +116,13 @@ describe('useCameraInfo', () => {
const camera = useCameraInfo(nodeRef(makeNode({ mode: 'orbit' })))
expect(() => camera.initialize(document.createElement('div'))).not.toThrow()
- expect(useToastStore().addAlert).toHaveBeenCalledOnce()
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title:
+ 'Failed to initialize Camera Info viewer. Try reloading the page.'
+ })
+ ])
})
it('forwards toolbar actions to the viewport', () => {
diff --git a/src/composables/useCameraInfo.ts b/src/composables/useCameraInfo.ts
index f39c9f6e559..65c49e2daed 100644
--- a/src/composables/useCameraInfo.ts
+++ b/src/composables/useCameraInfo.ts
@@ -16,7 +16,7 @@ import {
import type { NodeWithWidgets } from '@/extensions/core/cameraInfo/widgetBridge'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
const WIDGET_NAMES = [
'mode',
@@ -65,9 +65,7 @@ export function useCameraInfo(nodeRef: MaybeRef) {
} catch (error) {
console.error('Failed to initialize CameraInfoViewport:', error)
cleanup()
- useToastStore().addAlert(
- t('toastMessages.failedToInitializeCameraInfoViewer')
- )
+ useToast().warning(t('toastMessages.failedToInitializeCameraInfoViewer'))
}
}
diff --git a/src/composables/useCopyToClipboard.test.ts b/src/composables/useCopyToClipboard.test.ts
index f30a1856b93..edd0e8f22cc 100644
--- a/src/composables/useCopyToClipboard.test.ts
+++ b/src/composables/useCopyToClipboard.test.ts
@@ -1,17 +1,8 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
-const mockWriteText = vi.fn()
-const mockToastAdd = vi.fn()
-
-vi.mock(
- import('primevue/usetoast'), // oxlint-disable-line comfy/no-primevue-imports
+import { useToast } from '@/components/ui/toast/toastStore'
- () => ({
- useToast: vi.fn(() => ({
- add: mockToastAdd
- }))
- })
-)
+const mockWriteText = vi.fn()
vi.mock(import('@/i18n'))
@@ -34,8 +25,8 @@ describe('useCopyToClipboard', () => {
expect(copied).toBe(true)
expect(mockWriteText).toHaveBeenCalledWith('hello')
- expect(mockToastAdd).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'success' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'success' })
)
})
@@ -46,7 +37,7 @@ describe('useCopyToClipboard', () => {
const copied = await copyToClipboard('hello', { toastOnSuccess: false })
expect(copied).toBe(true)
- expect(mockToastAdd).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('falls back to legacy when modern clipboard fails', async () => {
@@ -59,8 +50,8 @@ describe('useCopyToClipboard', () => {
expect(copied).toBe(true)
expect(document.execCommand).toHaveBeenCalledWith('copy')
- expect(mockToastAdd).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'success' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'success' })
)
})
@@ -73,8 +64,8 @@ describe('useCopyToClipboard', () => {
expect(copied).toBe(false)
- expect(mockToastAdd).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'error' })
)
})
@@ -92,8 +83,8 @@ describe('useCopyToClipboard', () => {
expect(mockWriteText).not.toHaveBeenCalled()
expect(document.execCommand).toHaveBeenCalledWith('copy')
- expect(mockToastAdd).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'success' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'success' })
)
})
})
diff --git a/src/composables/useCopyToClipboard.ts b/src/composables/useCopyToClipboard.ts
index a03333f97bb..b5e6852e71c 100644
--- a/src/composables/useCopyToClipboard.ts
+++ b/src/composables/useCopyToClipboard.ts
@@ -1,4 +1,4 @@
-import { useToast } from 'primevue/usetoast'
+import { useToast } from '@/components/ui/toast/toastStore'
import { t } from '@/i18n'
@@ -44,20 +44,16 @@ export function useCopyToClipboard() {
if (success && !toastOnSuccess) return true
- toast.add(
- success
- ? {
- severity: 'success',
- summary: t('g.success'),
- detail: t('clipboard.successMessage'),
- life: 3000
- }
- : {
- severity: 'error',
- summary: t('g.error'),
- detail: t('clipboard.errorMessage')
- }
- )
+ if (success) {
+ toast.success(t('g.success'), {
+ description: t('clipboard.successMessage'),
+ duration: 3000
+ })
+ } else {
+ toast.error(t('g.error'), {
+ description: t('clipboard.errorMessage')
+ })
+ }
return success
}
diff --git a/src/composables/useCoreCommands.test.ts b/src/composables/useCoreCommands.test.ts
index 2a1ac3cb872..368cc4a2573 100644
--- a/src/composables/useCoreCommands.test.ts
+++ b/src/composables/useCoreCommands.test.ts
@@ -1,4 +1,5 @@
import { useDialogService } from '@/services/dialogService'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import { beforeEach, describe, expect, it, vi } from 'vitest'
@@ -17,7 +18,6 @@ import { app } from '@/scripts/app'
import { useModelStore } from '@/stores/modelStore'
import { useMissingModelStore } from '@/platform/missingModel/missingModelStore'
import { resetOnboardingState } from '@/platform/onboarding/onboardingReset'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { useSettingsDialog } from '@/platform/settings/composables/useSettingsDialog'
import { useLitegraphService } from '@/services/litegraphService'
@@ -378,9 +378,7 @@ describe('useCoreCommands', () => {
await findCommand().function()
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
- )
+ expect(useToast().error).toHaveBeenCalled()
expect(location.assign).not.toHaveBeenCalled()
expect(location.reload).not.toHaveBeenCalled()
})
@@ -781,9 +779,7 @@ describe('useCoreCommands', () => {
await findCmd('Comfy.QueueSelectedOutputNodes').function()
expect(mockBillingState.showSubscriptionDialog).not.toHaveBeenCalled()
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
- )
+ expect(useToast().error).toHaveBeenCalled()
})
it.for([
@@ -816,9 +812,7 @@ describe('useCoreCommands', () => {
expect(app.queuePrompt).not.toHaveBeenCalled()
expect(mockBillingState.showSubscriptionDialog).not.toHaveBeenCalled()
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'warn' })
- )
+ expect(useToast().warning).toHaveBeenCalled()
}
)
@@ -902,7 +896,7 @@ describe('useCoreCommands', () => {
asset,
'asset_browser'
)
- expect(useToastStore().add).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('shows an error toast when the asset cannot start a drag', async () => {
@@ -914,9 +908,7 @@ describe('useCoreCommands', () => {
await selectAssetFromBrowser()
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
- )
+ expect(useToast().error).toHaveBeenCalled()
})
})
})
diff --git a/src/composables/useCoreCommands.ts b/src/composables/useCoreCommands.ts
index 6934e54ce7b..83e8b717cd7 100644
--- a/src/composables/useCoreCommands.ts
+++ b/src/composables/useCoreCommands.ts
@@ -31,7 +31,7 @@ import { buildSupportUrl } from '@/platform/support/config'
import { useTelemetry } from '@/platform/telemetry'
import { reportError } from '@/platform/telemetry/reportError'
import type { ExecutionTriggerSource } from '@/platform/telemetry/types'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useWorkflowService } from '@/platform/workflow/core/services/workflowService'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import type { ComfyWorkflow } from '@/platform/workflow/management/stores/workflowStore'
@@ -88,11 +88,9 @@ export function useCoreCommands(): ComfyCommand[] {
function blockRunWithoutSubscription(): boolean {
if (!isCloud || canAccessSubscriptionFeatures.value) return false
if (isSalesManagedTier(subscription.value?.tier)) {
- toastStore.add({
- severity: 'warn',
- summary: t('subscription.salesManagedRunBlockedTitle'),
- detail: t('subscription.salesManagedRunBlockedDetail'),
- life: 5000
+ toast.warning(t('subscription.salesManagedRunBlockedTitle'), {
+ description: t('subscription.salesManagedRunBlockedDetail'),
+ duration: 5000
})
} else {
showSubscriptionDialog({ reason: 'subscribe_to_run' })
@@ -105,7 +103,7 @@ export function useCoreCommands(): ComfyCommand[] {
const dialogService = useDialogService()
const colorPaletteStore = useColorPaletteStore()
const authActions = useAuthActions()
- const toastStore = useToastStore()
+ const toast = useToast()
const canvasStore = useCanvasStore()
const executionStore = useExecutionStore()
const modelStore = useModelStore()
@@ -348,11 +346,9 @@ export function useCoreCommands(): ComfyCommand[] {
category: 'essentials' as const,
function: async () => {
await api.interrupt(executionStore.activeJobId)
- toastStore.add({
- severity: 'info',
- summary: t('g.interrupted'),
- detail: t('toastMessages.interrupted'),
- life: 1000
+ toast.info(t('g.interrupted'), {
+ description: t('toastMessages.interrupted'),
+ duration: 1000
})
}
},
@@ -363,11 +359,9 @@ export function useCoreCommands(): ComfyCommand[] {
category: 'essentials' as const,
function: async () => {
await useQueueStore().clear(['queue'])
- toastStore.add({
- severity: 'info',
- summary: t('g.confirmed'),
- detail: t('toastMessages.pendingTasksDeleted'),
- life: 3000
+ toast.info(t('g.confirmed'), {
+ description: t('toastMessages.pendingTasksDeleted'),
+ duration: 3000
})
}
},
@@ -427,10 +421,7 @@ export function useCoreCommands(): ComfyCommand[] {
category: 'view-controls' as const,
function: () => {
if (app.canvas.empty) {
- toastStore.add({
- severity: 'error',
- summary: t('toastMessages.emptyCanvas')
- })
+ toast.error(t('toastMessages.emptyCanvas'))
return
}
app.canvas.fitViewToSelectionAnimated({
@@ -578,10 +569,8 @@ export function useCoreCommands(): ComfyCommand[] {
const selectedOutputNodes = filterOutputNodes(selectedNodes)
if (selectedOutputNodes.length === 0) {
- toastStore.add({
- severity: 'error',
- summary: t('toastMessages.nothingToQueue'),
- detail: t('toastMessages.pleaseSelectOutputNodes')
+ toast.error(t('toastMessages.nothingToQueue'), {
+ description: t('toastMessages.pleaseSelectOutputNodes')
})
return
}
@@ -591,10 +580,8 @@ export function useCoreCommands(): ComfyCommand[] {
getExecutionIdsForSelectedNodes(selectedOutputNodes)
if (executionIds.length === 0) {
- toastStore.add({
- severity: 'error',
- summary: t('toastMessages.failedToQueue'),
- detail: t('toastMessages.failedExecutionPathResolution')
+ toast.error(t('toastMessages.failedToQueue'), {
+ description: t('toastMessages.failedExecutionPathResolution')
})
return
}
@@ -625,10 +612,8 @@ export function useCoreCommands(): ComfyCommand[] {
function: () => {
const { canvas } = app
if (!canvas.selectedItems.size) {
- toastStore.add({
- severity: 'error',
- summary: t('toastMessages.nothingToGroup'),
- detail: t('toastMessages.pleaseSelectNodesToGroup')
+ toast.error(t('toastMessages.nothingToGroup'), {
+ description: t('toastMessages.pleaseSelectNodesToGroup')
})
return
}
@@ -921,11 +906,9 @@ export function useCoreCommands(): ComfyCommand[] {
const result = await resetOnboardingState()
if (result.status === 'failed') {
- toastStore.add({
- severity: 'error',
- summary: t('onboardingReplay.failedSummary'),
- detail: t('onboardingReplay.failedDetail'),
- life: 5000
+ toast.error(t('onboardingReplay.failedSummary'), {
+ description: t('onboardingReplay.failedDetail'),
+ duration: 5000
})
reportError(result.cause, {
surface: 'platform',
@@ -1039,10 +1022,8 @@ export function useCoreCommands(): ComfyCommand[] {
// For DISABLED state, show error toast instead of opening settings
if (state === ManagerUIState.DISABLED) {
- toastStore.add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('manager.notAvailable')
+ toast.error(t('g.error'), {
+ description: t('manager.notAvailable')
})
return
}
@@ -1332,10 +1313,8 @@ export function useCoreCommands(): ComfyCommand[] {
versionAdded: '1.16.4',
function: async () => {
if (!useSettingStore().get('Comfy.Memory.AllowManualUnload')) {
- useToastStore().add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('g.commandProhibited', {
+ toast.error(t('g.error'), {
+ description: t('g.commandProhibited', {
command: 'Comfy.Memory.UnloadModels'
})
})
@@ -1351,10 +1330,8 @@ export function useCoreCommands(): ComfyCommand[] {
versionAdded: '1.16.4',
function: async () => {
if (!useSettingStore().get('Comfy.Memory.AllowManualUnload')) {
- useToastStore().add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('g.commandProhibited', {
+ toast.error(t('g.error'), {
+ description: t('g.commandProhibited', {
command: 'Comfy.Memory.UnloadModelsAndExecutionCache'
})
})
diff --git a/src/composables/useErrorHandling.test.ts b/src/composables/useErrorHandling.test.ts
index d39082e39ff..3d2d2167007 100644
--- a/src/composables/useErrorHandling.test.ts
+++ b/src/composables/useErrorHandling.test.ts
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { ErrorRecoveryStrategy } from '@/composables/useErrorHandling'
import { useErrorHandling } from '@/composables/useErrorHandling'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
describe('useErrorHandling', () => {
let errorHandler: ReturnType
@@ -332,13 +332,9 @@ describe('useErrorHandling', () => {
const wrapped = errorHandler.wrapWithErrorHandlingAsync(action)
await wrapped()
- const toastStore = useToastStore()
- expect(toastStore.add).toHaveBeenCalledWith(
- expect.objectContaining({
- severity: 'error',
- detail: t('g.disconnectedFromBackend')
- })
- )
+ expect(useToast().error).toHaveBeenCalledWith(t('g.error'), {
+ description: t('g.disconnectedFromBackend')
+ })
})
it('should not treat non-TypeError as network error', async () => {
@@ -349,12 +345,9 @@ describe('useErrorHandling', () => {
const wrapped = errorHandler.wrapWithErrorHandlingAsync(action)
await wrapped()
- const toastStore = useToastStore()
- expect(toastStore.add).toHaveBeenCalledWith(
- expect.objectContaining({
- detail: 'Failed to fetch'
- })
- )
+ expect(useToast().error).toHaveBeenCalledWith(t('g.error'), {
+ description: 'Failed to fetch'
+ })
})
})
diff --git a/src/composables/useErrorHandling.ts b/src/composables/useErrorHandling.ts
index 9bee2812df7..9a25537f7e1 100644
--- a/src/composables/useErrorHandling.ts
+++ b/src/composables/useErrorHandling.ts
@@ -1,5 +1,5 @@
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
/**
* Strategy for recovering from specific error conditions.
@@ -50,7 +50,7 @@ export interface ErrorRecoveryStrategy<
}
export function useErrorHandling() {
- const toast = useToastStore()
+ const toast = useToast()
const toastErrorHandler = (error: unknown) => {
const isNetworkError =
error instanceof TypeError &&
@@ -60,11 +60,7 @@ export function useErrorHandling() {
: error instanceof Error
? error.message
: t('g.unknownError')
- toast.add({
- severity: 'error',
- summary: t('g.error'),
- detail: message
- })
+ toast.error(t('g.error'), { description: message })
console.error(error)
}
diff --git a/src/composables/useLoad3d.test.ts b/src/composables/useLoad3d.test.ts
index 13910715940..04e4c852af9 100644
--- a/src/composables/useLoad3d.test.ts
+++ b/src/composables/useLoad3d.test.ts
@@ -20,7 +20,7 @@ import type { LGraph } from '@/lib/litegraph/src/LGraph'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type { IWidget } from '@/lib/litegraph/src/types/widgets'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { api } from '@/scripts/api'
import { createMockLGraphNode } from '@/utils/__tests__/litegraphTestUtils'
import { createMockCanvasPointerEvent } from '@/utils/__tests__/canvasTestUtils'
@@ -68,7 +68,6 @@ describe('useLoad3d', () => {
afterEach(() => scope.stop())
let mockLoad3d: Partial
let mockNode: LGraphNode
- let mockToastStore: ReturnType
beforeEach(() => {
vi.mocked(api.getServerFeature).mockReturnValue(false)
@@ -191,8 +190,6 @@ describe('useLoad3d', () => {
return this
})
vi.mocked(createLoad3d).mockImplementation(() => mockLoad3d as Load3d)
-
- mockToastStore = useToastStore()
})
describe('initialization', () => {
@@ -348,7 +345,7 @@ describe('useLoad3d', () => {
await composable.initializeLoad3d(containerRef)
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToInitializeLoad3dViewer'
)
})
@@ -825,7 +822,7 @@ describe('useLoad3d', () => {
await composable.handleExportModel('glb')
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.no3dSceneToExport'
)
})
@@ -842,7 +839,7 @@ describe('useLoad3d', () => {
await composable.handleExportModel('glb')
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToExportModel'
)
})
@@ -1069,9 +1066,7 @@ describe('useLoad3d', () => {
await composable.handleModelDrop(file)
expect(mockLoad3d.loadModel).not.toHaveBeenCalled()
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
- 'toastMessages.no3dScene'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('toastMessages.no3dScene')
})
})
@@ -1785,7 +1780,7 @@ describe('useLoad3d', () => {
expect(throwing).toHaveBeenCalledTimes(1)
expect(after).toHaveBeenCalledTimes(1)
expect(mockLoad3d.addEventListener).toHaveBeenCalled()
- expect(mockToastStore.addAlert).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
expect(console.error).toHaveBeenCalledWith(
'Load3d ready callback failed:',
expect.any(Error)
diff --git a/src/composables/useLoad3d.ts b/src/composables/useLoad3d.ts
index 15ff51c94fe..c3efa79198f 100644
--- a/src/composables/useLoad3d.ts
+++ b/src/composables/useLoad3d.ts
@@ -33,7 +33,7 @@ import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
import { useSettingStore } from '@/platform/settings/settingStore'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
@@ -286,9 +286,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
}
} catch (error) {
console.error('Error initializing Load3d:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToInitializeLoad3dViewer')
- )
+ useToast().warning(t('toastMessages.failedToInitializeLoad3dViewer'))
}
}
@@ -769,7 +767,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
showAsBackground: false
}
}
- useToastStore().addAlert(t('toastMessages.failedToLoadHDRI'))
+ useToast().warning(t('toastMessages.failedToLoadHDRI'))
} finally {
loading.value = false
loadingMessage.value = ''
@@ -800,7 +798,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
const handleExportModel = async (format: string) => {
if (!load3d) {
- useToastStore().addAlert(t('toastMessages.no3dSceneToExport'))
+ useToast().warning(t('toastMessages.no3dSceneToExport'))
return
}
@@ -808,7 +806,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
await load3d.exportModel(format)
} catch (error) {
console.error('Error exporting model:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToExportModel', {
format: format.toUpperCase()
})
@@ -818,7 +816,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
const handleModelDrop = async (file: File) => {
if (!load3d) {
- useToastStore().addAlert(t('toastMessages.no3dScene'))
+ useToast().warning(t('toastMessages.no3dScene'))
return
}
@@ -839,7 +837,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
const uploadedPath = await Load3dUtils.uploadFile(file, subfolder)
if (!uploadedPath) {
- useToastStore().addAlert(t('toastMessages.fileUploadFailed'))
+ useToast().warning(t('toastMessages.fileUploadFailed'))
return
}
@@ -865,7 +863,7 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => {
}
} catch (error) {
console.error('Model drop failed:', error)
- useToastStore().addAlert(t('toastMessages.failedToLoadModel'))
+ useToast().warning(t('toastMessages.failedToLoadModel'))
} finally {
loading.value = false
loadingMessage.value = ''
diff --git a/src/composables/useLoad3dDrag.test.ts b/src/composables/useLoad3dDrag.test.ts
index f1913103462..4410ca78735 100644
--- a/src/composables/useLoad3dDrag.test.ts
+++ b/src/composables/useLoad3dDrag.test.ts
@@ -3,7 +3,7 @@ import { ref } from 'vue'
import { useLoad3dDrag } from '@/composables/useLoad3dDrag'
import { SUPPORTED_EXTENSIONS } from '@/extensions/core/load3d/constants'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { createMockFileList } from '@/utils/__tests__/litegraphTestUtils'
vi.mock(import('@/i18n'))
@@ -30,12 +30,9 @@ function createMockDragEvent(
}
describe('useLoad3dDrag', () => {
- let mockToastStore: ReturnType
let mockOnModelDrop: (file: File) => void | Promise
beforeEach(() => {
- mockToastStore = useToastStore()
-
mockOnModelDrop = vi.fn()
})
@@ -137,7 +134,7 @@ describe('useLoad3dDrag', () => {
await handleDrop(event)
expect(mockOnModelDrop).not.toHaveBeenCalled()
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'load3d.unsupportedFileType'
)
})
@@ -217,7 +214,7 @@ describe('useLoad3dDrag', () => {
await handleDrop(event)
expect(mockOnModelDrop).not.toHaveBeenCalled()
- expect(mockToastStore.addAlert).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
})
diff --git a/src/composables/useLoad3dDrag.ts b/src/composables/useLoad3dDrag.ts
index 87a8292ec25..00f4474aa63 100644
--- a/src/composables/useLoad3dDrag.ts
+++ b/src/composables/useLoad3dDrag.ts
@@ -3,7 +3,7 @@ import type { MaybeRefOrGetter } from 'vue'
import { SUPPORTED_EXTENSIONS } from '@/extensions/core/load3d/constants'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
interface UseLoad3dDragOptions {
onModelDrop: (file: File) => void | Promise
@@ -56,7 +56,7 @@ export function useLoad3dDrag(options: UseLoad3dDragOptions) {
if (modelFile) {
await options.onModelDrop(modelFile)
} else {
- useToastStore().addAlert(t('load3d.unsupportedFileType'))
+ useToast().warning(t('load3d.unsupportedFileType'))
}
}
diff --git a/src/composables/useLoad3dViewer.test.ts b/src/composables/useLoad3dViewer.test.ts
index 25eabc194b1..7d83dbf6eec 100644
--- a/src/composables/useLoad3dViewer.test.ts
+++ b/src/composables/useLoad3dViewer.test.ts
@@ -7,7 +7,7 @@ import Load3dUtils from '@/extensions/core/load3d/Load3dUtils'
import { createLoad3d } from '@/extensions/core/load3d/createLoad3d'
import type { LGraph } from '@/lib/litegraph/src/LGraph'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useLoad3dService } from '@/services/load3dService'
import { createMockLGraphNode } from '@/utils/__tests__/litegraphTestUtils'
import { api } from '@/scripts/api'
@@ -68,7 +68,6 @@ describe('useLoad3dViewer', () => {
let mockLoad3d: Partial
let mockSourceLoad3d: Partial
let mockLoad3dService: ReturnType
- let mockToastStore: ReturnType
let mockNode: LGraphNode
beforeEach(() => {
@@ -188,8 +187,6 @@ describe('useLoad3dViewer', () => {
typeof useLoad3dService
>
vi.mocked(useLoad3dService).mockReturnValue(mockLoad3dService)
-
- mockToastStore = useToastStore()
})
describe('initialization', () => {
@@ -250,7 +247,7 @@ describe('useLoad3dViewer', () => {
await viewer.initializeViewer(containerRef, mockSourceLoad3d as Load3d)
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToInitializeLoad3dViewer'
)
})
@@ -272,7 +269,7 @@ describe('useLoad3dViewer', () => {
viewer.backgroundColor.value = '#ff0000'
await nextTick()
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToUpdateBackgroundColor'
)
})
@@ -302,7 +299,7 @@ describe('useLoad3dViewer', () => {
await viewer.exportModel('glb')
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToExportModel'
)
})
@@ -603,7 +600,7 @@ describe('useLoad3dViewer', () => {
const file = new File([''], 'test.jpg', { type: 'image/jpeg' })
await viewer.handleBackgroundImageUpdate(file)
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToUploadBackgroundImage'
)
})
@@ -688,9 +685,7 @@ describe('useLoad3dViewer', () => {
const file = new File([''], 'whatever.glb')
await viewer.handleModelDrop(file)
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
- 'toastMessages.no3dScene'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('toastMessages.no3dScene')
expect(mockLoad3d.loadModel).not.toHaveBeenCalled()
})
@@ -705,7 +700,7 @@ describe('useLoad3dViewer', () => {
const file = new File([''], 'whatever.glb')
await viewer.handleModelDrop(file)
- expect(mockToastStore.addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.fileUploadFailed'
)
expect(mockLoad3d.loadModel).not.toHaveBeenCalled()
@@ -848,6 +843,24 @@ describe('useLoad3dViewer', () => {
expect(viewer.backgroundColor.value).toBe('#282828')
})
+ it('warns when loading another model into the standalone viewer fails', async () => {
+ const viewer = useLoad3dViewer()
+ const containerRef = document.createElement('div')
+ await viewer.initializeStandaloneViewer(containerRef, 'model1.glb')
+ vi.mocked(mockLoad3d.loadModel!).mockRejectedValueOnce(
+ new Error('parse failed')
+ )
+
+ await viewer.initializeStandaloneViewer(containerRef, 'model2.glb')
+
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'toastMessages.failedToLoadModel'
+ })
+ ])
+ })
+
it('should save configuration during cleanup in standalone mode', async () => {
const viewer = useLoad3dViewer()
const containerRef = document.createElement('div')
diff --git a/src/composables/useLoad3dViewer.ts b/src/composables/useLoad3dViewer.ts
index 335d722c774..cae2c3d78d4 100644
--- a/src/composables/useLoad3dViewer.ts
+++ b/src/composables/useLoad3dViewer.ts
@@ -24,7 +24,7 @@ import type {
} from '@/extensions/core/load3d/interfaces'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { api } from '@/scripts/api'
import { useLoad3dService } from '@/services/load3dService'
@@ -166,8 +166,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.setBackgroundColor(newColor)
} catch (error) {
console.error('Error updating background color:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToUpdateBackgroundColor', { color: newColor })
+ useToast().warning(
+ t('toastMessages.failedToUpdateBackgroundColor', {
+ color: newColor
+ })
)
}
})
@@ -178,8 +180,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.toggleGrid(newValue)
} catch (error) {
console.error('Error toggling grid:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToToggleGrid', { show: newValue ? 'on' : 'off' })
+ useToast().warning(
+ t('toastMessages.failedToToggleGrid', {
+ show: newValue ? 'on' : 'off'
+ })
)
}
})
@@ -190,8 +194,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.toggleCamera(newCameraType)
} catch (error) {
console.error('Error toggling camera:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToToggleCamera', { camera: newCameraType })
+ useToast().warning(
+ t('toastMessages.failedToToggleCamera', {
+ camera: newCameraType
+ })
)
}
})
@@ -202,9 +208,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.setFOV(newFov)
} catch (error) {
console.error('Error updating FOV:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToUpdateFOV', { fov: newFov })
- )
+ useToast().warning(t('toastMessages.failedToUpdateFOV', { fov: newFov }))
}
})
@@ -214,8 +218,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.setLightIntensity(newValue)
} catch (error) {
console.error('Error updating light intensity:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToUpdateLightIntensity', { intensity: newValue })
+ useToast().warning(
+ t('toastMessages.failedToUpdateLightIntensity', {
+ intensity: newValue
+ })
)
}
})
@@ -227,7 +233,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
hasBackgroundImage.value = !!newValue
} catch (error) {
console.error('Error updating background image:', error)
- useToastStore().addAlert(t('toastMessages.failedToUpdateBackgroundImage'))
+ useToast().warning(t('toastMessages.failedToUpdateBackgroundImage'))
}
})
@@ -237,7 +243,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.setBackgroundRenderMode(newValue)
} catch (error) {
console.error('Error updating background render mode:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToUpdateBackgroundRenderMode', {
mode: newValue
})
@@ -251,8 +257,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.setUpDirection(newValue)
} catch (error) {
console.error('Error updating up direction:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToUpdateUpDirection', { direction: newValue })
+ useToast().warning(
+ t('toastMessages.failedToUpdateUpDirection', {
+ direction: newValue
+ })
)
}
})
@@ -263,8 +271,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
load3d.setMaterialMode(newValue)
} catch (error) {
console.error('Error updating material mode:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToUpdateMaterialMode', { mode: newValue })
+ useToast().warning(
+ t('toastMessages.failedToUpdateMaterialMode', {
+ mode: newValue
+ })
)
}
})
@@ -460,9 +470,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
setupAnimationEvents()
} catch (error) {
console.error('Error initializing Load3d viewer:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToInitializeLoad3dViewer')
- )
+ useToast().warning(t('toastMessages.failedToInitializeLoad3dViewer'))
}
}
@@ -509,7 +517,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
persistStandaloneThumbnail(modelUrl)
} catch (error) {
console.error('Error initializing standalone 3D viewer:', error)
- useToastStore().addAlert(t('toastMessages.failedToLoadModel'))
+ useToast().warning(t('toastMessages.failedToLoadModel'))
}
}
@@ -542,7 +550,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
persistStandaloneThumbnail(modelUrl)
} catch (error) {
console.error('Error loading model in standalone viewer:', error)
- useToastStore().addAlert('Failed to load 3D model')
+ useToast().warning(t('toastMessages.failedToLoadModel'))
}
}
@@ -604,8 +612,10 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
await load3d.exportModel(format)
} catch (error) {
console.error('Error exporting model:', error)
- useToastStore().addAlert(
- t('toastMessages.failedToExportModel', { format: format.toUpperCase() })
+ useToast().warning(
+ t('toastMessages.failedToExportModel', {
+ format: format.toUpperCase()
+ })
)
}
}
@@ -775,7 +785,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
}
if (!load3d) {
- useToastStore().addAlert(t('toastMessages.no3dScene'))
+ useToast().warning(t('toastMessages.no3dScene'))
return
}
@@ -792,7 +802,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
}
} catch (error) {
console.error('Error uploading background image:', error)
- useToastStore().addAlert(t('toastMessages.failedToUploadBackgroundImage'))
+ useToast().warning(t('toastMessages.failedToUploadBackgroundImage'))
}
}
@@ -803,7 +813,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
*/
const handleModelDrop = async (file: File) => {
if (!load3d) {
- useToastStore().addAlert(t('toastMessages.no3dScene'))
+ useToast().warning(t('toastMessages.no3dScene'))
return
}
@@ -814,7 +824,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
)
if (!uploadedPath) {
- useToastStore().addAlert(t('toastMessages.fileUploadFailed'))
+ useToast().warning(t('toastMessages.fileUploadFailed'))
return
}
@@ -840,7 +850,7 @@ export const useLoad3dViewer = (node?: LGraphNode) => {
}
} catch (error) {
console.error('Model drop failed:', error)
- useToastStore().addAlert(t('toastMessages.failedToLoadModel'))
+ useToast().warning(t('toastMessages.failedToLoadModel'))
}
}
diff --git a/src/composables/usePaste.test.ts b/src/composables/usePaste.test.ts
index 887455bda6c..26adcc04151 100644
--- a/src/composables/usePaste.test.ts
+++ b/src/composables/usePaste.test.ts
@@ -21,7 +21,7 @@ import type {
import { useCopy } from '@/composables/useCopy'
import { CANVAS_CLIPBOARD_KEY } from '@/lib/litegraph/src/canvas/clipboardStorage'
import { app } from '@/scripts/app'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { createMockLGraphNode } from '@/utils/__tests__/litegraphTestUtils'
import { createNode } from '@/utils/litegraphUtil'
import { shouldIgnoreCopyPaste } from '@/workbench/eventHelpers'
@@ -784,8 +784,8 @@ describe('usePaste', () => {
await vi.waitFor(() => {
expect(mockCanvas._deserializeItems).not.toHaveBeenCalled()
expect(mockCanvas.pasteFromClipboard).not.toHaveBeenCalled()
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'error' })
)
})
}
@@ -807,8 +807,8 @@ describe('usePaste', () => {
await vi.waitFor(() => {
expect(mockCanvas._deserializeItems).not.toHaveBeenCalled()
expect(mockCanvas.pasteFromClipboard).not.toHaveBeenCalled()
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'error' })
)
})
})
@@ -837,8 +837,8 @@ describe('usePaste', () => {
document.dispatchEvent(event)
await vi.waitFor(() => {
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'error' })
)
expect(mockCanvas.pasteFromClipboard).not.toHaveBeenCalled()
})
@@ -887,12 +887,12 @@ describe('usePaste', () => {
paste(otherApp)
expect(mockCanvas.pasteFromClipboard).not.toHaveBeenCalled()
- expect(useToastStore().add).toHaveBeenCalledWith(
+ expect(useToast().toasts).toEqual([
expect.objectContaining({
- severity: 'info',
- summary: 'Nothing to paste into this node'
+ kind: 'info',
+ title: 'Nothing to paste into this node'
})
- )
+ ])
})
it('runs the default paste only for the latest copy', () => {
@@ -937,7 +937,7 @@ describe('usePaste', () => {
paste(clipboardData)
expect(mockCanvas.pasteFromClipboard).toHaveBeenCalledOnce()
- expect(useToastStore().add).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
}
)
})
diff --git a/src/composables/usePaste.ts b/src/composables/usePaste.ts
index e7a3623c081..f18441e0f52 100644
--- a/src/composables/usePaste.ts
+++ b/src/composables/usePaste.ts
@@ -1,11 +1,11 @@
import { useEventListener } from '@vueuse/core'
+import { useToast } from '@/components/ui/toast/toastStore'
import { parseClipboardHtml } from '@/composables/useCopy'
import { useErrorHandling } from '@/composables/useErrorHandling'
import { t } from '@/i18n'
import { CANVAS_CLIPBOARD_KEY } from '@/lib/litegraph/src/canvas/clipboardStorage'
import type { LGraphCanvas, LGraphNode } from '@/lib/litegraph/src/litegraph'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { zClipboardItems } from '@/platform/workflow/validation/schemas/workflowSchema'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { app } from '@/scripts/app'
@@ -311,10 +311,8 @@ export const usePaste = () => {
if (!isMediaNodeSelected || holdsLatestCanvasCopy(html)) {
canvas.pasteFromClipboard()
} else {
- useToastStore().add({
- severity: 'info',
- summary: t('toastMessages.nothingToPasteIntoNode'),
- life: 3000
+ useToast().info(t('toastMessages.nothingToPasteIntoNode'), {
+ duration: 3000
})
}
}
diff --git a/src/composables/useReconnectingNotification.test.ts b/src/composables/useReconnectingNotification.test.ts
index 9c62b2db318..687ffa75d4a 100644
--- a/src/composables/useReconnectingNotification.test.ts
+++ b/src/composables/useReconnectingNotification.test.ts
@@ -3,23 +3,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { defineComponent, nextTick } from 'vue'
import { createI18n } from 'vue-i18n'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useReconnectingNotification } from '@/composables/useReconnectingNotification'
import { useSettingStore } from '@/platform/settings/settingStore'
-const mockToastAdd = vi.fn()
-const mockToastRemove = vi.fn()
-
-vi.mock(
- import('primevue/usetoast'), // oxlint-disable-line comfy/no-primevue-imports
-
- () => ({
- useToast: () => ({
- add: mockToastAdd,
- remove: mockToastRemove
- })
- })
-)
-
function setupComposable(): ReturnType {
const i18n = createI18n({
legacy: false,
@@ -55,7 +42,7 @@ describe('useReconnectingNotification', () => {
onReconnecting()
- expect(mockToastAdd).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('shows error toast after delay', () => {
@@ -64,10 +51,10 @@ describe('useReconnectingNotification', () => {
onReconnecting()
vi.advanceTimersByTime(2000)
- expect(mockToastAdd).toHaveBeenCalledWith(
+ expect(useToast().toasts).toContainEqual(
expect.objectContaining({
- severity: 'error',
- summary: 'Reconnecting'
+ kind: 'error',
+ title: 'Reconnecting'
})
)
})
@@ -80,8 +67,7 @@ describe('useReconnectingNotification', () => {
onReconnected()
vi.advanceTimersByTime(2000)
- expect(mockToastAdd).not.toHaveBeenCalled()
- expect(mockToastRemove).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('removes toast and shows success when reconnected after delay', () => {
@@ -89,23 +75,15 @@ describe('useReconnectingNotification', () => {
onReconnecting()
vi.advanceTimersByTime(2000)
- mockToastAdd.mockClear()
-
onReconnected()
- expect(mockToastRemove).toHaveBeenCalledWith(
- expect.objectContaining({
- severity: 'error',
- summary: 'Reconnecting'
- })
- )
- expect(mockToastAdd).toHaveBeenCalledWith(
+ expect(useToast().toasts).toEqual([
expect.objectContaining({
- severity: 'success',
- summary: 'Reconnected',
- life: 2000
+ kind: 'success',
+ title: 'Reconnected',
+ duration: 2000
})
- )
+ ])
})
it('does nothing when toast is disabled via setting', () => {
@@ -117,8 +95,7 @@ describe('useReconnectingNotification', () => {
vi.advanceTimersByTime(1500)
onReconnected()
- expect(mockToastAdd).not.toHaveBeenCalled()
- expect(mockToastRemove).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('does nothing when onReconnected is called without prior onReconnecting', () => {
@@ -126,19 +103,20 @@ describe('useReconnectingNotification', () => {
onReconnected()
- expect(mockToastAdd).not.toHaveBeenCalled()
- expect(mockToastRemove).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
- it('handles multiple reconnecting events without duplicating toasts', () => {
- const { onReconnecting } = setupComposable()
+ it('shows one reconnecting toast across repeated disconnects and clears it on reconnect', () => {
+ const { onReconnecting, onReconnected } = setupComposable()
onReconnecting()
- vi.advanceTimersByTime(2000) // first toast fires
- onReconnecting() // second reconnecting event
- vi.advanceTimersByTime(2000) // second toast fires
+ vi.advanceTimersByTime(2000)
+ onReconnecting()
+ vi.advanceTimersByTime(2000)
+ expect(useToast().toasts.map(({ kind }) => kind)).toEqual(['error'])
- expect(mockToastAdd).toHaveBeenCalledTimes(2)
+ onReconnected()
+ expect(useToast().toasts.map(({ kind }) => kind)).toEqual(['success'])
})
describe('tab visibility regained', () => {
@@ -166,12 +144,12 @@ describe('useReconnectingNotification', () => {
// Would have fired under the original (unextended) delay by now.
vi.advanceTimersByTime(1900)
- expect(mockToastAdd).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
// Extended delay (5000ms) elapses from the point visibility was regained.
vi.advanceTimersByTime(3100)
- expect(mockToastAdd).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error', summary: 'Reconnecting' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'error', title: 'Reconnecting' })
)
})
@@ -187,8 +165,7 @@ describe('useReconnectingNotification', () => {
onReconnected()
vi.advanceTimersByTime(5000)
- expect(mockToastAdd).not.toHaveBeenCalled()
- expect(mockToastRemove).not.toHaveBeenCalled()
+ expect(useToast().toasts).toEqual([])
})
it('reverts to the base delay once the post-visibility grace period elapses', async () => {
@@ -201,8 +178,8 @@ describe('useReconnectingNotification', () => {
onReconnecting()
vi.advanceTimersByTime(2000) // base delay again, not the extended one
- expect(mockToastAdd).toHaveBeenCalledWith(
- expect.objectContaining({ severity: 'error', summary: 'Reconnecting' })
+ expect(useToast().toasts).toContainEqual(
+ expect.objectContaining({ kind: 'error', title: 'Reconnecting' })
)
})
})
diff --git a/src/composables/useReconnectingNotification.ts b/src/composables/useReconnectingNotification.ts
index 65d9fd451e7..9300f9e1bd2 100644
--- a/src/composables/useReconnectingNotification.ts
+++ b/src/composables/useReconnectingNotification.ts
@@ -1,9 +1,9 @@
import { useDocumentVisibility, useTimeoutFn } from '@vueuse/core'
-import type { ToastMessageOptions } from 'primevue/toast'
-import { useToast } from 'primevue/usetoast'
import { ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
+import { useToast } from '@/components/ui/toast/toastStore'
+import { createToastId } from '@/types/toastId'
import { useSettingStore } from '@/platform/settings/settingStore'
const RECONNECT_TOAST_DELAY_MS = 2000
@@ -16,18 +16,12 @@ export function useReconnectingNotification() {
const toast = useToast()
const settingStore = useSettingStore()
- const reconnectingMessage: ToastMessageOptions = {
- severity: 'error',
- summary: t('g.reconnecting')
- }
-
- const reconnectingToastShown = ref(false)
const toastDelayMs = ref(RECONNECT_TOAST_DELAY_MS)
+ const reconnectingToastId = createToastId()
const { start, stop, isPending } = useTimeoutFn(
() => {
- toast.add(reconnectingMessage)
- reconnectingToastShown.value = true
+ toast.error(t('g.reconnecting'), { id: reconnectingToastId })
},
toastDelayMs,
{ immediate: false }
@@ -59,14 +53,8 @@ export function useReconnectingNotification() {
function onReconnected() {
stop()
- if (reconnectingToastShown.value) {
- toast.remove(reconnectingMessage)
- toast.add({
- severity: 'success',
- summary: t('g.reconnected'),
- life: 2000
- })
- reconnectingToastShown.value = false
+ if (toast.dismiss(reconnectingToastId)) {
+ toast.success(t('g.reconnected'), { duration: 2000 })
}
}
diff --git a/src/composables/useWorkspaceInset.test.ts b/src/composables/useWorkspaceInset.test.ts
index 263738f844f..709acf2abf7 100644
--- a/src/composables/useWorkspaceInset.test.ts
+++ b/src/composables/useWorkspaceInset.test.ts
@@ -51,7 +51,7 @@ describe('useWorkspaceInsetRight', () => {
expect(readInset()).toBe('0px')
})
- it('stops publishing once the owning scope is torn down', async () => {
+ it('clears the inset once the owning scope is torn down', async () => {
const width = ref(420)
const scope = effectScope()
scope.run(() => useWorkspaceInsetRight(() => width.value))
diff --git a/src/core/graph/subgraph/promotionUtils.ts b/src/core/graph/subgraph/promotionUtils.ts
index ab7a6e42b95..a4a5e4957e4 100644
--- a/src/core/graph/subgraph/promotionUtils.ts
+++ b/src/core/graph/subgraph/promotionUtils.ts
@@ -9,7 +9,7 @@ import type { LinkId } from '@/types/linkId'
import { reorderSubgraphInputs } from '@/lib/litegraph/src/subgraph/subgraphUtils'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import { nextUniqueName } from '@/lib/litegraph/src/strings'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import {
CANVAS_IMAGE_PREVIEW_WIDGET,
supportsVirtualCanvasImagePreview
@@ -494,10 +494,8 @@ function getParentNodes(): SubgraphNode[] {
const { navigationStack } = useSubgraphNavigationStore()
const subgraph = navigationStack.at(-1)
if (!subgraph) {
- useToastStore().add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('subgraphStore.promoteOutsideSubgraph')
+ useToast().error(t('g.error'), {
+ description: t('subgraphStore.promoteOutsideSubgraph')
})
return []
}
diff --git a/src/extensions/core/electronAdapter.ts b/src/extensions/core/electronAdapter.ts
index b3f3be155eb..19f169f91a4 100644
--- a/src/extensions/core/electronAdapter.ts
+++ b/src/extensions/core/electronAdapter.ts
@@ -3,7 +3,7 @@ import log from 'loglevel'
import { useExternalLink } from '@/composables/useExternalLink'
import { PYTHON_MIRROR } from '@/constants/uvMirrors'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import { app } from '@/scripts/app'
import { useDialogService } from '@/services/dialogService'
@@ -17,7 +17,7 @@ void (async () => {
const electronAPI = getElectronAPI()
const desktopAppVersion = await electronAPI.getElectronVersion()
const workflowStore = useWorkflowStore()
- const toastStore = useToastStore()
+ const toast = useToast()
const { staticUrls, buildDocsUrl } = useExternalLink()
const onChangeRestartApp = async (newValue: unknown, oldValue: unknown) => {
@@ -182,10 +182,8 @@ void (async () => {
})
if (!updateInfo.isUpdateAvailable) {
- toastStore.add({
- severity: 'info',
- summary: t('desktopUpdate.noUpdateFound'),
- life: 5_000
+ toast.info(t('desktopUpdate.noUpdateFound'), {
+ duration: 5_000
})
return
}
@@ -202,19 +200,15 @@ void (async () => {
await electronAPI.restartAndInstall()
} catch (error) {
log.error('Error installing update:', error)
- toastStore.add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('desktopUpdate.errorInstallingUpdate')
+ toast.error(t('g.error'), {
+ description: t('desktopUpdate.errorInstallingUpdate')
})
}
}
} catch (error) {
log.error('Error checking for updates:', error)
- toastStore.add({
- severity: 'error',
- summary: t('g.error'),
- detail: t('desktopUpdate.errorCheckingUpdate')
+ toast.error(t('g.error'), {
+ description: t('desktopUpdate.errorCheckingUpdate')
})
}
}
diff --git a/src/extensions/core/load3d.test.ts b/src/extensions/core/load3d.test.ts
index b40f3cbe210..128a6117c3e 100644
--- a/src/extensions/core/load3d.test.ts
+++ b/src/extensions/core/load3d.test.ts
@@ -1,11 +1,11 @@
import { fromAny, fromPartial } from '@total-typescript/shoehorn'
+import { useToast } from '@/components/ui/toast/toastStore'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { defineComponent } from 'vue'
import type { useLoad3d } from '@/composables/useLoad3d'
import type { CameraState } from '@/extensions/core/load3d/interfaces'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import type { ComfyApp } from '@/scripts/app'
import { app } from '@/scripts/app'
@@ -141,10 +141,6 @@ vi.mock(import('@/utils/litegraphUtil'), () => ({
isLoad3dNode: vi.fn(() => true)
}))
-vi.mock(import('@/lib/litegraph/src/litegraph'), () => ({
- LiteGraph: fromPartial({ ContextMenu: fromAny(vi.fn()) })
-}))
-
await import('@/extensions/core/load3d')
const load3DExt = capture.getExtension('Comfy.Load3D')
const preview3DExt = capture.getExtension('Comfy.Preview3D')
@@ -459,7 +455,7 @@ describe('Comfy.Preview3D.nodeCreated', () => {
await preview3DExt.nodeCreated!(node, app)
node.onExecuted!({ result: [] })
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.unableToGetModelFilePath'
)
})
@@ -579,7 +575,7 @@ describe('Comfy.Load3D.getCustomWidgets LOAD_3D', () => {
await flush()
expect(load3d.loadModel).toHaveBeenCalledWith('/api/view')
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToLoadModel'
)
})
@@ -1082,7 +1078,7 @@ describe('Comfy.Preview3DAdvanced.nodeCreated', () => {
await preview3DAdvancedExt.nodeCreated!(node, app)
node.onExecuted!({ result: [] })
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.unableToGetModelFilePath'
)
expect(configureForSaveMeshMock).not.toHaveBeenCalled()
diff --git a/src/extensions/core/load3d.ts b/src/extensions/core/load3d.ts
index 23ac56ccd17..4eff4992f2c 100644
--- a/src/extensions/core/load3d.ts
+++ b/src/extensions/core/load3d.ts
@@ -37,7 +37,7 @@ import type {
INumericWidget,
IStringWidget
} from '@/lib/litegraph/src/types/widgets'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import type {
NodeExecutionOutput,
NodeOutputWith
@@ -94,7 +94,7 @@ async function handleModelUpload(files: FileList, node: LGraphNode) {
const uploadPath = await Load3dUtils.uploadFile(files[0], subfolder)
if (!uploadPath) {
- useToastStore().addAlert(t('toastMessages.fileUploadFailed'))
+ useToast().warning(t('toastMessages.fileUploadFailed'))
return
}
@@ -109,7 +109,7 @@ async function handleModelUpload(files: FileList, node: LGraphNode) {
try {
await load3d.loadModel(modelUrl)
} catch {
- useToastStore().addAlert(t('toastMessages.failedToLoadModel'))
+ useToast().warning(t('toastMessages.failedToLoadModel'))
}
})
@@ -124,7 +124,7 @@ async function handleModelUpload(files: FileList, node: LGraphNode) {
markLoad3dSceneDirty(node)
} catch (error) {
console.error('Model upload failed:', error)
- useToastStore().addAlert(t('toastMessages.fileUploadFailed'))
+ useToast().warning(t('toastMessages.fileUploadFailed'))
}
}
@@ -142,7 +142,7 @@ async function handleResourcesUpload(files: FileList, node: LGraphNode) {
markLoad3dSceneDirty(node)
} catch (error) {
console.error('Extra resources upload failed:', error)
- useToastStore().addAlert(t('toastMessages.extraResourcesUploadFailed'))
+ useToast().warning(t('toastMessages.extraResourcesUploadFailed'))
}
}
@@ -666,7 +666,7 @@ useExtensionService().registerExtension({
if (!filePath) {
const msg = t('toastMessages.unableToGetModelFilePath')
console.error(msg)
- useToastStore().addAlert(msg)
+ useToast().warning(msg)
}
const cameraState = result?.[1]
@@ -903,7 +903,7 @@ function createPreview3DAdvancedExtension(
if (!reported) {
const msg = t('toastMessages.unableToGetModelFilePath')
console.error(msg)
- useToastStore().addAlert(msg)
+ useToast().warning(msg)
return
}
diff --git a/src/extensions/core/load3d/Load3dUtils.test.ts b/src/extensions/core/load3d/Load3dUtils.test.ts
index d1c0507a0bc..8e5a9563f3c 100644
--- a/src/extensions/core/load3d/Load3dUtils.test.ts
+++ b/src/extensions/core/load3d/Load3dUtils.test.ts
@@ -1,6 +1,10 @@
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
+import { useToast } from '@/components/ui/toast/toastStore'
import Load3dUtils from '@/extensions/core/load3d/Load3dUtils'
+import { api } from '@/scripts/api'
+
+vi.mock(import('@/scripts/api'))
describe('Load3dUtils.mapSceneLightIntensityToHdri', () => {
it('maps scene slider low end to a small positive HDRI intensity', () => {
@@ -23,3 +27,54 @@ describe('Load3dUtils.mapSceneLightIntensityToHdri', () => {
expect(Load3dUtils.mapSceneLightIntensityToHdri(3, 5, 5)).toBe(0.25)
})
})
+
+describe('Load3dUtils upload failures', () => {
+ const serverError = () =>
+ new Response(null, { status: 500, statusText: 'Internal Server Error' })
+
+ it('warns with a localized title when the model upload is rejected', async () => {
+ vi.mocked(api.fetchApi).mockResolvedValue(serverError())
+
+ await expect(
+ Load3dUtils.uploadFile(new File(['x'], 'mesh.glb'), '3d')
+ ).resolves.toBeUndefined()
+
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'Upload failed: 500 - Internal Server Error'
+ })
+ ])
+ })
+
+ it('warns with a localized title when the model upload throws', async () => {
+ vi.mocked(api.fetchApi).mockRejectedValue(new Error('Network Error'))
+
+ await expect(
+ Load3dUtils.uploadFile(new File(['x'], 'mesh.glb'), '3d')
+ ).resolves.toBeUndefined()
+
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'Upload failed: Network Error'
+ })
+ ])
+ })
+
+ it('warns with a localized title and throws when the temp image upload is rejected', async () => {
+ vi.mocked(fetch).mockResolvedValue(new Response(new Blob()))
+ vi.mocked(api.fetchApi).mockResolvedValue(serverError())
+
+ await expect(
+ Load3dUtils.uploadTempImage('data:image/png;base64,', 'scene')
+ ).rejects.toThrow('Error uploading temp file: 500 - Internal Server Error')
+
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'Upload failed: 500 - Internal Server Error'
+ })
+ ])
+ })
+})
diff --git a/src/extensions/core/load3d/Load3dUtils.ts b/src/extensions/core/load3d/Load3dUtils.ts
index 6e5e5c9cfdc..111df119d8b 100644
--- a/src/extensions/core/load3d/Load3dUtils.ts
+++ b/src/extensions/core/load3d/Load3dUtils.ts
@@ -1,7 +1,9 @@
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
+import { uploadTempFile } from '@/services/uploadTempFile'
+import { getErrorMessage } from '@/utils/errorUtil'
class Load3dUtils {
static async uploadTempImage(
@@ -15,23 +17,10 @@ class Load3dUtils {
type: fileType === 'mp4' ? 'video/mp4' : 'image/png'
})
- const body = new FormData()
- body.append('image', file)
- body.append('subfolder', 'threed')
- body.append('type', 'temp')
-
- const resp = await api.fetchApi('/upload/image', {
- method: 'POST',
- body
- })
-
- if (resp.status !== 200) {
- const err = `Error uploading temp file: ${resp.status} - ${resp.statusText}`
- useToastStore().addAlert(err)
- throw new Error(err)
- }
-
- return await resp.json()
+ const upload = await uploadTempFile(file, 'threed')
+ if (!upload.ok)
+ throw new Error(`Error uploading temp file: ${upload.reason}`)
+ return upload.file
}
static readonly MAX_UPLOAD_SIZE_MB = 100
@@ -50,7 +39,7 @@ class Load3dUtils {
fileSizeMB.toFixed(2),
'MB'
)
- useToastStore().addAlert(message)
+ useToast().warning(message)
return undefined
}
@@ -75,14 +64,18 @@ class Load3dUtils {
uploadPath = path
} else {
- useToastStore().addAlert(resp.status + ' - ' + resp.statusText)
+ useToast().warning(
+ t('g.uploadFailed', {
+ reason: `${resp.status} - ${resp.statusText}`
+ })
+ )
}
} catch (error) {
console.error('[Load3D] uploadFile: exception', error)
- useToastStore().addAlert(
- error instanceof Error
- ? error.message
- : t('toastMessages.fileUploadFailed')
+ useToast().warning(
+ t('g.uploadFailed', {
+ reason: getErrorMessage(error) ?? t('g.unknownError')
+ })
)
}
diff --git a/src/extensions/core/load3d/LoaderManager.test.ts b/src/extensions/core/load3d/LoaderManager.test.ts
index 7c35cf96585..08736d9d1d0 100644
--- a/src/extensions/core/load3d/LoaderManager.test.ts
+++ b/src/extensions/core/load3d/LoaderManager.test.ts
@@ -1,8 +1,8 @@
+import { useToast } from '@/components/ui/toast/toastStore'
import * as THREE from 'three'
import { fromAny } from '@total-typescript/shoehorn'
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { isGaussianSplatPLY } from '@/scripts/metadata/ply'
import type {
@@ -349,7 +349,7 @@ describe('LoaderManager', () => {
await lm.loadModel('api/view?other=1')
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.couldNotDetermineFileType'
)
expect(modelManager.setupModel).not.toHaveBeenCalled()
@@ -513,7 +513,7 @@ describe('LoaderManager', () => {
'modelLoadingEnd',
null
)
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.errorLoadingModel'
)
expect(console.error).toHaveBeenCalled()
@@ -531,7 +531,7 @@ describe('LoaderManager', () => {
})
expect(console.error).toHaveBeenCalled()
- expect(useToastStore().addAlert).not.toHaveBeenCalledWith(
+ expect(useToast().warning).not.toHaveBeenCalledWith(
'toastMessages.errorLoadingModel'
)
})
@@ -547,7 +547,7 @@ describe('LoaderManager', () => {
silentOnNotFound: true
})
- expect(useToastStore().addAlert).not.toHaveBeenCalledWith(
+ expect(useToast().warning).not.toHaveBeenCalledWith(
'toastMessages.errorLoadingModel'
)
})
@@ -560,7 +560,7 @@ describe('LoaderManager', () => {
silentOnNotFound: true
})
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.errorLoadingModel'
)
})
@@ -665,7 +665,7 @@ describe('LoaderManager', () => {
await Promise.all([firstPromise, secondPromise])
- expect(useToastStore().addAlert).not.toHaveBeenCalled()
+ expect(useToast().warning).not.toHaveBeenCalled()
const endEmits = eventManager.emitEvent.mock.calls.filter(
(call: unknown[]) => call[0] === 'modelLoadingEnd'
)
diff --git a/src/extensions/core/load3d/LoaderManager.ts b/src/extensions/core/load3d/LoaderManager.ts
index a160297ae68..441de80fa46 100644
--- a/src/extensions/core/load3d/LoaderManager.ts
+++ b/src/extensions/core/load3d/LoaderManager.ts
@@ -1,7 +1,7 @@
import type * as THREE from 'three'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { MeshModelAdapter } from './MeshModelAdapter'
import { createAdapterRef, fetchModelData } from './ModelAdapter'
@@ -112,7 +112,7 @@ export class LoaderManager implements LoaderManagerInterface {
}
if (!fileExtension) {
- useToastStore().addAlert(t('toastMessages.couldNotDetermineFileType'))
+ useToast().warning(t('toastMessages.couldNotDetermineFileType'))
return
}
@@ -140,7 +140,7 @@ export class LoaderManager implements LoaderManagerInterface {
this.eventManager.emitEvent('modelLoadingEnd', null)
console.error('Error loading model:', error)
if (!(options?.silentOnNotFound && isNotFoundError(error))) {
- useToastStore().addAlert(t('toastMessages.errorLoadingModel'))
+ useToast().warning(t('toastMessages.errorLoadingModel'))
}
}
}
diff --git a/src/extensions/core/load3d/ModelExporter.test.ts b/src/extensions/core/load3d/ModelExporter.test.ts
index 7f1c6561036..06342c8eaff 100644
--- a/src/extensions/core/load3d/ModelExporter.test.ts
+++ b/src/extensions/core/load3d/ModelExporter.test.ts
@@ -1,10 +1,10 @@
-import * as THREE from 'three'
import { fromAny } from '@total-typescript/shoehorn'
+import * as THREE from 'three'
import { describe, expect, it, vi } from 'vitest'
import { downloadBlob } from '@/base/common/downloadUtil'
+import { useToast } from '@/components/ui/toast/toastStore'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { ModelExporter } from './ModelExporter'
@@ -141,7 +141,7 @@ describe('ModelExporter', () => {
await expect(
ModelExporter.downloadFromURL('http://example.com/cube.glb', 'cube.glb')
).rejects.toThrow('network')
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToDownloadFile'
)
vi.unstubAllGlobals()
@@ -156,7 +156,7 @@ describe('ModelExporter', () => {
ModelExporter.downloadFromURL('http://example.com/cube.glb', 'cube.glb')
).rejects.toThrow('HTTP 404')
expect(downloadBlob).not.toHaveBeenCalled()
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToDownloadFile'
)
vi.unstubAllGlobals()
@@ -211,7 +211,7 @@ describe('ModelExporter', () => {
const settled = Promise.allSettled([promise])
await vi.runAllTimersAsync()
expect(await settled).toMatchObject([rejectedWith('parse fail')])
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToExportModel'
)
expect(t).toHaveBeenCalledWith('toastMessages.failedToExportModel', {
@@ -256,7 +256,7 @@ describe('ModelExporter', () => {
const settled = Promise.allSettled([promise])
await vi.runAllTimersAsync()
expect(await settled).toMatchObject([rejectedWith('obj fail')])
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToExportModel'
)
expect(t).toHaveBeenCalledWith('toastMessages.failedToExportModel', {
@@ -301,7 +301,7 @@ describe('ModelExporter', () => {
const settled = Promise.allSettled([promise])
await vi.runAllTimersAsync()
expect(await settled).toMatchObject([rejectedWith('stl fail')])
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToExportModel'
)
expect(t).toHaveBeenCalledWith('toastMessages.failedToExportModel', {
@@ -330,7 +330,7 @@ describe('ModelExporter', () => {
ModelExporter.exportDirect(null, 'out.spz', 'spz')
).rejects.toThrow('No source file available to export as spz')
expect(downloadBlob).not.toHaveBeenCalled()
- expect(useToastStore().addAlert).not.toHaveBeenCalled()
+ expect(useToast().warning).not.toHaveBeenCalled()
})
})
@@ -369,7 +369,7 @@ describe('ModelExporter', () => {
const settled = Promise.allSettled([promise])
await vi.runAllTimersAsync()
expect(await settled).toMatchObject([rejectedWith('fbx fail')])
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.failedToExportModel'
)
expect(t).toHaveBeenCalledWith('toastMessages.failedToExportModel', {
diff --git a/src/extensions/core/load3d/ModelExporter.ts b/src/extensions/core/load3d/ModelExporter.ts
index 6d340008713..112d9255523 100644
--- a/src/extensions/core/load3d/ModelExporter.ts
+++ b/src/extensions/core/load3d/ModelExporter.ts
@@ -6,7 +6,7 @@ import { STLExporter } from 'three/examples/jsm/exporters/STLExporter'
import { downloadBlob } from '@/base/common/downloadUtil'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
export class ModelExporter {
static detectFormatFromURL(url: string): string | null {
@@ -46,7 +46,7 @@ export class ModelExporter {
downloadBlob(desiredFilename, blob)
} catch (error) {
console.error('Error downloading from URL:', error)
- useToastStore().addAlert(t('toastMessages.failedToDownloadFile'))
+ useToast().warning(t('toastMessages.failedToDownloadFile'))
throw error
}
}
@@ -83,7 +83,7 @@ export class ModelExporter {
ModelExporter.saveArrayBuffer(result, filename)
} catch (error) {
console.error('Error exporting GLB:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToExportModel', { format: 'GLB' })
)
throw error
@@ -111,7 +111,7 @@ export class ModelExporter {
ModelExporter.saveString(result, filename)
} catch (error) {
console.error('Error exporting OBJ:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToExportModel', { format: 'OBJ' })
)
throw error
@@ -146,7 +146,7 @@ export class ModelExporter {
)
} catch (error) {
console.error('Error exporting FBX:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToExportModel', { format: 'FBX' })
)
throw error
@@ -174,7 +174,7 @@ export class ModelExporter {
ModelExporter.saveString(result, filename)
} catch (error) {
console.error('Error exporting STL:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToExportModel', { format: 'STL' })
)
throw error
diff --git a/src/extensions/core/load3d/exportMenuHelper.test.ts b/src/extensions/core/load3d/exportMenuHelper.test.ts
index 99d296649f1..0df7c8d77b5 100644
--- a/src/extensions/core/load3d/exportMenuHelper.test.ts
+++ b/src/extensions/core/load3d/exportMenuHelper.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
+import { useToast } from '@/components/ui/toast/toastStore'
import { t } from '@/i18n'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
import type Load3d from './Load3d'
@@ -106,17 +106,14 @@ describe('createExportMenuItems', () => {
item.callback()
await vi.waitFor(() => expect(exportModel).toHaveBeenCalledWith(value))
await vi.waitFor(() =>
- expect(useToastStore().add).toHaveBeenCalledWith(
- expect.objectContaining({
- severity: 'success',
- summary: 'toastMessages.exportSuccess'
- })
+ expect(useToast().success).toHaveBeenCalledWith(
+ 'toastMessages.exportSuccess'
)
)
expect(t).toHaveBeenCalledWith('toastMessages.exportSuccess', {
format: label
})
- expect(useToastStore().addAlert).not.toHaveBeenCalled()
+ expect(useToast().warning).not.toHaveBeenCalled()
}
)
@@ -136,9 +133,12 @@ describe('createExportMenuItems', () => {
glb.callback()
await vi.waitFor(() =>
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'toastMessages.failedToExportModel'
- )
+ expect(useToast().toasts).toEqual([
+ expect.objectContaining({
+ kind: 'warning',
+ title: 'toastMessages.failedToExportModel'
+ })
+ ])
)
expect(t).toHaveBeenCalledWith('toastMessages.failedToExportModel', {
format: 'GLB'
@@ -147,6 +147,5 @@ describe('createExportMenuItems', () => {
'Export failed:',
expect.any(Error)
)
- expect(useToastStore().add).not.toHaveBeenCalled()
})
})
diff --git a/src/extensions/core/load3d/exportMenuHelper.ts b/src/extensions/core/load3d/exportMenuHelper.ts
index 871648f6385..88d0a8edb9d 100644
--- a/src/extensions/core/load3d/exportMenuHelper.ts
+++ b/src/extensions/core/load3d/exportMenuHelper.ts
@@ -1,6 +1,6 @@
import { t } from '@/i18n'
import type { IContextMenuValue } from '@/lib/litegraph/src/types/contextMenu'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import type Load3d from '@/extensions/core/load3d/Load3d'
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
@@ -31,15 +31,14 @@ export function createExportMenuItems(
void (async () => {
try {
await load3d.exportModel(format.value)
- useToastStore().add({
- severity: 'success',
- summary: t('toastMessages.exportSuccess', {
+ useToast().success(
+ t('toastMessages.exportSuccess', {
format: format.label
})
- })
+ )
} catch (error) {
console.error('Export failed:', error)
- useToastStore().addAlert(
+ useToast().warning(
t('toastMessages.failedToExportModel', {
format: format.label
})
diff --git a/src/extensions/core/load3dPreviewExtensions.test.ts b/src/extensions/core/load3dPreviewExtensions.test.ts
index dd2ba97aaba..be5be669fda 100644
--- a/src/extensions/core/load3dPreviewExtensions.test.ts
+++ b/src/extensions/core/load3dPreviewExtensions.test.ts
@@ -1,9 +1,9 @@
import { fromAny, fromPartial } from '@total-typescript/shoehorn'
+import { useToast } from '@/components/ui/toast/toastStore'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { useLoad3d } from '@/composables/useLoad3d'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { app } from '@/scripts/app'
import type { useExtensionService } from '@/services/extensionService'
import type { useLoad3dService } from '@/services/load3dService'
@@ -412,7 +412,7 @@ describe('Comfy.PreviewGaussianSplat.nodeCreated', () => {
await splatExt.nodeCreated!(node, app)
node.onExecuted!({ result: [] })
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
+ expect(useToast().warning).toHaveBeenCalledWith(
'toastMessages.unableToGetModelFilePath'
)
})
diff --git a/src/extensions/core/load3dPreviewExtensions.ts b/src/extensions/core/load3dPreviewExtensions.ts
index b1fa6ea19fa..e825e46b1d4 100644
--- a/src/extensions/core/load3dPreviewExtensions.ts
+++ b/src/extensions/core/load3dPreviewExtensions.ts
@@ -14,7 +14,7 @@ import { readModel3DOutput } from '@/extensions/core/load3d/model3dOutput'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type { IContextMenuValue } from '@/lib/litegraph/src/types/contextMenu'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import type { NodeExecutionOutput } from '@/platform/remote/comfyui/execution/types'
import { app } from '@/scripts/app'
import { useExtensionService } from '@/services/extensionService'
@@ -201,7 +201,7 @@ function createPreview3DExtension(
if (!reported) {
const msg = t('toastMessages.unableToGetModelFilePath')
console.error(msg)
- useToastStore().addAlert(msg)
+ useToast().warning(msg)
return
}
diff --git a/src/extensions/core/nodeTemplates.ts b/src/extensions/core/nodeTemplates.ts
index a0d287aea81..d099579716c 100644
--- a/src/extensions/core/nodeTemplates.ts
+++ b/src/extensions/core/nodeTemplates.ts
@@ -3,10 +3,11 @@ import { t } from '@/i18n'
import type { IContextMenuValue } from '@/lib/litegraph/src/types/contextMenu'
import type { LGraphCanvas } from '@/lib/litegraph/src/litegraph'
import { reportError } from '@/platform/telemetry/reportError'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useDialogService } from '@/services/dialogService'
import type { ComfyExtension } from '@/types/comfy'
import { deserialiseAndCreate } from '@/utils/vintageClipboard'
+import { getErrorMessage } from '@/utils/errorUtil'
import { api } from '../../scripts/api'
import { app } from '../../scripts/app'
@@ -126,9 +127,9 @@ class ManageTemplates extends ComfyDialog {
await api.storeUserData(file, templates, { stringify: false })
} catch (error) {
console.error(error)
- useToastStore().addAlert(
- error instanceof Error ? error.message : String(error)
- )
+ useToast().warning(t('toastMessages.failedToSaveNodeTemplates'), {
+ description: getErrorMessage(error) ?? t('g.unknownError')
+ })
}
}
@@ -158,7 +159,7 @@ class ManageTemplates extends ComfyDialog {
exportAll() {
if (this.templates.length == 0) {
- useToastStore().addAlert(t('toastMessages.noTemplatesToExport'))
+ useToast().warning(t('toastMessages.noTemplatesToExport'))
return
}
@@ -406,7 +407,7 @@ const ext: ComfyExtension = {
data = JSON.parse(template.data)
} catch (error) {
console.error('Failed to parse node template data', error)
- useToastStore().addAlert(t('toastMessages.invalidTemplateData'))
+ useToast().warning(t('toastMessages.invalidTemplateData'))
return
}
diff --git a/src/extensions/core/uploadAudio.test.ts b/src/extensions/core/uploadAudio.test.ts
index a90820820cd..c0ac7d33154 100644
--- a/src/extensions/core/uploadAudio.test.ts
+++ b/src/extensions/core/uploadAudio.test.ts
@@ -1,11 +1,12 @@
import { fromAny, fromPartial } from '@total-typescript/shoehorn'
import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import type { useAudioService } from '@/services/audioService'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { reportError } from '@/platform/telemetry/reportError'
const {
@@ -214,9 +215,7 @@ describe('Comfy.UploadAudio AUDIOUPLOAD widget', () => {
const result = await capturedDragDrop!([createFile()])
expect(result).toEqual([])
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'g.uploadAlreadyInProgress'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('g.uploadAlreadyInProgress')
expect(api.fetchApi).not.toHaveBeenCalled()
})
@@ -230,7 +229,10 @@ describe('Comfy.UploadAudio AUDIOUPLOAD widget', () => {
expect(node.isUploading).toBe(false)
expect(audioWidget.value).toBe('previous.mp3')
- expect(useToastStore().addAlert).toHaveBeenCalledWith('500 - Server Error')
+ expect(useToast().warning).toHaveBeenCalledWith('g.uploadFailed')
+ expect(t).toHaveBeenCalledWith('g.uploadFailed', {
+ reason: '500 - Server Error'
+ })
expect(node.graph?.setDirtyCanvas).toHaveBeenCalledWith(true)
})
@@ -247,7 +249,8 @@ describe('Comfy.UploadAudio AUDIOUPLOAD widget', () => {
expect(node.isUploading).toBe(false)
expect(audioWidget.value).toBe('previous.mp3')
- expect(useToastStore().addAlert).toHaveBeenCalledWith(error.message)
+ expect(useToast().warning).toHaveBeenCalledWith('g.uploadFailed')
+ expect(t).toHaveBeenCalledWith('g.uploadFailed', { reason: error.message })
expect(node.graph?.setDirtyCanvas).toHaveBeenCalledWith(true)
})
@@ -342,7 +345,7 @@ describe('Comfy.RecordAudio AUDIO_RECORD widget', () => {
expect(mockMediaRecorderStart).toHaveBeenCalledTimes(1)
expect(recordWidget.label).toBe('g.stopRecording')
expect(reportError).not.toHaveBeenCalled()
- expect(useToastStore().addAlert).not.toHaveBeenCalled()
+ expect(useToast().warning).not.toHaveBeenCalled()
})
it('reports a recorder start failure after the microphone was granted', async () => {
@@ -385,12 +388,8 @@ describe('Comfy.RecordAudio AUDIO_RECORD widget', () => {
RECORDER_FAILURE_REPORT
)
expect(mockStopAllTracks).toHaveBeenCalledWith(stream)
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'g.recordingFailedToStart'
- )
- expect(useToastStore().addAlert).not.toHaveBeenCalledWith(
- 'g.micPermissionDenied'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('g.recordingFailedToStart')
+ expect(useToast().warning).not.toHaveBeenCalledWith('g.micPermissionDenied')
expect(recordWidget.label).toBe('g.startRecording')
})
@@ -407,9 +406,7 @@ describe('Comfy.RecordAudio AUDIO_RECORD widget', () => {
await pressRecord()
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'g.micPermissionDenied'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('g.micPermissionDenied')
expect(reportError).not.toHaveBeenCalled()
expect(mockMediaRecorderConstruct).not.toHaveBeenCalled()
})
@@ -426,12 +423,8 @@ describe('Comfy.RecordAudio AUDIO_RECORD widget', () => {
accessError,
RECORDER_FAILURE_REPORT
)
- expect(useToastStore().addAlert).toHaveBeenCalledWith(
- 'g.recordingFailedToStart'
- )
- expect(useToastStore().addAlert).not.toHaveBeenCalledWith(
- 'g.micPermissionDenied'
- )
+ expect(useToast().warning).toHaveBeenCalledWith('g.recordingFailedToStart')
+ expect(useToast().warning).not.toHaveBeenCalledWith('g.micPermissionDenied')
expect(mockMediaRecorderConstruct).not.toHaveBeenCalled()
})
})
diff --git a/src/extensions/core/uploadAudio.ts b/src/extensions/core/uploadAudio.ts
index 014b615560a..d14886199e1 100644
--- a/src/extensions/core/uploadAudio.ts
+++ b/src/extensions/core/uploadAudio.ts
@@ -11,7 +11,7 @@ import type {
IStringWidget
} from '@/lib/litegraph/src/types/widgets'
import { reportError } from '@/platform/telemetry/reportError'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import {
getResourceURL,
splitFilePath
@@ -22,7 +22,7 @@ import type { DOMWidget } from '@/scripts/domWidget'
import { useAudioService } from '@/services/audioService'
import type { NodeLocatorId } from '@/types'
import { widgetId } from '@/types/widgetId'
-import { toError } from '@/utils/errorUtil'
+import { getErrorMessage } from '@/utils/errorUtil'
import { getNodeByLocatorId } from '@/utils/graphTraversalUtil'
import { api } from '../../scripts/api'
@@ -84,11 +84,17 @@ async function uploadFile(
}
return true
} else {
- useToastStore().addAlert(resp.status + ' - ' + resp.statusText)
+ useToast().warning(
+ t('g.uploadFailed', { reason: `${resp.status} - ${resp.statusText}` })
+ )
return false
}
} catch (error) {
- useToastStore().addAlert(toError(error).message)
+ useToast().warning(
+ t('g.uploadFailed', {
+ reason: getErrorMessage(error) ?? t('g.unknownError')
+ })
+ )
return false
}
}
@@ -249,7 +255,7 @@ app.registerExtension({
if (!files.length) return files
if (node.isUploading) {
- useToastStore().addAlert(t('g.uploadAlreadyInProgress'))
+ useToast().warning(t('g.uploadAlreadyInProgress'))
return []
}
@@ -346,7 +352,7 @@ app.registerExtension({
},
level: 'error'
})
- useToastStore().addAlert(t('g.recordingFailedToStart'))
+ useToast().warning(t('g.recordingFailedToStart'))
if (mediaRecorder) {
try {
@@ -378,7 +384,7 @@ app.registerExtension({
const audioSrc = audioUIWidget.element.src
if (!audioSrc) {
- useToastStore().addAlert(t('g.noAudioRecorded'))
+ useToast().warning(t('g.noAudioRecorded'))
return ''
}
@@ -407,7 +413,7 @@ app.registerExtension({
err.name === 'NotAllowedError'
) {
console.error('Error accessing microphone:', err)
- useToastStore().addAlert(t('g.micPermissionDenied'))
+ useToast().warning(t('g.micPermissionDenied'))
useAudioService().stopAllTracks(currentStream)
currentStream = null
} else {
diff --git a/src/extensions/core/webcamCapture.ts b/src/extensions/core/webcamCapture.ts
index 316569e13bc..3aa56d9681e 100644
--- a/src/extensions/core/webcamCapture.ts
+++ b/src/extensions/core/webcamCapture.ts
@@ -1,9 +1,9 @@
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
+import { uploadTempFile } from '@/services/uploadTempFile'
-import { api } from '../../scripts/api'
import { app } from '../../scripts/app'
const webcamReady = new WeakMap>()
@@ -124,9 +124,8 @@ app.registerExtension({
if (captureOnQueue.value) {
capture()
} else if (!node.imgs?.length) {
- const err = `No webcam image captured`
- useToastStore().addAlert(err)
- throw new Error(err)
+ useToast().warning(t('toastMessages.noWebcamImageCaptured'))
+ throw new Error('No webcam image captured')
}
// Upload image to temp storage
@@ -137,20 +136,10 @@ app.registerExtension({
)
const name = `${+new Date()}.png`
const file = new File([blob], name)
- const body = new FormData()
- body.append('image', file)
- body.append('subfolder', 'webcam')
- body.append('type', 'temp')
- const resp = await api.fetchApi('/upload/image', {
- method: 'POST',
- body
- })
- if (resp.status !== 200) {
- const err = `Error uploading camera image: ${resp.status} - ${resp.statusText}`
- useToastStore().addAlert(err)
- throw new Error(err)
- }
- const data = await resp.json()
+ const upload = await uploadTempFile(file, 'webcam')
+ if (!upload.ok)
+ throw new Error(`Error uploading camera image: ${upload.reason}`)
+ const data = upload.file
const serverName = data.name || name
const subfolder = data.subfolder || 'webcam'
const type = data.type || 'temp'
diff --git a/src/locales/en/main.json b/src/locales/en/main.json
index 8f9cda49af6..ab667c31bd9 100644
--- a/src/locales/en/main.json
+++ b/src/locales/en/main.json
@@ -264,7 +264,7 @@
"community": "Community",
"all": "All",
"versionMismatchWarning": "Version Compatibility Warning",
- "versionMismatchWarningMessage": "{warning}: {detail} Visit https://docs.comfy.org/installation/update_comfyui#common-update-issues for update instructions.",
+ "versionMismatchUpdateInstructions": "{detail} Visit https://docs.comfy.org/installation/update_comfyui#common-update-issues for update instructions.",
"frontendOutdated": "Frontend version {frontendVersion} is outdated. Backend requires {requiredVersion} or higher.",
"frontendNewer": "Frontend version {frontendVersion} may not be compatible with backend version {backendVersion}.",
"comfyPackageOutdated": "Installed {name} version {installedVersion} is lower than the required version {requiredVersion}.",
@@ -2411,7 +2411,8 @@
"height": "Height",
"background": "Background",
"clear": "Clear",
- "uploadError": "Failed to upload painter image: {status} - {statusText}"
+ "uploadError": "Failed to upload painter image: {status} - {statusText}",
+ "uploadMissingName": "Painter image upload returned no file name"
},
"boundingBox": {
"x": "X",
@@ -2554,6 +2555,15 @@
},
"toastMessages": {
"nothingToPasteIntoNode": "Nothing to paste into this node",
+ "notificationsLabel": "Notification",
+ "notificationsViewportLabel": "Notifications ({hotkey})",
+ "modelsAndCacheCleared": "Models and Execution Cache have been cleared.",
+ "modelsUnloaded": "Models have been unloaded.",
+ "unloadModelsFailed": "Unloading of models failed. Installed ComfyUI may be an outdated version.",
+ "unloadModelsError": "An error occurred while trying to unload models.",
+ "workflowLinksFixed": "Fixed {patched} node connections and removed {deleted} invalid links.",
+ "workflowLinksFixedTitle": "Workflow Links Fixed",
+ "workflowValidationTitle": "Workflow Validation",
"nothingToQueue": "Nothing to queue",
"pleaseSelectOutputNodes": "Please select output nodes",
"failedToQueue": "Failed to queue",
@@ -2568,6 +2578,7 @@
"a1111CoreNodesUnavailable": "Could not load the workflow because this ComfyUI installation is missing core nodes. Check that the backend started correctly.",
"a1111EmbeddingsUnavailable": "Embeddings could not be loaded from the server. The workflow was imported, but embedding names were left as plain text.",
"dropFileError": "Unable to process dropped item: {error}",
+ "failedToRegisterSubgraph": "Failed to register subgraph",
"assetDropFailed": "Unable to load the dropped asset",
"missingMediaVerificationFailed": "Failed to verify missing media. Some inputs may not be shown in the Issues tab.",
"missingModelVerificationFailed": "Failed to verify missing models. Some models may not be shown in the Issues tab.",
@@ -2578,6 +2589,7 @@
"emptyCanvas": "Empty canvas",
"fileUploadFailed": "File upload failed",
"extraResourcesUploadFailed": "Extra resources upload failed",
+ "noWebcamImageCaptured": "No webcam image captured",
"fileTooLarge": "File too large ({size} MB). Maximum supported size is {maxSize} MB",
"unableToGetModelFilePath": "Unable to get model file path",
"couldNotDetermineFileType": "Could not determine file type",
@@ -2591,6 +2603,7 @@
"errorOpenImage": "Error opening image: {error}",
"noTemplatesToExport": "No templates to export",
"invalidTemplateData": "Failed to load node template: invalid data",
+ "failedToSaveNodeTemplates": "Failed to save node templates",
"failedToFetchLogs": "Failed to fetch server logs",
"migrateToLitegraphReroute": "Reroute nodes will be removed in future versions. Click to migrate to litegraph-native reroute.",
"legacyMaskEditorDeprecated": "The legacy mask editor is deprecated and will be removed soon.",
@@ -3019,6 +3032,9 @@
"cancelTimeout": "Subscription cancellation timed out"
},
"subscription": {
+ "planNotAvailable": "This plan is not available",
+ "previewLoadFailed": "Failed to load subscription preview",
+ "unableToSubscribe": "Unable to subscribe",
"billingTabBlocked": "Couldn't open the billing page. Allow pop-ups for this site and try again.",
"plansForWorkspace": "Plans for {workspace}",
"personalWorkspace": "Personal Workspace",
@@ -4304,7 +4320,7 @@
"assetDelete": {
"error": "Items failed to delete",
"success": "Deletion successful",
- "warn": "Some items failed to delete"
+ "warning": "Some items failed to delete"
},
"assetsDeleted": "{n} / {total} assets were deleted",
"jobsDeleted": "{n} / {total} jobs were deleted",
@@ -5277,7 +5293,7 @@
},
"workspace": {
"inviteAccepted": "Invite Accepted",
- "addedToWorkspace": "You have been added to:",
+ "addedToNamedWorkspace": "You have been added to {workspaceName}",
"inviteFailed": "Failed to Accept Invite",
"inviteSsoUnavailable": "Ask your admin to add you",
"inviteSsoUnavailableDetail": "Invite links can't be accepted from an SSO account yet. Ask a workspace admin to add you to the workspace directly.",
diff --git a/src/main.ts b/src/main.ts
index 918a22b8441..59ddd323d3c 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -5,7 +5,6 @@ import { captureMessage } from '@sentry/vue'
import { createPinia } from 'pinia'
import 'primeicons/primeicons.css'
import PrimeVue from 'primevue/config'
-import ToastService from 'primevue/toastservice'
import Tooltip from 'primevue/tooltip'
import { createApp } from 'vue'
@@ -31,7 +30,7 @@ import '@/lib/litegraph/public/css/litegraph.css'
import router from '@/router'
import { isDesktop, isNightly } from '@/platform/distribution/types'
import { stripPaymentReturnParams } from '@/platform/cloud/subscription/utils/paymentReturnUrl'
-import { useToastStore } from '@/platform/updates/common/toastStore'
+import { useToast } from '@/components/ui/toast/toastStore'
import { useBootstrapStore } from '@/stores/bootstrapStore'
import App from './App.vue'
@@ -127,11 +126,7 @@ setAssertReporter(
reportAssertFailure(message, context)
}
if (isNightly) {
- useToastStore(pinia).add({
- severity: 'warn',
- summary: 'Assertion failed',
- detail: message
- })
+ useToast(pinia).warning('Assertion failed', { description: message })
}
},
{ forwardsToRum: isCloud }
@@ -163,7 +158,6 @@ app
}
}
})
- .use(ToastService)
.use(pinia)
.use(i18n)
diff --git a/src/platform/assets/components/AssetExportProgressDialog.test.ts b/src/platform/assets/components/AssetExportProgressDialog.test.ts
index 91f0491ab21..59258a1eab9 100644
--- a/src/platform/assets/components/AssetExportProgressDialog.test.ts
+++ b/src/platform/assets/components/AssetExportProgressDialog.test.ts
@@ -51,6 +51,38 @@ describe('AssetExportProgressDialog', () => {
store.exportList[0].exportName = 'bundle.zip'
await nextTick()
- expect(screen.getByText('All exports completed')).toBeVisible()
+ expect(
+ screen.getByText('All exports completed', { selector: 'span' })
+ ).toBeVisible()
})
+
+ it('renders only while an export is tracked', async () => {
+ render(AssetExportProgressDialog, { global: { plugins: [i18n] } })
+ expect(screen.queryByRole('button', { name: 'Expand' })).toBeNull()
+
+ useAssetExportStore().trackExport('task-export-1')
+ await nextTick()
+
+ expect(screen.getByRole('button', { name: 'Expand' })).toBeVisible()
+ })
+})
+
+describe('AssetExportProgressDialog announcements', () => {
+ it.for([
+ { status: 'running', announcement: 'Exporting Assets' },
+ { status: 'failed', announcement: '1 export failed' },
+ { status: 'completed', announcement: 'All exports completed' }
+ ] as const)(
+ 'announces "$announcement" when the export is $status',
+ async ({ status, announcement }) => {
+ const store = renderDialog()
+
+ store.exportList[0].status = status
+ await nextTick()
+
+ expect(
+ screen.getByText(announcement, { selector: '[role="status"]' })
+ ).toBeInTheDocument()
+ }
+ )
})
diff --git a/src/platform/assets/components/AssetExportProgressDialog.vue b/src/platform/assets/components/AssetExportProgressDialog.vue
index 4e7b64ef48c..0f3a25fb61a 100644
--- a/src/platform/assets/components/AssetExportProgressDialog.vue
+++ b/src/platform/assets/components/AssetExportProgressDialog.vue
@@ -3,7 +3,7 @@ import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import Loader from '@/components/loader/Loader.vue'
-import HoneyToast from '@/components/honeyToast/HoneyToast.vue'
+import ToastPanel from '@/components/ui/toast/ToastPanel.vue'
import Button from '@/components/ui/button/Button.vue'
import type { AssetExport } from '@/stores/assetExportStore'
import { useAssetExportStore } from '@/stores/assetExportStore'
@@ -45,6 +45,10 @@ const footerLabel = computed(() => {
return t('exportToast.allExportsCompleted')
})
+const announcement = computed(() =>
+ isInProgress.value ? t('exportToast.exportingAssets') : footerLabel.value
+)
+
const footerIconClass = computed(() => {
if (isInProgress.value)
return 'icon-[lucide--loader-circle] animate-spin text-muted-foreground'
@@ -72,7 +76,7 @@ function closeDialog() {
-
+
-
+
diff --git a/src/platform/assets/components/ModelImportProgressDialog.test.ts b/src/platform/assets/components/ModelImportProgressDialog.test.ts
index f263d1d727e..6a49d3cf7c1 100644
--- a/src/platform/assets/components/ModelImportProgressDialog.test.ts
+++ b/src/platform/assets/components/ModelImportProgressDialog.test.ts
@@ -5,15 +5,13 @@ import { describe, expect, it, vi } from 'vitest'
import { nextTick } from 'vue'
import enMessages from '@/locales/en/main.json' with { type: 'json' }
+import { useToast } from '@/components/ui/toast/toastStore'
import { reportError } from '@/platform/telemetry/reportError'
-import { useToastStore } from '@/platform/updates/common/toastStore'
import { useAssetDownloadStore } from '@/stores/assetDownloadStore'
import ModelImportProgressDialog from './ModelImportProgressDialog.vue'
-vi.mock(import('@/platform/telemetry/reportError'), () => ({
- reportError: vi.fn()
-}))
+vi.mock(import('@/platform/telemetry/reportError'))
const i18n = createI18n({
legacy: false,
@@ -52,8 +50,6 @@ describe('ModelImportProgressDialog cancellation', () => {
it('reports cancellation failures and shows the error toast', async () => {
const user = userEvent.setup()
const store = renderDialog()
- const toastStore = useToastStore()
- const addToast = vi.spyOn(toastStore, 'add')
const error = new Error('Cancellation unavailable')
vi.spyOn(store, 'cancelDownload').mockResolvedValue({ ok: false, error })
@@ -66,10 +62,8 @@ describe('ModelImportProgressDialog cancellation', () => {
errorType: 'asset_download_cancellation_failure',
logToConsole: false
})
- expect(addToast).toHaveBeenCalledWith({
- severity: 'error',
- summary: 'Error',
- detail: 'Cancellation unavailable'
+ expect(useToast().error).toHaveBeenCalledWith('Error', {
+ description: 'Cancellation unavailable'
})
})
})
@@ -84,7 +78,6 @@ describe('ModelImportProgressDialog cancellation', () => {
await user.click(screen.getByRole('button', { name: 'Close' }))
await waitFor(() => expect(store.hasDownloads).toBe(false))
- expect(screen.queryByRole('status')).toBeNull()
})
it('restores the close control once a cancellation settles', async () => {
@@ -111,7 +104,7 @@ describe('ModelImportProgressDialog cancellation', () => {
await user.click(screen.getByRole('button', { name: 'Close' }))
- expect(screen.queryByRole('status')).toBeNull()
+ expect(store.hasDownloads).toBe(false)
})
it('dismisses a failed download while reconciliation continues', async () => {
@@ -123,6 +116,41 @@ describe('ModelImportProgressDialog cancellation', () => {
await user.click(screen.getByRole('button', { name: 'Close' }))
- expect(screen.queryByRole('status')).toBeNull()
+ expect(store.hasDownloads).toBe(false)
})
})
+
+it('renders only while a download is tracked', async () => {
+ render(ModelImportProgressDialog, { global: { plugins: [i18n] } })
+ expect(screen.queryByRole('button', { name: 'Expand' })).toBeNull()
+
+ useAssetDownloadStore().trackDownload(
+ 'task-123',
+ 'checkpoints',
+ 'model.safetensors'
+ )
+ await nextTick()
+
+ expect(screen.getByRole('button', { name: 'Expand' })).toBeVisible()
+})
+
+describe('ModelImportProgressDialog announcements', () => {
+ it.for([
+ { status: 'running', announcement: 'Importing Models' },
+ { status: 'failed', announcement: '1 download failed' },
+ { status: 'completed', announcement: 'All downloads completed' },
+ { status: 'cancelled', announcement: 'Cancelled' }
+ ] as const)(
+ 'announces "$announcement" when the import is $status',
+ async ({ status, announcement }) => {
+ const store = renderDialog()
+
+ store.downloadList[0].status = status
+ await nextTick()
+
+ expect(
+ screen.getByText(announcement, { selector: '[role="status"]' })
+ ).toBeInTheDocument()
+ }
+ )
+})
diff --git a/src/platform/assets/components/ModelImportProgressDialog.vue b/src/platform/assets/components/ModelImportProgressDialog.vue
index 770e0420f9d..e008963daa7 100644
--- a/src/platform/assets/components/ModelImportProgressDialog.vue
+++ b/src/platform/assets/components/ModelImportProgressDialog.vue
@@ -5,7 +5,7 @@ import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import Loader from '@/components/loader/Loader.vue'
-import HoneyToast from '@/components/honeyToast/HoneyToast.vue'
+import ToastPanel from '@/components/ui/toast/ToastPanel.vue'
import ProgressToastItem from '@/components/toast/ProgressToastItem.vue'
import Button from '@/components/ui/button/Button.vue'
import { useErrorHandling } from '@/composables/useErrorHandling'
@@ -66,6 +66,19 @@ const currentJobName = computed(() => {
return activeJob?.assetName || t('progressToast.downloadingModel')
})
+const outcomeLabel = computed(() => {
+ if (failedJobs.value.length > 0)
+ return t('progressToast.downloadsFailed', {
+ count: failedJobs.value.length
+ })
+ if (cancelledJobs.value.length > 0) return t('electronFileDownload.cancelled')
+ return t('progressToast.allDownloadsCompleted')
+})
+
+const announcement = computed(() =>
+ isInProgress.value ? t('progressToast.importingModels') : outcomeLabel.value
+)
+
const completedCount = computed(
() =>
completedJobs.value.length +
@@ -111,7 +124,7 @@ async function cancelDownload(taskId: TaskId) {
-
+
- {{
- t('progressToast.downloadsFailed', {
- count: failedJobs.length
- })
- }}
+ {{ outcomeLabel }}
@@ -222,7 +231,7 @@ async function cancelDownload(taskId: TaskId) {
class="icon-[lucide--circle-x] size-4 shrink-0 text-muted-foreground"
/>
- {{ t('electronFileDownload.cancelled') }}
+ {{ outcomeLabel }}
@@ -230,7 +239,7 @@ async function cancelDownload(taskId: TaskId) {
class="icon-[lucide--check-circle] size-4 shrink-0 text-jade-600"
/>
- {{ t('progressToast.allDownloadsCompleted') }}
+ {{ outcomeLabel }}
@@ -282,5 +291,5 @@ async function cancelDownload(taskId: TaskId) {