Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add steps UI e2e test #43

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions tests/steps/xdesign.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { expect, test } from '@playwright/test'

test.describe('steps 组件xdesign规范', () => {
test('横向单链型--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('steps#line-horizontal')
const demo = page.locator('#line-horizontal .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('line-horizontal.png')
})

test('垂直点状型--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('steps#line-dot')
const demo = page.locator('#line-dot .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('line-dot.png')
})

test('尺寸--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('steps#size')
const demo = page.locator('#size .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('size.png')
})

test('特殊样式--UI截图', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('steps#slot-item-footer')
const demo = page.locator('#slot-item-footer .pc-demo')
await expect(demo).toBeInViewport()
await expect(demo).toHaveScreenshot('slot-item-footer.png')

// hover
await page
.getByText('创建桶(超长标题超长标题超长标题超长标题超长标题超长标题超长标题超长标题超长标题)')
.first()
.hover()
await expect(demo).toHaveScreenshot('slot-item-footer-hover.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.