-
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.
test(pager): add pager UI E2E test case
- Loading branch information
Showing
18 changed files
with
93 additions
and
1 deletion.
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,90 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe('pager组件xdesign规范', () => { | ||
test('默认与悬浮态--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('pager#page-size') | ||
const demo = page.locator('#page-size .pc-demo') | ||
await expect(demo).toBeInViewport() | ||
await expect(demo).toHaveScreenshot('basic-usage.png') | ||
|
||
// 页码大小悬浮状态 | ||
const sizes = demo.locator('.tiny-pager__sizes') | ||
await expect(demo).toBeInViewport() | ||
await sizes.hover() | ||
await expect(demo).toHaveScreenshot('sizes-hover.png') | ||
// 上一页悬浮状态 | ||
const prev = demo.locator('.tiny-pager__btn-prev') | ||
await expect(demo).toBeInViewport() | ||
await prev.hover() | ||
await expect(demo).toHaveScreenshot('prev-hover.png') | ||
// 页码悬浮状态 | ||
const item = demo.locator('.tiny-pager__pages li').filter({ hasText: '20' }) | ||
await expect(demo).toBeInViewport() | ||
await prev.hover() | ||
await expect(demo).toHaveScreenshot('page-item-hover.png') | ||
// 下一页悬浮状态 | ||
const next = demo.locator('.tiny-pager__btn-next') | ||
await expect(demo).toBeInViewport() | ||
await next.hover() | ||
await expect(demo).toHaveScreenshot('next-hover.png') | ||
// 跳转悬浮状态 | ||
const goto = demo.locator('.tiny-pager__goto') | ||
await expect(demo).toBeInViewport() | ||
await goto.hover() | ||
await expect(demo).toHaveScreenshot('goto-hover.png') | ||
|
||
}) | ||
|
||
test('下拉框--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('pager#page-size') | ||
const demo = page.locator('#page-size .pc-demo') | ||
|
||
const sizes = demo.locator('.tiny-pager__sizes') | ||
const popover = page.locator('.tiny-popper.tiny-pager__selector') | ||
await sizes.click() | ||
await expect(popover).toBeInViewport() | ||
await expect(popover).toHaveScreenshot('popper.png') | ||
await popover.locator('.list-item').nth(2).hover() | ||
await expect(popover).toHaveScreenshot('popper-item-hover.png') | ||
}) | ||
|
||
test('禁用--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('pager#disabled-and-size') | ||
|
||
const demo = page.locator('#disabled-and-size') | ||
const mini = demo.locator('.tiny-pager.tiny-pager--mini') | ||
const pager = demo.locator('.tiny-pager__number').first() | ||
const switchBtn = demo.locator('.tiny-switch') | ||
await expect(mini).toHaveScreenshot('mini.png') | ||
|
||
await switchBtn.click() | ||
await expect(mini).toHaveScreenshot('mini-disabled.png') | ||
await expect(pager).toHaveScreenshot('pager-disabled.png') | ||
|
||
}) | ||
|
||
test('分页模式--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('pager#pager-mode') | ||
|
||
const demo = page.locator('#pager-mode') | ||
const pager = demo.locator('.tiny-pager') | ||
const btn = demo.locator('.tiny-radio-button') | ||
|
||
await btn.first().click() | ||
await expect(pager).toHaveScreenshot('pager-number.png') | ||
await btn.nth(1).click() | ||
await expect(pager).toHaveScreenshot('pager-simple.png') | ||
await btn.nth(2).click() | ||
await expect(pager).toHaveScreenshot('pager-complete.png') | ||
await btn.nth(3).click() | ||
await expect(pager).toHaveScreenshot('pager-fixed.png') | ||
await btn.nth(4).click() | ||
await expect(pager).toHaveScreenshot('pager-simplest.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.
Binary file added
BIN
+3.9 KB
tests/pager/xdesign.spec.ts-snapshots/mini-disabled-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
+5.13 KB
tests/pager/xdesign.spec.ts-snapshots/page-item-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.96 KB
tests/pager/xdesign.spec.ts-snapshots/pager-complete-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.14 KB
tests/pager/xdesign.spec.ts-snapshots/pager-disabled-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
+4.92 KB
tests/pager/xdesign.spec.ts-snapshots/pager-number-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.29 KB
tests/pager/xdesign.spec.ts-snapshots/pager-simple-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.04 KB
tests/pager/xdesign.spec.ts-snapshots/pager-simplest-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
+1.49 KB
tests/pager/xdesign.spec.ts-snapshots/popper-item-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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.