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

!2321 【communication】add WIFI testcase1

Merge pull request !2321 from 权力/cherry-pick-1646884903
......@@ -80,24 +80,29 @@ describe('bluetoothhostTest', function() {
*/
it('bluetooth_classic_enable_bluetooth_001', 0, async function (done) {
console.info('[bluetooth_js] enable start');
var enable = bluetooth.enableBluetooth();
expect(enable).assertEqual(true);
console.info('[bluetooth_js] enable On = '+ JSON.stringify(enable));
var sta = bluetooth.getState();
switch(sta){
case 0:
var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
expect(enable).assertEqual(true);
break;
case 1:
console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta));
break;
case 2:
console.info('[bluetooth_js] state is On:'+ JSON.stringify(sta));
break;
case 3:
var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
break;
default:
console.info('[bluetooth_js] enable success');
}
await sleep(2000);
var state = bluetooth.getState();
console.info('[bluetooth_js] getState On = '+ JSON.stringify(state));
console.info('[bluetooth_js]state on:' + JSON.stringify(bluetooth.BluetoothState.STATE_ON));
console.info('[bluetooth_js]off :' + JSON.stringify(bluetooth.BluetoothState.STATE_OFF));
console.info('[bluetooth_js] turning on :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_TURNING_ON));
console.info('[bluetooth_js] turning off :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_TURNING_OFF));
console.info('[bluetooth_js] ble turning on :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_TURNING_ON));
console.info('[bluetooth_js] ble on:'
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_ON));
console.info('[bluetooth_js] ble turning off :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_TURNING_OFF));
console.info('bluetooth enable done');
done();
})
......
......@@ -66,22 +66,27 @@ describe('bluetoothhostTest', function() {
done();
}
}
console.info('[bluetooth_js]state on:' + JSON.stringify(bluetooth.BluetoothState.STATE_ON));
console.info('[bluetooth_js]off :' + JSON.stringify(bluetooth.BluetoothState.STATE_OFF));
console.info('[bluetooth_js] turning on :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_TURNING_ON));
console.info('[bluetooth_js] turning off :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_TURNING_OFF));
console.info('[bluetooth_js] ble turning on :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_TURNING_ON));
console.info('[bluetooth_js] ble on:'
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_ON));
console.info('[bluetooth_js] ble turning off :'
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_TURNING_OFF));
var enable = bluetooth.enableBluetooth();
expect(enable).assertEqual(true);
console.info('[bluetooth_js] enable On = '+ JSON.stringify(enable));
await sleep(4000);
var sta = bluetooth.getState();
switch(sta){
case 0:
var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
expect(enable).assertEqual(true);
break;
case 1:
console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta));
break;
case 2:
console.info('[bluetooth_js] state is On:'+ JSON.stringify(sta));
break;
case 3:
var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
break;
default:
console.info('[bluetooth_js] enable success');
}
await sleep(2000);
var state = bluetooth.getState();
console.info('[bluetooth_js] getState On = '+ JSON.stringify(state));
await bluetooth.off('stateChange', result => {
......
......@@ -73,9 +73,26 @@ describe('bluetoothhostTest', function() {
*/
it('bluetooth_classic_enable_bluetooth_001', 0, async function (done) {
console.info('[bluetooth_js] enable start');
var enable = bluetooth.enableBluetooth();
expect(enable).assertEqual(true);
console.info('[bluetooth_js] enable On = '+ JSON.stringify(enable));
var sta = bluetooth.getState();
switch(sta){
case 0:
var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
expect(enable).assertEqual(true);
break;
case 1:
console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta));
break;
case 2:
console.info('[bluetooth_js] state is On:'+ JSON.stringify(sta));
break;
case 3:
var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
break;
default:
console.info('[bluetooth_js] enable success');
}
await sleep(2000);
var state = bluetooth.getState();
console.info('[bluetooth_js] getState On = '+ JSON.stringify(state));
......
......@@ -137,7 +137,7 @@ describe('ACTS_WifiTest', function() {
/**
* @tc.number CONFIG_0003
* @tc.name SUB_Communication_WiFi_Hotspot_Config_0003
* @tc.desc Test set a invalid hotspot config
* @tc.desc Test set a invalid band hotspot config
* @tc.level Level 2
*/
it('SUB_Communication_WiFi_Hotspot_Config_0003', 0, async function (done) {
......@@ -200,6 +200,10 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM1);
console.log("[wifi_test] set 65 preSharedKey invalid hotspot config result: " + isSuccess1);
expect(isSuccess1).assertFalse();
console.info("[wifi_test] check band of current band should be 5G.");
var hotspotConfigS= wifi.getHotspotConfig();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfigS));
expect(hotspotConfigS.preSharedKey.length).assertEqual(63);
done();
})
......@@ -296,7 +300,7 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("preSharedKey: " + config.ssid);
console.info("ssid: " + config.ssid);
expect(config.ssid.length).assertEqual(32);
done();
......@@ -566,10 +570,10 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] set a psk preSharedKey hotspot config result1: " + isSuccess1);
expect(isSuccess1).assertTrue();
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var configs = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(configs));
console.info("ssid: " + configs.ssid);
expect(configs.ssid).assertEqual('WIFITEST');
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + config.ssid);
expect(config.ssid).assertEqual('WIFITEST');
done();
})
......
......@@ -309,8 +309,8 @@ describe('ACTS_WifiTest', function() {
})
/**
* @tc.number Config_0002
* @tc.name SUB_Communication_WiFi_Sta_Config_0002
* @tc.number Config_0003
* @tc.name SUB_Communication_WiFi_Sta_Config_0003
* @tc.desc Test create a PSK SecurityType wifi device config
*/
it('SUB_Communication_WiFi_Sta_Config_0003', 0, async function(done) {
......@@ -384,7 +384,7 @@ describe('ACTS_WifiTest', function() {
if(err) {
console.info("[wifi_test]add callback failed : " + JSON.stringify(err));
return;
}
}
console.info("[wifi_test] wifi addDeviceconfig1 callback:" + JSON.stringify(netWorkId1));
expect(true).assertEqual(netWorkId1 != -1);
console.info("[wifi_test] check add device configs successfully ");
......@@ -394,7 +394,6 @@ describe('ACTS_WifiTest', function() {
resolve()
});
})
let promiseTwo = new Promise((resolve, reject) => {
wifi.addDeviceConfig(wifiDeviceConfig2,
(err,netWorkId2) => {
......@@ -422,15 +421,15 @@ describe('ACTS_WifiTest', function() {
})
/**
* @tc.number Config_0007
* @tc.name SUB_Communication_WiFi_Sta_Config_0007
* @tc.desc Test update wifi device config
* @tc.number Config_0005
* @tc.name SUB_Communication_WiFi_Sta_Config_0005
* @tc.desc Test disableNetwork device config
*/
it('SUB_Communication_WiFi_Sta_Config_0007', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0007]");
it('SUB_Communication_WiFi_Sta_Config_0005', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0005]");
console.info("[wifi_test] create a valid wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST",
var wifiDeviceConfigD = {
"ssid": "TESTD",
"bssid": "",
"preSharedKey": "12345678",
"isHiddenSsid": false,
......@@ -443,8 +442,7 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
};
await wifi.addDeviceConfig(wifiDeviceConfig1)
await wifi.addDeviceConfig(wifiDeviceConfigD)
.then(netWorkId => {
console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1);
......@@ -454,19 +452,61 @@ describe('ACTS_WifiTest', function() {
var disconNet = wifi.disableNetwork(netWorkId);
console.log("[wifi_test] wifi disableNetwork result: " + disconNet);
expect(disconNet).assertTrue();
console.info("[wifi_test] check device configs successfully ");
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi device config result : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigD.ssid);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0);
});
done()
})
/**
* @tc.number Config_0006
* @tc.name SUB_Communication_WiFi_Sta_Config_0006
* @tc.desc Test update wifi device config
*/
it('SUB_Communication_WiFi_Sta_Config_0006', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0006]");
console.info("[wifi_test] create a valid wifi device config start.");
var wifiDeviceConfigU = {
"ssid": "TEST",
"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},
};
await wifi.addDeviceConfig(wifiDeviceConfigU)
.then(netWorkId => {
console.info("[wifi_test]add PSK Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
wifiDeviceConfig1.ssid = "UPDATE";
wifiDeviceConfig1.preSharedKey = "1234567890";
console.info("[wifi_test] wifi new wifiDeviceConfig1:" + wifi.updateNetwork(wifiDeviceConfig1));
wifiDeviceConfigU.ssid = "UPDATE";
wifiDeviceConfigU.preSharedKey = "1234567890";
console.info("[wifi_test] wifi new wifiDeviceConfig1:" + wifi.updateNetwork(wifiDeviceConfigU));
console.info("[wifi_test] check update device configs successfully ");
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] updated wifi device config result : " + JSON.stringify(configs));
expect(true).assertEqual(configs[1].ssid == wifiDeviceConfig1.ssid);
expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfig1.preSharedKey);
expect(true).assertEqual(configs[1].ssid == wifiDeviceConfigU.ssid);
expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfigU.preSharedKey);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork();
......@@ -484,7 +524,6 @@ describe('ACTS_WifiTest', function() {
* @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0001
* @tc.desc Test SSID wifi device config
*/
it('SSUB_Communication_WiFi_Sta_Conn_SSID_0001', 0, async function(done) {
console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0001]");
console.info("[wifi_test] create a contains chinese SSID wifi device config start.");
......@@ -625,6 +664,51 @@ describe('ACTS_WifiTest', function() {
done()
})
/**
* @tc.number Config_SSID_0007
* @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0007
* @tc.desc Test SSID wifi device config
*/
it('SUB_Communication_WiFi_Sta_Conn_SSID_0007', 0, async function(done) {
console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0007]");
console.info("[wifi_test] create a kongge SSID wifi device config start.");
var wifiDeviceConfigT = {
"ssid": "test",
"bssid": "",
"preSharedKey": "12345678",
"isHiddenSsid": true,
"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},
};
await wifi.addDeviceConfig(wifiDeviceConfigT)
.then(netWorkId => {
console.info("[wifi_test]add contains chinese Deviceconfig promise : " + JSON.stringify(netWorkId));
expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs));
expect(true).assertEqual(configs[0].ssid == wifiDeviceConfigT.ssid);
expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfigT.isHiddenSsid);
console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test]remove config,current get Config : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0);
});
done()
})
/**
* @tc.number SUB_Communication_WiFi_Sta_info_0001
* @tc.name testgetMacAddress
......@@ -685,7 +769,7 @@ describe('ACTS_WifiTest', function() {
expect(wifi.isFeatureSupported(result)).assertTrue();
})
/**
/**
* @tc.number SUB_Communication_WiFi_Sta_info_0005
* @tc.name testHotspotDualBandSupported
* @tc.desc Test HotspotDualBandSupported api.
......@@ -800,6 +884,251 @@ describe('ACTS_WifiTest', function() {
await sleep(2000);
})
/**
* @tc.number Conn_Security_0001
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0001
* @tc.desc Test connectToDevice 10 bits WEP Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0001]");
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST10",
"bssid": "",
"preSharedKey": "ABCDEF1234",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_WEP,
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0003
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0003
* @tc.desc Test connectToDevice 26 bits WEP Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0003', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0003]");
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST26",
"bssid": "",
"preSharedKey": "12345678901234567890123456",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_WEP,
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0005
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0005
* @tc.desc Test connectToDevice 5bits ASCLL WEP Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0005', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0005]");
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST5",
"bssid": "",
"preSharedKey": "aB1@g",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_WEP,
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0007
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0007
* @tc.desc Test connectToDevice 13bits ASCLL WEP Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0007', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0007]");
console.info("[wifi_test] create WEP SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST7",
"bssid": "",
"preSharedKey": "1234aA@fFgGzZ",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_WEP,
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0013
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0013
* @tc.desc Test connectToDevice 63bits ASCLL PSK Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0013', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0013]");
console.info("[wifi_test] create 63bits PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST13",
"bssid": "",
"preSharedKey": "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH1234567",
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0014
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0014
* @tc.desc Test connectToDevice 8bits ASCLL PSK Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0014', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0014]");
console.info("[wifi_test] create 8bits PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST13",
"bssid": "",
"preSharedKey": "ABCDEFGH",
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Security_0015
* @tc.name SUB_Communication_WiFi_Sta_Conn_Security_0015
* @tc.desc Test connectToDevice 63bits ASCLL PSK Deviceconfig
*/
it('SUB_Communication_WiFi_Sta_Conn_Security_0015', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Security_0015]");
console.info("[wifi_test] create 63bits PSK SecurityType wifi device config start.");
var wifiDeviceConfig1 = {
"ssid": "TEST13",
"bssid": "",
"preSharedKey": "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH1234567",
"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();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
var isRemoved = wifi.removeAllNetwork();
console.info("[wifi_test] check remove configs successfully,result:" + isRemoved);
expect(isRemoved).assertTrue();
done()
})
/**
* @tc.number Conn_Info_0003
* @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册