Skip to content

Commit

Permalink
test(e2e): add split UI e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr committed Sep 26, 2024
1 parent 08e60e4 commit 38b6d00
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/split/xdesign.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { expect, test } from '@playwright/test'

test.describe('split组件xdesign规范', () => {
test('默认--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('split#basic-usage')
const demo = page.locator('#basic-usage .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('basic-usage.png')
})

test('分割方式--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('split#split-mode')
const demo = page.locator('#split-mode .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('split-mode.png')
})

test('嵌套使用--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('split#nested-use')
const demo = page.locator('#nested-use .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('nested-use.png')
})

test('简易模式中,双向展开--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('split#horizontal-collapse')
const demo = page.locator('#horizontal-collapse .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('horizontal-collapse.png')

const triggerDom = demo.locator('.tiny-split-trigger-con-simple')
await triggerDom.hover()
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('hover.png')
})

test('支持配置3个区块--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('split#three-areas')
const demo = page.locator('#three-areas .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('three-areas.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.
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 38b6d00

Please sign in to comment.