未验证 提交 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();
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册