提交 dd7f1afc 编写于 作者: Q q00313334

xts 3568 testcase runtime

Signed-off-by: Nq00313334 <quanli1@huawei.com>
上级 9fcfcd5e
...@@ -662,6 +662,25 @@ describe('bluetoothhostTest', function() { ...@@ -662,6 +662,25 @@ describe('bluetoothhostTest', function() {
} }
}) })
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_DISCONNRCT_0001
* @tc.name testDisConnect
* @tc.desc Test DisConnect api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('bluetooth_gatt_disconnect', 0, function () {
console.info('[bluetooth_js] gatt disconnect start');
let ret = gattClient.disconnect();
console.info('[bluetooth_js] gatt disconnect ret:' + ret);
expect(ret).assertEqual(false);
console.info('[bluetooth_js] gatt disconnect end');
})
/** /**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_CLIENT_CLOSE_0001 * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_CLIENT_CLOSE_0001
* @tc.name testGattClientClose * @tc.name testGattClientClose
...@@ -689,22 +708,6 @@ describe('bluetoothhostTest', function() { ...@@ -689,22 +708,6 @@ describe('bluetoothhostTest', function() {
} }
}) })
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_DISCONNRCT_0001
* @tc.name testDisConnect
* @tc.desc Test DisConnect api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('bluetooth_gatt_disconnect', 0, function () {
console.info('[bluetooth_js] gatt disconnect start');
let ret = gattClient.disconnect();
console.info('[bluetooth_js] gatt disconnect ret:' + ret);
expect(ret).assertEqual(false);
console.info('[bluetooth_js] gatt disconnect end');
})
}) })
...@@ -296,7 +296,7 @@ describe('ACTS_WifiTest', function() { ...@@ -296,7 +296,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("ssid: " + config.ssid); console.info("preSharedKey: " + config.ssid);
expect(config.ssid.length).assertEqual(32); expect(config.ssid.length).assertEqual(32);
done(); done();
...@@ -421,7 +421,7 @@ describe('ACTS_WifiTest', function() { ...@@ -421,7 +421,7 @@ describe('ACTS_WifiTest', function() {
if (wifi.isHotspotActive()) { if (wifi.isHotspotActive()) {
var off = wifi.disableHotspot(); var off = wifi.disableHotspot();
await sleep(5000); await sleep(5000);
console.info("[wifi_test] enableHotspot result -> " + off); console.info("[wifi_test] disableHotspot result -> " + off);
expect(off).assertTrue(); expect(off).assertTrue();
} }
...@@ -555,31 +555,23 @@ describe('ACTS_WifiTest', function() { ...@@ -555,31 +555,23 @@ describe('ACTS_WifiTest', function() {
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."); console.info("[wifi_test] open Hotspot, set valid hotspot config start.");
var HotspotConfigW= { var HotspotConfigWO= {
"ssid": "WIFI_TEST", "ssid": "WIFITEST",
"band": 1, "band": 1,
"preSharedKey": "12345678", "preSharedKey": "123456789",
"securityType":WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"maxConn": 8 "maxConn": 8
} }
var isSuccess1 = wifi.setHotspotConfig(HotspotConfigW); 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.info("[wifi_test] check the current config."); console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig(); var configs = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config)); console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(configs));
console.info("ssid: " + config.ssid); console.info("ssid: " + configs.ssid);
console.info("band: " + config.band); expect(configs.ssid).assertEqual('WIFITEST');
console.info("preSharedKey: " + config.preSharedKey);
console.info("securityType: " + config.securityType);
console.info("maxConn: " + config.maxConn);
console.info("[wifi_test] check the current config is same with set before.");
expect(config.ssid).assertEqual('WIFI_TEST');
expect(config.band).assertEqual(1);
expect(config.preSharedKey).assertEqual('12345678');
expect(config.securityType).assertEqual(3);
expect(config.maxConn).assertEqual(8);
done(); done();
}) })
...@@ -608,7 +600,7 @@ describe('ACTS_WifiTest', function() { ...@@ -608,7 +600,7 @@ describe('ACTS_WifiTest', function() {
console.info("ssid: " + stationInfo.name); console.info("ssid: " + stationInfo.name);
console.info("macAddress: " + stationInfo.macAddress); console.info("macAddress: " + stationInfo.macAddress);
console.info("ipAddress: " + stationInfo.ipAddress); console.info("ipAddress: " + stationInfo.ipAddress);
expect(stationInfo.length).assertEqual(); expect(stationInfo.length).assertEqual(0);
done(); done();
}) })
...@@ -731,7 +723,7 @@ describe('ACTS_WifiTest', function() { ...@@ -731,7 +723,7 @@ describe('ACTS_WifiTest', function() {
* @tc.type Function * @tc.type Function
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Sta_Off_0006', 0, async function (done) { it('SUB_Communication_WiFi_Hotspot_Off_0006', 0, async function (done) {
try { try {
await wifi.off('hotspotStaLeave', (data) => { await wifi.off('hotspotStaLeave', (data) => {
console.info("[wifi_test] hotspotStaLeave Off ->" + data); console.info("[wifi_test] hotspotStaLeave Off ->" + data);
......
...@@ -79,8 +79,9 @@ describe('ACTS_WifiTest', function () { ...@@ -79,8 +79,9 @@ describe('ACTS_WifiTest', function () {
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); var resultLength = Object.keys(data).length;
expect(true).assertEqual(data.length!=0); console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0);
}).catch((error) => { }).catch((error) => {
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();
...@@ -144,9 +145,9 @@ describe('ACTS_WifiTest', function () { ...@@ -144,9 +145,9 @@ describe('ACTS_WifiTest', function () {
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
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(data.length!=0); expect(true).assertEqual(resultLength!=0);
expect(true).assertEqual(data.goBand == WifiP2PConfig2.goBand);
}).catch((error) => { }).catch((error) => {
console.info("[wifi_test]getCurrentGroup promise then error." + JSON.stringify(error)); console.info("[wifi_test]getCurrentGroup promise then error." + JSON.stringify(error));
expect(error).assertFail(); expect(error).assertFail();
...@@ -189,9 +190,10 @@ describe('ACTS_WifiTest', function () { ...@@ -189,9 +190,10 @@ describe('ACTS_WifiTest', function () {
expect(addConfig).assertTrue(); expect(addConfig).assertTrue();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then((data) => { .then((data) => {
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(data.length!=0); expect(true).assertEqual(resultLength!=0);
expect(true).assertEqual(data.goBand == WifiP2PConfig.goBand);
console.info("[wifi_test] test start deletePersistentGroup"); 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); console.info("[wifi_test] test start deletePersistentGroup" + removePConfig);
...@@ -256,8 +258,9 @@ describe('ACTS_WifiTest', function () { ...@@ -256,8 +258,9 @@ describe('ACTS_WifiTest', function () {
}; };
await wifi.getP2pLinkedInfo() await wifi.getP2pLinkedInfo()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length;
console.info("[wifi_test] getP2pLinkedInfo [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getP2pLinkedInfo [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(data.length!=0); expect(true).assertEqual(resultLength!=0);
}).catch((error) => { }).catch((error) => {
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();
...@@ -272,7 +275,6 @@ describe('ACTS_WifiTest', function () { ...@@ -272,7 +275,6 @@ describe('ACTS_WifiTest', function () {
console.info("isGroupOwner: " + result.isGroupOwner); console.info("isGroupOwner: " + result.isGroupOwner);
console.info("groupOwnerAddr: " + result.groupOwnerAddr); console.info("groupOwnerAddr: " + result.groupOwnerAddr);
expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED); expect(false).assertEqual(result.connectState ==P2pConnectState.CONNECTED);
expect(false).assertEqual(result.connectState ==P2pConnectState.DISCONNECTED);
}); });
done(); done();
...@@ -328,8 +330,9 @@ describe('ACTS_WifiTest', function () { ...@@ -328,8 +330,9 @@ describe('ACTS_WifiTest', function () {
expect(scanConfig).assertTrue(); expect(scanConfig).assertTrue();
await wifi.getP2pPeerDevices() await wifi.getP2pPeerDevices()
.then((data) => { .then((data) => {
var resultLength = Object.keys(data).length;
console.info("[wifi_test] getP2pPeerDevices [promise] result -> " + JSON.stringify(data)); console.info("[wifi_test] getP2pPeerDevices [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(data.length!=0); expect(true).assertEqual(resultLength!=0);
}).catch((error) => { }).catch((error) => {
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();
......
...@@ -97,9 +97,13 @@ describe('ACTS_WifiTest', function() { ...@@ -97,9 +97,13 @@ 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();
await sleep(5000);
console.log("[wifi_test] wifi close result: " + disable);
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()).assertTrue(); expect(wifi.isWifiActive()).assertFalse();
done(); done();
}) })
...@@ -351,7 +355,71 @@ describe('ACTS_WifiTest', function() { ...@@ -351,7 +355,71 @@ describe('ACTS_WifiTest', function() {
}); });
done() done()
}) })
/**
* @tc.number Config_0004
* @tc.name SUB_Communication_WiFi_Sta_Config_0004
* @tc.desc Test remove all wifi device config
*/
it('SUB_Communication_WiFi_Sta_Config_0004', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0004]");
console.info("[wifi_test] create multiple valid wifi device config and add it.");
var wifiDeviceConfig1 = {
"ssid": "TESTWgr1",
"bssid": "",
"preSharedKey": "123456789",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
};
var wifiDeviceConfig2 = {
"ssid": "TESTWgr2",
"bssid": "",
"preSharedKey": "",
"isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_OPEN,
};
let promiseOne = new Promise((resolve, reject) => {
wifi.addDeviceConfig(wifiDeviceConfig1,
(err,netWorkId1) => {
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 ");
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length >= 1);
resolve()
});
})
let promiseTwo = new Promise((resolve, reject) => {
wifi.addDeviceConfig(wifiDeviceConfig2,
(err,netWorkId2) => {
if(err) {
console.info("[wifi_test]add callback failed : " + JSON.stringify(err));
return;
}
console.info("[wifi_test] wifi addDeviceconfig2 callback : " + JSON.stringify(netWorkId2));
expect(true).assertEqual(netWorkId2 != -1);
console.info("[wifi_test] check add device configs successfully ");
var configs = wifi.getDeviceConfigs();
console.info("[wifi_test] wifi getDeviceConfigs result : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length >= 1);
console.info("[wifi_test] remove all configs");
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 configs,current get Configs : " + JSON.stringify(configs));
expect(true).assertEqual(configs.length == 0);
resolve()
});
})
Promise.all([promiseOne, promiseTwo]).then(done)
})
/** /**
* @tc.number Config_0007 * @tc.number Config_0007
...@@ -417,7 +485,7 @@ describe('ACTS_WifiTest', function() { ...@@ -417,7 +485,7 @@ describe('ACTS_WifiTest', function() {
* @tc.desc Test SSID wifi device config * @tc.desc Test SSID wifi device config
*/ */
it('SUB_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.");
var wifiDeviceConfigZ = { var wifiDeviceConfigZ = {
...@@ -467,7 +535,7 @@ describe('ACTS_WifiTest', function() { ...@@ -467,7 +535,7 @@ describe('ACTS_WifiTest', function() {
* @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0002 * @tc.name SSUB_Communication_WiFi_Sta_Conn_SSID_0002
* @tc.desc Test SSID wifi device config * @tc.desc Test SSID wifi device config
*/ */
it('SUB_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]"); console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0002]");
console.info("[wifi_test] create a kongge SSID wifi device config start."); console.info("[wifi_test] create a kongge SSID wifi device config start.");
var wifiDeviceConfigK = { var wifiDeviceConfigK = {
...@@ -517,7 +585,7 @@ describe('ACTS_WifiTest', function() { ...@@ -517,7 +585,7 @@ describe('ACTS_WifiTest', function() {
* @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 SSID wifi device config
*/ */
it('SUB_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]"); console.info("[wifi_test][SSUB_Communication_WiFi_Sta_Conn_SSID_0003]");
console.info("[wifi_test] create a kongge SSID wifi device config start."); console.info("[wifi_test] create a kongge SSID wifi device config start.");
var wifiDeviceConfigT = { var wifiDeviceConfigT = {
...@@ -539,7 +607,8 @@ describe('ACTS_WifiTest', function() { ...@@ -539,7 +607,8 @@ 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));
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);
...@@ -616,7 +685,7 @@ describe('ACTS_WifiTest', function() { ...@@ -616,7 +685,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.
...@@ -728,7 +797,7 @@ describe('ACTS_WifiTest', function() { ...@@ -728,7 +797,7 @@ describe('ACTS_WifiTest', function() {
console.info("connState: " + result.connState); console.info("connState: " + result.connState);
done(); done();
}); });
await sleep(2000);
}) })
/** /**
...@@ -741,8 +810,8 @@ describe('ACTS_WifiTest', function() { ...@@ -741,8 +810,8 @@ describe('ACTS_WifiTest', function() {
var wifiDeviceConfigIp = { var wifiDeviceConfigIp = {
"ssid": "TEST1", "ssid": "TEST1",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "123456789",
"isHiddenSsid": "false", "isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
"netId": -1, "netId": -1,
"ipType": 1, "ipType": 1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册