未验证 提交 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() { ...@@ -80,24 +80,29 @@ describe('bluetoothhostTest', function() {
*/ */
it('bluetooth_classic_enable_bluetooth_001', 0, async function (done) { it('bluetooth_classic_enable_bluetooth_001', 0, async function (done) {
console.info('[bluetooth_js] enable start'); console.info('[bluetooth_js] enable start');
var enable = bluetooth.enableBluetooth(); var sta = bluetooth.getState();
expect(enable).assertEqual(true); switch(sta){
console.info('[bluetooth_js] enable On = '+ JSON.stringify(enable)); 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); await sleep(2000);
var state = bluetooth.getState(); var state = bluetooth.getState();
console.info('[bluetooth_js] getState On = '+ JSON.stringify(state)); 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'); console.info('bluetooth enable done');
done(); done();
}) })
......
...@@ -66,22 +66,27 @@ describe('bluetoothhostTest', function() { ...@@ -66,22 +66,27 @@ describe('bluetoothhostTest', function() {
done(); done();
} }
} }
console.info('[bluetooth_js]state on:' + JSON.stringify(bluetooth.BluetoothState.STATE_ON)); var sta = bluetooth.getState();
console.info('[bluetooth_js]off :' + JSON.stringify(bluetooth.BluetoothState.STATE_OFF)); switch(sta){
console.info('[bluetooth_js] turning on :' case 0:
+ JSON.stringify(bluetooth.BluetoothState.STATE_TURNING_ON)); var enable = bluetooth.enableBluetooth();
console.info('[bluetooth_js] turning off :' console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
+ JSON.stringify(bluetooth.BluetoothState.STATE_TURNING_OFF)); expect(enable).assertEqual(true);
console.info('[bluetooth_js] ble turning on :' break;
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_TURNING_ON)); case 1:
console.info('[bluetooth_js] ble on:' console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta));
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_ON)); break;
console.info('[bluetooth_js] ble turning off :' case 2:
+ JSON.stringify(bluetooth.BluetoothState.STATE_BLE_TURNING_OFF)); console.info('[bluetooth_js] state is On:'+ JSON.stringify(sta));
var enable = bluetooth.enableBluetooth(); break;
expect(enable).assertEqual(true); case 3:
console.info('[bluetooth_js] enable On = '+ JSON.stringify(enable)); var enable = bluetooth.enableBluetooth();
await sleep(4000); console.info('[bluetooth_js] enable0 = '+ JSON.stringify(enable));
break;
default:
console.info('[bluetooth_js] enable success');
}
await sleep(2000);
var state = bluetooth.getState(); var state = bluetooth.getState();
console.info('[bluetooth_js] getState On = '+ JSON.stringify(state)); console.info('[bluetooth_js] getState On = '+ JSON.stringify(state));
await bluetooth.off('stateChange', result => { await bluetooth.off('stateChange', result => {
......
...@@ -73,9 +73,26 @@ describe('bluetoothhostTest', function() { ...@@ -73,9 +73,26 @@ describe('bluetoothhostTest', function() {
*/ */
it('bluetooth_classic_enable_bluetooth_001', 0, async function (done) { it('bluetooth_classic_enable_bluetooth_001', 0, async function (done) {
console.info('[bluetooth_js] enable start'); console.info('[bluetooth_js] enable start');
var enable = bluetooth.enableBluetooth(); var sta = bluetooth.getState();
expect(enable).assertEqual(true); switch(sta){
console.info('[bluetooth_js] enable On = '+ JSON.stringify(enable)); 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); await sleep(2000);
var state = bluetooth.getState(); var state = bluetooth.getState();
console.info('[bluetooth_js] getState On = '+ JSON.stringify(state)); console.info('[bluetooth_js] getState On = '+ JSON.stringify(state));
......
...@@ -137,7 +137,7 @@ describe('ACTS_WifiTest', function() { ...@@ -137,7 +137,7 @@ describe('ACTS_WifiTest', function() {
/** /**
* @tc.number CONFIG_0003 * @tc.number CONFIG_0003
* @tc.name SUB_Communication_WiFi_Hotspot_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 * @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) {
...@@ -200,6 +200,10 @@ describe('ACTS_WifiTest', function() { ...@@ -200,6 +200,10 @@ describe('ACTS_WifiTest', function() {
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM1); var isSuccess1 = wifi.setHotspotConfig(HotspotConfigM1);
console.log("[wifi_test] set 65 preSharedKey invalid hotspot config result: " + isSuccess1); 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();
console.log("[wifi_test] getHotspotConfig result: " + JSON.stringify(hotspotConfigS));
expect(hotspotConfigS.preSharedKey.length).assertEqual(63);
done(); done();
}) })
...@@ -296,7 +300,7 @@ describe('ACTS_WifiTest', function() { ...@@ -296,7 +300,7 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" ); 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.ssid); console.info("ssid: " + config.ssid);
expect(config.ssid.length).assertEqual(32); expect(config.ssid.length).assertEqual(32);
done(); done();
...@@ -566,10 +570,10 @@ describe('ACTS_WifiTest', function() { ...@@ -566,10 +570,10 @@ describe('ACTS_WifiTest', function() {
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" ); console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var configs = wifi.getHotspotConfig(); var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(configs)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
console.info("ssid: " + configs.ssid); console.info("ssid: " + config.ssid);
expect(configs.ssid).assertEqual('WIFITEST'); expect(config.ssid).assertEqual('WIFITEST');
done(); done();
}) })
......
...@@ -309,8 +309,8 @@ describe('ACTS_WifiTest', function() { ...@@ -309,8 +309,8 @@ describe('ACTS_WifiTest', function() {
}) })
/** /**
* @tc.number Config_0002 * @tc.number Config_0003
* @tc.name SUB_Communication_WiFi_Sta_Config_0002 * @tc.name SUB_Communication_WiFi_Sta_Config_0003
* @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_0003', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0003', 0, async function(done) {
...@@ -384,7 +384,7 @@ describe('ACTS_WifiTest', function() { ...@@ -384,7 +384,7 @@ describe('ACTS_WifiTest', function() {
if(err) { if(err) {
console.info("[wifi_test]add callback failed : " + JSON.stringify(err)); console.info("[wifi_test]add callback failed : " + JSON.stringify(err));
return; return;
} }
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 "); console.info("[wifi_test] check add device configs successfully ");
...@@ -394,7 +394,6 @@ describe('ACTS_WifiTest', function() { ...@@ -394,7 +394,6 @@ describe('ACTS_WifiTest', function() {
resolve() resolve()
}); });
}) })
let promiseTwo = new Promise((resolve, reject) => { let promiseTwo = new Promise((resolve, reject) => {
wifi.addDeviceConfig(wifiDeviceConfig2, wifi.addDeviceConfig(wifiDeviceConfig2,
(err,netWorkId2) => { (err,netWorkId2) => {
...@@ -422,15 +421,15 @@ describe('ACTS_WifiTest', function() { ...@@ -422,15 +421,15 @@ describe('ACTS_WifiTest', function() {
}) })
/** /**
* @tc.number Config_0007 * @tc.number Config_0005
* @tc.name SUB_Communication_WiFi_Sta_Config_0007 * @tc.name SUB_Communication_WiFi_Sta_Config_0005
* @tc.desc Test update wifi device config * @tc.desc Test disableNetwork device config
*/ */
it('SUB_Communication_WiFi_Sta_Config_0007', 0, async function(done) { it('SUB_Communication_WiFi_Sta_Config_0005', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0007]"); console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0005]");
console.info("[wifi_test] create a valid wifi device config start."); console.info("[wifi_test] create a valid wifi device config start.");
var wifiDeviceConfig1 = { var wifiDeviceConfigD = {
"ssid": "TEST", "ssid": "TESTD",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
"isHiddenSsid": false, "isHiddenSsid": false,
...@@ -443,8 +442,7 @@ describe('ACTS_WifiTest', function() { ...@@ -443,8 +442,7 @@ describe('ACTS_WifiTest', function() {
"randomMacAddr": "11:22:33:44:55:66", "randomMacAddr": "11:22:33:44:55:66",
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
}; };
await wifi.addDeviceConfig(wifiDeviceConfigD)
await wifi.addDeviceConfig(wifiDeviceConfig1)
.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);
...@@ -454,19 +452,61 @@ describe('ACTS_WifiTest', function() { ...@@ -454,19 +452,61 @@ describe('ACTS_WifiTest', function() {
var disconNet = wifi.disableNetwork(netWorkId); var disconNet = wifi.disableNetwork(netWorkId);
console.log("[wifi_test] wifi disableNetwork result: " + disconNet); 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();
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 "); 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));
wifiDeviceConfig1.ssid = "UPDATE"; wifiDeviceConfigU.ssid = "UPDATE";
wifiDeviceConfig1.preSharedKey = "1234567890"; wifiDeviceConfigU.preSharedKey = "1234567890";
console.info("[wifi_test] wifi new wifiDeviceConfig1:" + wifi.updateNetwork(wifiDeviceConfig1)); console.info("[wifi_test] wifi new wifiDeviceConfig1:" + wifi.updateNetwork(wifiDeviceConfigU));
console.info("[wifi_test] check update device configs successfully "); 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 == wifiDeviceConfig1.ssid); expect(true).assertEqual(configs[1].ssid == wifiDeviceConfigU.ssid);
expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfig1.preSharedKey); expect(true).assertEqual(configs[1].preSharedKey == wifiDeviceConfigU.preSharedKey);
console.info("[wifi_test] remove config"); console.info("[wifi_test] remove config");
var isRemoved = wifi.removeAllNetwork(); var isRemoved = wifi.removeAllNetwork();
...@@ -484,7 +524,6 @@ describe('ACTS_WifiTest', function() { ...@@ -484,7 +524,6 @@ describe('ACTS_WifiTest', function() {
* @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0001 * @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0001
* @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]"); console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0001]");
console.info("[wifi_test] create a contains chinese SSID wifi device config start."); console.info("[wifi_test] create a contains chinese SSID wifi device config start.");
...@@ -625,6 +664,51 @@ describe('ACTS_WifiTest', function() { ...@@ -625,6 +664,51 @@ describe('ACTS_WifiTest', function() {
done() 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.number SUB_Communication_WiFi_Sta_info_0001
* @tc.name testgetMacAddress * @tc.name testgetMacAddress
...@@ -685,7 +769,7 @@ describe('ACTS_WifiTest', function() { ...@@ -685,7 +769,7 @@ describe('ACTS_WifiTest', function() {
expect(wifi.isFeatureSupported(result)).assertTrue(); expect(wifi.isFeatureSupported(result)).assertTrue();
}) })
/** /**
* @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.
...@@ -800,6 +884,251 @@ describe('ACTS_WifiTest', function() { ...@@ -800,6 +884,251 @@ describe('ACTS_WifiTest', function() {
await sleep(2000); 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.number Conn_Info_0003
* @tc.name SUB_Communication_WiFi_Sta_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.
先完成此消息的编辑!
想要评论请 注册