1008933-workspace-drag-performance.spec.ts
1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { test, expect } from "@playwright/test";
/**
* 缺陷 1008933 - 工作台左右拖动编辑器会感觉很卡
*
* 验收标准:
* 1. generator-area 在拖拽状态(.resizing 类)下,transition 应为 none
* 2. 拖拽开始时 .workspace-content 应存在(确保 DOM 缓存可正确命中)
*/
test.describe("工作台拖拽性能修复 (#1008933)", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/#/app/workspace");
await page.waitForLoadState("domcontentloaded");
});
test("generator-area 在 resizing 状态下 transition 应为 none", async ({
page,
}) => {
const generatorArea = page.locator(".generator-area").first();
const exists = await generatorArea.count();
if (!exists) {
test.skip(true, "未找到 .generator-area,跳过");
return;
}
// 手动添加 resizing class,模拟拖拽状态
await generatorArea.evaluate((el) => el.classList.add("resizing"));
const transition = await generatorArea.evaluate(
(el) => window.getComputedStyle(el).transition
);
// transition 应为 none(即 all 0s ease 0s 或类似的"无过渡"值)
expect(transition).toMatch(/^(none|all 0s)/)
// 清理
await generatorArea.evaluate((el) => el.classList.remove("resizing"));
});
test("工作台页面存在拖拽分割线和 workspace-content 容器", async ({
page,
}) => {
const workspaceContent = page.locator(".workspace-content");
const exists = await workspaceContent.count();
if (!exists) {
test.skip(true, "未找到 .workspace-content,跳过");
return;
}
expect(exists).toBeGreaterThan(0);
// 分割线存在(即使不能拖拽,至少结构正确)
const resizeHandles = page.locator(".resize-handle");
const handleCount = await resizeHandles.count();
expect(handleCount).toBeGreaterThan(0);
});
});