Files
mnote/wolai-frontend/tmp_trace/resources/src@32689d1d15f35667a225f1d71acc9e380135104a.txt
T

41 lines
1.8 KiB
Plaintext

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' });
await page.waitForTimeout(2000);
await page.screenshot({ path: 'playwright-debug.png', fullPage: true });
const focusButton = page.getByTestId('mindmap-focus-root');
await focusButton.click();
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'
);
});
});