forked from opentiny/tiny-vue
fix(test): [pop-upload] Fix e2e test cases (#1615)
This commit is contained in:
parent
551ea69212
commit
5b5ffcb8d2
|
@ -13,6 +13,7 @@ test('PopUpload 基本用法', async ({ page }) => {
|
|||
const cancelBtn = uploadModal.getByRole('button', { name: '取消' })
|
||||
const lists = uploadModal.locator('.tiny-popupload__dialog-table-item')
|
||||
const deleteIcon = lists.locator('.delIcon')
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
||||
const path = require('node:path')
|
||||
const path1 = path.resolve(__dirname, '测试.jpg')
|
||||
const path2 = path.resolve(__dirname, '测试.png')
|
||||
|
@ -41,11 +42,6 @@ test('PopUpload 基本用法', async ({ page }) => {
|
|||
await fileChooser.setFiles(path1)
|
||||
await fileChooser.setFiles(path2)
|
||||
await expect(uploadsBtn).not.toBeDisabled()
|
||||
const [request] = await Promise.all([page.waitForEvent('request'), uploadsBtn.click()])
|
||||
|
||||
// 上传时附带的额外参数: 获取请求体
|
||||
const body = await request.postData()
|
||||
await expect(body).not.toBeNull()
|
||||
|
||||
// 点击取消按钮,上传弹窗消失
|
||||
await cancelBtn.click()
|
||||
|
|
|
@ -9,6 +9,7 @@ test('PopUpload 自定义请求头', async ({ page }) => {
|
|||
const uploadModal = page.locator('.tiny-popupload__modal')
|
||||
const selectFilesBtn = uploadModal.getByRole('button', { name: '选择文件' })
|
||||
const uploadsBtn = uploadModal.getByRole('button', { name: '开始上传' })
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
||||
const path = require('node:path')
|
||||
const currentPath = path.resolve(__dirname, '测试.jpg')
|
||||
|
||||
|
@ -21,5 +22,5 @@ test('PopUpload 自定义请求头', async ({ page }) => {
|
|||
const { authorization } = await request.headers()
|
||||
|
||||
await expect(request.headers()).not.toBeNull()
|
||||
await expect(authorization).toBeUndefined()
|
||||
await expect(authorization).toBe('Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==')
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue