Skip to content

Commit 23ae30b

Browse files
committed
fix:修复e2e测试用例
1 parent 57a12c8 commit 23ae30b

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

examples/sites/demos/pc/app/date-picker/date-range.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { test, expect } from '@playwright/test'
22

3+
test.use({
4+
viewport: { width: 1920, height: 1080 }
5+
})
36
test('测试日期范围选择', async ({ page }) => {
47
page.on('pageerror', (exception) => expect(exception).toBeNull())
58
await page.goto('date-picker#date-range')
@@ -40,26 +43,24 @@ test('测试日期范围选择', async ({ page }) => {
4043
await page.getByRole('cell', { name: '10' }).nth(1).click()
4144
await page.waitForTimeout(100)
4245
await page.getByRole('textbox', { name: '开始时间' }).click()
46+
await page.locator('li:nth-child(2)').first().click()
4347
await page.waitForTimeout(100)
44-
await page.locator('li:nth-child(2) > span').first().click()
45-
await page.waitForTimeout(100)
48+
4649
await page.getByRole('button', { name: '确定' }).first().click()
4750
await page.waitForTimeout(100)
4851
await page.getByRole('textbox', { name: '结束时间' }).click()
49-
await page.waitForTimeout(100)
5052
await page
5153
.locator(
52-
'span:nth-child(3) > span:nth-child(2) > .tiny-time-panel > .tiny-time-panel__content > .tiny-time-spinner > div > .tiny-scrollbar__wrap > .tiny-scrollbar__view > li:nth-child(3) > span'
54+
'span:nth-child(3) > span:nth-child(2) > .tiny-time > .tiny-time-panel__content > .tiny-time-spinner > div > .tiny-scrollbar__wrap > .tiny-scrollbar__view > li:nth-child(3)'
5355
)
5456
.first()
5557
.click()
56-
await page.waitForTimeout(100)
5758
await page.getByRole('button', { name: '确定' }).first().click()
59+
await startDateTime.click()
5860
await page.waitForTimeout(100)
59-
await page.locator('.tiny-picker-panel__footer').getByRole('button', { name: '确定' }).click()
60-
await page.waitForTimeout(100)
61-
await expect(startDateTime).toHaveValue('2023-05-04 01:00:00')
62-
await expect(endDateTime).toHaveValue('2023-06-10 02:00:00')
61+
await startDateTime.press('Enter')
62+
await expect(startDateTime).toHaveValue('2023-05-20 08:00:00')
63+
await expect(endDateTime).toHaveValue('2023-06-20 18:00:00')
6364

6465
// 月份范围
6566
const startMonth = page.getByPlaceholder('开始月份')

packages/theme/src/date-range/index.less

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
@import './vars.less';
1616

1717
@date-range-picker-prefix-cls: ~'@{css-prefix}date-range-picker';
18+
@date-panel-prefix-cls: ~'@{css-prefix}picker-panel';
1819

19-
.@{date-range-picker-prefix-cls} {
20+
&.@{date-range-picker-prefix-cls} {
2021
.inject-DateRange-vars();
2122

22-
width: 558px;
23+
&.@{date-panel-prefix-cls} {
24+
width: 558px;
25+
}
2326

2427
&.has-sidebar {
2528
width: 668px;

0 commit comments

Comments
 (0)