Skip to content

Commit e655b3c

Browse files
committedSep 29, 2024·
test(e2e): add guide UI e2e test
1 parent 44a73ed commit e655b3c

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
 

‎tests/guide/xdesign.spec.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
test.describe('guide组件xdesign规范', () => {
4+
test('默认--UI截图', async ({ page }) => {
5+
page.on('pageerror', (exception) => expect(exception).toBeNull())
6+
await page.goto('guide#basic-usage')
7+
const demo = page.locator('#basic-usage .pc-demo')
8+
await demo.getByRole('button', { name: '开始引导' }).click()
9+
const guide = page.locator('.tiny-guide.shepherd-element')
10+
await expect(guide).toBeInViewport()
11+
await expect(guide).toHaveScreenshot('basic-usage.png')
12+
13+
// 关闭按钮hover状态
14+
const closeIcon = guide.locator('.shepherd-cancel-icon span')
15+
await closeIcon.hover()
16+
await expect(guide).toBeInViewport()
17+
await expect(guide).toHaveScreenshot('hover-icon.png')
18+
19+
// 下一步按钮hover状态
20+
const nextBtn = guide.getByRole('button', { name: '下一步' })
21+
await nextBtn.hover()
22+
await expect(guide).toBeInViewport()
23+
await expect(guide).toHaveScreenshot('hover-btn.png')
24+
})
25+
})
Loading
Loading
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.