未验证 提交 dc349576 编写于 作者: O openharmony_ci 提交者: Gitee

!2759 【communication】修改XTS 代码检视问题2

Merge pull request !2759 from 权力/master
...@@ -29,7 +29,7 @@ async function tryToDisableWifi(){ ...@@ -29,7 +29,7 @@ async function tryToDisableWifi(){
console.info("wifi_test/wifi status:" + wifi.isWifiActive()); console.info("wifi_test/wifi status:" + wifi.isWifiActive());
} }
var WifiSecurityType = { let WifiSecurityType = {
WIFI_SEC_TYPE_INVALID : 0, WIFI_SEC_TYPE_INVALID : 0,
WIFI_SEC_TYPE_OPEN : 1, WIFI_SEC_TYPE_OPEN : 1,
WIFI_SEC_TYPE_WEP : 2, WIFI_SEC_TYPE_WEP : 2,
...@@ -37,7 +37,7 @@ var WifiSecurityType = { ...@@ -37,7 +37,7 @@ var WifiSecurityType = {
WIFI_SEC_TYPE_SAE : 4, WIFI_SEC_TYPE_SAE : 4,
} }
var HotspotConfig = { let HotspotConfig = {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -60,15 +60,15 @@ describe('ACTS_WifiTest', function() { ...@@ -60,15 +60,15 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Hotspot_Open_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Open_0002', 0, async function (done) {
if (wifi.isWifiActive()) { if (wifi.isWifiActive()) {
var disable = wifi.disableWifi(); let disable = wifi.disableWifi();
await sleep(5000); await sleep(5000);
expect(disable).assertTrue(); expect(disable).assertTrue();
} }
var close =wifi.isWifiActive(); let close =wifi.isWifiActive();
console.info("[wifi_test] wifi status result: " + close); console.info("[wifi_test] wifi status result: " + close);
expect(close).assertFalse(); expect(close).assertFalse();
if (!wifi.isHotspotActive()) { if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot(); let on = wifi.enableHotspot();
await sleep(5000); await sleep(5000);
expect(on).assertTrue(); expect(on).assertTrue();
} }
...@@ -86,16 +86,16 @@ describe('ACTS_WifiTest', function() { ...@@ -86,16 +86,16 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0001', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0001', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive()); console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive());
expect(wifi.isHotspotActive()).assertFalse(); expect(wifi.isHotspotActive()).assertFalse();
var isSuccess = wifi.setHotspotConfig(HotspotConfig); let isSuccess = wifi.setHotspotConfig(HotspotConfig);
expect(isSuccess).assertTrue(); expect(isSuccess).assertTrue();
var hotspotConfig = wifi.getHotspotConfig(); let hotspotConfig = wifi.getHotspotConfig();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfig)); console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfig));
expect(hotspotConfig.band).assertEqual(1); expect(hotspotConfig.band).assertEqual(1);
done() done()
...@@ -110,24 +110,24 @@ describe('ACTS_WifiTest', function() { ...@@ -110,24 +110,24 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0002', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive()); console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive());
var HotspotConfig5G = { let HotspotConfig5G = {
"ssid": "testWgr", "ssid": "testWgr",
"band": 2, "band": 2,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess5 = wifi.setHotspotConfig(HotspotConfig5G); let isSuccess5 = wifi.setHotspotConfig(HotspotConfig5G);
expect(isSuccess5).assertFalse(); expect(isSuccess5).assertTrue();
var hotspotConfig5 = wifi.getHotspotConfig(); let hotspotConfig5 = wifi.getHotspotConfig();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfig5)); console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfig5));
expect(hotspotConfig5.band).assertEqual(1); expect(hotspotConfig5.band).assertEqual(2);
done() done()
}) })
...@@ -140,19 +140,19 @@ describe('ACTS_WifiTest', function() { ...@@ -140,19 +140,19 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0003', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0003', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
console.info("[wifi_test] disableHotspot result -> " + off); console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfig1= { let HotspotConfig1= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 21, "band": 21,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfig1); let isSuccess1 = wifi.setHotspotConfig(HotspotConfig1);
console.log("[wifi_test] set invalid band hotspot config result1:" + isSuccess1); console.log("[wifi_test] set invalid band hotspot config result1:" + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
done(); done();
...@@ -169,31 +169,31 @@ describe('ACTS_WifiTest', function() { ...@@ -169,31 +169,31 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0004', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0004', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigM= { let HotspotConfigM= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "123456789123456789123456789123456789123456789123456789123456789", "preSharedKey": "123456789123456789123456789123456789123456789123456789123456789",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigM);
console.log("[wifi_test] set max preSharedKey valid hotspot config result: " + isSuccess1); console.log("[wifi_test] set max preSharedKey valid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var HotspotConfigM1= { let HotspotConfigM1= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "1234567891234567891234567891234567891234567891234567891234567891", "preSharedKey": "1234567891234567891234567891234567891234567891234567891234567891",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM1); let isSuccess2 = wifi.setHotspotConfig(HotspotConfigM1);
expect(isSuccess1).assertFalse(); expect(isSuccess2).assertFalse();
var hotspotConfigS= wifi.getHotspotConfig(); let hotspotConfigS= wifi.getHotspotConfig();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfigS)); console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfigS));
expect(hotspotConfigS.preSharedKey.length).assertEqual(63); expect(hotspotConfigS.preSharedKey.length).assertEqual(63);
done(); done();
...@@ -208,39 +208,39 @@ describe('ACTS_WifiTest', function() { ...@@ -208,39 +208,39 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0005', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0005', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigI= { let HotspotConfigI= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigI);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("preSharedKey: " + config.preSharedKey); console.info("preSharedKey: " + config.preSharedKey);
expect(config.preSharedKey.length).assertEqual(8); expect(config.preSharedKey.length).assertEqual(8);
var HotspotConfigI2= { let HotspotConfigI2= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "1234567", "preSharedKey": "1234567",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI2); let isSuccess2 = wifi.setHotspotConfig(HotspotConfigI2);
expect(isSuccess1).assertFalse(); expect(isSuccess2).assertFalse();
var config = wifi.getHotspotConfig(); let config1 = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config1));
expect(config.preSharedKey.length).assertEqual(8); expect(config1.preSharedKey.length).assertEqual(8);
done(); done();
}) })
...@@ -253,35 +253,35 @@ describe('ACTS_WifiTest', function() { ...@@ -253,35 +253,35 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0006', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0006', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var isHotspotActive = wifi.isHotspotActive(); let isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertFalse(); expect(isHotspotActive).assertFalse();
var HotspotConfigS= { let HotspotConfigS= {
"ssid": "testWgr123testWgr123testWgr12356", "ssid": "testWgr123testWgr123testWgr12356",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigS); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigS);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var HotspotConfigS1= { let HotspotConfigS1= {
"ssid": "testWgr123testWgr123testWgr123567", "ssid": "testWgr123testWgr123testWgr123567",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigS1); let isSuccess2 = wifi.setHotspotConfig(HotspotConfigS1);
console.log("[wifi_test] set 33bit ssid invalid hotspot config result: " + isSuccess1); console.log("[wifi_test] set 33bit ssid invalid hotspot config result: " + isSuccess2);
expect(isSuccess1).assertFalse(); expect(isSuccess2).assertFalse();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
expect(config.ssid.length).assertEqual(32); expect(config.ssid.length).assertEqual(32);
done(); done();
...@@ -297,18 +297,18 @@ describe('ACTS_WifiTest', function() { ...@@ -297,18 +297,18 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0007', 0, async function(done) { it('SUB_Communication_WiFi_Hotspot_Config_0007', 0, async function(done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(2000); await sleep(2000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigN= { let HotspotConfigN= {
"ssid": "", "ssid": "",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigN); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigN);
console.log("[wifi_test] set a null ssid invalid hotspot config result1:" + isSuccess1); console.log("[wifi_test] set a null ssid invalid hotspot config result1:" + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
done(); done();
...@@ -322,24 +322,24 @@ describe('ACTS_WifiTest', function() { ...@@ -322,24 +322,24 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0008', 0, async function(done) { it('SUB_Communication_WiFi_Hotspot_Config_0008', 0, async function(done) {
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigC= { let HotspotConfigC= {
"ssid": "测试123!@#¥%……&*( ", "ssid": "测试123!@#¥%……&*( ",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigC); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigC);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var isHotspotActive = wifi.isHotspotActive(); let isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertFalse(); expect(isHotspotActive).assertFalse();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
expect(true).assertEqual(config.ssid==HotspotConfigC.ssid); expect(true).assertEqual(config.ssid==HotspotConfigC.ssid);
done(); done();
...@@ -354,41 +354,41 @@ describe('ACTS_WifiTest', function() { ...@@ -354,41 +354,41 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0009', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0009', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigWep= { let HotspotConfigWep= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_WEP, "securityType":WifiSecurityType.WIFI_SEC_TYPE_WEP,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigWep); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigWep);
console.log("[wifi_test] set a invalid preSharedKey hotspot config result1: " + isSuccess1); console.log("[wifi_test] set a invalid preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
var HotspotConfigSAE= { let HotspotConfigSAE= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_SAE, "securityType":WifiSecurityType.WIFI_SEC_TYPE_SAE,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess2 = wifi.setHotspotConfig(HotspotConfigSAE); let isSuccess2 = wifi.setHotspotConfig(HotspotConfigSAE);
console.log("[wifi_test] set a invalid preSharedKey hotspot config result1: " + isSuccess2); console.log("[wifi_test] set a invalid preSharedKey hotspot config result1: " + isSuccess2);
expect(isSuccess2).assertFalse(); expect(isSuccess2).assertFalse();
var HotspotConfigC= { let HotspotConfigC= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType":12, "securityType":12,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess3 = wifi.setHotspotConfig(HotspotConfigC); let isSuccess3 = wifi.setHotspotConfig(HotspotConfigC);
console.log("[wifi_test] set a invalid preSharedKey hotspot config result1: " + isSuccess3); console.log("[wifi_test] set a invalid preSharedKey hotspot config result1: " + isSuccess3);
expect(isSuccess3).assertFalse(); expect(isSuccess3).assertFalse();
done(); done();
...@@ -404,25 +404,25 @@ describe('ACTS_WifiTest', function() { ...@@ -404,25 +404,25 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0010', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0010', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigPSK= { let HotspotConfigPSK= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType":WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
} }
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigPSK); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigPSK);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
expect(config.securityType).assertEqual(3); expect(config.securityType).assertEqual(3);
console.log("[wifi_test] check the state of Hotspot" ); console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive(); let isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertFalse(); expect(isHotspotActive).assertFalse();
done(); done();
...@@ -438,22 +438,22 @@ describe('ACTS_WifiTest', function() { ...@@ -438,22 +438,22 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0011', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0011', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigO= { let HotspotConfigO= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
"preSharedKey": "", "preSharedKey": "",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_OPEN, "securityType":WifiSecurityType.WIFI_SEC_TYPE_OPEN,
"maxConn": 8 "maxConn": 8
} }
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigO); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigO);
console.log("[wifi_test] set a open preSharedKey hotspot config result1: " + isSuccess1); console.log("[wifi_test] set a open preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
expect(config.securityType).assertEqual(1); expect(config.securityType).assertEqual(1);
done(); done();
...@@ -469,38 +469,38 @@ describe('ACTS_WifiTest', function() { ...@@ -469,38 +469,38 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Conn_0001', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Conn_0001', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); let off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigI= { let HotspotConfigI= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "12345678",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigI);
console.log("[wifi_test] set maxConn valid hotspot config result: " + isSuccess1); console.log("[wifi_test] set maxConn valid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
expect(config.maxConn).assertEqual(8); expect(config.maxConn).assertEqual(8);
var HotspotConfigI2= { let HotspotConfigI2= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
"preSharedKey": "1234567", "preSharedKey": "1234567",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 9 "maxConn": 9
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI2); let isSuccess2 = wifi.setHotspotConfig(HotspotConfigI2);
console.log("[wifi_test] set more maxConn invalid hotspot config result: " + isSuccess1); console.log("[wifi_test] set more maxConn invalid hotspot config result: " + isSuccess2);
expect(isSuccess1).assertFalse(); expect(isSuccess2).assertFalse();
var config = wifi.getHotspotConfig(); let config1 = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config1));
expect(config.maxConn).assertEqual(8); expect(config1.maxConn).assertEqual(8);
done(); done();
}) })
...@@ -513,24 +513,24 @@ describe('ACTS_WifiTest', function() { ...@@ -513,24 +513,24 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Config_0012', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0012', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (!wifi.isHotspotActive()) { if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot(); let on = wifi.enableHotspot();
await sleep(5000); await sleep(5000);
expect(on).assertTrue(); expect(on).assertTrue();
} }
var isHotspotActive = wifi.isHotspotActive(); let isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue(); expect(isHotspotActive).assertTrue();
var HotspotConfigWO= { let HotspotConfigWO= {
"ssid": "WIFITEST", "ssid": "WIFITEST",
"band": 1, "band": 1,
"preSharedKey": "123456789", "preSharedKey": "123456789",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
} }
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigWO); let isSuccess1 = wifi.setHotspotConfig(HotspotConfigWO);
console.log("[wifi_test] set a psk preSharedKey hotspot config result1: " + isSuccess1); console.log("[wifi_test] set a psk preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
var config = wifi.getHotspotConfig(); let config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
expect(config.ssid).assertEqual('WIFITEST'); expect(config.ssid).assertEqual('WIFITEST');
done(); done();
...@@ -547,14 +547,14 @@ describe('ACTS_WifiTest', function() { ...@@ -547,14 +547,14 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Hotspot_Conn_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Conn_0002', 0, async function (done) {
await tryToDisableWifi(); await tryToDisableWifi();
if (!wifi.isHotspotActive()) { if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot(); let on = wifi.enableHotspot();
await sleep(5000); await sleep(5000);
expect(on).assertTrue(); expect(on).assertTrue();
} }
var isHotspotActive = wifi.isHotspotActive(); let isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue(); expect(isHotspotActive).assertTrue();
var stationInfo = wifi.getStations(); let stationInfo = wifi.getStations();
console.info("[wifi_test] getStations result ->" + JSON.stringify(stationInfo)); console.info("[wifi_test] getStations result ->" + JSON.stringify(stationInfo));
console.info("ssid: " + stationInfo.name + console.info("ssid: " + stationInfo.name +
"macAddress: " + stationInfo.macAddress + "macAddress: " + stationInfo.macAddress +
...@@ -700,3 +700,4 @@ describe('ACTS_WifiTest', function() { ...@@ -700,3 +700,4 @@ describe('ACTS_WifiTest', function() {
}) })
...@@ -29,7 +29,7 @@ async function tryToEnableWifi(){ ...@@ -29,7 +29,7 @@ async function tryToEnableWifi(){
console.info("wifi_test/wifi status:" + wifi.isWifiActive()); console.info("wifi_test/wifi status:" + wifi.isWifiActive());
} }
var GroupOwnerBand = { let GroupOwnerBand = {
GO_BAND_AUTO : 0, GO_BAND_AUTO : 0,
GO_BAND_2GHZ : 1, GO_BAND_2GHZ : 1,
GO_BAND_5GHZ : 2, GO_BAND_5GHZ : 2,
...@@ -50,7 +50,7 @@ describe('ACTS_WifiTest', function () { ...@@ -50,7 +50,7 @@ describe('ACTS_WifiTest', function () {
it('SUB_Communication_WiFi_P2P_Setting_0001', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Setting_0001', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
console.info("[wifi_test] test setDeviceName start."); console.info("[wifi_test] test setDeviceName start.");
var devName = wifi.setDeviceName("P2PTest"); let devName = wifi.setDeviceName("P2PTest");
console.info("[wifi_test] test start setDeviceName->" + devName); console.info("[wifi_test] test start setDeviceName->" + devName);
expect(devName).assertTrue(); expect(devName).assertTrue();
done(); done();
...@@ -63,7 +63,7 @@ describe('ACTS_WifiTest', function () { ...@@ -63,7 +63,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
...@@ -73,12 +73,12 @@ describe('ACTS_WifiTest', function () { ...@@ -73,12 +73,12 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig); let addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000); await sleep(2000);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length; let resultLength = Object.keys(data).length;
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0); expect(true).assertEqual(resultLength!=0);
}).catch((error) => { }).catch((error) => {
...@@ -96,7 +96,7 @@ describe('ACTS_WifiTest', function () { ...@@ -96,7 +96,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
...@@ -106,7 +106,7 @@ describe('ACTS_WifiTest', function () { ...@@ -106,7 +106,7 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig); let addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000); await sleep(2000);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
...@@ -127,7 +127,7 @@ describe('ACTS_WifiTest', function () { ...@@ -127,7 +127,7 @@ describe('ACTS_WifiTest', function () {
+ "groupName: " + result.groupName + + "groupName: " + result.groupName +
"clientDevices: " + result.clientDevices +"networkId: " + result.networkId "clientDevices: " + result.clientDevices +"networkId: " + result.networkId
+ "frequency: " + result.frequency + "goIpAddress: " + result.goIpAddress); + "frequency: " + result.frequency + "goIpAddress: " + result.goIpAddress);
var removeConfig = wifi.removeGroup(); let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
done(); done();
}); });
...@@ -140,7 +140,7 @@ describe('ACTS_WifiTest', function () { ...@@ -140,7 +140,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var WifiP2PConfig2 = { let WifiP2PConfig2 = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
...@@ -150,19 +150,19 @@ describe('ACTS_WifiTest', function () { ...@@ -150,19 +150,19 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig2); let addConfig = wifi.createGroup(WifiP2PConfig2);
await sleep(2000); await sleep(2000);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length; let resultLength = Object.keys(data).length;
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0); expect(true).assertEqual(resultLength!=0);
}).catch((error) => { }).catch((error) => {
console.info("[wifi_test]getCurrentGroup promise then error." + JSON.stringify(error)); console.info("[wifi_test]getCurrentGroup promise then error." + JSON.stringify(error));
expect(error).assertFail(); expect(error).assertFail();
}); });
var removeConfig = wifi.removeGroup(); let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
done(); done();
}) })
...@@ -174,7 +174,7 @@ describe('ACTS_WifiTest', function () { ...@@ -174,7 +174,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -2, netId : -2,
passphrase : "12345678", passphrase : "12345678",
...@@ -184,19 +184,19 @@ describe('ACTS_WifiTest', function () { ...@@ -184,19 +184,19 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig); let addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000); await sleep(2000);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length; let resultLength = Object.keys(data).length;
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0); expect(true).assertEqual(resultLength!=0);
var removePConfig = wifi.deletePersistentGroup(data.networkId); let removePConfig = wifi.deletePersistentGroup(data.networkId);
expect(removePConfig).assertTrue(); expect(removePConfig).assertTrue();
var removeConfig = wifi.removeGroup(); let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
}); });
done(); done();
...@@ -209,7 +209,7 @@ describe('ACTS_WifiTest', function () { ...@@ -209,7 +209,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var WifiP2PConfig3 = { let WifiP2PConfig3 = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "00:00:00:00:00:00",
netId : -2, netId : -2,
passphrase : "12345678", passphrase : "12345678",
...@@ -219,14 +219,14 @@ describe('ACTS_WifiTest', function () { ...@@ -219,14 +219,14 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices(); let scanConfig = wifi.startDiscoverDevices();
await sleep(2000); await sleep(2000);
expect(scanConfig).assertTrue(); expect(scanConfig).assertTrue();
var connConfig = wifi.p2pConnect(WifiP2PConfig3); let connConfig = wifi.p2pConnect(WifiP2PConfig3);
console.info("[wifi_test] test p2pConnect result." + connConfig); console.info("[wifi_test] test p2pConnect result." + connConfig);
expect(connConfig).assertTrue(); expect(connConfig).assertTrue();
var stopScan = wifi.stopDiscoverDevices(); let stopScan = wifi.stopDiscoverDevices();
console.info("[wifi_test] test stopDiscoverDevices result." + stopScan); console.info("[wifi_test] test stopDiscoverDevices result." + stopScan);
done() done()
}) })
...@@ -238,13 +238,13 @@ describe('ACTS_WifiTest', function () { ...@@ -238,13 +238,13 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var P2pConnectState = { let P2pConnectState = {
DISCONNECTED :0, DISCONNECTED :0,
CONNECTED : 1, CONNECTED : 1,
}; };
await wifi.getP2pLinkedInfo() await wifi.getP2pLinkedInfo()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length; let resultLength = Object.keys(data).length;
console.info("[wifi_test] getP2pLinkedInfo [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getP2pLinkedInfo [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0); expect(true).assertEqual(resultLength!=0);
}).catch((error) => { }).catch((error) => {
...@@ -262,7 +262,7 @@ describe('ACTS_WifiTest', function () { ...@@ -262,7 +262,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var P2pConnectState = { let P2pConnectState = {
DISCONNECTED :0, DISCONNECTED :0,
CONNECTED : 1, CONNECTED : 1,
}; };
...@@ -288,11 +288,11 @@ describe('ACTS_WifiTest', function () { ...@@ -288,11 +288,11 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var disConn = wifi.p2pCancelConnect(); let disConn = wifi.p2pCancelConnect();
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test p2pCancelConnect result." + disConn); console.info("[wifi_test] test p2pCancelConnect result." + disConn);
expect(disConn).assertTrue(); expect(disConn).assertTrue();
var removeConfig = wifi.removeGroup(); let removeConfig = wifi.removeGroup();
console.info("[wifi_test] test start removeGroup" + removeConfig); console.info("[wifi_test] test start removeGroup" + removeConfig);
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
done(); done();
...@@ -305,7 +305,7 @@ describe('ACTS_WifiTest', function () { ...@@ -305,7 +305,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){ it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){
await tryToEnableWifi(); await tryToEnableWifi();
var P2pDeviceStatus = { let P2pDeviceStatus = {
CONNECTED : 0, CONNECTED : 0,
INVITED : 1, INVITED : 1,
FAILED : 2, FAILED : 2,
...@@ -315,12 +315,12 @@ describe('ACTS_WifiTest', function () { ...@@ -315,12 +315,12 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices(); let scanConfig = wifi.startDiscoverDevices();
await sleep(2000); await sleep(2000);
expect(scanConfig).assertTrue(); expect(scanConfig).assertTrue();
await wifi.getP2pPeerDevices() await wifi.getP2pPeerDevices()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length; let resultLength = Object.keys(data).length;
console.info("[wifi_test] getP2pPeerDevices [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getP2pPeerDevices [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength >= 0); expect(true).assertEqual(resultLength >= 0);
}).catch((error) => { }).catch((error) => {
...@@ -338,7 +338,7 @@ describe('ACTS_WifiTest', function () { ...@@ -338,7 +338,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){ it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){
await tryToEnableWifi(); await tryToEnableWifi();
var P2pDeviceStatus = { let P2pDeviceStatus = {
CONNECTED : 0, CONNECTED : 0,
INVITED : 1, INVITED : 1,
FAILED : 2, FAILED : 2,
...@@ -348,7 +348,7 @@ describe('ACTS_WifiTest', function () { ...@@ -348,7 +348,7 @@ describe('ACTS_WifiTest', function () {
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()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices(); let scanConfig = wifi.startDiscoverDevices();
await sleep(2000); await sleep(2000);
expect(scanConfig).assertTrue(); expect(scanConfig).assertTrue();
...@@ -358,8 +358,8 @@ describe('ACTS_WifiTest', function () { ...@@ -358,8 +358,8 @@ describe('ACTS_WifiTest', function () {
return; return;
} }
console.info("[wifi_test] getP2pPeerDevices [callback] -> " + JSON.stringify(result)); console.info("[wifi_test] getP2pPeerDevices [callback] -> " + JSON.stringify(result));
var len = Object.keys(result).length; let len = Object.keys(result).length;
for (var j = 0; j < len; ++j) { for (let j = 0; j < len; ++j) {
console.info("deviceName: " + result[j].deviceName + console.info("deviceName: " + result[j].deviceName +
"deviceAddress: " + result[j].deviceAddress + "deviceAddress: " + result[j].deviceAddress +
"primaryDeviceType: " + result[j].primaryDeviceType + "primaryDeviceType: " + result[j].primaryDeviceType +
...@@ -381,7 +381,7 @@ describe('ACTS_WifiTest', function () { ...@@ -381,7 +381,7 @@ describe('ACTS_WifiTest', function () {
console.info("deviceStatus: " + result[j].deviceStatus); console.info("deviceStatus: " + result[j].deviceStatus);
} }
} }
var stopScan = wifi.stopDiscoverDevices(); let stopScan = wifi.stopDiscoverDevices();
expect(stopScan).assertTrue(); expect(stopScan).assertTrue();
done(); done();
}); });
...@@ -460,7 +460,7 @@ describe('ACTS_WifiTest', function () { ...@@ -460,7 +460,7 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) {
await tryToEnableWifi(); await tryToEnableWifi();
var recvP2pPeerDeviceChangeFunc = result => { let recvP2pPeerDeviceChangeFunc = result => {
console.info("wifi_test / p2p peer device change receive event: " + JSON.stringify(result)); console.info("wifi_test / p2p peer device change receive event: " + JSON.stringify(result));
wifi.getP2pDevices((err, data) => { wifi.getP2pDevices((err, data) => {
if (err) { if (err) {
...@@ -468,12 +468,12 @@ describe('ACTS_WifiTest', function () { ...@@ -468,12 +468,12 @@ describe('ACTS_WifiTest', function () {
return; return;
} }
console.info("wifi_test / getP2pDevices [callback] -> " + JSON.stringify(data)); console.info("wifi_test / getP2pDevices [callback] -> " + JSON.stringify(data));
var len = Object.keys(data).length; let len = Object.keys(data).length;
console.log("getP2pDevices number: " + len); console.log("getP2pDevices number: " + len);
for (var i = 0; i < len; ++i) { for (let i = 0; i < len; ++i) {
if (data[i].deviceName === "GRE") { if (data[i].deviceName === "GRE") {
console.info("wifi_test / p2pConnect: -> " + data[i].deviceAddress); console.info("wifi_test / p2pConnect: -> " + data[i].deviceAddress);
var config = { let config = {
"deviceAddress":data[i].deviceAddress, "deviceAddress":data[i].deviceAddress,
"netId":-1, "netId":-1,
"passphrase":"", "passphrase":"",
...@@ -506,16 +506,16 @@ describe('ACTS_WifiTest', function () { ...@@ -506,16 +506,16 @@ describe('ACTS_WifiTest', function () {
*/ */
it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) {
await tryToEnableWifi(); await tryToEnableWifi();
var recvP2pPersistentGroupChangeFunc = result => { let recvP2pPersistentGroupChangeFunc = result => {
console.info("wifi_test / p2p persistent group change receive event" + JSON.stringify(result)); console.info("wifi_test / p2p persistent group change receive event" + JSON.stringify(result));
var config = { let config = {
"deviceAddress" : "02:11:65:f2:0d:6e", "deviceAddress" : "02:11:65:f2:0d:6e",
"netId":-2, "netId":-2,
"passphrase":"", "passphrase":"",
"groupName":"", "groupName":"",
"goBand":0, "goBand":0,
}; };
var addConfig = wifi.createGroup(config); let addConfig = wifi.createGroup(config);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
wifi.getCurrentGroup((err, data) => { wifi.getCurrentGroup((err, data) => {
if (err) { if (err) {
...@@ -563,3 +563,4 @@ describe('ACTS_WifiTest', function () { ...@@ -563,3 +563,4 @@ describe('ACTS_WifiTest', function () {
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
}) })
...@@ -29,7 +29,7 @@ async function tryToEnableWifi(){ ...@@ -29,7 +29,7 @@ async function tryToEnableWifi(){
console.info("wifi_test/wifi status:" + wifi.isWifiActive()); console.info("wifi_test/wifi status:" + wifi.isWifiActive());
} }
var WifiSecurityType = { let WifiSecurityType = {
WIFI_SEC_TYPE_INVALID: 0, WIFI_SEC_TYPE_INVALID: 0,
WIFI_SEC_TYPE_OPEN: 1, WIFI_SEC_TYPE_OPEN: 1,
WIFI_SEC_TYPE_WEP: 2, WIFI_SEC_TYPE_WEP: 2,
...@@ -37,7 +37,7 @@ var WifiSecurityType = { ...@@ -37,7 +37,7 @@ var WifiSecurityType = {
WIFI_SEC_TYPE_SAE: 4, WIFI_SEC_TYPE_SAE: 4,
} }
var SuppState = { let SuppState = {
DISCONNECTED: 0, DISCONNECTED: 0,
INTERFACE_DISABLED: 1, INTERFACE_DISABLED: 1,
INACTIVE : 2, INACTIVE : 2,
...@@ -52,7 +52,7 @@ var SuppState = { ...@@ -52,7 +52,7 @@ var SuppState = {
INVALID: 11, INVALID: 11,
} }
var ConnState = { let ConnState = {
SCANNING: 0, SCANNING: 0,
CONNECTING: 1, CONNECTING: 1,
AUTHENTICATING: 2, AUTHENTICATING: 2,
...@@ -63,14 +63,14 @@ var ConnState = { ...@@ -63,14 +63,14 @@ var ConnState = {
UNKNOWN: 7, UNKNOWN: 7,
} }
var ipConfig = { let ipConfig = {
"ipAddress": 1284752956, "ipAddress": 1284752956,
"gateway": 17017024, "gateway": 17017024,
"dnsServers": 12345678, "dnsServers": 12345678,
"domains": ["aaa"], "domains": ["aaa"],
} }
var IpType = { let IpType = {
STATIC : 0, STATIC : 0,
DHCP : 1, DHCP : 1,
UNKNOWN: 2 UNKNOWN: 2
...@@ -88,14 +88,14 @@ describe('ACTS_WifiTest', function() { ...@@ -88,14 +88,14 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Open_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Open_0001', 0, async function(done) {
console.info("[wifi_test] check the state of wifi, if it's close, open it."); console.info("[wifi_test] check the state of wifi, if it's close, open it.");
var active = wifi.isWifiActive(); let active = wifi.isWifiActive();
if (!active) { if (!active) {
var enable = wifi.enableWifi(); let enable = wifi.enableWifi();
await sleep(5000); await sleep(5000);
console.log("[wifi_test] wifi open result: " + enable); console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue(); expect(enable).assertTrue();
} }
var disable = wifi.disableWifi(); let disable = wifi.disableWifi();
await sleep(5000); await sleep(5000);
console.log("[wifi_test] wifi close result: " + disable); console.log("[wifi_test] wifi close result: " + disable);
expect(disable).assertTrue(); expect(disable).assertTrue();
...@@ -112,14 +112,14 @@ describe('ACTS_WifiTest', function() { ...@@ -112,14 +112,14 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Scan_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Scan_0001', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var scan = wifi.scan(); let scan = wifi.scan();
await sleep(3000); await sleep(3000);
console.log("[wifi_test] open wifi scan result: " + scan); console.log("[wifi_test] open wifi scan result: " + scan);
expect(scan).assertTrue(); expect(scan).assertTrue();
await wifi.getScanInfos() await wifi.getScanInfos()
.then(result => { .then(result => {
var clen = Object.keys(result).length; let clen = Object.keys(result).length;
expect(clen).assertLarger(0); expect(clen).assertLarger(0);
console.info("[wifi_test] getScanInfos promise result " + JSON.stringify(result)); console.info("[wifi_test] getScanInfos promise result " + JSON.stringify(result));
}); });
...@@ -129,20 +129,17 @@ describe('ACTS_WifiTest', function() { ...@@ -129,20 +129,17 @@ describe('ACTS_WifiTest', function() {
if(err) { if(err) {
console.log("[wifi_test] wifi getScanInfos failed " + err); console.log("[wifi_test] wifi getScanInfos failed " + err);
} }
var clen = Object.keys(result).length; let clen = Object.keys(result).length;
if (!(clen == 0)) { 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 (let j = 0; j < clen; ++j) {
console.info("ssid: " + result[j].ssid); console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid +
console.info("bssid: " + result[j].bssid); "securityType: " + result[j].securityType +
console.info("securityType: " + result[j].securityType); "rssi: " + result[j].rssi + "band: " + result[j].band +
console.info("rssi: " + result[j].rssi); "frequency: " + result[j].frequency +
console.info("band: " + result[j].band); "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities
console.info("frequency: " + result[j].frequency); + "channelWidth: " + result[j].channelWidth);
console.info("timestamp: " + result[j].timestamp);
console.info("capabilities: " + result[j].capabilities);
console.info("channelWidth: " + result[j].channelWidth);
} }
} }
done() done()
...@@ -196,7 +193,7 @@ describe('ACTS_WifiTest', function() { ...@@ -196,7 +193,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) {
await tryToEnableWifi(); await tryToEnableWifi();
wifi.removeAllNetwork(); wifi.removeAllNetwork();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST_OPEN", "ssid": "TEST_OPEN",
"bssid": "", "bssid": "",
"preSharedKey": "", "preSharedKey": "",
...@@ -216,7 +213,7 @@ describe('ACTS_WifiTest', function() { ...@@ -216,7 +213,7 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test]add OPEN Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add OPEN Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].securityType == wifiDeviceConfig1.securityType); expect(true).assertEqual(configs[0].securityType == wifiDeviceConfig1.securityType);
expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfig1.isHiddenSsid); expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfig1.isHiddenSsid);
...@@ -232,16 +229,16 @@ describe('ACTS_WifiTest', function() { ...@@ -232,16 +229,16 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test]add OPEN Deviceconfig callback : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add OPEN Deviceconfig callback : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result2 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result2 : " + JSON.stringify(configs1));
expect(true).assertEqual(configs[0].securityType == wifiDeviceConfig1.securityType); expect(true).assertEqual(configs1[0].securityType == wifiDeviceConfig1.securityType);
expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfig1.isHiddenSsid); expect(true).assertEqual(configs1[0].isHiddenSsid == wifiDeviceConfig1.isHiddenSsid);
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig1.ssid); expect(true).assertEqual(configs1[0].ssid == wifiDeviceConfig1.ssid);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs2 = wifi.getDeviceConfigs();
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs2.length == 0);
done() done()
}); });
}) })
...@@ -254,7 +251,7 @@ describe('ACTS_WifiTest', function() { ...@@ -254,7 +251,7 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Sta_Config_0002', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0002', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST_PSK", "ssid": "TEST_PSK",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -274,18 +271,18 @@ describe('ACTS_WifiTest', function() { ...@@ -274,18 +271,18 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].securityType == wifiDeviceConfig1.securityType); expect(true).assertEqual(configs[0].securityType == wifiDeviceConfig1.securityType);
expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfig1.isHiddenSsid); expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfig1.isHiddenSsid);
expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfig1.preSharedKey); expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfig1.preSharedKey);
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig1.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig1.ssid);
var isRemoved = wifi.removeDevice(netWorkId); let isRemoved = wifi.removeDevice(netWorkId);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current getConfig: " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current getConfig: " + JSON.stringify(configs1));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -298,7 +295,7 @@ describe('ACTS_WifiTest', function() { ...@@ -298,7 +295,7 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Sta_Config_0003', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0003', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST_WEP", "ssid": "TEST_WEP",
"bssid": "", "bssid": "",
"preSharedKey": "ABCDEF1234", "preSharedKey": "ABCDEF1234",
...@@ -318,7 +315,7 @@ describe('ACTS_WifiTest', function() { ...@@ -318,7 +315,7 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test]add WEP Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add WEP Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId)); console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
...@@ -327,10 +324,10 @@ describe('ACTS_WifiTest', function() { ...@@ -327,10 +324,10 @@ describe('ACTS_WifiTest', function() {
expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfig1.preSharedKey); expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfig1.preSharedKey);
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig1.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig1.ssid);
var isRemoved = wifi.removeDevice(netWorkId); let isRemoved = wifi.removeDevice(netWorkId);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -342,14 +339,14 @@ describe('ACTS_WifiTest', function() { ...@@ -342,14 +339,14 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Config_0004', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0004', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TESTWgr1", "ssid": "TESTWgr1",
"bssid": "", "bssid": "",
"preSharedKey": "123456789", "preSharedKey": "123456789",
"isHiddenSsid": false, "isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
}; };
var wifiDeviceConfig2 = { let wifiDeviceConfig2 = {
"ssid": "TESTWgr2", "ssid": "TESTWgr2",
"bssid": "", "bssid": "",
"preSharedKey": "", "preSharedKey": "",
...@@ -366,7 +363,7 @@ describe('ACTS_WifiTest', function() { ...@@ -366,7 +363,7 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test] wifi addDeviceconfig1 callback:" + JSON.stringify(netWorkId1)); console.info("[wifi_test] wifi addDeviceconfig1 callback:" + JSON.stringify(netWorkId1));
expect(true).assertEqual(netWorkId1 != -1); expect(true).assertEqual(netWorkId1 != -1);
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs));
resolve() resolve()
}); });
...@@ -381,14 +378,14 @@ describe('ACTS_WifiTest', function() { ...@@ -381,14 +378,14 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test] wifi addDeviceconfig2 callback : " + JSON.stringify(netWorkId2)); console.info("[wifi_test] wifi addDeviceconfig2 callback : " + JSON.stringify(netWorkId2));
expect(true).assertEqual(netWorkId2 != -1); expect(true).assertEqual(netWorkId2 != -1);
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs1));
expect(true).assertEqual(configs.length >= 1); expect(true).assertEqual(configs1.length >= 1);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs2 = wifi.getDeviceConfigs();
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs2.length == 0);
resolve() resolve()
}); });
}) })
...@@ -404,7 +401,7 @@ describe('ACTS_WifiTest', function() { ...@@ -404,7 +401,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Config_0005', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0005', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigD = { let wifiDeviceConfigD = {
"ssid": "TESTD", "ssid": "TESTD",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -423,17 +420,17 @@ describe('ACTS_WifiTest', function() { ...@@ -423,17 +420,17 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
var disconNet = wifi.disableNetwork(netWorkId); let disconNet = wifi.disableNetwork(netWorkId);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi device config result : " + JSON.stringify(configs)); console.info("[wifi_test] wifi device config result : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigD.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigD.ssid);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -445,7 +442,7 @@ describe('ACTS_WifiTest', function() { ...@@ -445,7 +442,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Config_0006', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0006', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigU = { let wifiDeviceConfigU = {
"ssid": "TEST", "ssid": "TEST",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -464,21 +461,21 @@ describe('ACTS_WifiTest', function() { ...@@ -464,21 +461,21 @@ describe('ACTS_WifiTest', function() {
console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
wifiDeviceConfigU.ssid = "UPDATE"; wifiDeviceConfigU.ssid = "UPDATE";
wifiDeviceConfigU.preSharedKey = "1234567890"; wifiDeviceConfigU.preSharedKey = "1234567890";
expect(true).assertEqual(wifi.updateNetwork(wifiDeviceConfigU) >= 0); expect(true).assertEqual(wifi.updateNetwork(wifiDeviceConfigU) >= 0);
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test] updated wifi device config result : " + JSON.stringify(configs)); console.info("[wifi_test] updated wifi device config result : " + JSON.stringify(configs1));
expect(true).assertEqual(configs[1].ssid == wifiDeviceConfigU.ssid); expect(true).assertEqual(configs1[1].ssid == wifiDeviceConfigU.ssid);
expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfigU.preSharedKey); expect(true).assertEqual(configs1[1].preSharedKey == wifiDeviceConfigU.preSharedKey);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs2 = wifi.getDeviceConfigs();
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs2.length == 0);
}); });
done() done()
}) })
...@@ -491,7 +488,7 @@ describe('ACTS_WifiTest', function() { ...@@ -491,7 +488,7 @@ describe('ACTS_WifiTest', function() {
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0001', 0, async function(done) { it('SSUB_Communication_WiFi_Sta_Conn_SSID_0001', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigZ = { let wifiDeviceConfigZ = {
"ssid": "中文测试SSID", "ssid": "中文测试SSID",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -512,19 +509,19 @@ describe('ACTS_WifiTest', function() { ...@@ -512,19 +509,19 @@ describe('ACTS_WifiTest', function() {
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
var disconNet = wifi.disableNetwork(netWorkId); let disconNet = wifi.disableNetwork(netWorkId);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigZ.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigZ.ssid);
expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfigZ.preSharedKey); expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfigZ.preSharedKey);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs1));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -537,7 +534,7 @@ describe('ACTS_WifiTest', function() { ...@@ -537,7 +534,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0002', 0, async function(done) { it('SSUB_Communication_WiFi_Sta_Conn_SSID_0002', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigK = { let wifiDeviceConfigK = {
"ssid": "test text", "ssid": "test text",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -559,18 +556,18 @@ describe('ACTS_WifiTest', function() { ...@@ -559,18 +556,18 @@ describe('ACTS_WifiTest', function() {
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
var disconNet = wifi.disableNetwork(netWorkId); let disconNet = wifi.disableNetwork(netWorkId);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigK.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigK.ssid);
expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfigK.preSharedKey); expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfigK.preSharedKey);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -582,7 +579,7 @@ describe('ACTS_WifiTest', function() { ...@@ -582,7 +579,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0003', 0, async function(done) { it('SSUB_Communication_WiFi_Sta_Conn_SSID_0003', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigT = { let wifiDeviceConfigT = {
"ssid": "!@#¥%&*/", "ssid": "!@#¥%&*/",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -602,17 +599,17 @@ describe('ACTS_WifiTest', function() { ...@@ -602,17 +599,17 @@ describe('ACTS_WifiTest', function() {
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId)); console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigT.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigT.ssid);
expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfigT.preSharedKey); expect(true).assertEqual(configs[0].preSharedKey == wifiDeviceConfigT.preSharedKey);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs1));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -624,7 +621,7 @@ describe('ACTS_WifiTest', function() { ...@@ -624,7 +621,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_SSID_0007', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_SSID_0007', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigT = { let wifiDeviceConfigT = {
"ssid": "test", "ssid": "test",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -644,16 +641,16 @@ describe('ACTS_WifiTest', function() { ...@@ -644,16 +641,16 @@ describe('ACTS_WifiTest', function() {
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId)); console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigT.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigT.ssid);
expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfigT.isHiddenSsid); expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfigT.isHiddenSsid);
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs1 = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs1));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs1.length == 0);
}); });
done() done()
}) })
...@@ -670,7 +667,7 @@ describe('ACTS_WifiTest', function() { ...@@ -670,7 +667,7 @@ describe('ACTS_WifiTest', function() {
await tryToEnableWifi(); await tryToEnableWifi();
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info('[wifi_test] getDeviceMacAddress test start ...'); console.info('[wifi_test] getDeviceMacAddress test start ...');
var result = wifi.getDeviceMacAddress(); let result = wifi.getDeviceMacAddress();
console.info("[wifi_test] getDeviceMacAddress -> " + JSON.stringify(result)); console.info("[wifi_test] getDeviceMacAddress -> " + JSON.stringify(result));
expect(true).assertEqual(result.length >= 1) expect(true).assertEqual(result.length >= 1)
done(); done();
...@@ -688,7 +685,7 @@ describe('ACTS_WifiTest', function() { ...@@ -688,7 +685,7 @@ describe('ACTS_WifiTest', function() {
await tryToEnableWifi(); await tryToEnableWifi();
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info(" [wifi_test] getCountryCode start ... "); console.info(" [wifi_test] getCountryCode start ... ");
var countryCode = wifi.getCountryCode(); let countryCode = wifi.getCountryCode();
console.info("[wifi_test] getCountryCode -> " + JSON.stringify(countryCode)); console.info("[wifi_test] getCountryCode -> " + JSON.stringify(countryCode));
expect(JSON.stringify(countryCode)).assertEqual('"CN"'); expect(JSON.stringify(countryCode)).assertEqual('"CN"');
done() done()
...@@ -705,7 +702,7 @@ describe('ACTS_WifiTest', function() { ...@@ -705,7 +702,7 @@ describe('ACTS_WifiTest', function() {
it('SUB_Communication_WiFi_Sta_info_0004', 0, async function (done) { it('SUB_Communication_WiFi_Sta_info_0004', 0, async function (done) {
await tryToEnableWifi(); await tryToEnableWifi();
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var result = wifi.getSupportedFeatures(); let result = wifi.getSupportedFeatures();
console.info("[wifi_test] getFeatureSupported -> " + JSON.stringify(result)); console.info("[wifi_test] getFeatureSupported -> " + JSON.stringify(result));
console.info("[wifi_test] isFeatureSupported: " + result +"->" + wifi.isFeatureSupported(result)); console.info("[wifi_test] isFeatureSupported: " + result +"->" + wifi.isFeatureSupported(result));
expect(wifi.isFeatureSupported(result)).assertTrue(); expect(wifi.isFeatureSupported(result)).assertTrue();
...@@ -724,7 +721,7 @@ describe('ACTS_WifiTest', function() { ...@@ -724,7 +721,7 @@ describe('ACTS_WifiTest', function() {
console.info(" [wifi_test] isHotspotDualBandSupported start ... "); console.info(" [wifi_test] isHotspotDualBandSupported start ... ");
await tryToEnableWifi(); await tryToEnableWifi();
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var DualBand = wifi.isHotspotDualBandSupported(); let DualBand = wifi.isHotspotDualBandSupported();
console.info("[wifi_test] isHotspotDualBandSupported -> " + JSON.stringify(DualBand)); console.info("[wifi_test] isHotspotDualBandSupported -> " + JSON.stringify(DualBand));
expect(DualBand).assertFalse(); expect(DualBand).assertFalse();
done(); done();
...@@ -738,7 +735,7 @@ describe('ACTS_WifiTest', function() { ...@@ -738,7 +735,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function (done) { it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function (done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigConn = { let wifiDeviceConfigConn = {
"ssid": "TESTCONN", "ssid": "TESTCONN",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -753,14 +750,14 @@ describe('ACTS_WifiTest', function() { ...@@ -753,14 +750,14 @@ describe('ACTS_WifiTest', function() {
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
var result1 = wifi.connectToDevice(wifiDeviceConfigConn); let result1 = wifi.connectToDevice(wifiDeviceConfigConn);
expect(result1).assertTrue(); expect(result1).assertTrue();
console.info("[wifi_test]isConnected : " + wifi.isConnected()); console.info("[wifi_test]isConnected : " + wifi.isConnected());
expect(wifi.isConnected()).assertFalse(); expect(wifi.isConnected()).assertFalse();
expect(wifi.reconnect()).assertTrue(); expect(wifi.reconnect()).assertTrue();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs.length == 0);
done() done()
...@@ -797,7 +794,7 @@ describe('ACTS_WifiTest', function() { ...@@ -797,7 +794,7 @@ describe('ACTS_WifiTest', function() {
if(err) { if(err) {
console.log("[wifi_test] wifi getLinkedInfo failed " + err); console.log("[wifi_test] wifi getLinkedInfo failed " + err);
} }
var clen = Object.keys(result).length; let clen = Object.keys(result).length;
expect(clen).assertLarger(0); expect(clen).assertLarger(0);
console.info("[wifi_test] getLinkedInfo callback result: " + JSON.stringify(result)); console.info("[wifi_test] getLinkedInfo callback result: " + JSON.stringify(result));
console.info("ssid: " + result.ssid + "bssid:"+ result.bssid +"band: " + result.band+ console.info("ssid: " + result.ssid + "bssid:"+ result.bssid +"band: " + result.band+
...@@ -818,7 +815,7 @@ describe('ACTS_WifiTest', function() { ...@@ -818,7 +815,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0001', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST10", "ssid": "TEST10",
"bssid": "", "bssid": "",
"preSharedKey": "ABCDEF1234", "preSharedKey": "ABCDEF1234",
...@@ -832,12 +829,12 @@ describe('ACTS_WifiTest', function() { ...@@ -832,12 +829,12 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -850,7 +847,7 @@ describe('ACTS_WifiTest', function() { ...@@ -850,7 +847,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0002', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0002', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TESTDIS", "ssid": "TESTDIS",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
...@@ -864,15 +861,15 @@ describe('ACTS_WifiTest', function() { ...@@ -864,15 +861,15 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
expect(wifi.disconnect()).assertTrue(); expect(wifi.disconnect()).assertTrue();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -885,7 +882,7 @@ describe('ACTS_WifiTest', function() { ...@@ -885,7 +882,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0003', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0003', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST26", "ssid": "TEST26",
"bssid": "", "bssid": "",
"preSharedKey": "12345678901234567890123456", "preSharedKey": "12345678901234567890123456",
...@@ -899,13 +896,13 @@ describe('ACTS_WifiTest', function() { ...@@ -899,13 +896,13 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -918,7 +915,7 @@ describe('ACTS_WifiTest', function() { ...@@ -918,7 +915,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0005', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0005', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST5", "ssid": "TEST5",
"bssid": "", "bssid": "",
"preSharedKey": "aB1@g", "preSharedKey": "aB1@g",
...@@ -932,13 +929,13 @@ describe('ACTS_WifiTest', function() { ...@@ -932,13 +929,13 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -951,7 +948,7 @@ describe('ACTS_WifiTest', function() { ...@@ -951,7 +948,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0007', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0007', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST7", "ssid": "TEST7",
"bssid": "", "bssid": "",
"preSharedKey": "1234aA@fFgGzZ", "preSharedKey": "1234aA@fFgGzZ",
...@@ -965,13 +962,13 @@ describe('ACTS_WifiTest', function() { ...@@ -965,13 +962,13 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi"); console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -984,7 +981,7 @@ describe('ACTS_WifiTest', function() { ...@@ -984,7 +981,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0013', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0013', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST13", "ssid": "TEST13",
"bssid": "", "bssid": "",
"preSharedKey": "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH1234567", "preSharedKey": "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH1234567",
...@@ -998,13 +995,13 @@ describe('ACTS_WifiTest', function() { ...@@ -998,13 +995,13 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -1017,7 +1014,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1017,7 +1014,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0014', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0014', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST13", "ssid": "TEST13",
"bssid": "", "bssid": "",
"preSharedKey": "ABCDEFGH", "preSharedKey": "ABCDEFGH",
...@@ -1031,13 +1028,13 @@ describe('ACTS_WifiTest', function() { ...@@ -1031,13 +1028,13 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -1050,7 +1047,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1050,7 +1047,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0015', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0015', 0, async function(done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfig1 = { let wifiDeviceConfig1 = {
"ssid": "TEST13", "ssid": "TEST13",
"bssid": "", "bssid": "",
"preSharedKey": "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH1234567", "preSharedKey": "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH1234567",
...@@ -1064,13 +1061,13 @@ describe('ACTS_WifiTest', function() { ...@@ -1064,13 +1061,13 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfig1); let result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi"); console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
done() done()
...@@ -1083,7 +1080,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1083,7 +1080,7 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function (done) { it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function (done) {
await tryToEnableWifi(); await tryToEnableWifi();
var wifiDeviceConfigIp = { let wifiDeviceConfigIp = {
"ssid": "TEST1", "ssid": "TEST1",
"bssid": "", "bssid": "",
"preSharedKey": "123456789", "preSharedKey": "123456789",
...@@ -1097,17 +1094,17 @@ describe('ACTS_WifiTest', function() { ...@@ -1097,17 +1094,17 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
var result1 = wifi.connectToDevice(wifiDeviceConfigIp); let result1 = wifi.connectToDevice(wifiDeviceConfigIp);
console.log("[wifi_test] wifi connectToDevice result: " + result1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue(); expect(result1).assertTrue();
var isConnected= wifi.isConnected(); let isConnected= wifi.isConnected();
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var reass= wifi.reassociate(); let reass= wifi.reassociate();
expect(reass).assertTrue(); expect(reass).assertTrue();
var ipInfo = wifi.getIpInfo(); let ipInfo = wifi.getIpInfo();
expect(JSON.stringify(ipInfo)).assertContain("gateway"); expect(JSON.stringify(ipInfo)).assertContain("gateway");
console.info("gateway: " + ipInfo.gateway + "ipAddress: " + ipInfo.ipAddress console.info("gateway: " + ipInfo.gateway + "ipAddress: " + ipInfo.ipAddress
+ "leaseDuration: " + ipInfo.leaseDuration + + "leaseDuration: " + ipInfo.leaseDuration +
...@@ -1115,9 +1112,9 @@ describe('ACTS_WifiTest', function() { ...@@ -1115,9 +1112,9 @@ describe('ACTS_WifiTest', function() {
"netmask: " + ipInfo.netmask + "primaryDns:" + ipInfo.primaryDns + "netmask: " + ipInfo.netmask + "primaryDns:" + ipInfo.primaryDns +
"secondDns: " + ipInfo.secondDns + "serverIp: " + ipInfo.serverIp ); "secondDns: " + ipInfo.secondDns + "serverIp: " + ipInfo.serverIp );
var isRemoved = wifi.removeAllNetwork(); let isRemoved = wifi.removeAllNetwork();
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); let configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs.length == 0);
done() done()
...@@ -1142,9 +1139,9 @@ describe('ACTS_WifiTest', function() { ...@@ -1142,9 +1139,9 @@ describe('ACTS_WifiTest', function() {
}) })
await promise.then(done) await promise.then(done)
}); });
var disable = wifi.disableWifi() let disable = wifi.disableWifi()
await sleep(5000); await sleep(5000);
var enable = wifi.enableWifi(); let enable = wifi.enableWifi();
await sleep(5000); await sleep(5000);
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
done(); done();
...@@ -1195,7 +1192,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1195,7 +1192,7 @@ describe('ACTS_WifiTest', function() {
}) })
await promise.then(done) await promise.then(done)
}); });
var scan = wifi.scan(); let scan = wifi.scan();
await sleep(3000); await sleep(3000);
done(); done();
...@@ -1252,3 +1249,4 @@ describe('ACTS_WifiTest', function() { ...@@ -1252,3 +1249,4 @@ describe('ACTS_WifiTest', function() {
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.
先完成此消息的编辑!
想要评论请 注册