tiny-vue/examples/sites/demos/pc/app/popeditor/before-reset.spec.ts

24 lines
1021 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('PopEditor 重置', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('popeditor#before-reset')
const preview = page.locator('#before-reset')
const textBox = preview.getByRole('textbox')
const dialogBox = page.locator('.tiny-dialog-box')
const company = dialogBox.getByRole('listitem').filter({ hasText: '公司名' }).getByRole('textbox')
const city = dialogBox.getByRole('listitem').filter({ hasText: '城市' }).getByRole('textbox')
const resetBtn = dialogBox.getByRole('button', { name: '重 置' })
const infoModal = page.locator('.tiny-modal')
// 点击弹出框重置按钮清空搜索框modal弹出提示
await textBox.click()
await company.fill('111')
await city.fill('222')
await resetBtn.click()
await expect(infoModal.filter({ hasText: /^重置前的钩子函数$/ })).toBeVisible()
await expect(company).toHaveValue('')
await expect(city).toHaveValue('')
})