提交 2cfbdb0f 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

feat: uploadfile增加多文件上传示例和测试例

上级 4de4144b
......@@ -34,4 +34,10 @@ describe('ExtApi-UploadFile', () => {
res = await page.data('jest_result');
expect(res).toBe(true)
});
it('Check files upload', async () => {
res = await page.callMethod('jest_files_upload')
await page.waitFor(1000);
res = await page.data('jest_result');
expect(res).toBe(true)
});
});
......@@ -147,8 +147,31 @@
this.jest_result = false;
},
})
},
jest_files_upload(){
const imageSrc = "/static/uni.png";
this.task = uni.uploadFile({
url: 'https://unidemo.dcloud.net.cn/upload',
files:[
{
name:"file1",
uri:imageSrc
} as UploadFileOptionFiles,
{
name:"file2",
uri:imageSrc
} as UploadFileOptionFiles
],
success: (res:UploadFileSuccess) => {
if(res.statusCode == 200){
this.jest_result = true;
}
},
fail: () => {
this.jest_result = false;
},
})
}
}
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册