/* global cy */ // import { UploadUserFile } from 'element-plus' import InfoUpload from './index.vue' import { ObjectInterface } from 'script' const mount = (r: ObjectInterface = {}) => { // const file = ref() let row = { type: 'infoUpload', label: '文件上传', model: 'fileList', showFileList: true, showClear: false, drag: false, multiple: true, limit: 1, isReplace: true, autoUpload: false, accept: '.xlsx', tipBtnText: '下载失败记录', isDrag: false, trigger: '测试上传' // tipBtnClick: tipBtnClick, // showTipBtn: (showTipBtn) => { // watch(() => props.errorList, () => { // if (props.errorList.length > 0) { // showTipBtn.value = true // } else { // showTipBtn.value = false // } // }, { deep: true }) // return props.errorList.length // }, // on: (ref, uploadFiles, fileList) => { // if (uploadFiles && uploadFiles.length > 0) { // file.value = uploadFiles[0] // } // }, // remove: (res, file, fileList) => { // if (file) { // file.value = file // } // } } row = Object.assign(row, r) cy.mount(InfoUpload, { props: { row, modelData: {} } }) } describe(' 上传组件', () => { it('文件可上传', () => { mount() cy.get('.el-upload__input').attachFile('example.json') }) it('多文件可上传', () => { mount({ multiple: true }) cy.get('.el-upload__input').attachFile(['example.json', 'upload.txt']) }) })