diff --git a/web/app/components/app/log/__tests__/list.spec.tsx b/web/app/components/app/log/__tests__/list.spec.tsx
index 25512ed689..fe589b599a 100644
--- a/web/app/components/app/log/__tests__/list.spec.tsx
+++ b/web/app/components/app/log/__tests__/list.spec.tsx
@@ -84,10 +84,6 @@ vi.mock('@/app/components/app/store', () => ({
}),
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children }: { children: ReactNode }) => <>{children}>,
-}))
-
vi.mock('@/app/components/base/drawer', () => ({
default: ({ children, isOpen, onClose }: { children: ReactNode, isOpen: boolean, onClose: () => void }) => (
isOpen
diff --git a/web/app/components/app/overview/__tests__/app-card.spec.tsx b/web/app/components/app/overview/__tests__/app-card.spec.tsx
index a6bacce887..1e9ba71a4f 100644
--- a/web/app/components/app/overview/__tests__/app-card.spec.tsx
+++ b/web/app/components/app/overview/__tests__/app-card.spec.tsx
@@ -1,4 +1,4 @@
-import type { ReactElement, ReactNode } from 'react'
+import type { ReactElement } from 'react'
import type { AppDetailResponse } from '@/models/app'
import { fireEvent, screen, waitFor } from '@testing-library/react'
import { renderWithSystemFeatures } from '@/__tests__/utils/mock-system-features'
@@ -98,15 +98,6 @@ vi.mock('../../app-access-control', () => ({
),
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children, popupContent }: { children: ReactNode, popupContent?: ReactNode }) => (
-
- {children}
- {popupContent}
-
- ),
-}))
-
const mockWindowOpen = vi.fn()
Object.defineProperty(window, 'open', {
writable: true,
diff --git a/web/app/components/apps/__tests__/app-card.spec.tsx b/web/app/components/apps/__tests__/app-card.spec.tsx
index c841617474..d61ca306ae 100644
--- a/web/app/components/apps/__tests__/app-card.spec.tsx
+++ b/web/app/components/apps/__tests__/app-card.spec.tsx
@@ -296,11 +296,6 @@ vi.mock('@langgenius/dify-ui/dropdown-menu', () => {
}
})
-// Tooltip uses portals - minimal mock preserving popup content as title attribute
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children, popupContent }: { children: React.ReactNode, popupContent: React.ReactNode }) => React.createElement('div', { title: popupContent }, children),
-}))
-
// AppCardTags has tag API dependencies - mock for isolated testing
vi.mock('@/features/tag-management/components/app-card-tags', () => ({
AppCardTags: ({ tags }: { tags?: { id: string, name: string }[] }) => {
diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/list/item/__tests__/tooltip.spec.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/list/item/__tests__/tooltip.spec.tsx
index 86e4cb1061..c744fdb60e 100644
--- a/web/app/components/billing/pricing/plans/cloud-plan-item/list/item/__tests__/tooltip.spec.tsx
+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/list/item/__tests__/tooltip.spec.tsx
@@ -1,4 +1,5 @@
import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import Tooltip from '../tooltip'
describe('Tooltip', () => {
@@ -8,12 +9,14 @@ describe('Tooltip', () => {
// Rendering the info tooltip container
describe('Rendering', () => {
- it('should render the content panel when provide with text', () => {
+ it('should render the content panel when hovered', async () => {
+ const user = userEvent.setup()
const content = 'Usage resets on the first day of every month.'
render()
+ await user.hover(screen.getByRole('button', { name: content }))
- expect(() => screen.getByText(content)).not.toThrow()
+ expect(await screen.findByText(content)).toBeInTheDocument()
})
})
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/item.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/item.spec.tsx
index 5da25e5cb0..faef09986b 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/item.spec.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/__tests__/item.spec.tsx
@@ -15,12 +15,6 @@ vi.mock('@/app/components/base/radio/ui', () => ({
),
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children, popupContent }: { children: React.ReactNode, popupContent: string }) => (
- {children}
- ),
-}))
-
vi.mock('../file-icon', () => ({
default: () => ,
}))
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx
index 3c4fea6f51..e198853ddd 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx
@@ -42,10 +42,6 @@ vi.mock('../feature-icon', () => ({
default: ({ feature }: { feature: string }) => {feature},
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children }: { children: ReactNode }) => {children}
,
-}))
-
const mockCredentialPanelState = vi.hoisted(() => vi.fn())
vi.mock('../../provider-added-card/use-credential-panel-state', () => ({
useCredentialPanelState: mockCredentialPanelState,
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx
index 016eda373d..50db3887b0 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx
@@ -54,10 +54,6 @@ vi.mock('@langgenius/dify-ui/switch', () => ({
),
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children }: { children?: React.ReactNode }) => <>{children}>,
-}))
-
vi.mock('@/app/components/header/account-setting/model-provider-page/hooks', () => ({
useLanguage: () => 'en_US',
}))
@@ -233,7 +229,7 @@ describe('ReasoningConfigForm', () => {
it('should open schema modal for object fields and support app selection', () => {
const onChange = vi.fn()
- const { container } = render(
+ render(
{
/>,
)
- fireEvent.click(container.querySelector('div.ml-0\\.5.cursor-pointer')!)
+ fireEvent.click(screen.getByRole('button', { name: 'workflow.nodes.agent.clickToViewParameterSchema' }))
expect(screen.getByTestId('schema-modal')).toHaveTextContent('Config')
fireEvent.click(screen.getByTestId('close-schema'))
diff --git a/web/app/components/tools/workflow-tool/__tests__/index.spec.tsx b/web/app/components/tools/workflow-tool/__tests__/index.spec.tsx
index 8c35232d35..3a8e3a539b 100644
--- a/web/app/components/tools/workflow-tool/__tests__/index.spec.tsx
+++ b/web/app/components/tools/workflow-tool/__tests__/index.spec.tsx
@@ -1,4 +1,3 @@
-import type { ReactNode } from 'react'
import type { WorkflowToolDrawerPayload } from '../index'
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
@@ -28,21 +27,6 @@ vi.mock('@/app/components/tools/labels/selector', () => ({
),
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({
- children,
- popupContent,
- }: {
- children?: ReactNode
- popupContent?: ReactNode
- }) => (
-
- {children}
- {popupContent}
-
- ),
-}))
-
vi.mock('../confirm-modal', () => ({
default: ({ show, onClose, onConfirm }: { show: boolean, onClose: () => void, onConfirm: () => void }) => (
show
diff --git a/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx b/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx
index 3002cafa0a..208d87c23a 100644
--- a/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx
+++ b/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx
@@ -23,21 +23,6 @@ const {
},
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({
- children,
- popupContent,
- }: {
- children: React.ReactNode
- popupContent: React.ReactNode
- }) => (
-
- {popupContent}
- {children}
-
- ),
-}))
-
vi.mock('@/service/use-plugins', () => ({
useFeaturedToolsRecommendations: () => ({
plugins: [],
@@ -121,11 +106,13 @@ describe('Tabs', () => {
filterElem: filter
,
}
- it('should render start content and disabled tab tooltip text', () => {
+ it('should render start content and disabled tab tooltip text', async () => {
+ const user = userEvent.setup()
render()
expect(screen.getByText('start-content'))!.toBeInTheDocument()
- expect(screen.getByText('workflow.tabs.startDisabledTip'))!.toBeInTheDocument()
+ await user.hover(screen.getByText('Blocks'))
+ expect(await screen.findByText('workflow.tabs.startDisabledTip'))!.toBeInTheDocument()
})
it('should switch tabs through click handlers and render tools content with normalized icons', () => {
diff --git a/web/app/components/workflow/nodes/question-classifier/__tests__/node.spec.tsx b/web/app/components/workflow/nodes/question-classifier/__tests__/node.spec.tsx
index a7e72c343c..ad411639e9 100644
--- a/web/app/components/workflow/nodes/question-classifier/__tests__/node.spec.tsx
+++ b/web/app/components/workflow/nodes/question-classifier/__tests__/node.spec.tsx
@@ -1,25 +1,10 @@
import type { QuestionClassifierNodeType, Topic } from '../types'
import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { useTextGenerationCurrentProviderAndModelAndModelList } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { BlockEnum } from '@/app/components/workflow/types'
import Node from '../node'
-vi.mock('@/app/components/base/tooltip', () => ({
- __esModule: true,
- default: ({
- children,
- popupContent,
- }: {
- children: React.ReactNode
- popupContent: React.ReactNode
- }) => (
-
- {children}
- {popupContent}
-
- ),
-}))
-
vi.mock('@/app/components/header/account-setting/model-provider-page/hooks', () => ({
useTextGenerationCurrentProviderAndModelAndModelList: vi.fn(),
}))
@@ -101,7 +86,8 @@ describe('question-classifier/node', () => {
expect(screen.getByText('handle-topic-2')).toBeInTheDocument()
})
- it('returns nothing when neither model nor classes are configured and truncates long class names', () => {
+ it('returns nothing when neither model nor classes are configured and truncates long class names', async () => {
+ const user = userEvent.setup()
const longName = 'L'.repeat(60)
const { container, rerender } = render(
{
)
expect(screen.getByText(`${longName.slice(0, 50)}...`)).toBeInTheDocument()
- expect(screen.getByText(longName)).toBeInTheDocument()
+ await user.hover(screen.getByRole('button', { name: longName }))
+ expect(await screen.findByText(longName)).toBeInTheDocument()
rerender(
({
),
}))
-vi.mock('@/app/components/base/tooltip', () => ({
- default: ({ children }: { children: React.ReactNode }) => <>{children}>,
-}))
-
vi.mock('@/app/components/workflow/nodes/_base/components/field', () => ({
default: ({ title, children }: { title: string, children: React.ReactNode }) => (