test[config-provider/user-head]Add E2E TEST (#1064)

This commit is contained in:
James 2023-12-08 16:24:05 +08:00 committed by GitHub
parent ea71e31ff5
commit 2a2383b0bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 5 deletions

View File

@ -0,0 +1,9 @@
import { test, expect } from '@playwright/test'
test('测试自定义事件', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('config-provider#base')
await page.locator('.tiny-config-provider > .tiny-alert > .tiny-svg').nth(1).click()
await page.waitForTimeout(500)
await expect(page.locator('.tiny-modal > .tiny-modal__box').nth(1)).toHaveText('触发自定方法')
})

View File

@ -0,0 +1,12 @@
import { test, expect } from '@playwright/test'
test('测试自定义标签', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('config-provider#tag')
await page.getByText('这是一个Tag被DOM包裹').click()
await page.locator('#tag span').nth(2).click()
await page.waitForTimeout(300)
await page.locator('#tag span').nth(2).click()
await page.waitForTimeout(300)
await expect(page.locator('.tiny-switch').nth(2)).toHaveCSS('background-color', 'rgb(94, 124, 224)')
})

View File

@ -0,0 +1,11 @@
import { test, expect } from '@playwright/test'
test('测试改变文字方向', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('config-provider#text-direct')
await page.getByRole('link', { name: '改变文字方向' }).click()
await page.getByRole('button', { name: 'RTL' }).click()
await page.waitForTimeout(300)
await page.getByRole('button', { name: 'LTR' }).click()
await page.waitForTimeout(300)
})

View File

@ -0,0 +1,7 @@
---
title: ConfigProvide Assembly
---
# ConfigProvide Assembly
<div></div>

View File

@ -1,8 +1,8 @@
import { test, expect } from '@playwright/test'
test('图头像', async ({ page }) => {
test('图头像', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('user-head#image-user-head')
const minBox = page.locator('.tiny-user-head__portrait')
await page.goto('user-head#icon-user-head')
const minBox = page.locator('.tiny-user-head > .tiny-user-head__portrait')
await expect(minBox).toHaveCSS('background-image', 'none')
})

View File

@ -3,6 +3,6 @@ import { test, expect } from '@playwright/test'
test('图片头像', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('user-head#image-user-head')
const headImg = page.locator('.tiny-user-head')
await expect(headImg).toHaveAttribute('value', 'localhost:3000/webnova/static/img/compontent.b2f0f5b.png')
const minBox = page.locator('.tiny-user-head > .tiny-user-head__portrait')
await expect(minBox).toHaveCSS('color', 'rgb(255, 255, 255)')
})