提交 30b06434 编写于 作者: A Anne_LXM

update test

上级 ab93fe52
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
"version": "2.1.8", "version": "2.1.8",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
"登录", "登录",
"搜索", "搜索",
"uni-id实例", "uni-id实例",
"留言板" "留言板"
], ],
"repository": "https://gitcode.net/dcloud/uni-starter", "repository": "https://gitcode.net/dcloud/uni-starter",
"engines": { "engines": {
"HBuilderX": "^3.2.6" "HBuilderX": "^3.2.6"
...@@ -83,5 +83,8 @@ ...@@ -83,5 +83,8 @@
}, },
"dependencies": { "dependencies": {
"qrcodejs2": "^0.0.2" "qrcodejs2": "^0.0.2"
},
"devDependencies": {
"jest-image-snapshot": "^6.4.0"
} }
} }
...@@ -14,7 +14,6 @@ describe('pages/grid/grid.vue', () => { ...@@ -14,7 +14,6 @@ describe('pages/grid/grid.vue', () => {
}) })
it('点击宫格', async () => { it('点击宫格', async () => {
const perPage = await page.$$('.grid-item-box') const perPage = await page.$$('.grid-item-box')
// console.log('perPage: ',perPage);
expect(perPage.length).toBe(3) expect(perPage.length).toBe(3)
for (var i = 0; i < perPage.length; i++) { for (var i = 0; i < perPage.length; i++) {
await perPage[i].tap() await perPage[i].tap()
......
...@@ -6,10 +6,10 @@ describe('pages/list/list.vue', () => { ...@@ -6,10 +6,10 @@ describe('pages/list/list.vue', () => {
if(process.env.UNI_PLATFORM === "mp-weixin"){await page.waitFor(2000)} if(process.env.UNI_PLATFORM === "mp-weixin"){await page.waitFor(2000)}
}) })
it('检测标题', async () => { it('检测标题', async () => {
// expect.assertions(1); expect.assertions(1);
const getTitle = await page.data('dataList') const getTitle = await page.data('dataList')
console.log('getTitle: ',getTitle); 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 () => { it('点击搜索跳转', async () => {
await page.callMethod('searchClick') await page.callMethod('searchClick')
......
let pageIndex = 0 let pageIndex = 0
const pages = [ const pages = [
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd',
'/pages/ucenter/settings/settings', '/pages/ucenter/settings/settings',
'/pages/ucenter/ucenter', '/pages/ucenter/ucenter',
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd' '/uni_modules/uni-id-pages/pages/userinfo/userinfo',
] ]
let page; let page;
......
...@@ -57,13 +57,12 @@ describe('pages/ucenter/ucenter.vue', () => { ...@@ -57,13 +57,12 @@ describe('pages/ucenter/ucenter.vue', () => {
it('我的积分', async () => { it('我的积分', async () => {
if(!uniToken)return; if(!uniToken)return;
const getScoreRes = await page.callMethod('getScore') const getScoreRes = await page.callMethod('getScore')
let scoreInfo = getScoreRes && getScoreRes.result.data[0] console.log('getScoreRes: ',getScoreRes);
console.log('scoreInfo: ',scoreInfo);
await page.waitFor(500) await page.waitFor(500)
if (scoreInfo) { if (getScoreRes.score) {
expect.assertions(2); expect.assertions(2);
expect(scoreInfo.score).not.toBeUndefined(); expect(getScoreRes.score).not.toBeUndefined();
expect(scoreInfo.balance).toBeGreaterThanOrEqual(scoreInfo.score); expect(getScoreRes.balance).toBeGreaterThanOrEqual(getScoreRes.score);
} else { } else {
console.log("签到失败"); console.log("签到失败");
} }
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
title: msg, title: msg,
icon: 'none' icon: 'none'
}); });
return res return res.result.data[0]
}).finally((err) => { }).finally((err) => {
uni.hideLoading() uni.hideLoading()
return err return err
......
...@@ -6,11 +6,11 @@ describe('uni_modules/uni-id-pages/pages/login/login-withpwd.vue', () => { ...@@ -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') page = await program.navigateTo('/uni_modules/uni-id-pages/pages/login/login-withpwd')
await page.waitFor('view') await page.waitFor('view')
}); });
it('screenshot',async()=>{ // it('screenshot',async()=>{
const image = await program.screenshot(); // const image = await program.screenshot();
expect(image).toMatchImageSnapshot(); // expect(image).toMatchImageSnapshot();
await page.waitFor(500); // await page.waitFor(500);
}) // })
it('账号密码登录', async () => { it('账号密码登录', async () => {
await page.setData({ await page.setData({
"username": "DCloud", "username": "DCloud",
...@@ -28,8 +28,6 @@ describe('uni_modules/uni-id-pages/pages/login/login-withpwd.vue', () => { ...@@ -28,8 +28,6 @@ describe('uni_modules/uni-id-pages/pages/login/login-withpwd.vue', () => {
const resLogin = await page.callMethod('pwdLogin') const resLogin = await page.callMethod('pwdLogin')
console.log("resLogin: ", resLogin); console.log("resLogin: ", resLogin);
switch (resLogin.errCode){ switch (resLogin.errCode){
case 0: case 0:
console.log('登录成功') console.log('登录成功')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册