提交 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')
require('./WifiSoftAP.test.js')
require('./WifiP2P.test.js')
......@@ -149,8 +149,8 @@ describe('ACTS_WifiTest', function () {
expect(addConfig).assertTrue();
await wifi.getCurrentGroup()
.then((data) => {
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(data.length!=0);
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(data.length!=0);
}).catch((error) => {
console.info("[wifi_js]getCurrentGroup promise then error." + JSON.stringify(error));
expect().assertFail();
......@@ -262,7 +262,8 @@ describe('ACTS_WifiTest', function () {
expect(true).assertEqual(data.length!=0);
}).catch((error) => {
console.info("[wifi_test]getP2pLinkedInfo promise then error." + JSON.stringify(error));
expect().assertFail();
expect(error).assertFail();
});
wifi.getP2pLinkedInfo((err, result) => {
if (err) {
......@@ -273,12 +274,11 @@ describe('ACTS_WifiTest', function () {
console.info("connectState: " + result.connectState);
console.info("isGroupOwner: " + result.isGroupOwner);
console.info("groupOwnerAddr: " + result.groupOwnerAddr);
expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED);
expect(false).assertEqual(result.connectState ==P2pConnectState.DISCONNECTED);
done();
});
done();
})
/**
......
......@@ -61,7 +61,7 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Open_0002', 0, function () {
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Open_0002");
console.info("[wifi_test] enableHotspot and disableHotspot test start.");
if (wifi.isWifiActive()) {
if (wifi.isWifiActive()) {
var disable = wifi.disableWifi();
sleep(5000);
console.log("[wifi_test] wifi close result: " + disable);
......@@ -69,49 +69,16 @@ describe('ACTS_WifiTest', function() {
}
var close =wifi.isWifiActive();
console.info("[wifi_test] wifi status result: " + close);
expect(close).assertTrue();
if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot();
sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue();
}
console.info('[wifi_test] test enableHotspot and disableHotspot');
var enHot = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + enHot);
expect(wifi.isHotspotActive()).assertTrue();
var disHot = wifi.disableHotspot();
sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + disHot);
console.info("[wifi_test] enableHotspot result -> " + wifi.isHotspotActive());
expect(wifi.isHotspotActive()).assertFalse();
console.info("[wifi_test] enableHotspot and disableHotspot test end.");
})
/**
* @tc.number OPEN_0003
* @tc.name SUB_Communication_WiFi_Hotspot_Open_0003
* @tc.author wudangping wwx1075776
* @tc.desc Test open Hotspot after open wifi
* @tc.level Level 1
*/
it('SUB_Communication_WiFi_Hotspot_Open_0003', 0, function () {
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Open_0003");
if (wifi.isHotspotActive()) {
console.info("[wifi_test] close Hotspot test start.");
var off = wifi.disableHotspot();
expect(close).assertFalse();
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue();
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.info('[wifi_test] test close wifi and enableHotspot start');
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
console.info("[wifi_test] AP status result -> " + wifi.isHotspotActive());
expect(wifi.isHotspotActive()).assertTrue();
expect(wifi.isWifiActive()).assertFalse();
console.info("[wifi_test] enableHotspot and close wifi test end.");
})
/**
......@@ -130,33 +97,21 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue();
}
console.info("[wifi_test] AP status result -> " + wifi.isHotspotActive());
expect(wifi.isHotspotActive()).assertFalse();
var isSuccess = wifi.setHotspotConfig(HotspotConfig);
console.log("[wifi_test] set 2.4G hotspot config result: " + isSuccess);
expect(isSuccess).assertTrue();
console.info("[wifi_test] check the state of hotspot, if it's inactive, open it.");
if(!wifi.isHotspotActive()) {
console.info("[wifi_test] open Hotspot test start.");
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_js] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot " );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
console.info("[wifi_test] check band of current band should be 2.4G.");
var hotspotConfig = wifi.getHotspotConfig();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfig));
expect(hotspotConfig.band).assertEqual(1);
})
/**
/**
* @tc.number CONFIG_0002
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0002
* @tc.author wudangping wwx1075776
* @tc.desc Test set a valid 5G hotspot config
* @tc.level Level 1
*/
......@@ -179,18 +134,6 @@ describe('ACTS_WifiTest', function() {
var isSuccess5 = wifi.setHotspotConfig(HotspotConfig5G);
console.log("[wifi_test] set 5G hotspot config result1: " + isSuccess5);
expect(isSuccess5).assertFalse();
console.info("[wifi_test] check the state of hotspot, if it's inactive, open it.");
if (!wifi.isHotspotActive()) {
console.info("[wifi_test] open Hotspot test start.");
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
console.info("[wifi_test] check band of current band should be 5G.");
var hotspotConfig5 = wifi.getHotspotConfig();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfig5));
......@@ -200,7 +143,6 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0003
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0003
* @tc.author wudangping wwx1075776
* @tc.desc Test set a invalid hotspot config
* @tc.level Level 2
*/
......@@ -208,7 +150,7 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test] set a invalid hotspot config start.");
if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot();
sleep(5000);
sleep(10000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue();
}
......@@ -228,7 +170,6 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0004
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0004
* @tc.author wudangping wwx1075776
* @tc.desc Test set a max preSharedKey is hotspot config
* @tc.level Level 2
*/
......@@ -252,17 +193,6 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM);
console.log("[wifi_test] set max preSharedKey valid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertTrue();
console.info("[wifi_test] check the state of hotspot, if it's inactivated, open it.");
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot " );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
console.log("[wifi_test] set 65 preSharedKey invalid hotspot config " );
var HotspotConfigM1= {
"ssid": "testWgr",
......@@ -279,7 +209,6 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0005
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0005
* @tc.author wudangping wwx1075776
* @tc.desc Test set a min preSharedKey is hotspot config
* @tc.level Level 2
*/
......@@ -328,7 +257,6 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0006
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0006
* @tc.author wudangping wwx1075776
* @tc.desc Test set a max ssid for hotspot config
* @tc.level Level 2
*/
......@@ -337,9 +265,13 @@ describe('ACTS_WifiTest', function() {
if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot();
sleep(5000);
console.info("[wifi_js] disableHotspot result -> " + off);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(on2).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertFalse();
console.log("[wifi_test] set max ssid invalid hotspot config" );
var HotspotConfigS= {
"ssid": "testWgr123testWgr123testWgr12356",
......@@ -351,13 +283,7 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigS);
console.log("[wifi_test] set 32bit ssid invalid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertTrue();
console.info("[wifi_test] check the state of hotspot, if it's inactivated, open it.");
if (!wifi.isHotspotActive()) {
var on2 = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on2);
expect(on2).assertTrue();
}
console.log("[wifi_test] set 33bit ssid invalid hotspot config" );
var HotspotConfigS1= {
"ssid": "testWgr123testWgr123testWgr123567",
......@@ -370,17 +296,11 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] set 33bit ssid invalid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertFalse();
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
})
/**
* @tc.number CONFIG_0007
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0007
* @tc.author wudangping wwx1075776
* @tc.desc Test set a null ssid invalid hotspot config
* @tc.level Level 2
*/
......@@ -406,7 +326,6 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0008
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0008
* @tc.author wudangping wwx1075776
* @tc.desc Test set a contains Chinese.special.digits valid hotspot config
* @tc.level Level 2
*/
......@@ -423,22 +342,15 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] set a valid hotspot config result1:" + isSuccess1);
expect(isSuccess1).assertTrue();
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot " );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
expect(isHotspotActive).assertFalse();
})
/**
* @tc.number CONFIG_0009
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0009
* @tc.author wudangping wwx1075776
* @tc.desc Test set a invalid preSharedKey hotspot config
* @tc.level Level 2
*/
......@@ -489,7 +401,6 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0010
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0010
* @tc.author wudangping wwx1075776
* @tc.desc Test set a valid PSK preSharedKey hotspot config
* @tc.level Level 2
*/
......@@ -514,25 +425,16 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigPSK);
console.log("[wifi_test] set a PSK preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue();
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
expect(isHotspotActive).assertFalse();
})
/**
* @tc.number CONFIG_0011
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0011
* @tc.author wudangping wwx1075776
* @tc.desc Test set a valid OPEN preSharedKey hotspot config
* @tc.level Level 2
*/
......@@ -556,75 +458,15 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] set a open preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue();
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
})
/**
* @tc.number CONFIG_0012
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0012
* @tc.author wudangping wwx1075776
* @tc.desc Test set a valid hotspot config after open Hotspot
* @tc.level Level 2
*/
it('SUB_Communication_WiFi_Hotspot_Config_0012', 0, function () {
console.info("[wifi_test] wifi enableHotspot start.");
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
console.info("[wifi_test] open Hotspot, set valid hotspot config start.");
var HotspotConfigO= {
"ssid": "测试3@%&*",
"band": 1,
"preSharedKey": "12345678",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8
}
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigO);
console.log("[wifi_test] set a PSK preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue();
console.info("[wifi_test] check the current config.");
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
console.info("band: " + config.band);
console.info("preSharedKey: " + config.preSharedKey);
console.info("securityType: " + config.securityType);
console.info("maxConn: " + config.maxConn);
console.info("[wifi_test] check the current config is same with set before.");
expect(config.ssid).assertEqual('测试3@%&*');
expect(config.band).assertEqual(1);
expect(config.preSharedKey).assertEqual('12345678');
expect(config.securityType).assertEqual(3);
expect(config.maxConn).assertEqual(8);
console.info("[wifi_test] check the state of hotspot, if it's inactivated, open it.");
expect(wifi.isHotspotActive()).assertTrue();
})
/**
* @tc.number CONN_0001
* @tc.name SUB_Communication_WiFi_Hotspot_Conn_0001
* @tc.author wudangping wwx1075776
* @tc.desc Test set a maxConn and more maxConn hotspot config
* @tc.level Level 2
*/
it('SUB_Communication_WiFi_Hotspot_Conn_0001', 0, function () {
it('SUB_Communication_WiFi_Hotspot_Conn_0001', 0, function () {
console.info("[wifi_test] check the state of hotspot, if it's open, close it.");
if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot();
......@@ -668,10 +510,56 @@ describe('ACTS_WifiTest', function() {
expect(config.maxConn).assertEqual(8);
})
/**
* @tc.number CONFIG_0012
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0012
* @tc.desc Test set a valid hotspot config after open Hotspot
* @tc.level Level 2
*/
it('SUB_Communication_WiFi_Hotspot_Config_0012', 0, function () {
console.info("[wifi_test] wifi enableHotspot start.");
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0012.");
if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot();
sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue();
}
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue();
console.info("[wifi_test] open Hotspot, set valid hotspot config start.");
var HotspotConfigO= {
"ssid": "测试3@%&*",
"band": 1,
"preSharedKey": "12345678",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8
}
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigO);
console.log("[wifi_test] set a PSK preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue();
console.info("[wifi_test] check the current config.");
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
console.info("band: " + config.band);
console.info("preSharedKey: " + config.preSharedKey);
console.info("securityType: " + config.securityType);
console.info("maxConn: " + config.maxConn);
console.info("[wifi_test] check the current config is same with set before.");
expect(config.ssid).assertEqual('测试3@%&*');
expect(config.band).assertEqual(1);
expect(config.preSharedKey).assertEqual('12345678');
expect(config.securityType).assertEqual(3);
expect(config.maxConn).assertEqual(8);
})
/**
* @tc.number CONN_0002
* @tc.name SUB_Communication_WiFi_Hotspot_Conn_0002
* @tc.author wudangping wwx1075776
* @tc.desc Test Obtains the list of clients that are connected to a Wi-Fi hotspot.
* @tc.level Level 2
*/
......@@ -694,14 +582,12 @@ describe('ACTS_WifiTest', function() {
console.info("ssid: " + stationInfo.name);
console.info("macAddress: " + stationInfo.macAddress);
console.info("ipAddress: " + stationInfo.ipAddress);
expect(config).assertEqual(8);
})
/**
* @tc.number SUB_Communication_WiFi_Hotspot_ON_0001
* @tc.name testhotspotStateChangeOn
* @tc.author wudangping wwx1075776
* @tc.desc Test hotspotStateChangeOn api.
* @tc.size MEDIUM
* @tc.type Function
......@@ -725,7 +611,6 @@ describe('ACTS_WifiTest', function() {
* @tc.number SUB_Communication_WiFi_Hotspot_Off_0002
* @tc.name testhotspotStateChangeOff
* @tc.desc Test hotspotStateChange api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
......@@ -748,7 +633,6 @@ describe('ACTS_WifiTest', function() {
* @tc.number SUB_Communication_WiFi_Hotspot_ON_0003
* @tc.name testhotspotStaJoinOn
* @tc.desc Test hotspotStaJoinOn api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
......@@ -771,7 +655,6 @@ describe('ACTS_WifiTest', function() {
* @tc.number SUB_Communication_WiFi_Hotspot_Off_0004
* @tc.name testhotspotStaJoinOff
* @tc.desc Test hotspotStaJoin api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
......@@ -794,7 +677,6 @@ describe('ACTS_WifiTest', function() {
* @tc.number SUB_Communication_WiFi_Hotspot_ON_0005
* @tc.name testhotspotStaLeaveOn
* @tc.desc Test hotspotStaLeaveOn api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
......@@ -817,7 +699,6 @@ describe('ACTS_WifiTest', function() {
* @tc.number SUB_Communication_WiFi_Hotspot_Off_0006
* @tc.name testhotspotStaLeaveOff
* @tc.desc Test hotspotStaLeave api.
* @tc.author wudangping wwx1075776
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
......
......@@ -98,13 +98,10 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi open result: " + enable);
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());
expect(wifi.isWifiActive()).assertFalse();
expect(wifi.isWifiActive()).assertTrue();
sleep(3000);
})
/**
......@@ -123,7 +120,7 @@ describe('ACTS_WifiTest', function() {
expect(enable).assertTrue();
}
var scan = wifi.scan();
sleep(3000);
sleep(5000);
console.log("[wifi_test] open wifi scan result: " + scan);
expect(scan).assertTrue();
......@@ -144,7 +141,7 @@ describe('ACTS_WifiTest', function() {
}
var clen = Object.keys(result).length;
console.log("[wifi_test] wifi getScanInfos callback result length: " + clen);
if (!(clen == 0 && i < 3)) {
if (!(clen == 0)) {
expect(clen).assertLarger(0);
console.info("[wifi_test] getScanInfos callback result: " + JSON.stringify(result));
for (var j = 0; j < clen; ++j) {
......@@ -211,6 +208,7 @@ describe('ACTS_WifiTest', function() {
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] create a OPEN SecurityType wifi device config start.");
wifi.removeAllNetwork();
var wifiDeviceConfig1 = {
"ssid": "TEST_OPEN",
"bssid": "",
......@@ -295,7 +293,7 @@ describe('ACTS_WifiTest', function() {
expect(true).assertEqual(configs.length == 0);
});
done()
})
})
/**
* @tc.number Config_0005
......@@ -484,6 +482,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test reconnect wifi
*/
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.");
var wifiDeviceConfigConn = {
"ssid": "TESTCONN",
......@@ -509,10 +508,9 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
console.info("[wifi_test] reconnect wifi");
var result= wifi.reconnect();
sleep(5000);
console.log("[wifi_test] wifi reconnect result: " + result);
expect(result).assertTrue();
var reconn= wifi.reconnect();
console.log("[wifi_test] wifi reconnect result: " + reconn);
expect(reconn).assertTrue();
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
......@@ -529,44 +527,47 @@ describe('ACTS_WifiTest', function() {
* @tc.author wudangping wwx1075776
* @tc.desc Test getLinkedInfo information
*/
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0001]");
console.info(' console.info("[wifi_js] Wifi get link infos test[1]."');
wifi.getLinkedInfo()
it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0002]");
console.info(' console.info("[wifi_test] Wifi getlink infos test[1]."');
await wifi.getLinkedInfo()
.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');
console.info("[wifi_js] get wifi link [promise].");
console.info("[wifi_test] get wifi link [promise].");
done();
}).catch((error) => {
console.info("[wifi_js] promise then error." + JSON.stringify(error));
console.info("[wifi_test] promise then error." + JSON.stringify(error));
expect().assertFail();
});
wifi.getLinkedInfo((err, result) => {
if (err) {
return console.error('failed to getlink infos callback because ' + JSON.stringify(err));
}else {
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);
wifi.getLinkedInfo(
(err, result) => {
if(err) {
console.error('failed to getlink infos callback because ' + JSON.stringify(err));
}
}
done();
});
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();
});
})
/**
......@@ -575,7 +576,8 @@ describe('ACTS_WifiTest', function() {
* @tc.author wudangping wwx1075776
* @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.");
var wifiDeviceConfigIp = {
"ssid": "TEST1",
......@@ -593,10 +595,9 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
console.info("[wifi_test] reassociate wifi");
var result= wifi.reassociate();
sleep(5000);
console.log("[wifi_test] wifi reassociate result: " + result);
expect(result).assertTrue();
var reassoc= wifi.reassociate();
console.log("[wifi_test] wifi reassociate result: " + reassoc);
expect(reassoc).assertTrue();
console.info("[wifi_test] get IpInfo.");
var ipInfo = wifi.getIpInfo();
console.info("[wifi_test] getIpInfo -> " + JSON.stringify(ipInfo));
......@@ -608,29 +609,14 @@ describe('ACTS_WifiTest', function() {
console.info("primaryDns: " + ipInfo.primaryDns);
console.info("secondDns: " + ipInfo.secondDns);
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() {
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_Off_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) {
it('SUB_Communication_WiFi_Sta_ON_0002', 0, async function (done) {
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();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_Off_0004
* @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);
console.info("[wifi_test] wifiConnectionChange unregister end");
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
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);
}catch(e) {
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);
console.info("[wifi_test] wifiScanStateChange unregister end");
});
await(3000);
}catch(e) {
expect(null).assertFail();
}
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();
})
await wifi.on('wifiConnectionChange',function (data) {
console.info("[wifi_test] wifiConnectionChangeOn ->" + data);
expect(true).assertEqual(data != null);
done();
});
wifi.off('wifiConnectionChange',function (data) {
console.info("[wifi_test] wifiConnectionChangeOff ->" + data);
expect(true).assertEqual(data != null);
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*************");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册