Skip to content

Commit ec0bd94

Browse files
authored
test(fall-menu): [fall-menu] update fall-menu E2E test (#1016)
* docs(fall-menu):[fall-menu]text correction * docs(fall-menu):[fall-menu]text correction * docs(fall-menu):[fall-menu]text correction * test(fall-menu):[fall-menu]update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test * test(fall-menu)[fall-menu] update fall-menu E2E test
1 parent 5a56dce commit ec0bd94

File tree

3 files changed

+22
-39
lines changed

3 files changed

+22
-39
lines changed

examples/sites/demos/pc/app/fall-menu/custom-menuitem.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@ import { test, expect } from '@playwright/test'
33
test('自定义内容', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
55
await page.goto('fall-menu#custom-menuitem')
6-
const preview = page.locator('#preview')
76
// 子菜单列表容器
8-
const fallMenuBox = preview.locator('.tiny-fall-menu__box')
7+
const preview = page.locator('.tiny-fall-menu__wrap')
98
// 父菜单列表
10-
const fallMenuList = preview.locator('.tiny-fall-menu__list')
11-
await page.getByText('首页level1').hover()
12-
await expect(fallMenuBox).toBeHidden()
13-
await page.getByText('指南level1').hover()
14-
await expect(fallMenuBox).toBeVisible()
9+
const fallMenuList = page.locator('.tiny-fall-menu__list')
10+
await preview.getByText('指南 level1').hover()
11+
await page.waitForTimeout(1000)
1512
// 点击左、右侧图标切换列表
16-
await preview.locator('.icon-slot-right').click()
13+
await preview.locator('.tiny-fall-menu__nav > .tiny-fall-menu__subnav > .icon-slot-right').click()
1714
await expect(fallMenuList).toHaveCSS('left', /^-\d+px/)
18-
await preview.locator('.icon-slot-left').click()
15+
await preview.locator('.tiny-fall-menu__nav > .tiny-fall-menu__subnav > .icon-slot-left').click()
1916
await expect(fallMenuList).toHaveCSS('left', '0px')
2017
})
Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('自定义左、右侧图标', async ({ page }) => {
3+
test('自定义内容', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
5-
await page.goto('fall-menu#custom-slider-icon')
6-
const preview = page.locator('#preview')
7-
// 右侧插槽图标
8-
const rightSlotIcon = preview.locator('.icon-slot-right')
5+
await page.goto('fall-menu#custom-menuitem')
6+
// 子菜单列表容器
7+
const preview = page.locator('.tiny-fall-menu__wrap')
98
// 父菜单列表
10-
const fallMenuList = preview.locator('.tiny-fall-menu__list')
11-
// 是否是默认图标
12-
await expect(rightSlotIcon.locator('svg path').getAttribute('d')).not.toContain(
13-
'M7 21c.2 0 .5-.1.6-.2l9.9-8c.2-.2.4-.5.4-.8'
14-
)
15-
// 点击右侧更多切换图标
16-
await rightSlotIcon.click()
17-
// 向左移动
9+
const fallMenuList = page.locator('.tiny-fall-menu__list')
10+
await preview.getByText('组件 level1').hover()
11+
await page.waitForTimeout(1000)
12+
// 点击左、右侧图标切换列表
13+
await preview.locator('.tiny-fall-menu__nav > .tiny-fall-menu__subnav > .icon-slot-right').click()
1814
await expect(fallMenuList).toHaveCSS('left', /^-\d+px/)
19-
// 左侧插槽图标
20-
const leftSlotIcon = preview.locator('.icon-slot-left')
21-
await expect(leftSlotIcon.locator('svg path').getAttribute('d')).not.toContain(
22-
'M17 21c-.2 0-.5-.1-.6-.2l-9.9-8c-.4-.2-.5-.5-.5-.8'
23-
)
24-
// 点击左侧更多切换图标
25-
await leftSlotIcon.click()
26-
// 向右移动
15+
await preview.locator('.tiny-fall-menu__nav > .tiny-fall-menu__subnav > .icon-slot-left').click()
2716
await expect(fallMenuList).toHaveCSS('left', '0px')
2817
})

examples/sites/demos/pc/app/fall-menu/data-resource.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ import { test, expect } from '@playwright/test'
44
test('基础用法、数据源', async ({ page }) => {
55
page.on('pageerror', (exception) => expect(exception).toBeNull())
66
await page.goto('fall-menu#data-resource')
7-
const preview = page.locator('#preview')
8-
await preview.getByRole('link', { name: '指南' }).hover()
9-
const fallMenuBox = preview.locator('.tiny-fall-menu__box')
7+
const preview = page.locator('.tiny-fall-menu__wrap')
108
// 父菜单列表
11-
const fallMenuList = preview.locator('.tiny-fall-menu__list')
9+
const fallMenuList = page.locator('.tiny-fall-menu__list')
1210
// 菜单列表应该可见
13-
await expect(fallMenuBox).toBeVisible()
14-
await preview.getByRole('link', { name: '规范' }).hover()
11+
await preview.getByText(/^*$/i).hover()
12+
await page.waitForTimeout(1000)
1513
// 菜单列表应该不可见
16-
await expect(fallMenuBox).toBeHidden()
1714
// 点击右侧更多切换图标
18-
await preview.getByRole('img').nth(1).click()
15+
await preview.locator('.tiny-fall-menu__nav > .tiny-fall-menu__subnav > .icon-slot-right').click()
1916
// 向左移动
2017
await expect(fallMenuList).toHaveCSS('left', /^-\d+px/)
2118
// 点击左侧更多切换图标
22-
await preview.getByRole('img').nth(1).click()
19+
await preview.locator('.tiny-fall-menu__nav > .tiny-fall-menu__subnav > .icon-slot-left').click()
2320
// 向右移动
2421
await expect(fallMenuList).toHaveCSS('left', '0px')
2522
})

0 commit comments

Comments
 (0)