提交 18a6f0b6 编写于 作者: Q q00313334

p2p xts 3568 testcase not run

Signed-off-by: Nq00313334 <quanli1@huawei.com>
上级 84ede791
...@@ -16,3 +16,4 @@ require('./WifiSta.test.js') ...@@ -16,3 +16,4 @@ require('./WifiSta.test.js')
require('./WifiSoftAP.test.js') require('./WifiSoftAP.test.js')
require('./WifiP2P.test.js') require('./WifiP2P.test.js')
...@@ -262,7 +262,8 @@ describe('ACTS_WifiTest', function () { ...@@ -262,7 +262,8 @@ describe('ACTS_WifiTest', function () {
expect(true).assertEqual(data.length!=0); expect(true).assertEqual(data.length!=0);
}).catch((error) => { }).catch((error) => {
console.info("[wifi_test]getP2pLinkedInfo promise then error." + JSON.stringify(error)); console.info("[wifi_test]getP2pLinkedInfo promise then error." + JSON.stringify(error));
expect().assertFail(); expect(error).assertFail();
}); });
wifi.getP2pLinkedInfo((err, result) => { wifi.getP2pLinkedInfo((err, result) => {
if (err) { if (err) {
...@@ -273,12 +274,11 @@ describe('ACTS_WifiTest', function () { ...@@ -273,12 +274,11 @@ describe('ACTS_WifiTest', function () {
console.info("connectState: " + result.connectState); console.info("connectState: " + result.connectState);
console.info("isGroupOwner: " + result.isGroupOwner); console.info("isGroupOwner: " + result.isGroupOwner);
console.info("groupOwnerAddr: " + result.groupOwnerAddr); console.info("groupOwnerAddr: " + result.groupOwnerAddr);
expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED); expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED);
expect(false).assertEqual(result.connectState ==P2pConnectState.DISCONNECTED); expect(false).assertEqual(result.connectState ==P2pConnectState.DISCONNECTED);
done();
});
});
done();
}) })
/** /**
......
...@@ -98,13 +98,10 @@ describe('ACTS_WifiTest', function() { ...@@ -98,13 +98,10 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi open result: " + enable); console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue(); expect(enable).assertTrue();
} }
console.info("[wifi_test] close wifi test start.");
var disable = wifi.disableWifi();
sleep(3000);
console.log("[wifi_test] wifi close result: " + disable);
expect(disable).assertTrue();
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertFalse(); expect(wifi.isWifiActive()).assertTrue();
sleep(3000);
}) })
/** /**
...@@ -123,7 +120,7 @@ describe('ACTS_WifiTest', function() { ...@@ -123,7 +120,7 @@ describe('ACTS_WifiTest', function() {
expect(enable).assertTrue(); expect(enable).assertTrue();
} }
var scan = wifi.scan(); var scan = wifi.scan();
sleep(3000); sleep(5000);
console.log("[wifi_test] open wifi scan result: " + scan); console.log("[wifi_test] open wifi scan result: " + scan);
expect(scan).assertTrue(); expect(scan).assertTrue();
...@@ -144,7 +141,7 @@ describe('ACTS_WifiTest', function() { ...@@ -144,7 +141,7 @@ describe('ACTS_WifiTest', function() {
} }
var clen = Object.keys(result).length; var clen = Object.keys(result).length;
console.log("[wifi_test] wifi getScanInfos callback result length: " + clen); console.log("[wifi_test] wifi getScanInfos callback result length: " + clen);
if (!(clen == 0 && i < 3)) { if (!(clen == 0)) {
expect(clen).assertLarger(0); expect(clen).assertLarger(0);
console.info("[wifi_test] getScanInfos callback result: " + JSON.stringify(result)); console.info("[wifi_test] getScanInfos callback result: " + JSON.stringify(result));
for (var j = 0; j < clen; ++j) { for (var j = 0; j < clen; ++j) {
...@@ -211,6 +208,7 @@ describe('ACTS_WifiTest', function() { ...@@ -211,6 +208,7 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Sta_Config_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0001]"); console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0001]");
console.info("[wifi_test] create a OPEN SecurityType wifi device config start."); console.info("[wifi_test] create a OPEN SecurityType wifi device config start.");
wifi.removeAllNetwork();
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST_OPEN", "ssid": "TEST_OPEN",
"bssid": "", "bssid": "",
...@@ -484,6 +482,7 @@ describe('ACTS_WifiTest', function() { ...@@ -484,6 +482,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test reconnect wifi * @tc.desc Test reconnect wifi
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, function () { it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, function () {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0001]");
console.info("[wifi_test] wifi connectToDevice test."); console.info("[wifi_test] wifi connectToDevice test.");
var wifiDeviceConfigConn = { var wifiDeviceConfigConn = {
"ssid": "TESTCONN", "ssid": "TESTCONN",
...@@ -509,10 +508,9 @@ describe('ACTS_WifiTest', function() { ...@@ -509,10 +508,9 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi isConnected result: " + isConnected); console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
console.info("[wifi_test] reconnect wifi"); console.info("[wifi_test] reconnect wifi");
var result= wifi.reconnect(); var reconn= wifi.reconnect();
sleep(5000); console.log("[wifi_test] wifi reconnect result: " + reconn);
console.log("[wifi_test] wifi reconnect result: " + result); expect(reconn).assertTrue();
expect(result).assertTrue();
console.info("[wifi_test] remove config"); console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -529,41 +527,44 @@ describe('ACTS_WifiTest', function() { ...@@ -529,41 +527,44 @@ describe('ACTS_WifiTest', function() {
* @tc.author wudangping wwx1075776 * @tc.author wudangping wwx1075776
* @tc.desc Test getLinkedInfo information * @tc.desc Test getLinkedInfo information
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0001]"); console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0002]");
console.info(' console.info("[wifi_js] Wifi get link infos test[1]."'); console.info(' console.info("[wifi_test] Wifi getlink infos test[1]."');
wifi.getLinkedInfo() await wifi.getLinkedInfo()
.then((result) => { .then((result) => {
console.info("[wifi_js] get wifi link [promise] -> " + JSON.stringify(result)); console.info("[wifi_test] get wifilink [promise] -> " + JSON.stringify(result));
expect(JSON.stringify(result)).assertContain('band'); expect(JSON.stringify(result)).assertContain('band');
console.info("[wifi_js] get wifi link [promise]."); console.info("[wifi_test] get wifi link [promise].");
done(); done();
}).catch((error) => { }).catch((error) => {
console.info("[wifi_js] promise then error." + JSON.stringify(error)); console.info("[wifi_test] promise then error." + JSON.stringify(error));
expect().assertFail(); expect().assertFail();
}); });
wifi.getLinkedInfo((err, result) => { wifi.getLinkedInfo(
if (err) { (err, result) => {
return console.error('failed to getlink infos callback because ' + JSON.stringify(err)); if(err) {
}else { console.error('failed to getlink infos callback because ' + JSON.stringify(err));
console.info("[wifi_test] get wifi link [callback] -> " + JSON.stringify(result));
for (var j = 0; j < JSON.stringify(result).length; ++j) {
console.info("ssid: " + result[j].ssid);
console.info("bssid: " + result[j].bssid);
console.info("band: " + result[j].band);
console.info("isHidden: " + result[j].isHidden);
console.info("isRestricted: " + result[j].isRestricted);
console.info("chload: " + result[j].chload);
console.info("rssi " + result[j].rssi);
console.info("netWorkId: " + result[j].netWorkId);
console.info("linkSpeed: " + result[j].linkSpeed);
console.info("frequency: " + result[j].frequency);
console.info("snr: " + result[j].snr);
console.info("macAddress: " + result[j].macAddress);
console.info("ipAddress: " + result[j].ipAddress);
console.info("suppState: " + result[j].suppState);
console.info("connState: " + result[j].connState);
} }
var clen = Object.key(result).length;
console.info("[wifi_test] get wifilink callback result length -> " + clen);
if(!(clen == 0)) {
console.info("[wifi_test] get wifi link [callback] -> " + JSON.stringify(result));
console.info("ssid: " + result.ssid);
console.info("bssid: " + result.bssid);
console.info("band: " + result.band);
console.info("isHidden: " + result.isHidden);
console.info("isRestricted: " + result.isRestricted);
console.info("chload: " + result.chload);
console.info("rssi " + result.rssi);
console.info("netWorkId: " + result.netWorkId);
console.info("linkSpeed: " + result.linkSpeed);
console.info("frequency: " + result.frequency);
console.info("snr: " + result.snr);
console.info("macAddress: " + result.macAddress);
console.info("ipAddress: " + result.ipAddress);
console.info("suppState: " + result.suppState);
console.info("connState: " + result.connState);
} }
done(); done();
}); });
...@@ -575,7 +576,8 @@ describe('ACTS_WifiTest', function() { ...@@ -575,7 +576,8 @@ describe('ACTS_WifiTest', function() {
* @tc.author wudangping wwx1075776 * @tc.author wudangping wwx1075776
* @tc.desc Test get IpInfo information * @tc.desc Test get IpInfo information
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, function () { it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, function () {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0003]");
console.info("[wifi_test] wifi connectToDevice test."); console.info("[wifi_test] wifi connectToDevice test.");
var wifiDeviceConfigIp = { var wifiDeviceConfigIp = {
"ssid": "TEST1", "ssid": "TEST1",
...@@ -593,10 +595,9 @@ describe('ACTS_WifiTest', function() { ...@@ -593,10 +595,9 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi isConnected result: " + isConnected); console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
console.info("[wifi_test] reassociate wifi"); console.info("[wifi_test] reassociate wifi");
var result= wifi.reassociate(); var reassoc= wifi.reassociate();
sleep(5000); console.log("[wifi_test] wifi reassociate result: " + reassoc);
console.log("[wifi_test] wifi reassociate result: " + result); expect(reassoc).assertTrue();
expect(result).assertTrue();
console.info("[wifi_test] get IpInfo."); console.info("[wifi_test] get IpInfo.");
var ipInfo = wifi.getIpInfo(); var ipInfo = wifi.getIpInfo();
console.info("[wifi_test] getIpInfo -> " + JSON.stringify(ipInfo)); console.info("[wifi_test] getIpInfo -> " + JSON.stringify(ipInfo));
...@@ -608,29 +609,14 @@ describe('ACTS_WifiTest', function() { ...@@ -608,29 +609,14 @@ describe('ACTS_WifiTest', function() {
console.info("primaryDns: " + ipInfo.primaryDns); console.info("primaryDns: " + ipInfo.primaryDns);
console.info("secondDns: " + ipInfo.secondDns); console.info("secondDns: " + ipInfo.secondDns);
console.info("serverIp: " + ipInfo.serverIp); console.info("serverIp: " + ipInfo.serverIp);
}) console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0);
/**
* @tc.number SUB_Communication_WiFi_Sta_ON_0001
* @tc.name testwifiStateChangeOn
* @tc.desc Test wifiStateChangeOn api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_ON_0001', 0, async function (done) {
console.info("[wifi_test] wifiStateChange On test");
try {
wifi.on('wifiStateChange', (data) => {
console.info("[wifi_test] wifiStateChangeOn ->" + data);
expect(true).assertEqual(data != null);
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
done();
}) })
/** /**
...@@ -642,156 +628,20 @@ describe('ACTS_WifiTest', function() { ...@@ -642,156 +628,20 @@ describe('ACTS_WifiTest', function() {
* @tc.type Function * @tc.type Function
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Sta_Off_0002', 0, async function (done) { it('SUB_Communication_WiFi_Sta_ON_0002', 0, async function (done) {
try {
wifi.off('wifiStateChange', function (data) {
console.info("[wifi_test] wifiStateChangeOff ->" + data);
expect(true).assertEqual(data != null);
console.info("[wifi_test] wifiStateChange unregister end");
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_ON_0003
* @tc.name testwifiConnectionChnageOn
* @tc.desc Test wifiConnectionChnageOn api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_ON_0003', 0, async function (done) {
console.info("[wifi_test] wifiConnectionChange On test"); console.info("[wifi_test] wifiConnectionChange On test");
try {
wifi.on('wifiConnectionChange', (data) => {
console.info("[wifi_test] wifiConnectionChange On ->" + data);
expect(true).assertEqual(data != null);
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
done();
})
/** await wifi.on('wifiConnectionChange',function (data) {
* @tc.number SUB_Communication_WiFi_Sta_Off_0004 console.info("[wifi_test] wifiConnectionChangeOn ->" + data);
* @tc.name testwifiConnectionChangeOff
* @tc.desc Test wifiConnectionChangeOff api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_Off_0004', 0, async function (done) {
try {
wifi.off('wifiConnectionChange', (data) => {
console.info("[wifi_test] wifiConnectionChange Off ->" + data);
expect(true).assertEqual(data != null); expect(true).assertEqual(data != null);
console.info("[wifi_test] wifiConnectionChange unregister end");
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
done(); done();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_ON_0005
* @tc.name testwifiScanStateChangeOn
* @tc.desc Test wifiwifiScanStateChangeOn api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_ON_0005', 0, async function (done) {
console.info("[wifi_test]wifiScanStateChange On test");
try {
wifi.on('wifiScanStateChange', (data) => {
console.info("[wifi_test] wifiScanStateChange On ->" + data);
expect(true).assertEqual(data != null);
}); });
await(3000); wifi.off('wifiConnectionChange',function (data) {
}catch(e) { console.info("[wifi_test] wifiConnectionChangeOff ->" + data);
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_Off_0006
* @tc.name testwifiScanStateChangeOff
* @tc.desc Test wifiScanStateChangeOff api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_Off_0006', 0, async function (done) {
try {
wifi.off('wifiScanStateChange', (data) => {
console.info("[wifi_test] wifiScanStateChange Off ->" + data);
expect(true).assertEqual(data != null); expect(true).assertEqual(data != null);
console.info("[wifi_test] wifiScanStateChange unregister end");
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
done(); done();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_ON_0007
* @tc.name testwifiRssiChangeOn
* @tc.desc Test wifiRssiChangeOn api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_ON_0007', 0, async function (done) {
console.info("[wifi_test]wifiRssiChange On test");
try {
wifi.on('wifiRssiChange', (data) => {
console.info("[wifi_test] wifiRssiChange On ->" + data);
expect(true).assertEqual(data != null);
}); });
await(3000);
}catch(e) {
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_Off_0008
* @tc.name testwifiRssiChangeOff
* @tc.desc Test wifiRssiChange api
* @tc.author wudangping wwx1075776.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_Off_0008', 0, async function (done) {
try {
wifi.off('wifiRssiChange', (data) => {
console.info("[wifi_test] wifiRssiChange Off ->" + data);
expect(true).assertEqual(data != null);
console.info("[wifi_test] wifiRssiChange unregister end");
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
done();
}) })
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册