From 4f4f787e6f8bbfbda9e51a1e40b28777d3a80d40 Mon Sep 17 00:00:00 2001 From: Anne_LXM <54163582+anne-lxm@users.noreply.github.com> Date: Wed, 13 Dec 2023 21:02:50 +0800 Subject: [PATCH] update test --- pages/clientDB/demo/demo.test.js | 1 - pages/clientDB/permission/permission.test.js | 2 -- pages/cloudFunction/cloudFunction.test.js | 4 ++-- pages/storage/ext-storage-qiniu.test.js | 1 + pages/storage/space-storage.test.js | 1 + pages/user-info/detail.test.js | 2 ++ pages/user-info/edit.test.js | 1 + pages/user-info/list.test.js | 3 --- 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pages/clientDB/demo/demo.test.js b/pages/clientDB/demo/demo.test.js index a23c798..3ed16f0 100644 --- a/pages/clientDB/demo/demo.test.js +++ b/pages/clientDB/demo/demo.test.js @@ -36,7 +36,6 @@ describe('pages/clientDB/demo/demo.vue', () => { }) //新增一条留言 const userWrite = await page.callMethod('submitComment', '我是用户') - console.log('userWrite: ',userWrite); expect(userWrite.id.length).toBe(24); }) it('审核员', async () => { diff --git a/pages/clientDB/permission/permission.test.js b/pages/clientDB/permission/permission.test.js index 67872de..bc9e59b 100644 --- a/pages/clientDB/permission/permission.test.js +++ b/pages/clientDB/permission/permission.test.js @@ -5,9 +5,7 @@ describe('pages/clientDB/permission/permission.vue', () => { page = await program.reLaunch('/pages/clientDB/permission/permission') await page.waitFor('view') page = await program.currentPage() - }) - it('获取数据',async()=>{ //expect.assertions(2) if(process.env.UNI_PLATFORM === "mp-weixin"){ diff --git a/pages/cloudFunction/cloudFunction.test.js b/pages/cloudFunction/cloudFunction.test.js index 16228f3..7fdb862 100644 --- a/pages/cloudFunction/cloudFunction.test.js +++ b/pages/cloudFunction/cloudFunction.test.js @@ -1,5 +1,5 @@ +jest.setTimeout(20000) describe('pages/cloudFunction/cloudFunction.vue', () => { - let page beforeAll(async () => { // 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象) @@ -9,7 +9,7 @@ describe('pages/cloudFunction/cloudFunction.vue', () => { it('云函数页-检查标题',async()=>{ expect.assertions(1); const title = await page.$('.title') - expect(await title.text()).toBe('基础示例-云函数'); + expect((await title.text()).trim()).toBe('基础示例-云函数'); }) it('添加一条数据',async()=>{ expect.assertions(1); diff --git a/pages/storage/ext-storage-qiniu.test.js b/pages/storage/ext-storage-qiniu.test.js index 4159230..5c49689 100644 --- a/pages/storage/ext-storage-qiniu.test.js +++ b/pages/storage/ext-storage-qiniu.test.js @@ -1,3 +1,4 @@ +jest.setTimeout(20000) describe('pages/storage/ext-storage-qiniu.vue', () => { let page,platform; beforeAll(async () => { diff --git a/pages/storage/space-storage.test.js b/pages/storage/space-storage.test.js index 526b2d5..a3e6ec9 100644 --- a/pages/storage/space-storage.test.js +++ b/pages/storage/space-storage.test.js @@ -1,3 +1,4 @@ +jest.setTimeout(20000) describe('pages/storage/space-storage.vue', () => { let page beforeAll(async () => { diff --git a/pages/user-info/detail.test.js b/pages/user-info/detail.test.js index 28a748e..274055f 100644 --- a/pages/user-info/detail.test.js +++ b/pages/user-info/detail.test.js @@ -16,6 +16,8 @@ describe('pages/user-info/detail.vue', () => { await page.waitFor(1000) console.log('currentPage',await program.currentPage()) expect((await program.currentPage()).path).toBe('pages/user-info/edit') + }else{ + console.log('err query') } }) }) \ No newline at end of file diff --git a/pages/user-info/edit.test.js b/pages/user-info/edit.test.js index 0f5b6c3..2e3d24b 100644 --- a/pages/user-info/edit.test.js +++ b/pages/user-info/edit.test.js @@ -9,6 +9,7 @@ describe('pages/user-info/detail.vue', () => { it('修改表单内容', async () => { const getQuery = await page.query console.log('getQuery: ',getQuery); + if(!getQuery.id || getQuery.hobby_valuetotext.length<0)return; await page.setData({ "formData": { "username":"林小明加", diff --git a/pages/user-info/list.test.js b/pages/user-info/list.test.js index b25e6f2..50cb746 100644 --- a/pages/user-info/list.test.js +++ b/pages/user-info/list.test.js @@ -24,9 +24,6 @@ describe('pages/user-info/list.vue', () => { it('点击第一条',async()=>{ await page.waitFor(2000) const items = await page.$$('.uni-list-item') - console.log('items: ',items); - if(items.length<0)return; - if(items.length>0){ await items[0].tap() await waitTime() -- GitLab