Skip to content

Commit

Permalink
fix(date-picker): [date-picker] fix date-picker e2e test error (#2749)
Browse files Browse the repository at this point in the history
* fix(date-picker): fix date-picker e2e test error

* fix(date-picker): fix date-picker e2e test error

* fix(date-picker): fix date-picker e2e test error

* fix(date-picker): fix date-picker e2e test error
  • Loading branch information
zzcr authored Jan 6, 2025
1 parent b0a7e77 commit 99e46d0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions examples/sites/demos/pc/app/date-picker/clear.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ test('[DatePicker] 测试清除输入', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('date-picker#clear')

const datePickerDefaultClearIcon = page.getByRole('textbox').nth(1)
const datePickerHideClearIcon = page.getByRole('textbox').nth(2)
const datePickerCustomClearIcon = page.getByRole('textbox').nth(3)
const clearIcon = page.locator('.tiny-date-editor .tiny-input__icon-container .baseClearicon')
const demo = page.locator('#clear')

const datePickerDefaultClearIcon = demo.getByRole('textbox').nth(0)
const datePickerHideClearIcon = demo.getByRole('textbox').nth(1)
const datePickerCustomClearIcon = demo.getByRole('textbox').nth(2)
const clearIcon = demo.locator('.tiny-date-editor .tiny-input__icon-container .baseClearicon')

// 默认显示清除按钮
await datePickerDefaultClearIcon.hover()
Expand All @@ -24,7 +26,8 @@ test('[DatePicker] 测试清除输入', async ({ page }) => {
await expect(clearIcon.locator('path').nth(0)).toHaveAttribute('d', /^M12\.49 3\.3a.+22\.71 0Z$/)

// 测试清除功能
await expect(datePickerCustomClearIcon).toHaveValue('2023-05-24')
await page.locator('#clear').getByRole('img').nth(2).click()
await expect(datePickerCustomClearIcon).toHaveValue('')
await expect(datePickerDefaultClearIcon).toHaveValue('2023-05-24')
await datePickerDefaultClearIcon.hover()
await demo.locator('.baseClearicon').first().click()
await expect(datePickerDefaultClearIcon).toHaveValue('')
})

0 comments on commit 99e46d0

Please sign in to comment.