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

test: downloadfile uni.env测试例

上级 92517abb
...@@ -22,6 +22,17 @@ describe('ExtApi-DownloadFile', () => { ...@@ -22,6 +22,17 @@ describe('ExtApi-DownloadFile', () => {
expect(res).toBe(true); expect(res).toBe(true);
}); });
if (!process.env.uniTestPlatformInfo.startsWith('web')) {
it('Check uni.env', async () => {
await page.callMethod('jest_downloadFile_with_uni_env');
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true);
});
}
let shouldTestCookie = false let shouldTestCookie = false
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
let version = process.env.uniTestPlatformInfo let version = process.env.uniTestPlatformInfo
......
...@@ -71,6 +71,19 @@ ...@@ -71,6 +71,19 @@
}); });
}, },
jest_downloadFile_with_uni_env() {
uni.downloadFile({
url: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png",
filePath: `${uni.env.CACHE_PATH}/a/b/`,
success: () => {
this.jest_result = true
},
fail: () => {
this.jest_result = false
}
});
},
jest_set_cookie(){ jest_set_cookie(){
uni.request({ uni.request({
url: "https://request.dcloud.net.cn/api/http/header/setCookie", url: "https://request.dcloud.net.cn/api/http/header/setCookie",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册