fix(test): [cascader, notify] update e2e test (#1445)

This commit is contained in:
yoyo 2024-03-01 16:31:34 +08:00 committed by GitHub
parent 21c75a1c03
commit db3ccaafd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,7 @@ test('动态加载且父子级不相关联 lazyload & checkStrictly', async ({ p
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('cascader#auto-load-checkStrictly')
await page.locator('.tiny-cascader').click()
const svg = page.locator('.tiny-cascader-node__postfix > .st0')
const svg = page.locator('.tiny-cascader-node__postfix > path')
await expect(svg).toBeVisible()
await page.locator('li[role="menuitem"]').click()
const loadingSvg = page.getByRole('menuitem', { name: '选项1' }).locator('path')

View File

@ -4,8 +4,11 @@ test('动态加载 lazyload', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('cascader#auto-load')
await page.getByRole('textbox', { name: '请选择' }).click()
const svg = page.locator('.tiny-cascader-node__postfix > .st0')
await expect(svg).toHaveAttribute('d', 'M7 21c.2 0 .5-.1.6-.2l9.9-8c.2-.2.4-.5.4-.8 0-.3-.1-.6-.4-.8L7.6 3.3c-.4-.4-1.1-.3-1.4.2-.4.4-.3 1.1.2 1.4l8.9 7.2-8.9 7.2c-.4.4-.5 1-.2 1.4.2.2.5.3.8.3z')
const svg = page.locator('.tiny-cascader-node__postfix > path')
await expect(svg).toHaveAttribute(
'd',
'M7 21c.2 0 .5-.1.6-.2l9.9-8c.2-.2.4-.5.4-.8 0-.3-.1-.6-.4-.8L7.6 3.3c-.4-.4-1.1-.3-1.4.2-.4.4-.3 1.1.2 1.4l8.9 7.2-8.9 7.2c-.4.4-.5 1-.2 1.4.2.2.5.3.8.3z'
)
await page.getByRole('menuitem', { name: '选项1' }).click()
const loadingSvg = page.getByRole('menuitem', { name: '选项1' }).locator('path')
await expect(loadingSvg).toHaveAttribute(

View File

@ -4,7 +4,7 @@ test('自定义关闭图标', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('notify#closeIcon')
await page.getByRole('button', { name: '自定义关闭图标' }).click()
const svg = page.locator('.tiny-notify__icon-close > .tiny-svg > .st0')
const svg = page.locator('.tiny-notify__icon-close > .tiny-svg > path')
await expect(svg).toHaveAttribute(
'd',
'M3 1h18c.9 0 2 1.1 2 2v18c0 .9-1 2-2 2H3c-.9 0-2-1.1-2-2V3c0-.9 1.1-2 2-2zm0 2v18h18V3H3zm13.8 4.2c.3.3.3.9 0 1.2L13.2 12l3.6 3.6c.3.3.3.9 0 1.2-.2.2-.4.2-.6.2-.2 0-.4-.1-.6-.2L12 13.2l-3.6 3.6c-.1.1-.4.2-.6.2s-.4-.1-.6-.2c-.3-.3-.3-.9 0-1.2l3.6-3.6-3.6-3.6c-.3-.3-.3-.9 0-1.2.3-.3.9-.3 1.2 0l3.6 3.6 3.6-3.6c.3-.3.8-.3 1.2 0z'