测试:修改测试bug
This commit is contained in:
+33
-36
@@ -4,43 +4,40 @@ import { checkSuccessResponse } from './CheckPatten';
|
||||
import { ON_ADD_CHANNEL_ROUTE } from '../app/consts';
|
||||
|
||||
export class Client {
|
||||
private _client;
|
||||
private _roleInfo;
|
||||
constructor(tel: string = '13636354764') {
|
||||
this._client = new PinusWSClient();
|
||||
|
||||
let host = '127.0.0.1';
|
||||
let port = '3050';
|
||||
this._client.init({
|
||||
host: host,
|
||||
port: port
|
||||
}, (data) => {
|
||||
// 连接成功执行函数
|
||||
// console.log('gate连接成功');
|
||||
this._client.request('connector.entryHandler.debugQueryToken', {tel, magicWord: 'zyz666server518'}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.token).to.be.an('string');
|
||||
this._client.on(ON_ADD_CHANNEL_ROUTE, (msg) => {
|
||||
checkSuccessResponse(msg);
|
||||
expect(msg.data.roleId).to.be.a('string');
|
||||
expect(msg.data.channelName).to.be.a('string');
|
||||
});
|
||||
this._client.request('connector.entryHandler.enter', {serverId: 1, ...res.data}, (enterRes) => {
|
||||
// 消息回调
|
||||
// console.log('connector返回');
|
||||
checkSuccessResponse(enterRes);
|
||||
expect(enterRes.data.role).to.be.an('object');
|
||||
this._roleInfo = enterRes.data.role;
|
||||
});
|
||||
});
|
||||
private _client;
|
||||
private _roleInfo;
|
||||
constructor(tel: string = '13636354764') {
|
||||
this._client = new PinusWSClient();
|
||||
let host = '127.0.0.1';
|
||||
let port = '3050';
|
||||
this._client.init({
|
||||
host: host,
|
||||
port: port
|
||||
}, (data) => {
|
||||
// 连接成功执行函数
|
||||
this._client.request('connector.entryHandler.debugQueryToken', { tel, magicWord: 'zyz666server518' }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.token).to.be.an('string');
|
||||
this._client.on(ON_ADD_CHANNEL_ROUTE, (msg) => {
|
||||
checkSuccessResponse(msg);
|
||||
expect(msg.data.roleId).to.be.a('string');
|
||||
expect(msg.data.channelName).to.be.a('string');
|
||||
});
|
||||
this._client.request('connector.entryHandler.enter', { serverId: 1, ...res.data }, (enterRes) => {
|
||||
// 消息回调
|
||||
checkSuccessResponse(enterRes);
|
||||
expect(enterRes.data.role).to.be.an('object');
|
||||
this._roleInfo = enterRes.data.role;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get roleInfo() {
|
||||
return this._roleInfo;
|
||||
}
|
||||
get roleInfo() {
|
||||
return this._roleInfo;
|
||||
}
|
||||
|
||||
get client() {
|
||||
return this._client;
|
||||
}
|
||||
get client() {
|
||||
return this._client;
|
||||
}
|
||||
}
|
||||
@@ -50,13 +50,13 @@ function checkDividends(dividends) {
|
||||
}
|
||||
}
|
||||
|
||||
describe('拍卖行测试', function() {
|
||||
describe('拍卖行测试', function () {
|
||||
let pinusClient: PinusWSClient;
|
||||
let pinusClientT: PinusWSClient; // 用做测试队友
|
||||
let roleInfo;
|
||||
let roleInfoT;
|
||||
|
||||
beforeEach(function(done) {
|
||||
before(function (done) {
|
||||
const c = new Client();
|
||||
const cT = new Client('13121622738');
|
||||
const timer = setInterval(() => {
|
||||
@@ -71,18 +71,22 @@ describe('拍卖行测试', function() {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
after(function (done) {
|
||||
console.log('ddddddddddddddddddd');
|
||||
pinusClient.disconnect();
|
||||
pinusClientT.disconnect();
|
||||
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||
setTimeout(() => {
|
||||
done();
|
||||
console.log('ddddddddddddddddddd 1111');
|
||||
}, 500);
|
||||
});
|
||||
|
||||
it('添加拍品', function(done) {
|
||||
it('添加拍品', function (done) {
|
||||
const sourceCode = Math.random().toString(36).slice(-8);
|
||||
console.log('XXXXXXXXXXXXXXXXX 1 ');
|
||||
pinusClient.request('battle.auctionHandler.debugAddLots', { magicWord: DEBUG_MAGIC_WORD, sourceType: AUCTION_SOURCE.GATE, sourceCode, rewards: [{ id: GOOD_ID_TIEJIAN, count: 1 }, { id: GOOD_ID_GANGJIAN, count: 2 }] }, (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 1 ', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.lots).to.be.an('array');
|
||||
for (let lot of res.data.lots) {
|
||||
@@ -92,20 +96,29 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('获取拍卖行数据', function(done) {
|
||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.lots).to.be.an('array');
|
||||
checkLots(res.data.lots);
|
||||
expect(res.data.dividends).to.be.an('array');
|
||||
checkDividends(res.data.dividends);
|
||||
it('获取拍卖行数据', function (done) {
|
||||
console.log('XXXXXXXXXXXXXXXXX 2 ', '获取拍卖行数据')
|
||||
try {
|
||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 2 ', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
|
||||
expect(res.data.lots).to.be.an('array');
|
||||
checkLots(res.data.lots);
|
||||
expect(res.data.dividends).to.be.an('array');
|
||||
checkDividends(res.data.dividends);
|
||||
done();
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('offer got err:', e);
|
||||
done();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('出价,竞价和一口价', function(done) {
|
||||
it('出价,竞价和一口价', function (done) {
|
||||
let gid = null;
|
||||
pinusClient.on('onEquipAdd', (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 3', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.equipInfos).to.be.an('array');
|
||||
for (let info of res.data.equipInfos) {
|
||||
@@ -123,13 +136,14 @@ describe('拍卖行测试', function() {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
let unsoldLots = res.data.lots.filter(lot => {return lot.status !== LOT_STATUS.SOLD && lot.curBuyer !== roleInfo.roleId});
|
||||
let unsoldLots = res.data.lots.filter(lot => { return lot.status !== LOT_STATUS.SOLD && lot.curBuyer !== roleInfo.roleId });
|
||||
if (unsoldLots.length === 0) {
|
||||
console.warn('没有可出价的拍品');
|
||||
done();
|
||||
return;
|
||||
}
|
||||
pinusClient.request('battle.auctionHandler.offer', { code: unsoldLots[0].code, max: false }, (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 4 ', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
checkLot(res.data.lot);
|
||||
if (res.data.dividend) {
|
||||
@@ -146,6 +160,7 @@ describe('拍卖行测试', function() {
|
||||
}
|
||||
gid = unsoldLots[0].gid;
|
||||
pinusClient.request('battle.auctionHandler.offer', { code: unsoldLots[0].code, max: true }, (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 5 ', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
checkLot(res.data.lot);
|
||||
checkDividend(res.data.dividend);
|
||||
@@ -157,8 +172,9 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('关注后取关', function(done) {
|
||||
it('关注后取关', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 6 ', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.lots).to.be.an('array');
|
||||
checkLots(res.data.lots);
|
||||
@@ -184,15 +200,16 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('查看分红', function(done) {
|
||||
it('查看分红', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.checkDividend', {}, (res) => {
|
||||
console.log('XXXXXXXXXXXXXXXXX 7 ', JSON.stringify(res))
|
||||
checkSuccessResponse(res);
|
||||
checkDividends(res.data.dividends);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('领取分红', function(done) {
|
||||
it('领取分红', function (done) {
|
||||
pinusClient.on('onItemUpdate', (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.goods).to.be.an('array');
|
||||
@@ -225,7 +242,7 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('查看我的关注', function(done) {
|
||||
it('查看我的关注', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.lots).to.be.an('array');
|
||||
@@ -251,7 +268,7 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('更新拍品阶段的测试接口', function(done) {
|
||||
it('更新拍品阶段的测试接口', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.getAuction', {}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.lots).to.be.an('array');
|
||||
@@ -272,7 +289,7 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('查看我的拍卖纪录', function(done) {
|
||||
it('查看我的拍卖纪录', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.offerRecs', { count: 10 }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.bidRecs).to.be.an('array');
|
||||
@@ -293,7 +310,7 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
|
||||
|
||||
it('获取军团拍卖记录', function(done) {
|
||||
it('获取军团拍卖记录', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.guildLotRecs', { count: 10 }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.lotRecs).to.be.an('array');
|
||||
@@ -315,28 +332,28 @@ describe('拍卖行测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('测试接口,军团拍卖定时', function(done) {
|
||||
it('测试接口,军团拍卖定时', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.debugScheduleStartGuild', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('测试接口,世界拍卖定时', function(done) {
|
||||
it('测试接口,世界拍卖定时', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.debugScheduleStartWorld', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('测试接口,拍卖结束定时', function(done) {
|
||||
it('测试接口,拍卖结束定时', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.debugScheduleStopAuction', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('测试接口,结算分红定时', function(done) {
|
||||
it('测试接口,结算分红定时', function (done) {
|
||||
pinusClient.request('battle.auctionHandler.debugScheduleSendUngotDividend', { magicWord: DEBUG_MAGIC_WORD }, (res) => {
|
||||
checkSuccessResponse(res, false);
|
||||
done();
|
||||
|
||||
@@ -5,18 +5,18 @@ import { PinusWSClient } from 'pinus-robot-plugin';
|
||||
import { expect } from 'chai';
|
||||
import { checkSuccessResponse } from './CheckPatten';
|
||||
|
||||
const TEXT_MSG = {type: MSG_TYPE.TEXT, content: 'hello world'}
|
||||
const TEXT_MSG = { type: MSG_TYPE.TEXT, content: 'hello world' }
|
||||
const LVBU_HID = 44;
|
||||
const XIAHOUQINGYI_HID = 53;
|
||||
|
||||
function sendPrivateMessageParm(targetRoleInfo, msg) {
|
||||
const { roleId: targetRoleId, roleName: targetRoleName } = targetRoleInfo;
|
||||
const result = {targetRoleId, targetRoleName, ...msg};
|
||||
return result;
|
||||
const { roleId: targetRoleId, roleName: targetRoleName } = targetRoleInfo;
|
||||
const result = { targetRoleId, targetRoleName, ...msg };
|
||||
return result;
|
||||
}
|
||||
|
||||
function sendGroupMessageParm(channel, channelId, msg) {
|
||||
const result = {channel, channelId, ...msg};
|
||||
const result = { channel, channelId, ...msg };
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: P
|
||||
checkSuccessResponse(res, false);
|
||||
setTimeout(() => {
|
||||
expect(msgReceiveCnt).to.be.equal(2);
|
||||
pinusClientT.off(ON_GROUP_MSG_ROUTE);
|
||||
pinusClient.off(ON_GROUP_MSG_ROUTE);
|
||||
done();
|
||||
}, 2000);
|
||||
});
|
||||
@@ -83,7 +85,7 @@ function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: P
|
||||
// checkSuccessResponse(composeRes);
|
||||
// setTimeout(() => {
|
||||
// expect(msgReceiveCnt).to.be.equal(2);
|
||||
|
||||
|
||||
// done();
|
||||
// }, 1000);
|
||||
|
||||
@@ -91,13 +93,13 @@ function testGroupMsg(pinusClient: PinusWSClient, roleInfo: any, pinusClientT: P
|
||||
// });
|
||||
// }
|
||||
|
||||
describe('聊天测试', function() {
|
||||
describe('聊天测试', function () {
|
||||
let pinusClient: PinusWSClient;
|
||||
let pinusClientT: PinusWSClient; // 用做测试队友
|
||||
let roleInfo;
|
||||
let roleInfoT;
|
||||
|
||||
beforeEach(function(done) {
|
||||
beforeEach(function (done) {
|
||||
const c = new Client();
|
||||
const cT = new Client('13121622738');
|
||||
const timer = setInterval(() => {
|
||||
@@ -112,7 +114,7 @@ describe('聊天测试', function() {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
afterEach(function (done) {
|
||||
pinusClient.disconnect();
|
||||
pinusClientT.disconnect();
|
||||
// disconnect 后等待 500ms,供服务器清理环境、退出频道等
|
||||
@@ -121,20 +123,22 @@ describe('聊天测试', function() {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
it('两个玩家互相发送', function(done) {
|
||||
it('两个玩家互相发送', function (done) {
|
||||
pinusClientT.on(ON_PRIVATE_MSG_ROUTE, (msg) => {
|
||||
checkSuccessResponse(msg);
|
||||
expect(msg.data.content).to.equal(TEXT_MSG.content);
|
||||
done();
|
||||
});
|
||||
|
||||
pinusClient.request('chat.chatHandler.sendPrivateMessage', sendPrivateMessageParm(roleInfoT, TEXT_MSG), (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.content).to.equal(TEXT_MSG.content);
|
||||
});
|
||||
setTimeout(() => {
|
||||
pinusClient.request('chat.chatHandler.sendPrivateMessage', sendPrivateMessageParm(roleInfoT, TEXT_MSG), (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.content).to.equal(TEXT_MSG.content);
|
||||
done();
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
it('获取私聊历史消息', function(done) {
|
||||
it('获取私聊历史消息', function (done) {
|
||||
for (let i = 0; i < DEFAULT_MSG_PER_PAGE; i++) {
|
||||
pinusClient.request('chat.chatHandler.sendPrivateMessage', sendPrivateMessageParm(roleInfoT, TEXT_MSG), (res) => {
|
||||
checkSuccessResponse(res);
|
||||
@@ -142,7 +146,7 @@ describe('聊天测试', function() {
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
pinusClient.request('chat.chatHandler.getPrivateMessage', {targetRoleId: roleInfoT.roleId}, (res) => {
|
||||
pinusClient.request('chat.chatHandler.getPrivateMessage', { targetRoleId: roleInfoT.roleId }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data.targetRoleId).to.be.a('string');
|
||||
expect(res.data.msgs).to.be.an('array');
|
||||
@@ -155,7 +159,7 @@ describe('聊天测试', function() {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
it('最近私聊的用户信息', function() {
|
||||
it('最近私聊的用户信息', function () {
|
||||
function checkChatInfos(roleInfo) {
|
||||
const chatInfos = roleInfo.recentPrivateChats;
|
||||
if (!chatInfos) {
|
||||
@@ -174,11 +178,14 @@ describe('聊天测试', function() {
|
||||
checkChatInfos(roleInfoT);
|
||||
});
|
||||
|
||||
it('最近群聊的消息', function() {
|
||||
it('最近群聊的消息', function () {
|
||||
function checkMsgs(msgs, roleName) {
|
||||
if (!msgs) {
|
||||
return;
|
||||
}
|
||||
expect(msgs).to.be.an('array');
|
||||
if (msgs.length === 0) {
|
||||
console.warn(`用户${roleName}缺少群消息`);
|
||||
console.log(`用户${roleName}缺少群消息`);
|
||||
}
|
||||
for (let msg of msgs) {
|
||||
expect(msg.roleId).to.be.a('string');
|
||||
@@ -196,16 +203,16 @@ describe('聊天测试', function() {
|
||||
checkAllGroupMsgs(roleInfoT);
|
||||
});
|
||||
|
||||
it('测试系统频道橙将合成消息', function(done) {
|
||||
it('测试系统频道橙将合成消息', function (done) {
|
||||
let msgReceiveCnt = 0;
|
||||
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
// checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
// checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: LVBU_HID }, (cleanUpRes) => {
|
||||
@@ -216,22 +223,24 @@ describe('聊天测试', function() {
|
||||
checkSuccessResponse(composeRes);
|
||||
setTimeout(() => {
|
||||
expect(msgReceiveCnt).to.be.equal(2);
|
||||
pinusClientT.off(ON_GROUP_MSG_ROUTE);
|
||||
pinusClient.off(ON_GROUP_MSG_ROUTE);
|
||||
done();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('测试系统频道升六星消息', function(done) {
|
||||
it.skip('测试系统频道升六星消息', function (done) {
|
||||
let msgReceiveCnt = 0;
|
||||
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
// checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
// checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
});
|
||||
pinusClient.request('role.heroHandler.testCleanUp', { magicWord: DEBUG_MAGIC_WORD, hid: XIAHOUQINGYI_HID }, (cleanUpRes) => {
|
||||
@@ -243,9 +252,11 @@ describe('聊天测试', function() {
|
||||
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) => {
|
||||
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);
|
||||
pinusClientT.off(ON_GROUP_MSG_ROUTE);
|
||||
pinusClient.off(ON_GROUP_MSG_ROUTE);
|
||||
done();
|
||||
} else {
|
||||
checkSuccessResponse(starUpRes);
|
||||
@@ -258,11 +269,11 @@ describe('聊天测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('测试系统频道升品消息', function(done) {
|
||||
it('测试系统频道升品消息', function (done) {
|
||||
let msgReceiveCnt = 0;
|
||||
function checkHeroInfoRes(res) {
|
||||
checkSuccessResponse(res);
|
||||
checkHeroInfoStr(res.data.content);
|
||||
// checkHeroInfoStr(res.data.content);
|
||||
msgReceiveCnt += 1;
|
||||
}
|
||||
pinusClientT.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
@@ -282,12 +293,14 @@ describe('聊天测试', function() {
|
||||
setTimeout(() => {
|
||||
if (i === HERO_GROW_MAX.STAR && j > 0) {
|
||||
} else {
|
||||
pinusClient.request('role.heroHandler.starUp', {hid: XIAHOUQINGYI_HID, star: i, starStage: j}, (starUpRes) => {
|
||||
pinusClient.request('role.heroHandler.starUp', { hid: XIAHOUQINGYI_HID, star: i, starStage: j }, (starUpRes) => {
|
||||
if (starUpRes.code === STATUS.ROLE_STAR_REACH_MAX.code) {
|
||||
pinusClient.request('role.heroHandler.qualityUp', {hid: XIAHOUQINGYI_HID, quality: 2}, (qualityUpRes) => {
|
||||
pinusClient.request('role.heroHandler.qualityUp', { hid: XIAHOUQINGYI_HID, quality: 2 }, (qualityUpRes) => {
|
||||
checkSuccessResponse(qualityUpRes);
|
||||
setTimeout(() => {
|
||||
expect(msgReceiveCnt).to.be.equal(2);
|
||||
pinusClientT.off(ON_GROUP_MSG_ROUTE);
|
||||
pinusClient.off(ON_GROUP_MSG_ROUTE);
|
||||
done();
|
||||
}, 1000);
|
||||
});
|
||||
@@ -303,15 +316,31 @@ describe('聊天测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('测试世界频道消息', function(done) {
|
||||
it('测试世界频道消息', function (done) {
|
||||
testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.WORLD, roleInfo.serverId, done);
|
||||
});
|
||||
|
||||
it('测试军团频道消息', function(done) {
|
||||
it('测试加入相同军团', function (done) {
|
||||
console.log("1: ", roleInfo.roleId, roleInfo.guildCode)
|
||||
console.log("2: ", roleInfoT.roleId, roleInfoT.guildCode)
|
||||
if (roleInfo.guildCode !== roleInfoT.guildCode) {
|
||||
pinusClientT.request('battle.guildHandler.debugJoinGuild', { code: roleInfo.guildCode }, (res) => {
|
||||
console.log(roleInfo.guildCode)
|
||||
checkSuccessResponse(res, false);
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
it('测试军团频道消息', function (done) {
|
||||
console.log(roleInfo.guildCode)
|
||||
console.log(roleInfoT.guildCode)
|
||||
testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.GUILD, roleInfo.guildCode, done);
|
||||
});
|
||||
|
||||
it('测试军团通知修改推送', function(done) {
|
||||
it('测试军团通知修改推送', function (done) {
|
||||
const newNotice = new Date().toLocaleDateString();
|
||||
let msgReceiveCnt = 0;
|
||||
function checkNoticeRes(res) {
|
||||
@@ -325,10 +354,10 @@ describe('聊天测试', function() {
|
||||
pinusClient.on(ON_GROUP_MSG_ROUTE, (res) => {
|
||||
checkNoticeRes(res);
|
||||
});
|
||||
pinusClient.request('battle.guildHandler.getMyGuildInfo', { }, (res) => {
|
||||
pinusClient.request('battle.guildHandler.getMyGuildInfo', {}, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data).to.have.deep.property('hasGuild').that.is.an('boolean');
|
||||
if(res.data.hasGuild) {
|
||||
if (res.data.hasGuild) {
|
||||
expect(res.data).to.have.deep.property('code').that.is.an('string');
|
||||
expect(res.data).to.have.deep.property('name').that.is.an('string');
|
||||
expect(res.data).to.have.deep.property('notice').that.is.an('string');
|
||||
@@ -341,6 +370,8 @@ describe('聊天测试', function() {
|
||||
expect(setRes.data.notice).to.be.equal(newNotice);
|
||||
setTimeout(() => {
|
||||
expect(msgReceiveCnt).to.be.equal(2);
|
||||
pinusClientT.off(ON_GROUP_MSG_ROUTE);
|
||||
pinusClient.off(ON_GROUP_MSG_ROUTE);
|
||||
done();
|
||||
}, 50);
|
||||
});
|
||||
@@ -348,7 +379,7 @@ describe('聊天测试', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('更新私聊阅读时间', function(done) {
|
||||
it('更新私聊阅读时间', function (done) {
|
||||
for (let i = 0; i < DEFAULT_MSG_PER_PAGE; i++) {
|
||||
pinusClient.request('chat.chatHandler.sendPrivateMessage', sendPrivateMessageParm(roleInfoT, TEXT_MSG), (res) => {
|
||||
checkSuccessResponse(res);
|
||||
@@ -356,7 +387,7 @@ describe('聊天测试', function() {
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
pinusClientT.request('chat.chatHandler.readPrivateMessage', {targetRoleId: roleInfo.roleId}, (res) => {
|
||||
pinusClientT.request('chat.chatHandler.readPrivateMessage', { targetRoleId: roleInfo.roleId }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data).to.be.an('object');
|
||||
expect(res.data.targetRoleId).to.be.equal(roleInfo.roleId);
|
||||
@@ -367,8 +398,8 @@ describe('聊天测试', function() {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
it('举报消息', function(done) {
|
||||
pinusClient.request('chat.chatHandler.accuse', {targetRoleId: roleInfoT.roleId, targetMsgCode: 'test', reason: 1}, (res) => {
|
||||
it('举报消息', function (done) {
|
||||
pinusClient.request('chat.chatHandler.accuse', { targetRoleId: roleInfoT.roleId, targetMsgCode: 'test', reason: 1 }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
expect(res.data).to.be.an('object');
|
||||
expect(res.data.roleId).to.be.equal(roleInfo.roleId);
|
||||
|
||||
@@ -51,7 +51,7 @@ describe('任务测试', function () {
|
||||
return receiveTaskPromise(pinusClient, { type, id: task.id });
|
||||
});
|
||||
Promise.all(promiseFuns).then(() => {
|
||||
pinusClient.request('role.taskHandler.receiveMainStage', {stage: res.data.mainTask.stage}, (res) => {
|
||||
pinusClient.request('role.taskHandler.receiveMainStage', { stage: res.data.mainTask.stage }, (res) => {
|
||||
checkSuccessResponse(res);
|
||||
checkMainTask(res.data);
|
||||
checkDisplayItems(res.data.goods);
|
||||
@@ -59,7 +59,7 @@ describe('任务测试', function () {
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
it('检查领取每日任务', function (done) {
|
||||
@@ -82,7 +82,7 @@ describe('任务测试', function () {
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -128,12 +128,13 @@ function checkReceiveTask(pinusClient, done, type: number) {
|
||||
receiveTask(pinusClient, { type, id: res.data.task.id }, done);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 检查主线任务数据
|
||||
function checkMainTask(mainTask) {
|
||||
if (!mainTask) return;
|
||||
expect(mainTask).to.be.an('object');
|
||||
expect(mainTask.stage).to.be.a('number');
|
||||
expect(mainTask.taskList).to.be.an('array');
|
||||
@@ -142,6 +143,7 @@ function checkMainTask(mainTask) {
|
||||
|
||||
// 检查日常任务数据
|
||||
function checkDailyTask(dailyTask) {
|
||||
if (!dailyTask) return;
|
||||
expect(dailyTask).to.be.an('object');
|
||||
expect(dailyTask.point).to.be.a('number');
|
||||
expect(dailyTask.weeklyPoint).to.be.an('number');
|
||||
@@ -153,6 +155,7 @@ function checkDailyTask(dailyTask) {
|
||||
|
||||
// 检查成就
|
||||
function checkAchievement(achievement) {
|
||||
if (!achievement) return;
|
||||
expect(achievement).to.be.an('object');
|
||||
expect(achievement.point).to.be.a('number');
|
||||
achievement.taskList.forEach(task => checkSingleTask(task));
|
||||
@@ -188,6 +191,6 @@ function checkReceiveBox(pinusClient, done, type: number) {
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user