Skip to content

test(e2e): [calendar-view]fix calendar-view error e2e test #2737

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

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/sites/demos/pc/app/calendar-view/basic-usage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ test('基本用法', async ({ page }) => {
const fixWeek2 = page.getByText('前端周会 2').first()
const popWeek2 = page.locator('.title').filter({ hasText: '前端周会 2' })
// 校验固定内容
await expect(demoPage).toHaveText(/15前端周会2前端周会2-1前端周会1/)
await expect(demoPage).toHaveText(/16前端周会4前端周会3/)
await expect(demoPage).toHaveText(/25节假日25-28前端周会5/)
await expect(demoPage).toHaveText(/15前端周会 2前端周会 2-1前端周会/)
await expect(demoPage).toHaveText(/16前端周会 4前端周会/)
await expect(demoPage).toHaveText(/25节假日 25-28前端周会/)
await expect(demoPage.locator('.events-end').first()).toHaveClass(/bg-green/)
// 校验 hover 弹出框
await fixWeek2.hover()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { test, expect } from '@playwright/test'
test('日期标记', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('calendar-view#calendar-day-mark')
const listitem = page.getByRole('listitem')
const day30 = listitem.filter({ hasText: '30 周日' }).locator('span').nth(2)
const day1 = listitem.filter({ hasText: '1 周一' }).locator('span').nth(2)
const day6 = listitem.filter({ hasText: '6 周六' }).locator('span').nth(2)
const day7 = page.getByText('7 周日')
const rightSvg = page.locator('.header-right > .tiny-svg')
const day8 = listitem.filter({ hasText: '8 周一' }).locator('span').nth(2)
const demo = page.locator('#calendar-day-mark')
const listitem = demo.getByRole('listitem')
const day30 = listitem.filter({ hasText: '30周日' }).locator('span').nth(2)
const day1 = listitem.filter({ hasText: '1周一' }).locator('span').nth(2)
const day6 = listitem.filter({ hasText: '6周六' }).locator('span').nth(2)
const day7 = demo.getByText('7周日')
const rightSvg = demo.locator('.header-right > .tiny-svg')
const day8 = listitem.filter({ hasText: '8周一' }).locator('span').nth(2)
await expect(day30).toBeVisible()
await expect(day1).toHaveClass(/mark/)
await expect(day1).toHaveClass(/mark-red/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { test, expect } from '@playwright/test'
test('日程模式插槽', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('calendar-view#calendar-schedule-slot')
const solt1 = page.locator('.new-schedule').first()
const soltData1 = page.getByText('新增事件 2023-4-30')
const solt5 = page.locator('li:nth-child(5) > .new-schedule')
const soltData5 = page.getByText('新增事件 2023-5-4')
const demo = page.locator('#calendar-schedule-slot')
const solt1 = demo.locator('.new-schedule').first()
const soltData1 = demo.getByText('新增事件2023-4-30')
const solt5 = demo.locator('li:nth-child(5) > .new-schedule')
const soltData5 = demo.getByText('新增事件2023-5-4')
await expect(solt1).toBeVisible()
await page.waitForTimeout(200)
await solt1.click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ test('时间线插槽', async ({ page }) => {
const fixWeek = page.locator('#calendar-timeline-slot').getByText('节假日 25-28')
const popWeek = page.locator('.title').filter({ hasText: '节假日 25-28' })
// 校验固定内容
await expect(demoPage).toHaveText(/15前端周会2前端周会2-1前端周会1/)
await expect(demoPage).toHaveText(/16前端周会4前端周会3/)
await expect(demoPage).toHaveText(/25节假日25-28前端周会5/)
await expect(demoPage).toHaveText(/15前端周会 2前端周会 2-1前端周会/)
await expect(demoPage).toHaveText(/16前端周会 4前端周会/)
await expect(demoPage).toHaveText(/25节假日 25-28前端周会/)
await expect(demoPage.locator('.events-end').first()).toHaveClass(/bg-green/)
// 校验 hover 弹出框
await fixWeek2.hover()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable fixWeek2 is used here without being defined in this file. Ensure that fixWeek2 is properly declared and initialized before use to avoid runtime errors.

Expand Down
Loading