聊天:升星和升品的推送及测试

This commit is contained in:
liangtongchuan
2021-03-08 21:23:42 +08:00
parent 6c51d0b79d
commit 92006fc886
4 changed files with 122 additions and 7 deletions
+109 -4
View File
@@ -1,4 +1,4 @@
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_MSG_ROUTE, ON_GROUP_MSG_ROUTE, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, STATUS } from './../app/consts';
import { DEFAULT_MSG_PER_PAGE, MSG_TYPE, ON_MSG_ROUTE, ON_GROUP_MSG_ROUTE, CHANNEL_PREFIX, DEBUG_MAGIC_WORD, STATUS, HERO_GROW_MAX, ABI_STAGE } from './../app/consts';
import { Client } from './Client';
import 'mocha';
import { PinusWSClient } from 'pinus-robot-plugin';
@@ -7,7 +7,7 @@ import { checkSuccessResponse } from './CheckPatten';
const TEXT_MSG = {type: MSG_TYPE.TEXT, content: 'hello world'}
const LVBU_HID = 44;
const LVBU_PIECE_ID = 21044;
const XIAHOUQINGYI_HID = 53;
function sendPrivateMessageParm(targetRoleInfo, msg) {
const { roleId: targetRoleId, roleName: targetRoleName } = targetRoleInfo;
@@ -63,6 +63,34 @@ function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: P
}, 100);
}
// function testHeroPush(pinusClient: PinusWSClient, pinusClientT: PinusWSClient, hid: number, route: string, routeParam: object, done: Mocha.Done) {
// let msgReceiveCnt = 0;
// pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
// checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
// msgReceiveCnt += 1;
// });
// pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
// checkSuccessResponse(res);
// checkHeroInfoStr(res.data.content);
// msgReceiveCnt += 1;
// });
// pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid }, (cleanUpRes) => {
// if (cleanUpRes.code !== STATUS.HERO_NOT_FIND.code) {
// checkSuccessResponse(cleanUpRes, false);
// }
// pinusClient.request(route, routeParam, (composeRes) => {
// checkSuccessResponse(composeRes);
// setTimeout(() => {
// expect(msgReceiveCnt).to.be.equal(2);
// done();
// }, 1000);
// });
// });
// }
describe('聊天测试', function() {
let pinusClient: PinusWSClient;
let pinusClientT: PinusWSClient; // 用做测试队友
@@ -127,7 +155,6 @@ describe('聊天测试', function() {
});
it('测试系统频道橙将合成消息', function(done) {
const roomId = `${CHANNEL_PREFIX.SYS}_${roleInfo.serverId}`;
let msgReceiveCnt = 0;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
checkSuccessResponse(res);
@@ -153,9 +180,87 @@ describe('聊天测试', function() {
});
});
it('测试系统频道升六星消息', function(done) {
let msgReceiveCnt = 0;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
checkSuccessResponse(res);
checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
checkSuccessResponse(res);
checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
});
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: XIAHOUQINGYI_HID }, (cleanUpRes) => {
if (cleanUpRes.code !== STATUS.HERO_NOT_FIND.code) {
checkSuccessResponse(cleanUpRes, false);
}
pinusClient.request('role.heroHandler.compose', { hid: XIAHOUQINGYI_HID }, (composeRes) => {
checkSuccessResponse(composeRes);
for (let i = 2; i <= HERO_GROW_MAX.STAR; i++) {
for (let j = 0; j < ABI_STAGE.END; j++) {
setTimeout(() => {
pinusClient.request('role.heroHandler.starUp', {hid: XIAHOUQINGYI_HID, star: i, starStage: j}, (starUpRes) => {
if (starUpRes.code === STATUS.ROLE_STAR_REACH_MAX.code) {
expect(msgReceiveCnt).to.be.equal(2);
done();
} else {
checkSuccessResponse(starUpRes);
}
});
}, 50 * (i - 2) * ABI_STAGE.END + 50 * j);
}
}
});
});
});
// TODO: 升品推送测试
it('测试系统频道升品消息', function(done) {
done();
let msgReceiveCnt = 0;
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
checkSuccessResponse(res);
checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
});
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
checkSuccessResponse(res);
checkHeroInfoStr(res.data.content);
msgReceiveCnt += 1;
});
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: XIAHOUQINGYI_HID }, (cleanUpRes) => {
if (cleanUpRes.code !== STATUS.HERO_NOT_FIND.code) {
checkSuccessResponse(cleanUpRes, false);
}
pinusClient.request('role.heroHandler.compose', { hid: XIAHOUQINGYI_HID }, (composeRes) => {
checkSuccessResponse(composeRes);
for (let i = 2; i <= HERO_GROW_MAX.STAR; i++) {
for (let j = 0; j < ABI_STAGE.END; j++) {
setTimeout(() => {
if (i === HERO_GROW_MAX.STAR && j > 0) {
} else {
pinusClient.request('role.heroHandler.starUp', {hid: XIAHOUQINGYI_HID, star: i, starStage: j}, (starUpRes) => {
if (starUpRes.code === STATUS.ROLE_STAR_REACH_MAX.code) {
expect(msgReceiveCnt).to.be.equal(2);
msgReceiveCnt = 0;
pinusClient.request('role.heroHandler.qualityUp', {hid: XIAHOUQINGYI_HID, quality: 2}, (qualityUpRes) => {
checkSuccessResponse(qualityUpRes);
setTimeout(() => {
expect(msgReceiveCnt).to.be.equal(2);
done();
}, 1000);
});
} else {
checkSuccessResponse(starUpRes);
}
});
}
}, 50 * (i - 2) * ABI_STAGE.END + 50 * j);
}
}
});
});
});
it('测试世界频道消息', function(done) {