-
Notifications
You must be signed in to change notification settings - Fork 17
test(popconfirm): add popconfirm e2e UI test cases #42
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
Open
Youyou-smiles
wants to merge
3
commits into
opentiny:dev
Choose a base branch
from
Youyou-smiles:lty/test-popconfirm
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| import { expect, test } from '@playwright/test' | ||
|
|
||
| test.describe('popconfirm组件xdesign规范', () => { | ||
| test('默认--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#basic-usage') | ||
| const demo = page.locator('#basic-usage .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API基本用法通过 title 设置标题内容,' }).nth(3) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('basic-usage.png') | ||
|
|
||
| // hover时截图 | ||
| const pop = demo.getByRole('button', { name: '悬浮我提示' }) | ||
| await pop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
|
|
||
| test('触发方式--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#trigger') | ||
| const demo = page.locator('#trigger .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API触发方式通过 trigger' }).nth(3) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('trigger.png') | ||
|
|
||
| // hover时截图 | ||
| const hoverPop = demo.getByRole('button', { name: '鼠标悬停显示' }) | ||
| await hoverPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('trigger-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
|
|
||
| // click时截图 | ||
| const clickPop = demo.getByRole('button', { name: '点击显示' }) | ||
| await clickPop.hover() | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('trigger-click.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
|
|
||
| test('图标类型--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#type') | ||
| const demo = page.locator('#type .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API图标类型通过 type' }).nth(3) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('type.png') | ||
|
|
||
| // hover时截图 | ||
| const info = demo.getByRole('button', { name: 'info' }) | ||
| const error = demo.getByRole('button', { name: 'error' }) | ||
| const warning = demo.getByRole('button', { name: 'warning' }) | ||
| const success = demo.getByRole('button', { name: 'success' }) | ||
| const hoverPop = demo.getByRole('button', { name: '自定义' }) | ||
|
|
||
| await info.hover() | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('info-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| await page.waitForTimeout(200) | ||
|
|
||
| await error.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('error-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| await page.waitForTimeout(200) | ||
|
|
||
| await warning.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('warning-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| await page.waitForTimeout(200) | ||
|
|
||
| await success.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('success-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| await page.waitForTimeout(200) | ||
|
|
||
| await hoverPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('hoverPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
|
|
||
| }) | ||
|
|
||
| test('位置--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#placement') | ||
| const demo = page.locator('#placement .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API提示框显示位置通过 placement' }).nth(2) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('placement.png') | ||
|
|
||
| // hover时截图 | ||
| const topPop = demo.getByRole('button', { name: '显示在下方' }) | ||
| const rightPop = demo.getByRole('button', { name: '显示在右边' }) | ||
|
|
||
| await topPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('topPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| await page.waitForTimeout(200) | ||
|
|
||
| await rightPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('rightPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
|
|
||
| test('类名--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#custom-class') | ||
| const demo = page.locator('#custom-class .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API自定义类名通过 custom-class' }).nth(2) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('custom-class.png') | ||
|
|
||
| // hover时截图 | ||
| const classPop = demo.getByRole('button', { name: '悬浮我提示' }) | ||
| await classPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('classPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
|
|
||
| test('插槽--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#slot-footer') | ||
| const demo = page.locator('#slot-footer .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API底部插槽通过 footer' }).nth(2) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('slot-footer.png') | ||
|
|
||
| // hover时截图 | ||
| const slotPop = demo.getByRole('button', { name: '悬浮我提示' }) | ||
| await slotPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('slotPop-hover.png') | ||
| page.getByRole('button', { name: '自定义关闭按钮' }).click() | ||
| }) | ||
|
|
||
| test('宽度--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#width') | ||
| const demo = page.locator('#width .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API宽度通过 width 设置提示框宽度。悬浮我提示' }).nth(2) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('width.png') | ||
|
|
||
| // hover时截图 | ||
| const widthPop = demo.getByRole('button', { name: '悬浮我提示' }) | ||
| await widthPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('widthPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
|
|
||
| test('隐藏取消--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#cancel-button') | ||
| const demo = page.locator('#cancel-button .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API隐藏取消按钮通过 cancel-button' }).nth(2) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('cancel-button.png') | ||
|
|
||
| // hover时截图 | ||
| const cancelPop = demo.getByRole('button', { name: '悬浮我提示' }) | ||
| await cancelPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('cancelPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
|
|
||
| test('事件--UI截图', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('popconfirm#event') | ||
| const demo = page.locator('#event .pc-demo') | ||
| const popDemo = page.locator('#doc-layout div').filter({ hasText: '示例API事件当气泡确认框显示时触发 show' }).nth(2) | ||
| await expect(demo).toBeInViewport() | ||
| await expect(demo).toHaveScreenshot('event.png') | ||
|
|
||
| // hover时截图 | ||
| const eventPop = demo.getByRole('button', { name: '悬浮我提示' }) | ||
| await eventPop.hover() | ||
| await expect(popDemo).toBeInViewport() | ||
| await expect(popDemo).toHaveScreenshot('eventPop-hover.png') | ||
| page.getByRole('button', { name: '确定' }).click() | ||
| }) | ||
| }) | ||
Binary file added
BIN
+2.04 KB
tests/popconfirm/xdesign.spec.ts-snapshots/basic-usage-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.04 KB
tests/popconfirm/xdesign.spec.ts-snapshots/cancel-button-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26.2 KB
tests/popconfirm/xdesign.spec.ts-snapshots/cancelPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.3 KB
tests/popconfirm/xdesign.spec.ts-snapshots/classPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.04 KB
tests/popconfirm/xdesign.spec.ts-snapshots/custom-class-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.7 KB
tests/popconfirm/xdesign.spec.ts-snapshots/error-hover-chromium-win32.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.
Binary file added
BIN
+30.8 KB
tests/popconfirm/xdesign.spec.ts-snapshots/eventPop-hover-chromium-win32.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.
Binary file added
BIN
+20.8 KB
tests/popconfirm/xdesign.spec.ts-snapshots/hoverPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.08 KB
tests/popconfirm/xdesign.spec.ts-snapshots/info-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.2 KB
tests/popconfirm/xdesign.spec.ts-snapshots/placement-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.8 KB
tests/popconfirm/xdesign.spec.ts-snapshots/rightPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.04 KB
tests/popconfirm/xdesign.spec.ts-snapshots/slot-footer-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.5 KB
tests/popconfirm/xdesign.spec.ts-snapshots/slotPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.8 KB
tests/popconfirm/xdesign.spec.ts-snapshots/success-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.6 KB
tests/popconfirm/xdesign.spec.ts-snapshots/topPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.49 KB
tests/popconfirm/xdesign.spec.ts-snapshots/trigger-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.06 KB
tests/popconfirm/xdesign.spec.ts-snapshots/trigger-click-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.9 KB
tests/popconfirm/xdesign.spec.ts-snapshots/trigger-hover-chromium-win32.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.
Binary file added
BIN
+19.4 KB
tests/popconfirm/xdesign.spec.ts-snapshots/warning-hover-chromium-win32.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.
Binary file added
BIN
+26.7 KB
tests/popconfirm/xdesign.spec.ts-snapshots/widthPop-hover-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.