Skip to content

Commit 9d885e7

Browse files
authored
test(drawer): add drawer ui-test (#59)
1 parent d7cf736 commit 9d885e7

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

tests/drawer/xdesign.spec.ts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
test.describe('drawer组件xdesign规范', () => {
4+
test('基本用法--UI截图', async ({ page }) => {
5+
page.on('pageerror', (exception) => expect(exception).toBeNull())
6+
await page.goto('drawer#basic-usage')
7+
const demo = page.locator('#basic-usage')
8+
await demo.getByRole('button', { name: '抽屉组件' }).click()
9+
const body = demo.locator('.tiny-drawer__box')
10+
await expect(body).toBeInViewport()
11+
await expect(body).toHaveScreenshot('basic-usage.png')
12+
})
13+
14+
test('帮助提示--UI截图', async ({ page }) => {
15+
page.on('pageerror', (exception) => expect(exception).toBeNull())
16+
await page.goto('drawer#tips-props')
17+
const demo = page.locator('#tips-props')
18+
await demo.getByRole('button', { name: '展开抽屉' }).click()
19+
const body = demo.locator('.tiny-drawer__box')
20+
await expect(body).toBeInViewport()
21+
await expect(body).toHaveScreenshot('tips-props.png')
22+
})
23+
24+
test('底部插槽--UI截图', async ({ page }) => {
25+
page.on('pageerror', (exception) => expect(exception).toBeNull())
26+
await page.goto('drawer#footer-slot')
27+
const demo = page.locator('#footer-slot')
28+
await demo.getByRole('button', { name: '底部插槽示例' }).click()
29+
const body = demo.locator('.tiny-drawer__box')
30+
await expect(body).toBeInViewport()
31+
await expect(body).toHaveScreenshot('footer-slot.png')
32+
})
33+
34+
})
Loading
Loading
Loading

0 commit comments

Comments
 (0)