-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,33 @@ | ||
import { expect, test } from '@playwright/test' | ||
import path from 'path' | ||
|
||
test.describe('pop-upload 组件xdesign规范', () => { | ||
test('自定义上传提示 --UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('pop-upload#upload-tip') | ||
const demo = page.locator('#upload-tip .pc-demo') | ||
const modal = page.locator('.tiny-popupload__modal > .tiny-modal__box').locator('visible=true') | ||
await expect(demo).toBeInViewport() | ||
await demo.getByRole('button', { name: '添加文件' }).click() | ||
await expect(modal).toHaveCount(1) | ||
await expect(modal).toHaveScreenshot('upload-tip.png') | ||
|
||
// 点击开始上传截图 | ||
const lists = modal.locator('.tiny-popupload__dialog-table-item') | ||
const uploadBtn = modal.getByRole('button', { name: '添加文件' }) | ||
const currentPath1 = path.resolve('tests/pop-upload/测试.jpg') | ||
const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'), uploadBtn.click()]) | ||
await fileChooser.setFiles(currentPath1) | ||
await expect(lists).toHaveCount(1) | ||
await expect(modal).toHaveScreenshot('upload-tip-list.png') | ||
|
||
// 点击删除确认截图 | ||
await modal.getByText('删除', { exact: true }).first().click() | ||
await expect(modal).toHaveScreenshot('upload-tip-list-popover.png') | ||
|
||
// 上传后的截图 | ||
await modal.getByRole('button', { name: '开始上传' }).click() | ||
await expect(page.getByText('共1条数据:其中1条出错,请修改后重试')).toHaveCount(1) | ||
await expect(modal).toHaveScreenshot('upload-tip-list-fail.png') | ||
}) | ||
}) |
Binary file added
BIN
+27.3 KB
tests/pop-upload/xdesign.spec.ts-snapshots/upload-tip-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
+30.1 KB
tests/pop-upload/xdesign.spec.ts-snapshots/upload-tip-list-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
+32.8 KB
tests/pop-upload/xdesign.spec.ts-snapshots/upload-tip-list-fail-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
+33.4 KB
...pop-upload/xdesign.spec.ts-snapshots/upload-tip-list-popover-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.