From 884185001af3ae5e8c5c1e7421ad61514393d029 Mon Sep 17 00:00:00 2001
From: MomoPoppy <125256456+MomoPoppy@users.noreply.github.com>
Date: Tue, 5 Dec 2023 17:11:38 +0800
Subject: [PATCH] test(tree-menu): [tree-menu] Optimizing e2e test cases for
TreeMenu components (#1031)
---
.../demos/pc/app/tree-menu/accordion.spec.ts | 4 +-
.../pc/app/tree-menu/basic-usage.spec.ts | 6 +-
.../current-node-composition-api.vue | 10 +-
.../pc/app/tree-menu/current-node.spec.ts | 33 +++--
.../demos/pc/app/tree-menu/current-node.vue | 14 +-
.../pc/app/tree-menu/custom-icon.spec.ts | 14 +-
.../pc/app/tree-menu/data-resource.spec.ts | 54 +++++---
.../app/tree-menu/default-expand-all.spec.ts | 33 +++--
.../default-expanded-keys-highlight.spec.ts | 10 +-
.../tree-menu/default-expanded-keys.spec.ts | 18 ++-
.../demos/pc/app/tree-menu/draggable.spec.ts | 15 ++-
.../demos/pc/app/tree-menu/empty-text.spec.ts | 2 +-
.../tree-menu/event-allow-draggable.spec.ts | 5 +-
.../demos/pc/app/tree-menu/events.spec.ts | 84 ++++++++----
.../tree-menu/expand-on-click-node.spec.ts | 35 ++++-
.../app/tree-menu/filter-node-method.spec.ts | 15 ++-
.../pc/app/tree-menu/filter-node-method.vue | 4 -
.../demos/pc/app/tree-menu/indent.spec.ts | 13 +-
.../demos/pc/app/tree-menu/lazy-load.spec.ts | 12 +-
.../pc/app/tree-menu/menu-collapsible.spec.ts | 7 +-
.../pc/app/tree-menu/show-checkbox.spec.ts | 120 ++++++++++++------
.../pc/app/tree-menu/text-ellipsis.spec.ts | 11 +-
.../pc/app/tree-menu/tree-menu-slot.spec.ts | 7 +-
23 files changed, 354 insertions(+), 172 deletions(-)
diff --git a/examples/sites/demos/pc/app/tree-menu/accordion.spec.ts b/examples/sites/demos/pc/app/tree-menu/accordion.spec.ts
index 6b79006e8..953962f1f 100644
--- a/examples/sites/demos/pc/app/tree-menu/accordion.spec.ts
+++ b/examples/sites/demos/pc/app/tree-menu/accordion.spec.ts
@@ -4,7 +4,9 @@ test('手风琴', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('tree-menu#accordion')
- const treeMenu = page.locator('#preview .tiny-tree-menu')
+ const wrap = page.locator('#accordion')
+ const treeMenu = wrap.locator('.tiny-tree-menu')
+
await treeMenu.getByTitle('指南').click()
await expect(treeMenu.getByTitle('引入组件')).toBeVisible()
await expect(treeMenu.getByTitle('构建部署')).toBeVisible()
diff --git a/examples/sites/demos/pc/app/tree-menu/basic-usage.spec.ts b/examples/sites/demos/pc/app/tree-menu/basic-usage.spec.ts
index 2f7243245..924f55dab 100644
--- a/examples/sites/demos/pc/app/tree-menu/basic-usage.spec.ts
+++ b/examples/sites/demos/pc/app/tree-menu/basic-usage.spec.ts
@@ -4,7 +4,9 @@ test('基本使用,无数据场景', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('tree-menu#basic-usage')
- const treeMenu = page.locator('#preview .tiny-tree-menu')
- await expect(treeMenu.getByPlaceholder('请输入内容进行筛选').locator('input')).toBeVisible()
+ const wrap = page.locator('#basic-usage')
+ const treeMenu = wrap.locator('.tiny-tree-menu')
+
+ await expect(treeMenu.locator('.tiny-input__inner')).toBeVisible()
await expect(treeMenu).toContainText('暂无数据')
})
diff --git a/examples/sites/demos/pc/app/tree-menu/current-node-composition-api.vue b/examples/sites/demos/pc/app/tree-menu/current-node-composition-api.vue
index 7d33c42a8..8927cba72 100644
--- a/examples/sites/demos/pc/app/tree-menu/current-node-composition-api.vue
+++ b/examples/sites/demos/pc/app/tree-menu/current-node-composition-api.vue
@@ -4,9 +4,13 @@
场景2:通过 setCurrentNode(node:ITreeNode) 设置当前节点
场景3:通过 getCurrentKey() 获取当前节点的 key 为:{{ currentKey }}
++ 场景3:通过 getCurrentKey() 获取当前节点的 key 为:{{ currentKey }} +
场景4:通过 getCurrentNode() 获取当前节点的数据为:{{ currentNode }}
++ 场景4:通过 getCurrentNode() 获取当前节点的数据为:{{ currentNode }} +
场景2:通过 setCurrentNode(node:ITreeNode) 设置当前节点
场景3:通过 getCurrentKey() 获取当前节点的 key 为:{{ currentKey }}
++ 场景3:通过 getCurrentKey() 获取当前节点的 key 为:{{ currentKey }} +
场景4:通过 getCurrentNode() 获取当前节点的数据为:{{ currentNode }}
++ 场景4:通过 getCurrentNode() 获取当前节点的数据为:{{ currentNode }} +