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

!2577 【communication】xts测试用例优化

Merge pull request !2577 from 权力/myfeature1
...@@ -21,6 +21,14 @@ function sleep(delay) { ...@@ -21,6 +21,14 @@ function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay)) return new Promise(resovle => setTimeout(resovle, delay))
} }
async function tryToDisableWifi(){
if(wifi.isWifiActive()){
console.info("wifi_test/disable wifi:" + wifi.disableWifi());
await sleep(5000);
}
console.info("wifi_test/wifi status:" + wifi.isWifiActive());
}
var WifiSecurityType = { var WifiSecurityType = {
WIFI_SEC_TYPE_INVALID : 0, WIFI_SEC_TYPE_INVALID : 0,
WIFI_SEC_TYPE_OPEN : 1, WIFI_SEC_TYPE_OPEN : 1,
...@@ -51,12 +59,9 @@ describe('ACTS_WifiTest', function() { ...@@ -51,12 +59,9 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_Communication_WiFi_Hotspot_Open_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Open_0002', 0, async function (done) {
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Open_0002"); if (wifi.isWifiActive()) {
console.info("[wifi_test] enableHotspot and disableHotspot test start.");
if (wifi.isWifiActive()) {
var disable = wifi.disableWifi(); var disable = wifi.disableWifi();
await sleep(3000); await sleep(5000);
console.log("[wifi_test] wifi close result: " + disable);
expect(disable).assertTrue(); expect(disable).assertTrue();
} }
var close =wifi.isWifiActive(); var close =wifi.isWifiActive();
...@@ -65,12 +70,10 @@ describe('ACTS_WifiTest', function() { ...@@ -65,12 +70,10 @@ describe('ACTS_WifiTest', function() {
if (!wifi.isHotspotActive()) { if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot(); var on = wifi.enableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue(); expect(on).assertTrue();
} }
console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive()); console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive());
expect(wifi.isHotspotActive()).assertTrue(); expect(wifi.isHotspotActive()).assertTrue();
console.info("[wifi_test] enableHotspot and disableHotspot test end.");
done(); done();
}) })
...@@ -81,24 +84,20 @@ describe('ACTS_WifiTest', function() { ...@@ -81,24 +84,20 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0001', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0001', 0, async function (done) {
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0001"); await tryToDisableWifi();
console.info("[wifi_test] set a valid 2.4G hotspot config start.");
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
console.info("[wifi_test] disableHotspot result -> " + off);
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); var isSuccess = wifi.setHotspotConfig(HotspotConfig);
console.log("[wifi_test] set 2.4G hotspot config result: " + isSuccess);
expect(isSuccess).assertTrue(); expect(isSuccess).assertTrue();
console.info("[wifi_test] check band of current band should be 2.4G.");
var hotspotConfig = wifi.getHotspotConfig(); var 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);
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0001 end");
done() done()
}) })
...@@ -109,14 +108,13 @@ describe('ACTS_WifiTest', function() { ...@@ -109,14 +108,13 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 1 * @tc.level Level 1
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0002', 0, async function (done) {
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0002"); await tryToDisableWifi();
console.info("[wifi_test] set a valid hotspot config start.");
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.info("[wifi_test] Hotspot status result -> " + wifi.isHotspotActive());
var HotspotConfig5G = { var HotspotConfig5G = {
"ssid": "testWgr", "ssid": "testWgr",
"band": 2, "band": 2,
...@@ -125,9 +123,8 @@ describe('ACTS_WifiTest', function() { ...@@ -125,9 +123,8 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
}; };
var isSuccess5 = wifi.setHotspotConfig(HotspotConfig5G); var isSuccess5 = wifi.setHotspotConfig(HotspotConfig5G);
console.log("[wifi_test] set 5G hotspot config result1: " + isSuccess5);
expect(isSuccess5).assertFalse(); expect(isSuccess5).assertFalse();
console.info("[wifi_test] check band of current band should be 5G.");
var hotspotConfig5 = wifi.getHotspotConfig(); var 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(1);
...@@ -141,7 +138,7 @@ describe('ACTS_WifiTest', function() { ...@@ -141,7 +138,7 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0003', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0003', 0, async function (done) {
console.info("[wifi_test] set a invalid hotspot config start."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
...@@ -170,15 +167,12 @@ describe('ACTS_WifiTest', function() { ...@@ -170,15 +167,12 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0004', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0004', 0, async function (done) {
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0004"); await tryToDisableWifi();
console.info("[wifi_test] check the state of hotspot, if it's open, close it.");
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.log("[wifi_test] set max preSharedKey valid hotspot config " );
var HotspotConfigM= { var HotspotConfigM= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
...@@ -189,7 +183,7 @@ describe('ACTS_WifiTest', function() { ...@@ -189,7 +183,7 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM); var 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();
console.log("[wifi_test] set 65 preSharedKey invalid hotspot config " );
var HotspotConfigM1= { var HotspotConfigM1= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
...@@ -198,9 +192,7 @@ describe('ACTS_WifiTest', function() { ...@@ -198,9 +192,7 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM1); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM1);
console.log("[wifi_test] set 65 preSharedKey invalid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
console.info("[wifi_test] check band of current band should be 5G.");
var hotspotConfigS= wifi.getHotspotConfig(); var 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);
...@@ -214,14 +206,13 @@ describe('ACTS_WifiTest', function() { ...@@ -214,14 +206,13 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0005', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0005', 0, async function (done) {
console.info("[wifi_test] check the state of hotspot, if it's open, close it."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.log("[wifi_test] set min preSharedKey valid hotspot config " );
var HotspotConfigI= { var HotspotConfigI= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
...@@ -230,14 +221,13 @@ describe('ACTS_WifiTest', function() { ...@@ -230,14 +221,13 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI);
console.log("[wifi_test] set 8 preSharedKey valid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var 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);
console.log("[wifi_test] set 7 preSharedKey invalid hotspot config" );
var HotspotConfigI2= { var HotspotConfigI2= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
...@@ -246,12 +236,10 @@ describe('ACTS_WifiTest', function() { ...@@ -246,12 +236,10 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI2); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI2);
console.log("[wifi_test] set 7 preSharedKey invalid hotspot config result:" + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var 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);
expect(config.preSharedKey.length).assertEqual(8); expect(config.preSharedKey.length).assertEqual(8);
done(); done();
}) })
...@@ -263,18 +251,16 @@ describe('ACTS_WifiTest', function() { ...@@ -263,18 +251,16 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0006', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0006', 0, async function (done) {
console.info("[wifi_test] check the state of hotspot, if it's open, close it."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off); expect(off).assertTrue();
expect(on2).assertTrue();
} }
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive(); var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertFalse(); expect(isHotspotActive).assertFalse();
console.log("[wifi_test] set max ssid invalid hotspot config" );
var HotspotConfigS= { var HotspotConfigS= {
"ssid": "testWgr123testWgr123testWgr12356", "ssid": "testWgr123testWgr123testWgr12356",
"band": 1, "band": 1,
...@@ -283,10 +269,8 @@ describe('ACTS_WifiTest', function() { ...@@ -283,10 +269,8 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigS); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigS);
console.log("[wifi_test] set 32bit ssid invalid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
console.log("[wifi_test] set 33bit ssid invalid hotspot config" );
var HotspotConfigS1= { var HotspotConfigS1= {
"ssid": "testWgr123testWgr123testWgr123567", "ssid": "testWgr123testWgr123testWgr123567",
"band": 1, "band": 1,
...@@ -297,10 +281,8 @@ describe('ACTS_WifiTest', function() { ...@@ -297,10 +281,8 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigS1); var isSuccess1 = 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: " + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
expect(config.ssid.length).assertEqual(32); expect(config.ssid.length).assertEqual(32);
done(); done();
...@@ -312,12 +294,11 @@ describe('ACTS_WifiTest', function() { ...@@ -312,12 +294,11 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test set a null ssid invalid hotspot config * @tc.desc Test set a null ssid invalid hotspot config
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0007', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0007', 0, async function(done) {
console.info("[wifi_test] set a null ssid invalid hotspot config start."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(2000); await sleep(2000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
var HotspotConfigN= { var HotspotConfigN= {
...@@ -339,15 +320,12 @@ describe('ACTS_WifiTest', function() { ...@@ -339,15 +320,12 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test set a contains Chinese.special.digits valid hotspot config * @tc.desc Test set a contains Chinese.special.digits valid hotspot config
* @tc.level Level 2 * @tc.level Level 2
*/ */
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(); var off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
console.info("[wifi_test] enableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.info("[wifi_test] set contains Chinese valid hotspot config start.");
var HotspotConfigC= { var HotspotConfigC= {
"ssid": "测试123!@#¥%……&*( ", "ssid": "测试123!@#¥%……&*( ",
"band": 1, "band": 1,
...@@ -356,17 +334,13 @@ describe('ACTS_WifiTest', function() { ...@@ -356,17 +334,13 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
}; };
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigC); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigC);
console.log("[wifi_test] set a valid hotspot config result1:" + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
console.log("[wifi_test] check the state of Hotspot " );
var isHotspotActive = wifi.isHotspotActive(); var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertFalse(); expect(isHotspotActive).assertFalse();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
expect(true).assertEqual(config.ssid==HotspotConfigC.ssid); expect(true).assertEqual(config.ssid==HotspotConfigC.ssid);
done(); done();
}) })
...@@ -378,11 +352,10 @@ describe('ACTS_WifiTest', function() { ...@@ -378,11 +352,10 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0009', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0009', 0, async function (done) {
console.info("[wifi_test] set invalid hotspot config start."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(3000); await sleep(3000);
console.info("[wifi_test] enableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
...@@ -429,16 +402,13 @@ describe('ACTS_WifiTest', function() { ...@@ -429,16 +402,13 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0010', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0010', 0, async function (done) {
console.info("[wifi_test] set valid hotspot config start."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.info("[wifi_test] set PSK securityType hotspot config start.");
var HotspotConfigPSK= { var HotspotConfigPSK= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
...@@ -447,12 +417,9 @@ describe('ACTS_WifiTest', function() { ...@@ -447,12 +417,9 @@ describe('ACTS_WifiTest', function() {
"maxConn": 8 "maxConn": 8
} }
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigPSK); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigPSK);
console.log("[wifi_test] set a PSK preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue(); expect(isSuccess1).assertTrue();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
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(); var isHotspotActive = wifi.isHotspotActive();
...@@ -469,14 +436,13 @@ describe('ACTS_WifiTest', function() { ...@@ -469,14 +436,13 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0011', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0011', 0, async function (done) {
console.info("[wifi_test] wifi disableHotspot start."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.info("[wifi_test] set open securityType hotspot config start.");
var HotspotConfigO= { var HotspotConfigO= {
"ssid": "test123", "ssid": "test123",
"band": 1, "band": 1,
...@@ -487,10 +453,8 @@ describe('ACTS_WifiTest', function() { ...@@ -487,10 +453,8 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigO); var 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();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
expect(config.securityType).assertEqual(1); expect(config.securityType).assertEqual(1);
done(); done();
...@@ -503,15 +467,13 @@ describe('ACTS_WifiTest', function() { ...@@ -503,15 +467,13 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Conn_0001', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Conn_0001', 0, async function (done) {
console.info("[wifi_test] check the state of hotspot, if it's open, close it."); await tryToDisableWifi();
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
console.log("[wifi_test] set min maxConn valid hotspot config " );
var HotspotConfigI= { var HotspotConfigI= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
...@@ -522,13 +484,10 @@ describe('ACTS_WifiTest', function() { ...@@ -522,13 +484,10 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI); var 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();
console.log("[wifi_test] check current hotspot config maxConn is 8 " );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("maxConn: " + config.maxConn);
expect(config.maxConn).assertEqual(8); expect(config.maxConn).assertEqual(8);
console.log("[wifi_test] set more maxConn invalid hotspot config" );
var HotspotConfigI2= { var HotspotConfigI2= {
"ssid": "testWgr", "ssid": "testWgr",
"band": 1, "band": 1,
...@@ -539,10 +498,8 @@ describe('ACTS_WifiTest', function() { ...@@ -539,10 +498,8 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigI2); var isSuccess1 = 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: " + isSuccess1);
expect(isSuccess1).assertFalse(); expect(isSuccess1).assertFalse();
console.log("[wifi_test] check current hotspot config maxConn" );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.maxConn);
expect(config.maxConn).assertEqual(8); expect(config.maxConn).assertEqual(8);
done(); done();
}) })
...@@ -554,19 +511,15 @@ describe('ACTS_WifiTest', function() { ...@@ -554,19 +511,15 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Config_0012', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Config_0012', 0, async function (done) {
console.info("[wifi_test] wifi enableHotspot start."); await tryToDisableWifi();
console.info("[wifi_test] SUB_Communication_WiFi_Hotspot_Config_0012.");
if (!wifi.isHotspotActive()) { if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot(); var on = wifi.enableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue(); expect(on).assertTrue();
} }
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive(); var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue(); expect(isHotspotActive).assertTrue();
console.info("[wifi_test] open Hotspot, set valid hotspot config start.");
var HotspotConfigWO= { var HotspotConfigWO= {
"ssid": "WIFITEST", "ssid": "WIFITEST",
"band": 1, "band": 1,
...@@ -577,10 +530,8 @@ describe('ACTS_WifiTest', function() { ...@@ -577,10 +530,8 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigWO); var 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();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
expect(config.ssid).assertEqual('WIFITEST'); expect(config.ssid).assertEqual('WIFITEST');
done(); done();
...@@ -594,24 +545,20 @@ describe('ACTS_WifiTest', function() { ...@@ -594,24 +545,20 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_Communication_WiFi_Hotspot_Conn_0002', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Conn_0002', 0, async function (done) {
console.info("[wifi_test] check the state of hotspot, if it's open, close it."); await tryToDisableWifi();
if (!wifi.isHotspotActive()) { if (!wifi.isHotspotActive()) {
var on = wifi.enableHotspot(); var on = wifi.enableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + on);
expect(on).assertTrue(); expect(on).assertTrue();
} }
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive(); var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive); console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
expect(isHotspotActive).assertTrue(); expect(isHotspotActive).assertTrue();
console.log("[wifi_test] Obtains the list of clients that are connected to Wi-Fi hotspot" );
var stationInfo = wifi.getStations(); var 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 +
console.info("macAddress: " + stationInfo.macAddress); "macAddress: " + stationInfo.macAddress +
console.info("ipAddress: " + stationInfo.ipAddress); "ipAddress: " + stationInfo.ipAddress);
expect(stationInfo.length).assertEqual(0); expect(stationInfo.length).assertEqual(0);
done(); done();
...@@ -753,4 +700,3 @@ describe('ACTS_WifiTest', function() { ...@@ -753,4 +700,3 @@ describe('ACTS_WifiTest', function() {
}) })
...@@ -21,6 +21,13 @@ function sleep(delay) { ...@@ -21,6 +21,13 @@ function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay)) return new Promise(resovle => setTimeout(resovle, delay))
} }
async function tryToEnableWifi(){
if(!wifi.isWifiActive()){
console.info("wifi_test/enable wifi:" + wifi.enableWifi());
await sleep(3000);
}
console.info("wifi_test/wifi status:" + wifi.isWifiActive());
}
var GroupOwnerBand = { var GroupOwnerBand = {
GO_BAND_AUTO : 0, GO_BAND_AUTO : 0,
...@@ -38,44 +45,36 @@ describe('ACTS_WifiTest', function () { ...@@ -38,44 +45,36 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number Setting_0001 * @tc.number Setting_0001
* @tc.name SUB_Communication_WiFi_P2P_Setting_0001 * @tc.name SUB_Communication_WiFi_P2P_Setting_0001
* @tc.author wudangping wwx1075776
* @tc.desc Test setDeviceName infos * @tc.desc Test setDeviceName infos
*/ */
it('SUB_Communication_WiFi_P2P_Setting_0001', 0, function() { it('SUB_Communication_WiFi_P2P_Setting_0001', 0, async function(done) {
await tryToEnableWifi();
console.info("[wifi_test] test setDeviceName start."); console.info("[wifi_test] test setDeviceName start.");
var devName = wifi.setDeviceName("P2PTest"); var 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();
}) })
/** /**
* @tc.number config_0001 * @tc.number config_0001
* @tc.name SUB_Communication_WiFi_P2P_Config_0001 * @tc.name SUB_Communication_WiFi_P2P_Config_0001
* @tc.author wudangping wwx1075776 * @tc.desc Test createGroup and getCurrentGroup promise infos
* @tc.desc Test createGroup and getCurrentGroup infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig = { var WifiP2PConfig = {
deviceAddress : "02:11:65:f2:0d:6e", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
groupName : "AAAZZZ", groupName : "AAAZZZ",
goBand : 0 goBand : 0
}; };
console.info("[wifi_test] check the state of wifi, if it's close, open it.");
var active = wifi.isWifiActive();
if(!active){
var enable = wifi.enableWifi();
await sleep(3000);
console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue();
}
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info("[wifi_test] test start createGroup .");
var addConfig = wifi.createGroup(WifiP2PConfig); var addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test start createGroup result." + addConfig);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
...@@ -86,62 +85,72 @@ describe('ACTS_WifiTest', function () { ...@@ -86,62 +85,72 @@ describe('ACTS_WifiTest', function () {
console.info("[wifi_js]getCurrentGroup promise then error." + JSON.stringify(error)); console.info("[wifi_js]getCurrentGroup promise then error." + JSON.stringify(error));
expect().assertFail(); expect().assertFail();
}); });
wifi.getCurrentGroup(
})
/**
* @tc.number config_0002
* @tc.name SUB_Communication_WiFi_P2P_Config_0002
* @tc.desc Test getCurrentGroup callback infos
*/
it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00",
netId : -1,
passphrase : "12345678",
groupName : "AAAZZZ",
goBand : 0
};
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000);
expect(addConfig).assertTrue();
await wifi.getCurrentGroup(
(err, result) => { (err, result) => {
if (err) { if (err) {
console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err)); console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err));
return; return;
} }
console.info("[wifi_test] getCurrentGroup [callback] -> " + JSON.stringify(result)); console.info("[wifi_test] getCurrentGroup [callback] -> " + JSON.stringify(result));
console.info("isP2pGo: " + result.isP2pGo); console.info("isP2pGo: " + result.isP2pGo +
console.info("deviceName: " + result.ownerInfo.deviceName); "deviceName: " + result.ownerInfo.deviceName +
console.info("deviceAddress: " + result.ownerInfo.deviceAddress); "deviceAddress: " + result.ownerInfo.deviceAddress +
console.info("primaryDeviceType: " + result.ownerInfo.primaryDeviceType); "primaryDeviceType: " + result.ownerInfo.primaryDeviceType +
console.info("deviceStatus: " + result.ownerInfo.deviceStatus); "deviceStatus: " + result.ownerInfo.deviceStatus +
console.info("groupCapabilitys: " + result.ownerInfo.groupCapabilitys); "groupCapabilitys: " + result.ownerInfo.groupCapabilitys +
console.info("passphrase: " + result.passphrase); "passphrase: " + result.passphrase + "interface: "+ result.interface
console.info("interface: " + result.interface); + "groupName: " + result.groupName +
console.info("groupName: " + result.groupName); "clientDevices: " + result.clientDevices +"networkId: " + result.networkId
console.info("clientDevices: " + result.clientDevices); + "frequency: " + result.frequency + "goIpAddress: " + result.goIpAddress);
console.info("networkId: " + result.networkId);
console.info("frequency: " + result.frequency);
console.info("goIpAddress: " + result.goIpAddress);
console.info("[wifi_test] test start removeGroup");
var removeConfig = wifi.removeGroup(); var removeConfig = wifi.removeGroup();
console.info("[wifi_test] test start removeGroup" + removeConfig);
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
done(); done();
}); });
}) })
/** /**
* @tc.number config_0002 * @tc.number config_0003
* @tc.name SUB_Communication_WiFi_P2P_Config_0002 * @tc.name SUB_Communication_WiFi_P2P_Config_0003
* @tc.author wudangping wwx1075776
* @tc.desc Test createGroup 2.4G band and getCurrentGroup infos * @tc.desc Test createGroup 2.4G band and getCurrentGroup infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig2 = { var WifiP2PConfig2 = {
deviceAddress : "02:11:65:f2:0d:6e", deviceAddress : "00:00:00:00:00:00",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
groupName : "AAAZZZ", groupName : "AAAZZZ",
goBand : 1 goBand : 1
}; };
console.info("[wifi_test] check the state of wifi, if it's close, open it.");
var active = wifi.isWifiActive();
if(!active){
var enable = wifi.enableWifi();
await sleep(3000);
console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue();
}
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info("[wifi_test] test start create 2.4G band Group .");
var addConfig = wifi.createGroup(WifiP2PConfig2); var addConfig = wifi.createGroup(WifiP2PConfig2);
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test start createGroup result." + addConfig);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
...@@ -152,106 +161,82 @@ describe('ACTS_WifiTest', function () { ...@@ -152,106 +161,82 @@ describe('ACTS_WifiTest', function () {
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();
}); });
console.info("[wifi_test] test start removeGroup");
var removeConfig = wifi.removeGroup(); var removeConfig = wifi.removeGroup();
console.info("[wifi_test] test start removeGroup" + removeConfig);
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
done(); done();
}) })
/** /**
* @tc.number config_0003 * @tc.number config_0004
* @tc.name SUB_Communication_WiFi_P2P_Config_0003 * @tc.name SUB_Communication_WiFi_P2P_Config_0004
* @tc.author wudangping wwx1075776
* @tc.desc Test createGroup and deletePersistentGroup infos * @tc.desc Test createGroup and deletePersistentGroup infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig = { var WifiP2PConfig = {
deviceAddress : "02:11:65:f2:0d:6e", deviceAddress : "00:00:00:00:00:00",
netId : -2, netId : -2,
passphrase : "12345678", passphrase : "12345678",
groupName : "AAAZZZ", groupName : "AAAZZZ",
goBand : 0 goBand : 0
}; };
console.info("[wifi_test] check the state of wifi, if it's close, open it.");
var active = wifi.isWifiActive();
if(!active){
var enable = wifi.enableWifi();
await sleep(3000);
console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue();
}
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info("[wifi_test] test start createGroup [promise].");
var addConfig = wifi.createGroup(WifiP2PConfig); var addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test start createGroup [promise]." + addConfig);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length; var 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);
console.info("[wifi_test] test start deletePersistentGroup");
var removePConfig = wifi.deletePersistentGroup(data.networkId); var removePConfig = wifi.deletePersistentGroup(data.networkId);
console.info("[wifi_test] test start deletePersistentGroup" + removePConfig);
expect(removePConfig).assertTrue(); expect(removePConfig).assertTrue();
console.info("[wifi_test] test start removeGroup");
var removeConfig = wifi.removeGroup(); var removeConfig = wifi.removeGroup();
console.info("[wifi_test] test start removeGroup" + removeConfig);
expect(removeConfig).assertTrue(); expect(removeConfig).assertTrue();
}); });
done(); done();
}) })
/** /**
* @tc.number config_0004 * @tc.number config_0005
* @tc.name SUB_Communication_WiFi_P2P_Config_0004 * @tc.name SUB_Communication_WiFi_P2P_Config_0005
* @tc.author wudangping wwx1075776 * @tc.desc Test p2pConnect infos
* @tc.desc Test p2pConnect infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig3 = { var WifiP2PConfig3 = {
deviceAddress : "02:11:65:f2:0d:6e", deviceAddress : "00:00:00:00:00:00",
netId : -2, netId : -2,
passphrase : "12345678", passphrase : "12345678",
groupName : "AAAZZZ", groupName : "AAAZZZ",
goBand : 0 goBand : 0
}; };
console.info("[wifi_test] check the state of wifi, if it's close, open it.");
var active = wifi.isWifiActive();
if(!active){
var enable = wifi.enableWifi();
await sleep(3000);
console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue();
}
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info("[wifi_test] test start startDiscoverDevices.");
var scanConfig = wifi.startDiscoverDevices(); var scanConfig = wifi.startDiscoverDevices();
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test startDiscoverDevices result." + scanConfig);
expect(scanConfig).assertTrue(); expect(scanConfig).assertTrue();
console.info("[wifi_test] test start p2pConnect.");
var connConfig = wifi.p2pConnect(WifiP2PConfig3); var 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();
console.info("[wifi_test] test start stopDiscoverDevices.");
var stopScan = wifi.stopDiscoverDevices(); var stopScan = wifi.stopDiscoverDevices();
console.info("[wifi_test] test stopDiscoverDevices result." + stopScan); console.info("[wifi_test] test stopDiscoverDevices result." + stopScan);
done() done()
}) })
/** /**
* @tc.number config_0005 * @tc.number config_0006
* @tc.name SUB_Communication_WiFi_P2P_Config_0005 * @tc.name SUB_Communication_WiFi_P2P_Config_0006
* @tc.author wudangping wwx1075776 * @tc.desc Test getP2pLinkedInfo promise infos
* @tc.desc Test getP2pLinkedInfo infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) {
await tryToEnableWifi();
var P2pConnectState = { var P2pConnectState = {
DISCONNECTED :0, DISCONNECTED :0,
CONNECTED : 1, CONNECTED : 1,
...@@ -265,34 +250,47 @@ describe('ACTS_WifiTest', function () { ...@@ -265,34 +250,47 @@ describe('ACTS_WifiTest', function () {
console.info("[wifi_test]getP2pLinkedInfo promise then error." + JSON.stringify(error)); console.info("[wifi_test]getP2pLinkedInfo promise then error." + JSON.stringify(error));
expect(error).assertFail(); expect(error).assertFail();
}); });
wifi.getP2pLinkedInfo((err, result) => {
done();
})
/**
* @tc.number config_0007
* @tc.name SUB_Communication_WiFi_P2P_Config_0007
* @tc.desc Test getP2pLinkedInfo callback infos
*/
it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) {
await tryToEnableWifi();
var P2pConnectState = {
DISCONNECTED :0,
CONNECTED : 1,
};
await wifi.getP2pLinkedInfo((err, result) => {
if (err) { if (err) {
console.error('failed to getP2pLinkedInfo callback ' + JSON.stringify(err)); console.error('failed to getP2pLinkedInfo callback ' + JSON.stringify(err));
return; return;
} }
console.info("[wifi_test] getP2pLinkedInfo [callback] -> " + JSON.stringify(result)); console.info("[wifi_test] getP2pLinkedInfo [callback] -> " + JSON.stringify(result));
console.info("connectState: " + result.connectState); console.info("connectState: " + result.connectState +
console.info("isGroupOwner: " + result.isGroupOwner); "isGroupOwner: " + result.isGroupOwner +
console.info("groupOwnerAddr: " + result.groupOwnerAddr); "groupOwnerAddr: " + result.groupOwnerAddr);
expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED); expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED);
}); });
done(); done();
}) })
/** /**
* @tc.number config_0006 * @tc.number config_0008
* @tc.name SUB_Communication_WiFi_P2P_Config_0006 * @tc.name SUB_Communication_WiFi_P2P_Config_0008
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pCancelConnect infos * @tc.desc Test p2pCancelConnect infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) {
console.info("[wifi_test] test start p2pCancelConnect."); await tryToEnableWifi();
var disConn = wifi.p2pCancelConnect(); var 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();
console.info("[wifi_test] test start removeGroup");
var removeConfig = wifi.removeGroup(); var 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();
...@@ -300,12 +298,12 @@ describe('ACTS_WifiTest', function () { ...@@ -300,12 +298,12 @@ describe('ACTS_WifiTest', function () {
}) })
/** /**
* @tc.number config_0007 * @tc.number config_0009
* @tc.name SUB_Communication_WiFi_P2P_Config_0007 * @tc.name SUB_Communication_WiFi_P2P_Config_0009
* @tc.author wudangping wwx1075776
* @tc.desc Test getP2pPeerDevices infos * @tc.desc Test getP2pPeerDevices infos
*/ */
it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) { it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){
await tryToEnableWifi();
var P2pDeviceStatus = { var P2pDeviceStatus = {
CONNECTED : 0, CONNECTED : 0,
INVITED : 1, INVITED : 1,
...@@ -313,20 +311,11 @@ describe('ACTS_WifiTest', function () { ...@@ -313,20 +311,11 @@ describe('ACTS_WifiTest', function () {
AVAILABLE : 3, AVAILABLE : 3,
UNAVAILABLE : 4, UNAVAILABLE : 4,
}; };
console.info("[wifi_test] check the state of wifi, if it's close, open it.");
var active = wifi.isWifiActive();
if(!active){
var enable = wifi.enableWifi();
await sleep(3000);
console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue();
}
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info("[wifi_test] test start startDiscoverDevices.");
var scanConfig = wifi.startDiscoverDevices(); var scanConfig = wifi.startDiscoverDevices();
await sleep(2000); await sleep(2000);
console.info("[wifi_test] test startDiscoverDevices result." + scanConfig);
expect(scanConfig).assertTrue(); expect(scanConfig).assertTrue();
await wifi.getP2pPeerDevices() await wifi.getP2pPeerDevices()
.then((data) => { .then((data) => {
...@@ -337,7 +326,32 @@ describe('ACTS_WifiTest', function () { ...@@ -337,7 +326,32 @@ describe('ACTS_WifiTest', function () {
console.info("[wifi_test]getP2pPeerDevices promise then error." + JSON.stringify(error)); console.info("[wifi_test]getP2pPeerDevices promise then error." + JSON.stringify(error));
expect().assertFail(); expect().assertFail();
}); });
wifi.getP2pPeerDevices((err, result) => { done();
})
/**
* @tc.number config_0010
* @tc.name SUB_Communication_WiFi_P2P_Config_0010
* @tc.desc Test getP2pPeerDevices infos
*/
it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){
await tryToEnableWifi();
var P2pDeviceStatus = {
CONNECTED : 0,
INVITED : 1,
FAILED : 2,
AVAILABLE : 3,
UNAVAILABLE : 4,
};
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices();
await sleep(2000);
expect(scanConfig).assertTrue();
await wifi.getP2pPeerDevices((err, result) => {
if (err) { if (err) {
console.error('failed to getP2pPeerDevices infos callback because ' + JSON.stringify(err)); console.error('failed to getP2pPeerDevices infos callback because ' + JSON.stringify(err));
return; return;
...@@ -345,11 +359,11 @@ describe('ACTS_WifiTest', function () { ...@@ -345,11 +359,11 @@ describe('ACTS_WifiTest', function () {
console.info("[wifi_test] getP2pPeerDevices [callback] -> " + JSON.stringify(result)); console.info("[wifi_test] getP2pPeerDevices [callback] -> " + JSON.stringify(result));
var len = Object.keys(result).length; var len = Object.keys(result).length;
for (var j = 0; j < len; ++j) { for (var j = 0; j < len; ++j) {
console.info("deviceName: " + result[j].deviceName); console.info("deviceName: " + result[j].deviceName +
console.info("deviceAddress: " + result[j].deviceAddress); "deviceAddress: " + result[j].deviceAddress +
console.info("primaryDeviceType: " + result[j].primaryDeviceType); "primaryDeviceType: " + result[j].primaryDeviceType +
console.info("deviceStatus: " + result[j].deviceStatus); "deviceStatus: " + result[j].deviceStatus +
console.info("groupCapabilitys: " + result[j].groupCapabilitys); "groupCapabilitys: " + result[j].groupCapabilitys );
if(result[j].deviceStatus ==P2pDeviceStatus.UNAVAILABLE){ if(result[j].deviceStatus ==P2pDeviceStatus.UNAVAILABLE){
console.info("deviceStatus: " + result[j].deviceStatus); console.info("deviceStatus: " + result[j].deviceStatus);
} }
...@@ -366,30 +380,26 @@ describe('ACTS_WifiTest', function () { ...@@ -366,30 +380,26 @@ describe('ACTS_WifiTest', function () {
console.info("deviceStatus: " + result[j].deviceStatus); console.info("deviceStatus: " + result[j].deviceStatus);
} }
} }
console.info("[wifi_test] test stopDiscoverDevices.");
var stopScan = wifi.stopDiscoverDevices(); var stopScan = wifi.stopDiscoverDevices();
console.info("[wifi_test] test stopDiscoverDevices result." + stopScan);
expect(stopScan).assertTrue(); expect(stopScan).assertTrue();
done(); done();
}); });
}) })
/** /**
* @tc.number p2pStateChange_0001 * @tc.number p2pStateChange_0001
* @tc.name SUB_Communication_WiFi_P2P_P2pStateChange_0001 * @tc.name SUB_Communication_WiFi_P2P_P2pStateChange_0001
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pStateChange callback * @tc.desc Test p2pStateChange callback
*/ */
it('SUB_Communication_WiFi_P2P_P2pStateChange_0001', 0, async function (done) { it('SUB_Communication_WiFi_P2P_P2pStateChange_0001', 0, async function (done) {
console.info('[wifi_test] OnP2pStateChange test start ...'); await tryToEnableWifi();
await wifi.on('p2pStateChange', result => { await wifi.on('p2pStateChange', result => {
console.info("onP2pStateChange callback, result:" + JSON.stringify(result)); console.info("onP2pStateChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
done(); done();
}); });
setTimeout(function() { setTimeout(function() {
console.info('[wifi_test] offP2pStateChange test start ...');
wifi.off('p2pStateChange', result => { wifi.off('p2pStateChange', result => {
console.info("offP2pStateChange callback, result: " + JSON.stringify(result)); console.info("offP2pStateChange callback, result: " + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -401,29 +411,10 @@ describe('ACTS_WifiTest', function () { ...@@ -401,29 +411,10 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number p2pConnectionChange_0002 * @tc.number p2pConnectionChange_0002
* @tc.name SUB_Communication_WiFi_P2P_p2pConnectionChange_0002 * @tc.name SUB_Communication_WiFi_P2P_p2pConnectionChange_0002
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pConnectionChange callback * @tc.desc Test p2pConnectionChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pConnectionChange_0002', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pConnectionChange_0002', 0, async function (done) {
console.info('[wifi_test] p2pConnectionChange test start ...'); await tryToEnableWifi();
var recvP2pConnectionChangeFunc = result => {
console.info("wifi_test / p2p connection change receive event: " + JSON.stringify(result));
wifi.getP2pLinkedInfo((err, data) => {
if (err) {
console.error('wifi_test / failed to get getP2pLinkedInfo: ' + JSON.stringify(err));
return;
}
console.info("wifi_test / get getP2pLinkedInfo [callback] -> " + JSON.stringify(data));
});
wifi.getCurrentGroup((err, data) => {
if (err) {
console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err));
return;
}
console.info("wifi_test / get getCurrentGroup [callback] -> " + JSON.stringify(data));
});
};
await wifi.on('p2pConnectionChange', recvP2pConnectionChangeFunc => { await wifi.on('p2pConnectionChange', recvP2pConnectionChangeFunc => {
console.info("[wifi_test] p2pConnectionChange result -> " + recvP2pConnectionChangeFunc); console.info("[wifi_test] p2pConnectionChange result -> " + recvP2pConnectionChangeFunc);
expect(true).assertEqual(recvP2pConnectionChangeFunc !=null); expect(true).assertEqual(recvP2pConnectionChangeFunc !=null);
...@@ -442,7 +433,6 @@ describe('ACTS_WifiTest', function () { ...@@ -442,7 +433,6 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number p2pDeviceChange_0003 * @tc.number p2pDeviceChange_0003
* @tc.name SUB_Communication_WiFi_P2P_p2pDeviceChange_0003 * @tc.name SUB_Communication_WiFi_P2P_p2pDeviceChange_0003
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pDeviceChange callback * @tc.desc Test p2pDeviceChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pDeviceChange_0003', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pDeviceChange_0003', 0, async function (done) {
...@@ -465,11 +455,10 @@ describe('ACTS_WifiTest', function () { ...@@ -465,11 +455,10 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number p2pPeerDeviceChange_0004 * @tc.number p2pPeerDeviceChange_0004
* @tc.name SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004 * @tc.name SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pPeerDeviceChange callback * @tc.desc Test p2pPeerDeviceChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) {
console.info('[wifi_test] Onp2pDeviceChange test start ...'); await tryToEnableWifi();
var recvP2pPeerDeviceChangeFunc = result => { var 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) => {
...@@ -501,7 +490,6 @@ describe('ACTS_WifiTest', function () { ...@@ -501,7 +490,6 @@ describe('ACTS_WifiTest', function () {
done(); done();
}); });
setTimeout(function() { setTimeout(function() {
console.info('[wifi_test] offP2pPeerDeviceChange test start ...');
wifi.off('p2pPeerDeviceChange', result => { wifi.off('p2pPeerDeviceChange', result => {
console.info("offP2pPeerDeviceChange callback, result: " + JSON.stringify(result)); console.info("offP2pPeerDeviceChange callback, result: " + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -513,11 +501,10 @@ describe('ACTS_WifiTest', function () { ...@@ -513,11 +501,10 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number p2pPersistentGroupChange_0005 * @tc.number p2pPersistentGroupChange_0005
* @tc.name SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005 * @tc.name SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pPersistentGroupChange callback * @tc.desc Test p2pPersistentGroupChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) {
console.info('[wifi_test] OnP2pPersistentGroupChange test start ...'); await tryToEnableWifi();
var recvP2pPersistentGroupChangeFunc = result => { var 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 = { var config = {
...@@ -527,9 +514,7 @@ describe('ACTS_WifiTest', function () { ...@@ -527,9 +514,7 @@ describe('ACTS_WifiTest', function () {
"groupName":"", "groupName":"",
"goBand":0, "goBand":0,
}; };
console.info("[wifi_test] test start createGroup .");
var addConfig = wifi.createGroup(config); var addConfig = wifi.createGroup(config);
console.info("[wifi_test] test start createGroup result." + addConfig);
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
wifi.getCurrentGroup((err, data) => { wifi.getCurrentGroup((err, data) => {
if (err) { if (err) {
...@@ -545,7 +530,6 @@ describe('ACTS_WifiTest', function () { ...@@ -545,7 +530,6 @@ describe('ACTS_WifiTest', function () {
done(); done();
}); });
setTimeout(function() { setTimeout(function() {
console.info('[wifi_test] offP2pPersistentGroupChange test start ...');
wifi.off('p2pPersistentGroupChange', result => { wifi.off('p2pPersistentGroupChange', result => {
console.info("offP2pPersistentGroupChange callback, result: " + JSON.stringify(result)); console.info("offP2pPersistentGroupChange callback, result: " + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -557,18 +541,16 @@ describe('ACTS_WifiTest', function () { ...@@ -557,18 +541,16 @@ describe('ACTS_WifiTest', function () {
/** /**
* @tc.number p2pDiscoveryChange_0006 * @tc.number p2pDiscoveryChange_0006
* @tc.name SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006 * @tc.name SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006
* @tc.author wudangping wwx1075776
* @tc.desc Test p2pDiscoveryChange callback * @tc.desc Test p2pDiscoveryChange callback
*/ */
it('SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006', 0, async function (done) { it('SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006', 0, async function (done) {
console.info('[wifi_test] Onp2pDiscoveryChange test start ...'); await tryToEnableWifi();
await wifi.on('p2pDiscoveryChange', result => { await wifi.on('p2pDiscoveryChange', result => {
console.info("onp2pDiscoveryChange callback, result:" + JSON.stringify(result)); console.info("onp2pDiscoveryChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
done(); done();
}); });
setTimeout(function() { setTimeout(function() {
console.info('[wifi_test] offp2pDiscoveryChange test start ...');
wifi.off('p2pDiscoveryChange', result => { wifi.off('p2pDiscoveryChange', result => {
console.info("offp2pDiscoveryChange callback, result: " + JSON.stringify(result)); console.info("offp2pDiscoveryChange callback, result: " + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -580,4 +562,3 @@ describe('ACTS_WifiTest', function () { ...@@ -580,4 +562,3 @@ describe('ACTS_WifiTest', function () {
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
}) })
...@@ -21,6 +21,14 @@ function sleep(delay) { ...@@ -21,6 +21,14 @@ function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay)) return new Promise(resovle => setTimeout(resovle, delay))
} }
async function tryToEnableWifi(){
if(!wifi.isWifiActive()){
console.info("wifi_test/enable wifi:" + wifi.enableWifi());
await sleep(3000);
}
console.info("wifi_test/wifi status:" + wifi.isWifiActive());
}
var WifiSecurityType = { var WifiSecurityType = {
WIFI_SEC_TYPE_INVALID: 0, WIFI_SEC_TYPE_INVALID: 0,
WIFI_SEC_TYPE_OPEN: 1, WIFI_SEC_TYPE_OPEN: 1,
...@@ -44,21 +52,6 @@ var SuppState = { ...@@ -44,21 +52,6 @@ var SuppState = {
INVALID: 11, INVALID: 11,
} }
var wifiDeviceConfig = {
"ssid": "TEST",
"bssid": "A1:B1:C1:D1:E1:F1",
"preSharedKey": "12345678",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"netId": -1,
"ipType": 1,
"creatorUid": 7,
"disableReason": 0,
"randomMacType": 0,
"randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}
var ConnState = { var ConnState = {
SCANNING: 0, SCANNING: 0,
CONNECTING: 1, CONNECTING: 1,
...@@ -77,6 +70,12 @@ var ipConfig = { ...@@ -77,6 +70,12 @@ var ipConfig = {
"domains": ["aaa"], "domains": ["aaa"],
} }
var IpType = {
STATIC : 0,
DHCP : 1,
UNKNOWN: 2
}
describe('ACTS_WifiTest', function() { describe('ACTS_WifiTest', function() {
beforeEach(function() {}) beforeEach(function() {})
...@@ -88,7 +87,6 @@ describe('ACTS_WifiTest', function() { ...@@ -88,7 +87,6 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test wifi.isWifiEnable API functionality. * @tc.desc Test wifi.isWifiEnable API functionality.
*/ */
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][SUB_Communication_WiFi_Sta_Open_0001]");
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(); var active = wifi.isWifiActive();
if (!active) { if (!active) {
...@@ -97,11 +95,11 @@ describe('ACTS_WifiTest', function() { ...@@ -97,11 +95,11 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] wifi open result: " + enable); console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue(); expect(enable).assertTrue();
} }
console.info("[wifi_test] close wifi test start.");
var disable = wifi.disableWifi(); var 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();
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertFalse(); expect(wifi.isWifiActive()).assertFalse();
done(); done();
...@@ -113,36 +111,25 @@ describe('ACTS_WifiTest', function() { ...@@ -113,36 +111,25 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test get ScanInfos callback API functionality. * @tc.desc Test get ScanInfos callback API functionality.
*/ */
it('SUB_Communication_WiFi_Sta_Scan_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Scan_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Scan_0001]"); await tryToEnableWifi();
var active1 = wifi.isWifiActive();
if (!active1) {
var enable = wifi.enableWifi();
await sleep(5000);
console.log("[wifi_test] wifi open result: " + enable);
expect(enable).assertTrue();
}
var scan = wifi.scan(); var 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();
console.info("[wifi_test] Wifi getScanInfos promise test[1].");
await wifi.getScanInfos() await wifi.getScanInfos()
.then(result => { .then(result => {
var clen = Object.keys(result).length; var clen = Object.keys(result).length;
console.log("[wifi_test] wifi getScanInfos promise result length: " + clen);
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));
}); });
console.info("[wifi_test] Wifi getScanInfos callback test[2].");
wifi.getScanInfos( wifi.getScanInfos(
(err,result) => { (err,result) => {
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; var clen = Object.keys(result).length;
console.log("[wifi_test] wifi getScanInfos callback result length: " + clen);
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));
...@@ -167,8 +154,8 @@ describe('ACTS_WifiTest', function() { ...@@ -167,8 +154,8 @@ describe('ACTS_WifiTest', function() {
* @tc.name SUB_Communication_WiFi_Sta_Scan_0004 * @tc.name SUB_Communication_WiFi_Sta_Scan_0004
* @tc.desc Test wifi.getSignalLevel API functionality. * @tc.desc Test wifi.getSignalLevel API functionality.
*/ */
it('SUB_Communication_WiFi_Sta_Scan_0004', 0, function() { it('SUB_Communication_WiFi_Sta_Scan_0004', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Scan_0004]"); await tryToEnableWifi();
console.info("[wifi_test] check the 2.4G rssi assgined to level test."); console.info("[wifi_test] check the 2.4G rssi assgined to level test.");
expect(wifi.getSignalLevel(-65, 1)).assertEqual(4); expect(wifi.getSignalLevel(-65, 1)).assertEqual(4);
...@@ -198,6 +185,7 @@ describe('ACTS_WifiTest', function() { ...@@ -198,6 +185,7 @@ describe('ACTS_WifiTest', function() {
expect(wifi.getSignalLevel(-86, 2)).assertEqual(0); expect(wifi.getSignalLevel(-86, 2)).assertEqual(0);
expect(wifi.getSignalLevel(-127, 2)).assertEqual(0); expect(wifi.getSignalLevel(-127, 2)).assertEqual(0);
done();
}) })
/** /**
...@@ -206,8 +194,7 @@ describe('ACTS_WifiTest', function() { ...@@ -206,8 +194,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test create a OPEN SecurityType wifi device config * @tc.desc Test create a OPEN SecurityType wifi device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0001]"); await tryToEnableWifi();
console.info("[wifi_test] create a OPEN SecurityType wifi device config start.");
wifi.removeAllNetwork(); wifi.removeAllNetwork();
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST_OPEN", "ssid": "TEST_OPEN",
...@@ -216,19 +203,19 @@ describe('ACTS_WifiTest', function() { ...@@ -216,19 +203,19 @@ describe('ACTS_WifiTest', function() {
"isHiddenSsid": false, "isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_OPEN, "securityType": WifiSecurityType.WIFI_SEC_TYPE_OPEN,
"netId": -1, "netId": -1,
"ipType": 1, "ipType": IpType.DHCP,
"creatorUid": 7, "creatorUid": 7,
"disableReason": 0, "disableReason": 0,
"randomMacType": 0, "randomMacType": 0,
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": ipConfig,
}; };
await wifi.addDeviceConfig(wifiDeviceConfig1) await wifi.addDeviceConfig(wifiDeviceConfig1)
.then(netWorkId => { .then(netWorkId => {
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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
...@@ -244,19 +231,16 @@ describe('ACTS_WifiTest', function() { ...@@ -244,19 +231,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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result2 : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result2 : " + 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].ssid == wifiDeviceConfig1.ssid); expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig1.ssid);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
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()
}); });
...@@ -268,8 +252,8 @@ describe('ACTS_WifiTest', function() { ...@@ -268,8 +252,8 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test create a PSK SecurityType wifi device config * @tc.desc Test create a PSK SecurityType wifi device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0002', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0002', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0002]"); await tryToEnableWifi();
console.info("[wifi_test] create a PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST_PSK", "ssid": "TEST_PSK",
"bssid": "", "bssid": "",
...@@ -289,7 +273,7 @@ describe('ACTS_WifiTest', function() { ...@@ -289,7 +273,7 @@ describe('ACTS_WifiTest', function() {
.then(netWorkId => { .then(netWorkId => {
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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
...@@ -297,9 +281,7 @@ describe('ACTS_WifiTest', function() { ...@@ -297,9 +281,7 @@ 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeDevice(netWorkId); var isRemoved = wifi.removeDevice(netWorkId);
console.info("[wifi_test] check remove config successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current getConfig: " + JSON.stringify(configs)); console.info("[wifi_test]remove config,current getConfig: " + JSON.stringify(configs));
...@@ -311,11 +293,11 @@ describe('ACTS_WifiTest', function() { ...@@ -311,11 +293,11 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number Config_0003 * @tc.number Config_0003
* @tc.name SUB_Communication_WiFi_Sta_Config_0003 * @tc.name SUB_Communication_WiFi_Sta_Config_0003
* @tc.desc Test create a PSK SecurityType wifi device config * @tc.desc Test create a WEP SecurityType wifi device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0003', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0003', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0003]"); await tryToEnableWifi();
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST_WEP", "ssid": "TEST_WEP",
"bssid": "", "bssid": "",
...@@ -335,7 +317,7 @@ describe('ACTS_WifiTest', function() { ...@@ -335,7 +317,7 @@ describe('ACTS_WifiTest', function() {
.then(netWorkId => { .then(netWorkId => {
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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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();
...@@ -345,12 +327,9 @@ describe('ACTS_WifiTest', function() { ...@@ -345,12 +327,9 @@ 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeDevice(netWorkId); var isRemoved = wifi.removeDevice(netWorkId);
console.info("[wifi_test] check remove config successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current getConfig: " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs.length == 0);
}); });
done() done()
...@@ -362,8 +341,7 @@ describe('ACTS_WifiTest', function() { ...@@ -362,8 +341,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test remove all wifi device config * @tc.desc Test remove all wifi device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0004', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0004', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0004]"); await tryToEnableWifi();
console.info("[wifi_test] create multiple valid wifi device config and add it.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TESTWgr1", "ssid": "TESTWgr1",
"bssid": "", "bssid": "",
...@@ -387,7 +365,7 @@ describe('ACTS_WifiTest', function() { ...@@ -387,7 +365,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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length >= 1); expect(true).assertEqual(configs.length >= 1);
...@@ -403,16 +381,14 @@ describe('ACTS_WifiTest', function() { ...@@ -403,16 +381,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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs)); console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length >= 1); expect(true).assertEqual(configs.length >= 1);
console.info("[wifi_test] remove all configs");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove configs,current get Configs : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0); expect(true).assertEqual(configs.length == 0);
resolve() resolve()
}); });
...@@ -426,8 +402,7 @@ describe('ACTS_WifiTest', function() { ...@@ -426,8 +402,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test disableNetwork device config * @tc.desc Test disableNetwork device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0005', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0005', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0005]"); await tryToEnableWifi();
console.info("[wifi_test] create a valid wifi device config start.");
var wifiDeviceConfigD = { var wifiDeviceConfigD = {
"ssid": "TESTD", "ssid": "TESTD",
"bssid": "", "bssid": "",
...@@ -446,23 +421,17 @@ describe('ACTS_WifiTest', function() { ...@@ -446,23 +421,17 @@ describe('ACTS_WifiTest', function() {
.then(netWorkId => { .then(netWorkId => {
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);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
console.info("[wifi_test] disableNetwork test start.");
var disconNet = wifi.disableNetwork(netWorkId); var disconNet = wifi.disableNetwork(netWorkId);
console.log("[wifi_test] wifi disableNetwork result: " + disconNet);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
console.info("[wifi_test] check device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
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()
...@@ -474,8 +443,7 @@ describe('ACTS_WifiTest', function() { ...@@ -474,8 +443,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test update wifi device config * @tc.desc Test update wifi device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0006', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0006', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0006]"); await tryToEnableWifi();
console.info("[wifi_test] create a valid wifi device config start.");
var wifiDeviceConfigU = { var wifiDeviceConfigU = {
"ssid": "TEST", "ssid": "TEST",
"bssid": "", "bssid": "",
...@@ -494,26 +462,21 @@ describe('ACTS_WifiTest', function() { ...@@ -494,26 +462,21 @@ describe('ACTS_WifiTest', function() {
.then(netWorkId => { .then(netWorkId => {
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);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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";
console.info("[wifi_test] wifi new wifiDeviceConfig1:" + wifi.updateNetwork(wifiDeviceConfigU)); expect(true).assertEqual(wifi.updateNetwork(wifiDeviceConfigU) >= 0);
console.info("[wifi_test] check update device configs successfully ");
var configs = wifi.getDeviceConfigs(); var configs = 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(configs));
expect(true).assertEqual(configs[1].ssid == wifiDeviceConfigU.ssid); expect(true).assertEqual(configs[1].ssid == wifiDeviceConfigU.ssid);
expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfigU.preSharedKey); expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfigU.preSharedKey);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
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()
...@@ -525,8 +488,8 @@ describe('ACTS_WifiTest', function() { ...@@ -525,8 +488,8 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test SSID wifi device config * @tc.desc Test SSID wifi device config
*/ */
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0001', 0, async function(done) { it('SSUB_Communication_WiFi_Sta_Conn_SSID_0001', 0, async function(done) {
console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0001]"); await tryToEnableWifi();
console.info("[wifi_test] create a contains chinese SSID wifi device config start.");
var wifiDeviceConfigZ = { var wifiDeviceConfigZ = {
"ssid": "中文测试SSID", "ssid": "中文测试SSID",
"bssid": "", "bssid": "",
...@@ -545,21 +508,18 @@ describe('ACTS_WifiTest', function() { ...@@ -545,21 +508,18 @@ describe('ACTS_WifiTest', function() {
.then(netWorkId => { .then(netWorkId => {
console.info("[wifi_test]add contains chinese Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add contains chinese Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
console.info("[wifi_test] disableNetwork test start.");
var disconNet = wifi.disableNetwork(netWorkId); var disconNet = wifi.disableNetwork(netWorkId);
console.log("[wifi_test] wifi disableNetwork result: " + disconNet);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var 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));
...@@ -575,8 +535,7 @@ describe('ACTS_WifiTest', function() { ...@@ -575,8 +535,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test SSID wifi device config * @tc.desc Test SSID wifi device config
*/ */
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0002', 0, async function(done) { it('SSUB_Communication_WiFi_Sta_Conn_SSID_0002', 0, async function(done) {
console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0002]"); await tryToEnableWifi();
console.info("[wifi_test] create a kongge SSID wifi device config start.");
var wifiDeviceConfigK = { var wifiDeviceConfigK = {
"ssid": "test text", "ssid": "test text",
"bssid": "", "bssid": "",
...@@ -594,26 +553,22 @@ describe('ACTS_WifiTest', function() { ...@@ -594,26 +553,22 @@ describe('ACTS_WifiTest', function() {
await wifi.addDeviceConfig(wifiDeviceConfigK) await wifi.addDeviceConfig(wifiDeviceConfigK)
.then(netWorkId => { .then(netWorkId => {
console.info("[wifi_test]add contains chinese Deviceconfig promise : " + JSON.stringify(netWorkId)); console.info("[wifi_test]add kongge SSID Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
console.info("[wifi_test] disableNetwork test start.");
var disconNet = wifi.disableNetwork(netWorkId); var disconNet = wifi.disableNetwork(netWorkId);
console.log("[wifi_test] wifi disableNetwork result: " + disconNet);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var configs = wifi.getDeviceConfigs();
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()
...@@ -622,11 +577,10 @@ describe('ACTS_WifiTest', function() { ...@@ -622,11 +577,10 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number Config_SSID_0003 * @tc.number Config_SSID_0003
* @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0003 * @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0003
* @tc.desc Test SSID wifi device config * @tc.desc Test contains chinese SSID device config
*/ */
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0003', 0, async function(done) { it('SSUB_Communication_WiFi_Sta_Conn_SSID_0003', 0, async function(done) {
console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0003]"); await tryToEnableWifi();
console.info("[wifi_test] create a kongge SSID wifi device config start.");
var wifiDeviceConfigT = { var wifiDeviceConfigT = {
"ssid": "!@#¥%&*/", "ssid": "!@#¥%&*/",
"bssid": "", "bssid": "",
...@@ -644,19 +598,17 @@ describe('ACTS_WifiTest', function() { ...@@ -644,19 +598,17 @@ describe('ACTS_WifiTest', function() {
await wifi.addDeviceConfig(wifiDeviceConfigT) await wifi.addDeviceConfig(wifiDeviceConfigT)
.then(netWorkId => { .then(netWorkId => {
console.info("[wifi_test]add contains chinese Deviceconfig promise : " + JSON.stringify(netWorkId));
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));
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var 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);
...@@ -667,11 +619,10 @@ describe('ACTS_WifiTest', function() { ...@@ -667,11 +619,10 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number Config_SSID_0007 * @tc.number Config_SSID_0007
* @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0007 * @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0007
* @tc.desc Test SSID wifi device config * @tc.desc Test hidden SSID wifi device config
*/ */
it('SUB_Communication_WiFi_Sta_Conn_SSID_0007', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_SSID_0007', 0, async function(done) {
console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0007]"); await tryToEnableWifi();
console.info("[wifi_test] create a kongge SSID wifi device config start.");
var wifiDeviceConfigT = { var wifiDeviceConfigT = {
"ssid": "test", "ssid": "test",
"bssid": "", "bssid": "",
...@@ -689,18 +640,15 @@ describe('ACTS_WifiTest', function() { ...@@ -689,18 +640,15 @@ describe('ACTS_WifiTest', function() {
await wifi.addDeviceConfig(wifiDeviceConfigT) await wifi.addDeviceConfig(wifiDeviceConfigT)
.then(netWorkId => { .then(netWorkId => {
console.info("[wifi_test]add contains chinese Deviceconfig promise : " + JSON.stringify(netWorkId));
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));
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs(); var 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);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var 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));
...@@ -718,11 +666,7 @@ describe('ACTS_WifiTest', function() { ...@@ -718,11 +666,7 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Sta_info_0001', 0, async function (done) { it('SUB_Communication_WiFi_Sta_info_0001', 0, async function (done) {
if (!wifi.isWifiActive()) { await tryToEnableWifi();
var enable = wifi.enableWifi();
await sleep(3000);
expect(enable).assertTrue();
}
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(); var result = wifi.getDeviceMacAddress();
...@@ -740,11 +684,7 @@ describe('ACTS_WifiTest', function() { ...@@ -740,11 +684,7 @@ describe('ACTS_WifiTest', function() {
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Sta_Info_0002', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Info_0002', 0, async function(done) {
if (!wifi.isWifiActive()) { await tryToEnableWifi();
var enable = wifi.enableWifi();
await sleep(3000);
expect(enable).assertTrue();
}
expect(wifi.isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
console.info(" [wifi_test] getCountryCode start ... "); console.info(" [wifi_test] getCountryCode start ... ");
var countryCode = wifi.getCountryCode(); var countryCode = wifi.getCountryCode();
...@@ -761,15 +701,17 @@ describe('ACTS_WifiTest', function() { ...@@ -761,15 +701,17 @@ describe('ACTS_WifiTest', function() {
* @tc.type Function * @tc.type Function
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Sta_info_0004', 0, function () { it('SUB_Communication_WiFi_Sta_info_0004', 0, async function (done) {
console.info('[wifi_test]FeatureSupported test start ...'); await tryToEnableWifi();
expect(wifi.isWifiActive()).assertTrue();
var result = wifi.getSupportedFeatures(); var 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();
done();
}) })
/** /**
* @tc.number SUB_Communication_WiFi_Sta_info_0005 * @tc.number SUB_Communication_WiFi_Sta_info_0005
* @tc.name testHotspotDualBandSupported * @tc.name testHotspotDualBandSupported
* @tc.desc Test HotspotDualBandSupported api. * @tc.desc Test HotspotDualBandSupported api.
...@@ -779,6 +721,8 @@ describe('ACTS_WifiTest', function() { ...@@ -779,6 +721,8 @@ describe('ACTS_WifiTest', function() {
*/ */
it('SUB_Communication_WiFi_Sta_Info_0005', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Info_0005', 0, async function(done) {
console.info(" [wifi_test] isHotspotDualBandSupported start ... "); console.info(" [wifi_test] isHotspotDualBandSupported start ... ");
await tryToEnableWifi();
expect(wifi.isWifiActive()).assertTrue();
var DualBand = wifi.isHotspotDualBandSupported(); var 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();
...@@ -792,43 +736,28 @@ describe('ACTS_WifiTest', function() { ...@@ -792,43 +736,28 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test reconnect wifi * @tc.desc Test reconnect wifi
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function (done) { it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function (done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0001]"); await tryToEnableWifi();
console.info("[wifi_test] wifi connectToDevice test.");
var wifiDeviceConfigConn = { var wifiDeviceConfigConn = {
"ssid": "TESTCONN", "ssid": "TESTCONN",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
"isHiddenSsid": false, "isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"netId": -1, "netId": -1,
"ipType": 1, "ipType": 1,
"creatorUid": 7, "creatorUid": 7,
"disableReason": 0, "disableReason": 0,
"randomMacType": 0, "randomMacType": 0,
"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 active = wifi.isWifiActive(); expect(wifi.isWifiActive()).assertTrue();
console.log("[wifi_test] wifi active result2: " + active);
if(!active){
var enable = wifi.enableWifi();
expect(enable).assertTrue();
await sleep(3000);
}
var result1 = wifi.connectToDevice(wifiDeviceConfigConn); var result1 = wifi.connectToDevice(wifiDeviceConfigConn);
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]isConnected : " + wifi.isConnected());
var isConnected= wifi.isConnected(); expect(wifi.isConnected()).assertFalse();
console.log("[wifi_test] wifi isConnected result: " + isConnected); expect(wifi.reconnect()).assertTrue();
expect(isConnected).assertFalse();
console.info("[wifi_test] reconnect wifi");
var reconn= wifi.reconnect();
console.log("[wifi_test] wifi reconnect result: " + reconn);
expect(reconn).assertTrue();
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var 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));
...@@ -843,42 +772,42 @@ describe('ACTS_WifiTest', function() { ...@@ -843,42 +772,42 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test getLinkedInfo information * @tc.desc Test getLinkedInfo information
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0002]"); await tryToEnableWifi();
console.info("[wifi_test] Wifi get link infos test[1].");
await wifi.getLinkedInfo() await wifi.getLinkedInfo()
.then((result) => { .then((result) => {
console.info("[wifi_test] get wifi link [promise] -> " + JSON.stringify(result)); console.info("[wifi_test] get wifi link [promise] -> " + JSON.stringify(result));
expect(JSON.stringify(result)).assertContain('band'); expect(JSON.stringify(result)).assertContain('band');
console.info("[wifi_js] get wifi link [promise].");
done(); done();
}).catch((error) => { }).catch((error) => {
console.info("[wifi_test] promise then error." + JSON.stringify(error)); console.info("[wifi_test] promise then error." + JSON.stringify(error));
expect().assertFail(); expect().assertFail();
}); });
})
/**
* @tc.number conn_Config_0003
* @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003
* @tc.desc Test getLinkedInfo callback information
*/
it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function(done) {
await tryToEnableWifi();
await wifi.getLinkedInfo( await wifi.getLinkedInfo(
(err,result) => { (err,result) => {
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; var clen = Object.keys(result).length;
console.log("[wifi_test] wifi getLinkedInfo callback result length: " + clen);
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); console.info("ssid: " + result.ssid + "bssid:"+ result.bssid +"band: " + result.band+
console.info("bssid: " + result.bssid); "isHidden: " + result.isHidden + "isRestricted: " + result.isRestricted +
console.info("band: " + result.band); "chload: " + result.chload + "rssi " + result.rssi + "netWorkId: " + result.netWorkId+
console.info("isHidden: " + result.isHidden); "linkSpeed: " + result.linkSpeed + "frequency:"
console.info("isRestricted: " + result.isRestricted); + result.frequency +"snr:" + result.snr+
console.info("chload: " + result.chload); "macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress +
console.info("rssi " + result.rssi); "suppState: " + result.suppState + "connState: " + result.connState);
console.info("netWorkId: " + result.netWorkId); expect(true).assertEqual(result.connState==ConnState.CONNECTING);
console.info("linkSpeed: " + result.linkSpeed); expect(false).assertEqual(result.suppState==suppState.DISCONNECTED);
console.info("frequency: " + result.frequency);
console.info("snr: " + result.snr);
console.info("macAddress: " + result.macAddress);
console.info("ipAddress: " + result.ipAddress);
console.info("suppState: " + result.suppState);
console.info("connState: " + result.connState);
done(); done();
}); });
await sleep(2000); await sleep(2000);
...@@ -890,8 +819,7 @@ describe('ACTS_WifiTest', function() { ...@@ -890,8 +819,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test connectToDevice 10 bits WEP Deviceconfig * @tc.desc Test connectToDevice 10 bits WEP Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0001', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0001]"); await tryToEnableWifi();
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST10", "ssid": "TEST10",
"bssid": "", "bssid": "",
...@@ -909,9 +837,7 @@ describe('ACTS_WifiTest', function() { ...@@ -909,9 +837,7 @@ describe('ACTS_WifiTest', function() {
var result1 = wifi.connectToDevice(wifiDeviceConfig1); var 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");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -919,14 +845,48 @@ describe('ACTS_WifiTest', function() { ...@@ -919,14 +845,48 @@ describe('ACTS_WifiTest', function() {
done() done()
}) })
/** /**
* @tc.number Conn_Security_0002
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0002
* @tc.desc Test disconnect Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0002', 0, async function(done) {
await tryToEnableWifi();
var wifiDeviceConfig1 = {
"ssid": "TESTDIS",
"bssid": "",
"preSharedKey": "12345678",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"netId": -1,
"ipType": 1,
"creatorUid": 7,
"disableReason": 0,
"randomMacType": 0,
"randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
};
var result1 = wifi.connectToDevice(wifiDeviceConfig1);
console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue();
var isConnected= wifi.isConnected();
expect(isConnected).assertFalse();
expect(wifi.disconnect()).assertTrue();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0003 * @tc.number Conn_Security_0003
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0003 * @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0003
* @tc.desc Test connectToDevice 26 bits WEP Deviceconfig * @tc.desc Test connectToDevice 26 bits WEP Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0003', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0003', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0003]"); await tryToEnableWifi();
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST26", "ssid": "TEST26",
"bssid": "", "bssid": "",
...@@ -944,9 +904,8 @@ describe('ACTS_WifiTest', function() { ...@@ -944,9 +904,8 @@ describe('ACTS_WifiTest', function() {
var result1 = wifi.connectToDevice(wifiDeviceConfig1); var 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");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -960,8 +919,7 @@ describe('ACTS_WifiTest', function() { ...@@ -960,8 +919,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test connectToDevice 5bits ASCLL WEP Deviceconfig * @tc.desc Test connectToDevice 5bits ASCLL WEP Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0005', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0005', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0005]"); await tryToEnableWifi();
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST5", "ssid": "TEST5",
"bssid": "", "bssid": "",
...@@ -979,9 +937,8 @@ describe('ACTS_WifiTest', function() { ...@@ -979,9 +937,8 @@ describe('ACTS_WifiTest', function() {
var result1 = wifi.connectToDevice(wifiDeviceConfig1); var 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");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -995,8 +952,7 @@ describe('ACTS_WifiTest', function() { ...@@ -995,8 +952,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test connectToDevice 13bits ASCLL WEP Deviceconfig * @tc.desc Test connectToDevice 13bits ASCLL WEP Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0007', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0007', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0007]"); await tryToEnableWifi();
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST7", "ssid": "TEST7",
"bssid": "", "bssid": "",
...@@ -1016,7 +972,6 @@ describe('ACTS_WifiTest', function() { ...@@ -1016,7 +972,6 @@ describe('ACTS_WifiTest', function() {
expect(result1).assertTrue(); expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi"); console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -1030,8 +985,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1030,8 +985,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test connectToDevice 63bits ASCLL PSK Deviceconfig * @tc.desc Test connectToDevice 63bits ASCLL PSK Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0013', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0013', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0013]"); await tryToEnableWifi();
console.info("[wifi_test] create 63bits PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST13", "ssid": "TEST13",
"bssid": "", "bssid": "",
...@@ -1049,9 +1003,8 @@ describe('ACTS_WifiTest', function() { ...@@ -1049,9 +1003,8 @@ describe('ACTS_WifiTest', function() {
var result1 = wifi.connectToDevice(wifiDeviceConfig1); var 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");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -1065,8 +1018,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1065,8 +1018,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test connectToDevice 8bits ASCLL PSK Deviceconfig * @tc.desc Test connectToDevice 8bits ASCLL PSK Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0014', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0014', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0014]"); await tryToEnableWifi();
console.info("[wifi_test] create 8bits PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST13", "ssid": "TEST13",
"bssid": "", "bssid": "",
...@@ -1084,9 +1036,8 @@ describe('ACTS_WifiTest', function() { ...@@ -1084,9 +1036,8 @@ describe('ACTS_WifiTest', function() {
var result1 = wifi.connectToDevice(wifiDeviceConfig1); var 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");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -1100,8 +1051,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1100,8 +1051,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test connectToDevice 63bits ASCLL PSK Deviceconfig * @tc.desc Test connectToDevice 63bits ASCLL PSK Deviceconfig
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Security_0015', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Conn_Security_0015', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0015]"); await tryToEnableWifi();
console.info("[wifi_test] create 63bits PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfig1 = {
"ssid": "TEST13", "ssid": "TEST13",
"bssid": "", "bssid": "",
...@@ -1121,7 +1071,6 @@ describe('ACTS_WifiTest', function() { ...@@ -1121,7 +1071,6 @@ describe('ACTS_WifiTest', function() {
expect(result1).assertTrue(); expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi"); console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved); console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
...@@ -1135,7 +1084,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1135,7 +1084,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test get IpInfo information * @tc.desc Test get IpInfo information
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function (done) { it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function (done) {
console.info("[wifi_test] wifi connectToDevice test."); await tryToEnableWifi();
var wifiDeviceConfigIp = { var wifiDeviceConfigIp = {
"ssid": "TEST1", "ssid": "TEST1",
"bssid": "", "bssid": "",
...@@ -1153,28 +1102,22 @@ describe('ACTS_WifiTest', function() { ...@@ -1153,28 +1102,22 @@ describe('ACTS_WifiTest', function() {
var result1 = wifi.connectToDevice(wifiDeviceConfigIp); var 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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
console.info("[wifi_test] reassociate wifi");
var reass= wifi.reassociate(); var reass= wifi.reassociate();
console.log("[wifi_test] wifi reassociate result: " + reass);
expect(reass).assertTrue(); expect(reass).assertTrue();
console.info("[wifi_test] get IpInfo.");
var ipInfo = wifi.getIpInfo(); var ipInfo = wifi.getIpInfo();
console.info("[wifi_test] getIpInfo -> " + JSON.stringify(ipInfo));
expect(JSON.stringify(ipInfo)).assertContain("gateway"); expect(JSON.stringify(ipInfo)).assertContain("gateway");
console.info("gateway: " + ipInfo.gateway); console.info("gateway: " + ipInfo.gateway + "ipAddress: " + ipInfo.ipAddress
console.info("ipAddress: " + ipInfo.ipAddress); + "leaseDuration: " + ipInfo.leaseDuration +
console.info("leaseDuration: " + ipInfo.leaseDuration); "leaseDuration: " + ipInfo.leaseDuration +
console.info("netmask: " + ipInfo.netmask); "netmask: " + ipInfo.netmask + "primaryDns:" + ipInfo.primaryDns +
console.info("primaryDns: " + ipInfo.primaryDns); "secondDns: " + ipInfo.secondDns + "serverIp: " + ipInfo.serverIp );
console.info("secondDns: " + ipInfo.secondDns);
console.info("serverIp: " + ipInfo.serverIp);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue(); expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs(); var 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));
...@@ -1185,32 +1128,26 @@ describe('ACTS_WifiTest', function() { ...@@ -1185,32 +1128,26 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number wifiStateChange_0001 * @tc.number wifiStateChange_0001
* @tc.name SUB_Communication_WiFi_Sta_wifiStateChange_0001 * @tc.name SUB_Communication_WiFi_Sta_wifiStateChange_0001
* @tc.author wudangping wwx1075776
* @tc.desc Test wifiStateChange callback * @tc.desc Test wifiStateChange callback
*/ */
it('SUB_Communication_WiFi_Sta_wifiStateChange_0001', 0, async function (done) { it('SUB_Communication_WiFi_Sta_wifiStateChange_0001', 0, async function (done) {
console.info('[wifi_test] OnWifiStateChange test start ...'); await tryToEnableWifi();
wifi.on('wifiStateChange', async result => { wifi.on('wifiStateChange', async result => {
console.info("wifiStateChange callback, result:" + JSON.stringify(result)); console.info("wifiStateChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
let promise = new Promise((resolve) => { let promise = new Promise((resolve) => {
console.info('[wifi_test] offwifiStateChange test start ...');
wifi.off('wifiStateChange', result => { wifi.off('wifiStateChange', result => {
console.info("offwifiStateChange callback, result: " + JSON.stringify(result)); console.info("offwifiStateChange callback, result: " + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
resolve() resolve()
}); });
}) })
await promise.then(done) await promise.then(done)
}); });
var disable = wifi.disableWifi() var disable = wifi.disableWifi()
await sleep(5000); await sleep(5000);
console.log("[wifi_test] wifi close result: " + disable);
var enable = wifi.enableWifi(); var enable = wifi.enableWifi();
await sleep(5000); await sleep(5000);
console.log("[wifi_test] wifi open result: " + enable);
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
done(); done();
...@@ -1219,16 +1156,14 @@ describe('ACTS_WifiTest', function() { ...@@ -1219,16 +1156,14 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number wifiConnectionChange_0002 * @tc.number wifiConnectionChange_0002
* @tc.name SUB_Communication_WiFi_Sta_wifiConnectionChange_0002 * @tc.name SUB_Communication_WiFi_Sta_wifiConnectionChange_0002
* @tc.author wudangping wwx1075776
* @tc.desc Test wifiStateChange callback * @tc.desc Test wifiStateChange callback
*/ */
it('SUB_Communication_WiFi_Sta_wifiConnectionChange_0002', 0, async function (done) { it('SUB_Communication_WiFi_Sta_wifiConnectionChange_0002', 0, async function (done) {
console.info('[wifi_test] OnWifiStateChange test start ...'); await tryToEnableWifi();
wifi.on('wifiConnectionChange', async result => { wifi.on('wifiConnectionChange', async result => {
console.info("wifiConnectionChange callback, result:" + JSON.stringify(result)); console.info("wifiConnectionChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
let promise = new Promise((resolve) => { let promise = new Promise((resolve) => {
console.info('[wifi_test] offwifiConnectionChange test start ...'); console.info('[wifi_test] offwifiConnectionChange test start ...');
wifi.off('wifiConnectionChange', result => { wifi.off('wifiConnectionChange', result => {
console.info("offwifiConnectionChange callback, result: " + JSON.stringify(result)); console.info("offwifiConnectionChange callback, result: " + JSON.stringify(result));
...@@ -1236,7 +1171,7 @@ describe('ACTS_WifiTest', function() { ...@@ -1236,7 +1171,7 @@ describe('ACTS_WifiTest', function() {
resolve() resolve()
}); });
}) })
await promise.then(done) await promise.then(done)
}); });
done(); done();
...@@ -1245,12 +1180,10 @@ describe('ACTS_WifiTest', function() { ...@@ -1245,12 +1180,10 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number wifiScanStateChange_0003 * @tc.number wifiScanStateChange_0003
* @tc.name SUB_Communication_WiFi_Sta_wifiScanStateChange_0003 * @tc.name SUB_Communication_WiFi_Sta_wifiScanStateChange_0003
* @tc.author wudangping wwx1075776
* @tc.desc Test wifiScanStateChange callback * @tc.desc Test wifiScanStateChange callback
*/ */
it('SUB_Communication_WiFi_Sta_wifiScanStateChange_0003', 0, async function (done) { it('SUB_Communication_WiFi_Sta_wifiScanStateChange_0003', 0, async function (done) {
console.info('[wifi_test] OnwifiScanStateChange test start ...'); await tryToEnableWifi();
wifi.on('wifiScanStateChange', async result => { wifi.on('wifiScanStateChange', async result => {
console.info("wifiScanStateChange callback, result:" + JSON.stringify(result)); console.info("wifiScanStateChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -1266,7 +1199,6 @@ describe('ACTS_WifiTest', function() { ...@@ -1266,7 +1199,6 @@ describe('ACTS_WifiTest', function() {
}); });
var scan = wifi.scan(); var scan = wifi.scan();
await sleep(3000); await sleep(3000);
console.log("[wifi_test] open wifi scan result: " + scan);
done(); done();
}) })
...@@ -1274,12 +1206,10 @@ describe('ACTS_WifiTest', function() { ...@@ -1274,12 +1206,10 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number wifiRssiChange_0004 * @tc.number wifiRssiChange_0004
* @tc.name SUB_Communication_WiFi_Sta_wifiRssiChange_0004 * @tc.name SUB_Communication_WiFi_Sta_wifiRssiChange_0004
* @tc.author wudangping wwx1075776
* @tc.desc Test wifiRssiChange callback * @tc.desc Test wifiRssiChange callback
*/ */
it('SUB_Communication_WiFi_Sta_wifiRssiChange_0004', 0, async function (done) { it('SUB_Communication_WiFi_Sta_wifiRssiChange_0004', 0, async function (done) {
console.info('[wifi_test] OnwifiRssiChange test start ...'); await tryToEnableWifi();
wifi.on('wifiRssiChange', async result => { wifi.on('wifiRssiChange', async result => {
console.info("wifiRssiChange callback, result:" + JSON.stringify(result)); console.info("wifiRssiChange callback, result:" + JSON.stringify(result));
expect(true).assertEqual(result !=null); expect(true).assertEqual(result !=null);
...@@ -1300,11 +1230,10 @@ describe('ACTS_WifiTest', function() { ...@@ -1300,11 +1230,10 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number streamChange_0005 * @tc.number streamChange_0005
* @tc.name SUB_Communication_WiFi_Sta_wifiRssiChange_0005 * @tc.name SUB_Communication_WiFi_Sta_wifiRssiChange_0005
* @tc.author wudangping wwx1075776
* @tc.desc Test streamChange callback * @tc.desc Test streamChange callback
*/ */
it('SUB_Communication_WiFi_Sta_streamChange_0005', 0, async function (done) { it('SUB_Communication_WiFi_Sta_streamChange_0005', 0, async function (done) {
console.info('[wifi_test] OnstreamChange test start ...'); await tryToEnableWifi();
wifi.on('streamChange', async result => { wifi.on('streamChange', async result => {
console.info("streamChange callback, result:" + JSON.stringify(result)); console.info("streamChange callback, result:" + JSON.stringify(result));
...@@ -1325,6 +1254,3 @@ describe('ACTS_WifiTest', function() { ...@@ -1325,6 +1254,3 @@ 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.
先完成此消息的编辑!
想要评论请 注册