提交 01ae3d9f 编写于 作者: study夏羽's avatar study夏羽

修复搜索条件问题

上级 da862267
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
keyword(keyword, oldValue) { keyword(keyword, oldValue) {
let where = '"article_status" == 1 ' let where = '"article_status" == 1 '
if (keyword) { if (keyword) {
this.where = where + `/${keyword}/.test(title)`; this.where = where + `&& /${keyword}/.test(title)`;
} else { } else {
this.where = where; this.where = where;
} }
......
...@@ -22,15 +22,14 @@ describe('pages/list/search/search.vue', () => { ...@@ -22,15 +22,14 @@ describe('pages/list/search/search.vue', () => {
}) })
it('搜索内容', async () => { it('搜索内容', async () => {
expect.assertions(1); // expect.assertions(1);
const setSearchTest = await page.setData({ const setSearchTest = await page.setData({
searchText: '小程序', searchText: '小程序',
}) })
// console.log(await page.data('searchText')); console.log(await page.data('searchText'));
await page.callMethod('search', '小程序') await page.callMethod('search', '小程序')
await page.waitFor(300) await page.waitFor(300)
console.log(await program.currentPage(),"-----------------------");
expect((await program.currentPage()).path).toBe('pages/list/list') expect((await program.currentPage()).path).toBe('pages/list/list')
// 执行 navigateBack 验证是否返回
// expect((await program.navigateBack()).path).toBe('pages/list/search/search')
}) })
}); });
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
describe('pages/ucenter/about/about.vue', () => { describe('pages/ucenter/about/about.vue', () => {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.navigateTo('/pages/ucenter/about/about') page = await program.redirectTo('/pages/ucenter/about/about')
await page.waitFor(500) await page.waitFor(500)
}) })
......
...@@ -5,7 +5,7 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => { ...@@ -5,7 +5,7 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.redirectTo('/pages/ucenter/login-page/pwd-login/pwd-login') page = await program.navigateTo('/pages/ucenter/login-page/pwd-login/pwd-login')
await page.waitFor(500) await page.waitFor(500)
}) })
...@@ -43,7 +43,29 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => { ...@@ -43,7 +43,29 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => {
}) })
const resLogin = await page.callMethod('pwdLogin') const resLogin = await page.callMethod('pwdLogin')
console.log("resLogin: ", resLogin.msg); console.log("resLogin: ", resLogin.msg);
expect(resLogin.msg).toBe("登录成功");
switch (resLogin.msg){
case 10102:
expect(resLogin.msg).toBe("密码错误");
const setForm = await page.setData({
"password": "222222",
"username": "数字天堂",
"agree": true,
})
const resLogin = await page.callMethod('pwdLogin')
break;
case 10103:
expect(resLogin.msg).toBe("密码错误次数过多");
break;
case 10002:
expect(resLogin.msg).toBe("验证码不可为空");
break;
case 0:
expect(resLogin.msg).toBe("登录成功");
break;
default:
break;
}
}) })
}) })
...@@ -8,55 +8,35 @@ describe('pages/ucenter/settings/settings', () => { ...@@ -8,55 +8,35 @@ describe('pages/ucenter/settings/settings', () => {
page = await program.navigateTo('/pages/ucenter/settings/settings') page = await program.navigateTo('/pages/ucenter/settings/settings')
await page.waitFor(500) await page.waitFor(500)
}) })
it('切换语言', async () => { it('切换语言', async () => {
console.log(await page.data('uniToken'),'uniToken-------------------------');
// await page.callMethod('changeLanguage') 弹框不支持点击
console.log((await program.currentPage()).path);
if (process.env.UNI_PLATFORM === "app-plus") { if (process.env.UNI_PLATFORM === "app-plus") {
//清理缓存 //清理缓存
await page.callMethod('clearTmp') await page.callMethod('clearTmp')
console.log("clearTmp: -------------"); console.log("clearTmp: -------------");
console.log(await page.data('pushIsOn'), "pushIsOn-------------");
const pushRes = await page.data('pushIsOn')
if (pushRes == "wait") {
console.log(await page.data('pushIsOn'),"pushIsOn-------------");
const pushRes = await page.data('pushIsOn')
if(pushRes == "wait"){
await page.callMethod('pushServer.off') await page.callMethod('pushServer.off')
console.log("pushServer---------"); console.log("pushServer---------");
} }
} }
}) })
it('退出登录', async () => { /* it('退出登录', async () => {
const perPage = await page.$('.content') const getTokenRes = await page.waitFor(async () => {
const uList = await perPage.$('.userInfo-class')
await page.waitFor(300)
const getTokenRes = await page.waitFor(async()=>{
return await page.data('uniToken') return await page.data('uniToken')
}) })
console.log("getTokenRes: ",getTokenRes); console.log("getTokenRes: ", getTokenRes);
await page.callMethod('clickLogout')
console.log((await program.currentPage()).path); console.log(await page.data('uniToken'), 'uniToken-------------------------');
if(getTokenRes){
await page.callMethod('clickLogout')
}
}) })
*/
}); });
\ No newline at end of file
...@@ -22,6 +22,7 @@ describe('pages/ucenter/userinfo/bind-mobile/bind-mobile.vue', () => { ...@@ -22,6 +22,7 @@ describe('pages/ucenter/userinfo/bind-mobile/bind-mobile.vue', () => {
await page.waitFor(300) await page.waitFor(300)
}else{ }else{
const codebtn = await page.$('.short-code-btn') const codebtn = await page.$('.short-code-btn')
console.log("codebtn: ",codebtn);
const sendMsgRes = await codebtn.callMethod('sendMsg') const sendMsgRes = await codebtn.callMethod('sendMsg')
await page.waitFor(300) await page.waitFor(300)
} }
......
...@@ -4,7 +4,7 @@ describe('pages/ucenter/userinfo/userinfo.vue', () => { ...@@ -4,7 +4,7 @@ describe('pages/ucenter/userinfo/userinfo.vue', () => {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.redirectTo('/pages/ucenter/userinfo/userinfo') page = await program.navigateTo('/pages/ucenter/userinfo/userinfo')
await page.waitFor(500) await page.waitFor(500)
}) })
...@@ -15,15 +15,19 @@ describe('pages/ucenter/userinfo/userinfo.vue', () => { ...@@ -15,15 +15,19 @@ describe('pages/ucenter/userinfo/userinfo.vue', () => {
}) })
console.log("getTokenRes: ",getTokenRes); console.log("getTokenRes: ",getTokenRes);
// if(getTokenRes){ var name = "数字天堂DCloud" + Math.round(Math.random()*10);
// const nicknameRes = await page.callMethod("setNickname","数字天堂DCloud") console.log("name: ",name);
// await page.waitFor(300)
// console.log("nicknameRes: ",nicknameRes); if(getTokenRes){
// expect(nicknameRes.updated).toBe(1) const nicknameRes = await page.callMethod("setNickname",name)
// } await page.waitFor(300)
console.log("nicknameRes: ",nicknameRes);
expect(nicknameRes.updated).toBe(1)
}
}) })
it('绑定手机号', async () => { it('绑定手机号', async () => {
console.log(await page.data('uniToken'),"-------------------------");
await page.callMethod('bindMobileBySmsCode') await page.callMethod('bindMobileBySmsCode')
await page.waitFor(300) await page.waitFor(300)
console.log((await program.currentPage()).path); console.log((await program.currentPage()).path);
......
static/screenshot/about.png

103.1 KB | W: | H:

static/screenshot/about.png

67.6 KB | W: | H:

static/screenshot/about.png
static/screenshot/about.png
static/screenshot/about.png
static/screenshot/about.png
  • 2-up
  • Swipe
  • Onion skin
const Sequencer = require("@jest/test-sequencer").default; const Sequencer = require("@jest/test-sequencer").default;
const sortTestFilenames = ["register.test.js","pwd-login.test.js","userinfo.test.js"]; const sortTestFilenames = ["register.test.js","pwd-login.test.js","userinfo.test.js","search.test.js"];
class CustomSequencer extends Sequencer { class CustomSequencer extends Sequencer {
sort(tests) { sort(tests) {
// 测试例排序 // 测试例排序
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册