This commit is contained in:
aozhiwei 2022-04-28 12:13:52 +08:00
parent c7005a40f3
commit be1dc9dc2d
2 changed files with 36 additions and 15 deletions

View File

@ -2,31 +2,19 @@ const TestCase = require('./testcase');
const urls = { const urls = {
'login': 'https://login-z2-test.cebg.games', 'login': 'https://login-z2-test.cebg.games',
'relation': 'wss://relation-test.kingsome.cn/friend/websocket',
'cloud': 'https://cloud-z2-test.cebg.games', 'cloud': 'https://cloud-z2-test.cebg.games',
'service': 'https://service-z2-test.cebg.games', 'service': 'https://service-z2-test.cebg.games',
'gamelog': 'https://gamelog-z2-test.cebg.games', 'gamelog': 'https://gamelog-z2-test.cebg.games',
'mail': 'https://gamemail-z2-test.cebg.games', 'mail': 'https://gamemail-z2-test.cebg.games',
'game2006api': 'https://game2006api-z2-test.cebg.games', 'game2006api': 'https://game2006api-z2-test.cebg.games',
'game2006': 'https://game2006-z2-test.cebg.games', 'relation': 'wss://relation-test.kingsome.cn/friend/websocket',
'game2006-n1': 'https://game2006-n1-z2-test.cebg.games', 'game2006': 'wss://game2006-z2-test.cebg.games',
'game2006-n1': 'wss://game2006-n1-z2-test.cebg.games',
}; };
async function start() { async function start() {
const testCase = new TestCase(urls); const testCase = new TestCase(urls);
await testCase.init(); await testCase.init();
/*await clientNet.init();
await clientNet.connect();
clientNet.on('connect', () => {
console.log('onConnect');
clientNet.registerMsgHandle('SMLogin', (msg) => {
});
clientNet.sendMsg('CMLogin', {
accountId: loginData['account_id'],
sessionId: loginData['session_id'],
});
});*/
} }
start(); start();

View File

@ -33,6 +33,7 @@ class TestCase {
'proto/friend/cs_proto.proto', 'proto/friend/cs_proto.proto',
'proto/friend/cs_msgid.proto' 'proto/friend/cs_msgid.proto'
); );
console.log(this.urls['game2006']);
this.battleWs = new ClientNet( this.battleWs = new ClientNet(
this.urls['game2006'], this.urls['game2006'],
'proto/battle/cs_proto.proto', 'proto/battle/cs_proto.proto',
@ -47,6 +48,8 @@ class TestCase {
await this.step4(); await this.step4();
await this.step5(); await this.step5();
await this.step6(); await this.step6();
await this.step7();
await this.step8();
} }
async step1() { async step1() {
@ -120,6 +123,36 @@ class TestCase {
console.log(response); console.log(response);
} }
async step7() {
await this.relationWs.init();
await this.relationWs.connect();
this.relationWs.on('connect', () => {
console.log('relation onConnect');
this.relationWs.registerMsgHandle('SMLogin', (msg) => {
});
this.relationWs.sendMsg('CMLogin', {
accountId: this.loginData['account_id'],
sessionId: this.loginData['session_id'],
});
});
}
async step8() {
await this.battleWs.init();
await this.battleWs.connect();
this.battleWs.on('connect', () => {
console.log('battle onConnect');
this.battleWs.registerMsgHandle('SMJoinedNotify', (msg) => {
});
this.battleWs.sendMsg('CMJoin', {
accountId: this.loginData['account_id'],
sessionId: this.loginData['session_id'],
});
});
}
} }
module.exports = TestCase; module.exports = TestCase;