diff --git a/package.json b/package.json index 818e2e6e795a2a769dc82073a3b45517f3b862be..ca68da76bdcaab572fd94458c936dfff5c22d839 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "version": "2.1.8", "description": "云端一体应用快速开发基本项目模版", "keywords": [ - "login", - "登录", - "搜索", - "uni-id实例", - "留言板" - ], + "login", + "登录", + "搜索", + "uni-id实例", + "留言板" + ], "repository": "https://gitcode.net/dcloud/uni-starter", "engines": { "HBuilderX": "^3.2.6" @@ -83,5 +83,8 @@ }, "dependencies": { "qrcodejs2": "^0.0.2" + }, + "devDependencies": { + "jest-image-snapshot": "^6.4.0" } } diff --git a/pages/grid/grid.test.js b/pages/grid/grid.test.js index 26de6bb15714949cbac82c4e5ea73d09fe43bb9b..863c4108406a875b09971dfaf57ae5a8eda58bc7 100644 --- a/pages/grid/grid.test.js +++ b/pages/grid/grid.test.js @@ -14,7 +14,6 @@ describe('pages/grid/grid.vue', () => { }) it('点击宫格', async () => { const perPage = await page.$$('.grid-item-box') - // console.log('perPage: ',perPage); expect(perPage.length).toBe(3) for (var i = 0; i < perPage.length; i++) { await perPage[i].tap() diff --git a/pages/list/list.test.js b/pages/list/list.test.js index 383d9e70ba7f34b85592265f73e1cc98bf29cd07..45474c85fb956e894bc421bf6687f93579d0e93f 100644 --- a/pages/list/list.test.js +++ b/pages/list/list.test.js @@ -6,10 +6,10 @@ describe('pages/list/list.vue', () => { if(process.env.UNI_PLATFORM === "mp-weixin"){await page.waitFor(2000)} }) it('检测标题', async () => { - // expect.assertions(1); + expect.assertions(1); const getTitle = await page.data('dataList') console.log('getTitle: ',getTitle); - // expect((await page.data('dataList')).title).toBe('阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务') + expect((await page.data('dataList')).title).toBe('阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务') }) it('点击搜索跳转', async () => { await page.callMethod('searchClick') diff --git a/pages/pages.test.js b/pages/pages.test.js index 3939049e598f5f79321f341c8e74a3229ce329bb..6424fe030304ec0271d2e824e524d333f58c3fdb 100644 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -1,8 +1,9 @@ let pageIndex = 0 const pages = [ + '/uni_modules/uni-id-pages/pages/login/login-withoutpwd', '/pages/ucenter/settings/settings', '/pages/ucenter/ucenter', - '/uni_modules/uni-id-pages/pages/login/login-withoutpwd' + '/uni_modules/uni-id-pages/pages/userinfo/userinfo', ] let page; diff --git a/pages/ucenter/ucenter.test.js b/pages/ucenter/ucenter.test.js index 0299b105fc613f539924969c689e50099909ace3..e9d0290e317e6cf3cc829be4e1653ad80efcdbac 100644 --- a/pages/ucenter/ucenter.test.js +++ b/pages/ucenter/ucenter.test.js @@ -57,13 +57,12 @@ describe('pages/ucenter/ucenter.vue', () => { it('我的积分', async () => { if(!uniToken)return; const getScoreRes = await page.callMethod('getScore') - let scoreInfo = getScoreRes && getScoreRes.result.data[0] - console.log('scoreInfo: ',scoreInfo); + console.log('getScoreRes: ',getScoreRes); await page.waitFor(500) - if (scoreInfo) { + if (getScoreRes.score) { expect.assertions(2); - expect(scoreInfo.score).not.toBeUndefined(); - expect(scoreInfo.balance).toBeGreaterThanOrEqual(scoreInfo.score); + expect(getScoreRes.score).not.toBeUndefined(); + expect(getScoreRes.balance).toBeGreaterThanOrEqual(getScoreRes.score); } else { console.log("签到失败"); } diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue index 03a984f5347396e34616498ed4d49a75a794efff..dd5a7d770ec886029fc25978250c521f54fdf52f 100644 --- a/pages/ucenter/ucenter.vue +++ b/pages/ucenter/ucenter.vue @@ -269,7 +269,7 @@ title: msg, icon: 'none' }); - return res + return res.result.data[0] }).finally((err) => { uni.hideLoading() return err diff --git a/uni_modules/uni-id-pages/pages/login/login-withpwd.test.js b/uni_modules/uni-id-pages/pages/login/login-withpwd.test.js index a753ff338b3e53f88aeeaf8a469a4be43657023b..13b5ee686d1a3a6bfdbade44a6b17543cd782861 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withpwd.test.js +++ b/uni_modules/uni-id-pages/pages/login/login-withpwd.test.js @@ -6,11 +6,11 @@ describe('uni_modules/uni-id-pages/pages/login/login-withpwd.vue', () => { page = await program.navigateTo('/uni_modules/uni-id-pages/pages/login/login-withpwd') await page.waitFor('view') }); - it('screenshot',async()=>{ - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); - await page.waitFor(500); - }) + // it('screenshot',async()=>{ + // const image = await program.screenshot(); + // expect(image).toMatchImageSnapshot(); + // await page.waitFor(500); + // }) it('账号密码登录', async () => { await page.setData({ "username": "DCloud", @@ -28,8 +28,6 @@ describe('uni_modules/uni-id-pages/pages/login/login-withpwd.vue', () => { const resLogin = await page.callMethod('pwdLogin') console.log("resLogin: ", resLogin); - - switch (resLogin.errCode){ case 0: console.log('登录成功')