-
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(calendar-view): Add calendar-view e2e UI test (#64)
- Loading branch information
1 parent
5033dcb
commit 08e60e4
Showing
5 changed files
with
43 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,43 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe('calendar 组件xdesign规范', () => { | ||
test('calendar-view--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('calendar-view#basic-usage') | ||
const demo = page.locator('#basic-usage .pc-demo') | ||
await expect(demo).toBeInViewport() | ||
await expect(demo).toHaveScreenshot('basic-usage.png') | ||
|
||
// hover时截图 | ||
const line = demo.getByText('前端周会2', { exact: true }) | ||
await line.hover() | ||
await expect(demo).toBeInViewport() | ||
await expect(demo).toHaveScreenshot('line-hover.png') | ||
|
||
}) | ||
|
||
test('设置工作日或节假日--UI截图', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('calendar-view#set-working-day') | ||
const demo = page.locator('#set-working-day .pc-demo') | ||
await expect(demo).toBeInViewport() | ||
await expect(demo).toHaveScreenshot('set-working-day.png') | ||
|
||
const btn1 = demo.getByRole('button', { name: '工作日' }) | ||
const btn2 = demo.getByRole('button', { name: '休息日' }) | ||
const btn3 = demo.getByRole('button', { name: '节假日' }) | ||
const date1 = demo.locator('li').filter({ hasText: '8' }).first() | ||
const date2 = demo.locator('li').filter({ hasText: '9' }).first() | ||
const date3 = demo.locator('li').filter({ hasText: '10' }).first() | ||
|
||
await date1.click() | ||
await btn1.click() | ||
await date2.click() | ||
await btn2.click() | ||
await date3.click() | ||
await btn3.click() | ||
|
||
await expect(demo).toBeInViewport() | ||
await expect(demo).toHaveScreenshot('right-hover.png') | ||
}) | ||
}) |
Binary file added
BIN
+24 KB
tests/calendar-view/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
+28.4 KB
tests/calendar-view/xdesign.spec.ts-snapshots/line-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
+18 KB
tests/calendar-view/xdesign.spec.ts-snapshots/right-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
+19.4 KB
tests/calendar-view/xdesign.spec.ts-snapshots/set-working-day-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.