From 51f29e816ab47d374a56606cf47c6de6cfce0fd3 Mon Sep 17 00:00:00 2001 From: discreted66 <953831480@qq.com> Date: Thu, 15 May 2025 10:30:26 -0700 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8De2e=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sites/demos/pc/app/date-picker/format.spec.ts | 2 +- .../sites/demos/pc/app/time-picker/format.spec.ts | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/examples/sites/demos/pc/app/date-picker/format.spec.ts b/examples/sites/demos/pc/app/date-picker/format.spec.ts index b8ac19b68d..8d4319d714 100644 --- a/examples/sites/demos/pc/app/date-picker/format.spec.ts +++ b/examples/sites/demos/pc/app/date-picker/format.spec.ts @@ -11,7 +11,7 @@ test('[DatePicker] 测试日期格式化', async ({ page }) => { // time-format: 时间输入框中显示的格式 await page.locator('.tiny-date-editor input').nth(1).click() - await page.getByRole('row', { name: '21 22 23 24 25 26 27' }).getByText('24').click() + await page.getByRole('cell', { name: '24' }).locator('span').click(); await page.getByRole('button', { name: '确定' }).click() await expect(page.locator('.tiny-date-editor input').nth(1)).toHaveValue('2023 年 05 月 24 日 08 时 00 分 00 秒') diff --git a/examples/sites/demos/pc/app/time-picker/format.spec.ts b/examples/sites/demos/pc/app/time-picker/format.spec.ts index 795b4b2635..4c87407846 100644 --- a/examples/sites/demos/pc/app/time-picker/format.spec.ts +++ b/examples/sites/demos/pc/app/time-picker/format.spec.ts @@ -40,15 +40,9 @@ test('时间格式化', async ({ page }) => { await expect(page.getByRole('textbox', { name: '19:30:00' })).toBeVisible() // picker-options.format: 下拉框中显示的格式 - const timePickerHour = page - .locator( - 'div:nth-child(14) > .tiny-time-panel__content > .tiny-time-spinner > div > .tiny-scrollbar__wrap > .tiny-scrollbar__view > li:nth-child(19)' - ) - .first() - const timePickerMinute = page.locator( - 'div:nth-child(14) > .tiny-time-panel__content > .tiny-time-spinner > div:nth-child(2) > .tiny-scrollbar__wrap > .tiny-scrollbar__view > li:nth-child(41)' - ) - const timePickerSecond = page.locator('.of-hidden > div:nth-child(12) .tiny-scrollbar').nth(2) + const timePickerHour = page.getByRole('list').first() + const timePickerMinute = page.getByRole('list').nth(1) + const timePickerSecond = page.getByRole('list').nth(2) await page.getByRole('textbox', { name: '18:40:00' }).click() await page.waitForTimeout(200) await expect(timePickerHour).toBeVisible()