forked from opentiny/tiny-vue
test(tag): [tag] update tag E2E test (#992)
This commit is contained in:
parent
6ef5bb8ac0
commit
422dabe2c2
|
@ -6,7 +6,7 @@ test('是否正常移除标签', async ({ page }) => {
|
|||
|
||||
const first = page.locator('.tiny-tag').filter({ hasText: '标签一' })
|
||||
const close = first.locator('.tiny-tag__close')
|
||||
const modal = page.locator('.tiny-modal__box')
|
||||
const modal = page.locator('.tiny-modal__box').nth(0)
|
||||
|
||||
await close.click()
|
||||
await modal.waitFor({ state: 'attached', timeout: 100 })
|
||||
|
|
|
@ -4,7 +4,7 @@ test('边框和自定义背景色', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('tag#color3')
|
||||
|
||||
const tags = page.locator('.tiny-tag')
|
||||
const tags = page.locator('.all-demos-container').locator('.tiny-tag')
|
||||
const first = tags.nth(0)
|
||||
|
||||
await expect(tags).toHaveClass([
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('progress 正常显示', async ({ page }) => {
|
||||
test('配置式标签', async ({ page }) => {
|
||||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('tag#content')
|
||||
|
||||
const tag = page.locator('#preview').getByText('配置式标签')
|
||||
const tag = page.locator('.all-demos-container').getByText('配置式标签')
|
||||
|
||||
await expect(tag).toHaveCount(1)
|
||||
})
|
||||
|
|
|
@ -4,16 +4,16 @@ test('动态编辑标签', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('tag#create')
|
||||
|
||||
const preview = page.locator('#preview')
|
||||
const preview = page.locator('.all-demos-container')
|
||||
const add = page.getByRole('button', { name: '+ New Tag' })
|
||||
const input = preview.getByRole('textbox')
|
||||
const newTag = preview.getByText('新标签')
|
||||
const newTag = preview.locator('.tiny-tag').filter({ hasText: '新标签' })
|
||||
const close = page.locator('span').filter({ hasText: '新标签' }).locator('svg')
|
||||
|
||||
await add.click()
|
||||
await input.fill('新标签')
|
||||
await input.press('Enter')
|
||||
await expect(newTag, 'Creation failed').toBeVisible()
|
||||
await expect(newTag).toHaveCount(1)
|
||||
await close.click()
|
||||
await expect(newTag, 'Deletion failed').not.toBeVisible()
|
||||
})
|
||||
|
|
|
@ -4,7 +4,7 @@ test('是否正常禁用', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('tag#disabled')
|
||||
|
||||
const tags = page.locator('.tiny-tag')
|
||||
const tags = page.locator('.all-demos-container').locator('.tiny-tag')
|
||||
const close = tags.last().locator('.tiny-tag__close')
|
||||
|
||||
await expect(tags).toHaveClass([/is-disabled/, /is-disabled/, /is-disabled/])
|
||||
|
|
|
@ -4,9 +4,10 @@ test('三大主题分别对应的五种类型', async ({ page }) => {
|
|||
page.on('pageerror', (exception) => expect(exception).not.toBeNull())
|
||||
await page.goto('tag#effect')
|
||||
|
||||
const light = page.locator('.tiny-tag--light')
|
||||
const dark = page.locator('.tiny-tag--dark')
|
||||
const plain = page.locator('.tiny-tag--plain')
|
||||
const scoped = page.locator('.all-demos-container')
|
||||
const light = scoped.locator('.tiny-tag--light')
|
||||
const dark = scoped.locator('.tiny-tag--dark')
|
||||
const plain = scoped.locator('.tiny-tag--plain')
|
||||
|
||||
await expect(light).toHaveCount(5)
|
||||
await expect(dark).toHaveCount(5)
|
||||
|
|
Loading…
Reference in New Issue