Skip to content

Commit

Permalink
fix: fix e2e error
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr committed Oct 15, 2024
1 parent 04557da commit f66850a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/radio/default-slot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ test('默认插槽', async ({ page }) => {
await page.goto('radio#default-slot')

const demo = page.locator('#default-slot')
const radio1 = demo.getByRole('radio', { name: '内容一:选项描述' })
const radio2 = demo.getByRole('radio', { name: '内容二:选项描述' })
const radio1 = demo.locator('label').filter({ hasText: '内容一:选项描述' })
const radio2 = demo.locator('label').filter({ hasText: '内容二:选项描述' })
await expect(radio1).toBeVisible()
await expect(radio2).toBeVisible()
})
11 changes: 6 additions & 5 deletions examples/sites/demos/pc/app/radio/group-options.spec.ts
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('radio#group-options')
const radio1Label = page.locator('.tiny-radio__label').nth(0)
const radio2Label = page.locator('.tiny-radio__label').nth(1)
const radio1 = page.locator('.tiny-radio').nth(0)
const radio2 = page.locator('.tiny-radio').nth(1)
const demo = page.locator('#group-options')
const radio1Label = demo.locator('.tiny-radio__label').nth(0)
const radio2Label = demo.locator('.tiny-radio__label').nth(1)
const radio1 = demo.locator('.tiny-radio').nth(0)
const radio2 = demo.locator('.tiny-radio').nth(1)
await expect(radio1).toHaveClass('tiny-radio is-checked')
await expect(radio1Label).toHaveText('很好')
await expect(radio2Label).toHaveText('一般')
await page.getByRole('radio', { name: '一般' }).click()
await demo.locator('label').filter({ hasText: '一般' }).click()
await expect(radio2).toHaveClass('tiny-radio is-focus is-checked')
})
5 changes: 3 additions & 2 deletions examples/sites/demos/pc/app/radio/radio-events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ test('单选框事件', async ({ page }) => {
await page.goto('radio#radio-events')

const demo = page.locator('#radio-events')
await demo.getByRole('radio', { name: '选项二' }).click()

await demo.locator('label').filter({ hasText: '选项二' }).click()
const radio1 = page.locator('div').filter({ hasText: 'change 事件,选中的 Radio label 值为:2' }).nth(1)
await expect(radio1).toBeVisible()

await demo.getByRole('radio', { name: '月度' }).first().click()
await demo.locator('label').filter({ hasText: '月度' }).first().click()
const radio2 = page.locator('div').filter({ hasText: 'change 事件,选中的 Radio label 值为:2' }).nth(1)
await expect(radio2).toBeVisible()
})

0 comments on commit f66850a

Please sign in to comment.