tiny-vue_version0/examples/sites/demos/pc/app/time-select/range-placeholder.spec.ts

26 lines
1.3 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from '@playwright/test'
test('固定时间范围', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('time-select#range-placeholder')
const timeInput = page.getByRole('textbox', { name: '起始时间' })
const options = page.locator('.tiny-picker-panel').nth(1).locator('div')
await timeInput.click()
// options的第一条是options.first()时间是08:30最后一条最大时间是options.nth(43)时间是1830
await expect(options.first()).toContainText('08:30')
await expect(options.nth(43)).toContainText('18:30')
// 起始时间选择10:00稍后验证结束时间10:00是否disabled。
options.nth(9).click()
await expect(page.locator('.tiny-input-suffix .tiny-input__inner').first()).toHaveValue('10:00')
const timeEnd = page.getByRole('textbox', { name: '结束时间' })
const endOptions = page.locator('.tiny-picker-panel').nth(1).locator('div')
await timeEnd.click()
await expect(endOptions.first()).toContainText('08:30')
await expect(endOptions.nth(43)).toContainText('18:30')
// 验证结束时间10:00是否disabled
await expect(endOptions.nth(9)).toHaveClass('tiny-time-select__item disabled')
endOptions.nth(10).click()
await expect(page.locator('.tiny-input-suffix .tiny-input__inner').last()).toHaveValue('10:15')
})