tiny-vue_version0/examples/sites/demos/pc/app/file-upload/basic-usage.spec.ts

18 lines
684 B
TypeScript

import { test, expect } from '@playwright/test'
test('基本用法', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('file-upload#basic-usage')
const upload = page.getByRole('button', { name: '点击上传' })
const lists = page.locator('.tiny-upload-list__li')
const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'), upload.click()])
const path = require('node:path')
const currentPath = path.resolve(__dirname, '测试.jpg')
await fileChooser.setFiles(currentPath)
await page.getByText('测试.jpg').isVisible()
await expect(lists).toHaveText('测试.jpg按 delete 键可删除')
})