import { expect, test } from '@playwright/test'; const STORY_URL = '/iframe.html?id=mindmap-kmindrenderer--interactive-lab&viewMode=story'; test.describe('KMind Storybook 场景', () => { test('浮动工具栏可以插入节点并触发保存状态', async ({ page }) => { await page.goto(STORY_URL, { waitUntil: 'domcontentloaded' }); const focusButton = page.getByTestId('mindmap-focus-root'); await focusButton.click(); await expect(page.getByTestId('mindmap-selected-text-value')).toContainText('KMind 产品规划'); const countEl = page.getByTestId('mindmap-node-count-value'); const initialCount = Number(await countEl.textContent()); await page.getByRole('button', { name: '子节点' }).click(); await expect(countEl).toHaveText(String(initialCount + 1)); await expect(page.getByTestId('mindmap-save-state')).toHaveText('已保存', { timeout: 10_000, }); }); test('禅模式遮罩可进入并退出', async ({ page }) => { await page.goto(STORY_URL, { waitUntil: 'domcontentloaded' }); await page.getByRole('button', { name: '禅模式' }).click(); await expect(page.getByTestId('mindmap-zen-overlay')).toBeVisible(); await page.getByRole('button', { name: '退出禅模式' }).click(); await expect(page.getByTestId('mindmap-zen-overlay')).toBeHidden(); }); test('大纲预览按钮可模拟 Alt+Click 悬浮预览', async ({ page }) => { await page.goto(STORY_URL, { waitUntil: 'domcontentloaded' }); await page.getByTestId('outline-preview-node-ux-guide').click(); await expect(page.getByTestId('mindmap-preview-title')).toHaveText('体验指南'); await expect(page.getByTestId('mindmap-preview-link')).toHaveText( 'app://document/design-guide' ); }); });