tiny-vue/examples/sites/demos/pc/app/button-group/text-value-field.spec.ts

19 lines
986 B
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('button-group#text-value-field')
const demo = page.locator('#text-value-field')
const buttonGroup = demo.locator('.tiny-button-group').first()
await buttonGroup.getByRole('button', { name: 'Button3' }).click()
await expect(buttonGroup.locator('li').nth(2)).toHaveClass('active')
await expect(demo.locator('.pc-demo')).toHaveText(/当前选中值3/)
await buttonGroup.getByRole('button', { name: 'Button2' }).click()
await expect(buttonGroup.locator('li').nth(1)).toHaveClass('active')
await expect(demo.locator('.pc-demo')).toHaveText(/当前选中值2/)
await buttonGroup.getByRole('button', { name: 'Button1' }).click()
await expect(buttonGroup.locator('li').nth(0)).toHaveClass('active')
await expect(demo.locator('.pc-demo')).toHaveText(/当前选中值1/)
})