-
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
1 parent
9fbf3b8
commit 8c9ee66
Showing
9 changed files
with
72 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe('carousel组件xdesign规范', () => { | ||
test('基本用法--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#basic-usage') | ||
const demo = page.locator('#basic-usage') | ||
const carousel = demo.locator('.tiny-carousel') | ||
await carousel.getByRole('list').getByRole('button').nth(1).click() | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('basic-usage.png') | ||
}) | ||
test('显示左右箭头--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#carousel-arrow-always') | ||
const demo = page.locator('#carousel-arrow-always') | ||
// 按钮常态、悬浮 | ||
await demo.locator('.tiny-carousel__arrow').first().click() | ||
const carousel = demo.locator('.tiny-carousel') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('carousel-arrow-always.png') | ||
}) | ||
test('箭头禁用--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#close-loop') | ||
const demo = page.locator('#close-loop') | ||
const carousel = demo.locator('.tiny-carousel') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('close-loop.png') | ||
}) | ||
test('纵向轮播--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#up-down-carousel') | ||
const demo = page.locator('#up-down-carousel') | ||
const carousel = demo.locator('.tiny-carousel') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('up-down-carousel.png') | ||
}) | ||
test('显示标题--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#show-title') | ||
const demo = page.locator('#show-title') | ||
const carousel = demo.locator('.tiny-carousel') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('show-title.png') | ||
}) | ||
test('卡片模式--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#card-mode') | ||
const demo = page.locator('#card-mode') | ||
const carousel = demo.locator('.tiny-carousel') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('card-mode.png') | ||
}) | ||
test('插槽模式--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#card-show') | ||
const demo = page.locator('#card-show') | ||
const carousel = demo.locator('.tiny-carousel') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('card-show.png') | ||
}) | ||
test('弹窗模式--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('carousel#dialog-show') | ||
const demo = page.locator('#dialog-show') | ||
await demo.getByRole('button', { name: '弹出轮播' }).click() | ||
const carousel = demo.locator('.tiny-dialog-box') | ||
await expect(carousel).toBeInViewport() | ||
await expect(carousel).toHaveScreenshot('dialog-card.png') | ||
}) | ||
}) |
Binary file added
BIN
+1.79 KB
tests/carousel/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.22 KB
tests/carousel/xdesign.spec.ts-snapshots/card-mode-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
+46.5 KB
tests/carousel/xdesign.spec.ts-snapshots/card-show-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.47 KB
tests/carousel/xdesign.spec.ts-snapshots/carousel-arrow-always-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.6 KB
tests/carousel/xdesign.spec.ts-snapshots/close-loop-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
+8.09 KB
tests/carousel/xdesign.spec.ts-snapshots/dialog-card-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.3 KB
tests/carousel/xdesign.spec.ts-snapshots/show-title-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
+1.62 KB
tests/carousel/xdesign.spec.ts-snapshots/up-down-carousel-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.