Skip to content

Commit

Permalink
test(drawer): add drawer ui-test (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
James-9696 authored Sep 25, 2024
1 parent d7cf736 commit 9d885e7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/drawer/xdesign.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { expect, test } from '@playwright/test'

test.describe('drawer组件xdesign规范', () => {
test('基本用法--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('drawer#basic-usage')
const demo = page.locator('#basic-usage')
await demo.getByRole('button', { name: '抽屉组件' }).click()
const body = demo.locator('.tiny-drawer__box')
await expect(body).toBeInViewport()
await expect(body).toHaveScreenshot('basic-usage.png')
})

test('帮助提示--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('drawer#tips-props')
const demo = page.locator('#tips-props')
await demo.getByRole('button', { name: '展开抽屉' }).click()
const body = demo.locator('.tiny-drawer__box')
await expect(body).toBeInViewport()
await expect(body).toHaveScreenshot('tips-props.png')
})

test('底部插槽--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('drawer#footer-slot')
const demo = page.locator('#footer-slot')
await demo.getByRole('button', { name: '底部插槽示例' }).click()
const body = demo.locator('.tiny-drawer__box')
await expect(body).toBeInViewport()
await expect(body).toHaveScreenshot('footer-slot.png')
})

})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9d885e7

Please sign in to comment.