Skip to content

Commit a5d6bf9

Browse files
committed
test(site): fix icon not correct test e2e
1 parent c5a67e6 commit a5d6bf9

File tree

6 files changed

+7
-19
lines changed

6 files changed

+7
-19
lines changed

examples/sites/demos/pc/app/action-menu/basic-usage.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ test('基本用法', async ({ page }) => {
1616
// 更多按钮
1717
await expect(moreItem).toHaveText(//)
1818
// 图标显示
19-
await expect(moreItem.locator('svg > path').nth(0)).toHaveAttribute(
20-
'd',
21-
'M8 11.43c-.15 0-.31-.06-.42-.18L1.92 5.6c-.23-.23-.23-.61 0-.85s.61-.23.85 0L8 9.98l5.23-5.23a.61.61 0 0 1 .85 0c.23.23.23.61 0 .85l-5.66 5.66c-.11.11-.27.17-.42.17z'
22-
)
19+
await expect(moreItem.locator('.tiny-dropdown__trigger .tiny-svg')).toBeVisible()
2320
// 分割线
2421
await expect(actionMenu.locator('.tiny-action-menu__item-line')).toHaveCount(2)
2522
// 图标旋转

examples/sites/demos/pc/app/action-menu/card-mode.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ test('基本用法', async ({ page }) => {
1212
await expect(visibleItem).toHaveCount(4)
1313
await expect(moreItem).not.toHaveText(//)
1414
// 三点图标
15-
await expect(moreItem.locator('circle')).toHaveCount(3)
15+
const SvgPathReg = /^M2\.3 7\.78v.+219-1\.17Z$/
16+
await expect(moreItem.locator('.tiny-svg path').first()).toHaveAttribute('d', SvgPathReg)
1617
})

examples/sites/demos/pc/app/action-menu/icon.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test('只显示文本', async ({ page }) => {
2424
await page.goto('action-menu#icon')
2525

2626
const wrap = page.locator('#icon')
27-
const actionMenu = wrap.locator('.tiny-action-menu').nth(2)
27+
const actionMenu = wrap.locator('.tiny-action-menu').nth(1)
2828
const actionMenuItem = actionMenu.locator('.tiny-action-menu__item')
2929

3030
await expect(actionMenuItem.nth(0).locator('.tiny-svg')).toBeHidden()

examples/sites/demos/pc/app/button-group/show-more.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ test('测试更多按钮', async ({ page }) => {
2222
// 判断图标是否正确
2323
const moreButton = buttonGroup.getByRole('button').nth(3)
2424
const moreButtonSvg = moreButton.locator('svg path').first()
25-
const moreSvgPathReg = /^M292\.768 449\.694c2\.491\.515.+002-12.555-\.002z$/
25+
const moreSvgPathReg = /^M2\.3 7\.78v.+219-1\.17Z$/
2626
await expect(moreButtonSvg).toHaveAttribute('d', moreSvgPathReg)
2727
})

examples/sites/demos/pc/app/date-picker/clear.spec.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ test('[DatePicker] 测试清除输入', async ({ page }) => {
1212
// 默认显示清除按钮
1313
await datePickerDefaultClearIcon.hover()
1414
await expect(clearIcon).toBeVisible()
15-
await expect(clearIcon.locator('path').nth(1)).toHaveAttribute(
16-
'd',
17-
'M4.25 3.4 8 7.15l3.75-3.75a.61.61 0 0 1 .85 0c.23.23.23.62 0 .85L8.85 8l3.75 3.75c.23.24.23.62 0 .85a.61.61 0 0 1-.85 0L8 8.85 4.25 12.6a.61.61 0 0 1-.85 0 .592.592 0 0 1 0-.85L7.15 8 3.4 4.25a.61.61 0 0 1 0-.85.61.61 0 0 1 .85 0z'
18-
)
15+
await expect(clearIcon.locator('path').nth(0)).toHaveAttribute('d', /^M12\.49 3\.3a.+22\.71 0Z$/)
1916

2017
// 隐藏清除按钮
2118
await datePickerHideClearIcon.hover()
@@ -24,10 +21,7 @@ test('[DatePicker] 测试清除输入', async ({ page }) => {
2421
// 自定义清除图标
2522
await datePickerCustomClearIcon.hover()
2623
await expect(clearIcon).toBeVisible()
27-
await expect(clearIcon.locator('path').nth(1)).toHaveAttribute(
28-
'd',
29-
'M4.25 3.4 8 7.15l3.75-3.75a.61.61 0 0 1 .85 0c.23.23.23.62 0 .85L8.85 8l3.75 3.75c.23.24.23.62 0 .85a.61.61 0 0 1-.85 0L8 8.85 4.25 12.6a.61.61 0 0 1-.85 0 .592.592 0 0 1 0-.85L7.15 8 3.4 4.25a.61.61 0 0 1 0-.85.61.61 0 0 1 .85 0z'
30-
)
24+
await expect(clearIcon.locator('path').nth(0)).toHaveAttribute('d', /^M12\.49 3\.3a.+22\.71 0Z$/)
3125

3226
// 测试清除功能
3327
await expect(datePickerCustomClearIcon).toHaveValue('2023-05-24')

examples/sites/demos/pc/app/dropdown/basic-usage.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ test('基本用法', async ({ page }) => {
1313

1414
// 箭头是否存在
1515
await expect(dropDownSvg).toBeVisible()
16-
await expect(dropDownSvg.locator('path')).toHaveAttribute(
17-
'd',
18-
'M8 11.43c-.15 0-.31-.06-.42-.18L1.92 5.6c-.23-.23-.23-.61 0-.85s.61-.23.85 0L8 9.98l5.23-5.23a.61.61 0 0 1 .85 0c.23.23.23.61 0 .85l-5.66 5.66c-.11.11-.27.17-.42.17z'
19-
)
2016

2117
await page.waitForTimeout(500)
2218
await dropDown.hover()

0 commit comments

Comments
 (0)