1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' 17import { UiComponent, UiDriver, BY, Component, Driver, UiWindow, ON, MatchPattern, DisplayRotation, ResizeDirection, UiDirection, MouseButton, WindowMode, PointerMatrix, UIElementInfo, UIEventObserver } from '@ohos.UiTest' 18import wifiMg from '@ohos.wifiManager' 19 20function sleep(delay) { 21 return new Promise(resovle => setTimeout(resovle, delay)) 22} 23 24function checkWifiPowerOn(){ 25 console.info("[wifi_test]wifi status:" + wifiMg.isWifiActive()); 26} 27 28function resolveIP(ip) { 29 return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); 30} 31 32async function clickRequestPermission() { 33 try { 34 console.info('[wifi_js] clickRequestPermission start'); 35 let driver = Driver.create(); 36 await driver.delayMs(3000); 37 let button = await driver.findComponent(ON.text("本次使用", MatchPattern.CONTAINS)); 38 await button.click(); 39 await driver.delayMs(3000); 40 console.info('[wifi_js] clickRequestPermission end'); 41 } catch (err) { 42 console.info('[wifi_js] clickRequestPermission failed'); 43 } 44} 45 46export default function actsWifiManagerFunctionsTest() { 47 describe('actsWifiManagerFunctionsTest', function() { 48 beforeAll(async function (done) { 49 console.info('beforeAll case'); 50 await clickRequestPermission(); 51 done(); 52 }) 53 54 beforeEach(function () { 55 checkWifiPowerOn(); 56 }) 57 afterEach(function () { 58 }) 59 60 /** 61 * @tc.number SUB_Communication_WiFi_XTS_Sta_0021 62 * @tc.name testGetSignalLevel 63 * @tc.desc Test getSignalLevel API functionality.. 64 * @tc.type Function 65 * @tc.size LargeTest 66 * @tc.level Level 3 67 */ 68 it('SUB_Communication_WiFi_XTS_Sta_0021', 0, function () { 69 console.info("[wifi_test] check the 2.4G rssi assgined to level test."); 70 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-65, 1)); 71 expect(wifiMg.getSignalLevel(-65, 1)).assertEqual(4); 72 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-66, 1)); 73 expect(wifiMg.getSignalLevel(-66, 1)).assertEqual(3); 74 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-75, 1)); 75 expect(wifiMg.getSignalLevel(-75, 1)).assertEqual(3); 76 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-76, 1)); 77 expect(wifiMg.getSignalLevel(-76, 1)).assertEqual(2); 78 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-82, 1)); 79 expect(wifiMg.getSignalLevel(-82, 1)).assertEqual(2); 80 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-83, 1)); 81 expect(wifiMg.getSignalLevel(-83, 1)).assertEqual(1); 82 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-88, 1)); 83 expect(wifiMg.getSignalLevel(-88, 1)).assertEqual(1); 84 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-89, 1)); 85 expect(wifiMg.getSignalLevel(-89, 1)).assertEqual(0); 86 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-127, 1)); 87 expect(wifiMg.getSignalLevel(-127, 1)).assertEqual(0); 88 89 console.info("[wifi_test] check the 5G rssi assgined to level test."); 90 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-65, 2)); 91 expect(wifiMg.getSignalLevel(-65, 2)).assertEqual(4); 92 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-66, 2)); 93 expect(wifiMg.getSignalLevel(-66, 2)).assertEqual(3); 94 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-72, 2)); 95 expect(wifiMg.getSignalLevel(-72, 2)).assertEqual(3); 96 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-73, 2)); 97 expect(wifiMg.getSignalLevel(-73, 2)).assertEqual(2); 98 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-79, 2)); 99 expect(wifiMg.getSignalLevel(-79, 2)).assertEqual(2); 100 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-80, 2)); 101 expect(wifiMg.getSignalLevel(-80, 2)).assertEqual(1); 102 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-85, 2)); 103 expect(wifiMg.getSignalLevel(-85, 2)).assertEqual(1); 104 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-86, 2)); 105 expect(wifiMg.getSignalLevel(-86, 2)).assertEqual(0); 106 console.info("[wifi_test] getSignalLevel " + wifiMg.getSignalLevel(-127, 2)); 107 expect(wifiMg.getSignalLevel(-127, 2)).assertEqual(0); 108 }) 109 110 /** 111 * @tc.number SUB_Communication_WiFi_XTS_Sta_0017 112 * @tc.name testgetCountryCode 113 * @tc.desc Test getCountryCode API function. 114 * @tc.type Function 115 * @tc.size LargeTest 116 * @tc.level Level 3 117 */ 118 it('SUB_Communication_WiFi_XTS_Sta_0017', 0, function () { 119 expect(wifiMg.isWifiActive()).assertTrue(); 120 let getCountryCodeResult = wifiMg.getCountryCode(); 121 console.info("[wifi_test]getCountryCode :" + JSON.stringify(getCountryCodeResult)); 122 let countrylenth = getCountryCodeResult.length; 123 console.info("[wifi_test]getCountryCode.length :" + JSON.stringify(countrylenth)); 124 expect(true).assertEqual(countrylenth == 2); 125 let WIDTH_20MHZ = wifiMg.WifiChannelWidth .WIDTH_20MHZ; 126 console.info("[wifi_test]WIDTH_20MHZ : " + JSON.stringify(WIDTH_20MHZ)); 127 expect(true).assertEqual( WIDTH_20MHZ == 0); 128 let WIDTH_40MHZ = wifiMg.WifiChannelWidth .WIDTH_40MHZ; 129 console.info("[wifi_test]WIDTH_40MHZ : " + JSON.stringify(WIDTH_40MHZ)); 130 expect(true).assertEqual( WIDTH_40MHZ == 1); 131 let WIDTH_80MHZ = wifiMg.WifiChannelWidth .WIDTH_80MHZ; 132 console.info("[wifi_test]WIDTH_80MHZ : " + JSON.stringify(WIDTH_80MHZ)); 133 expect(true).assertEqual( WIDTH_80MHZ == 2); 134 let WIDTH_160MHZ = wifiMg.WifiChannelWidth .WIDTH_160MHZ; 135 console.info("[wifi_test]WIDTH_160MHZ : " + JSON.stringify(WIDTH_160MHZ)); 136 expect(true).assertEqual( WIDTH_160MHZ == 3); 137 let WIDTH_80MHZ_PLUS = wifiMg.WifiChannelWidth .WIDTH_80MHZ_PLUS; 138 console.info("[wifi_test]WIDTH_80MHZ_PLUS : " + JSON.stringify(WIDTH_80MHZ_PLUS)); 139 expect(true).assertEqual( WIDTH_80MHZ_PLUS == 4); 140 let WIDTH_INVALID = wifiMg.WifiChannelWidth .WIDTH_INVALID; 141 console.info("[wifi_test]WIDTH_INVALID : " + JSON.stringify(WIDTH_INVALID)); 142 expect(true).assertEqual( WIDTH_INVALID == 5); 143 }) 144 145 /** 146 * @tc.number SUB_Communication_WiFi_XTS_Sta_0020 147 * @tc.name testFeatureSupported 148 * @tc.desc Test FeatureSupported API function. 149 * @tc.type Function 150 * @tc.size LargeTest 151 * @tc.level Level 3 152 */ 153 it('SUB_Communication_WiFi_XTS_Sta_0020', 0, function () { 154 expect(wifiMg.isWifiActive()).assertTrue(); 155 let wifiUtils = { 156 WIFI_FEATURE_INFRA: 0x0001, 157 WIFI_FEATURE_INFRA_5G: 0x0002, 158 WIFI_GAS_ANQP: 0x0004, 159 WIFI_WIFI_DIRECT: 0x0008, 160 WIFI_FEATURE_MOBILE_HOTSPOT: 0x0010, 161 WIFI_FEATURE_AWARE: 0x0040, 162 WIFI_FEATURE_AP_STA: 0x8000, 163 WIFI_FEATURE_WPA3_SAE: 0x8000000, 164 WIFI_FEATURE_WPA3_SUITE_B: 0x10000000, 165 WIFI_FEATURE_OWE: 0x20000000 166 } 167 let isSupport1 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_INFRA); 168 console.info("[wifi_test] isFeatureSupported -> " + isSupport1); 169 let isSupport2 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_INFRA_5G); 170 console.info("[wifi_test] isFeatureSupported2 -> " + isSupport2); 171 let isSupport3 = wifiMg.isFeatureSupported(wifiUtils.WIFI_GAS_ANQP); 172 console.info("[wifi_test] isFeatureSupported3 -> " + isSupport3); 173 let isSupport4 = wifiMg.isFeatureSupported(wifiUtils.WIFI_WIFI_DIRECT); 174 console.info("[wifi_test] isFeatureSupported4 -> " + isSupport4); 175 let isSupport5 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_MOBILE_HOTSPOT); 176 console.info("[wifi_test] isFeatureSupported5 -> " + isSupport5); 177 let isSupport6 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_AWARE); 178 console.info("[wifi_test] isFeatureSupported6 -> " + isSupport6); 179 let isSupport7 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_AP_STA); 180 console.info("[wifi_test] isFeatureSupported7 -> " + isSupport7); 181 let isSupport8 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_WPA3_SAE); 182 console.info("[wifi_test] isFeatureSupported8 -> " + isSupport8); 183 let isSupport9 = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_WPA3_SUITE_B); 184 console.info("[wifi_test] isFeatureSupported9 -> " + isSupport9); 185 let isSupport = wifiMg.isFeatureSupported(wifiUtils.WIFI_FEATURE_OWE); 186 console.info("[wifi_test] isFeatureSupported -> " + isSupport); 187 }) 188 189 /** 190 * @tc.number SUB_Communication_WiFi_XTS_Sta_0004 191 * @tc.name testGetLinkedInfo 192 * @tc.desc Test Test getLinkedInfo and getIpInfo information. 193 * @tc.type Function 194 * @tc.size LargeTest 195 * @tc.level Level 1 196 */ 197 it('SUB_Communication_WiFi_XTS_Sta_0004', 0, async function (done) { 198 let isConnectedResult = wifiMg.isConnected(); 199 let ipInfoResult = wifiMg.getIpInfo(); 200 expect(JSON.stringify(ipInfoResult)).assertContain("gateway"); 201 let ipAddress = resolveIP(ipInfoResult.ipAddress); 202 console.info("[wifi_test]ipAddress result: " + ipAddress); 203 console.info("gateway: " + ipInfoResult.gateway + "ipAddress: " + ipInfoResult.ipAddress 204 + "leaseDuration: " + ipInfoResult.leaseDuration + 205 "leaseDuration: " + ipInfoResult.leaseDuration + 206 "netmask: " + ipInfoResult.netmask + "primaryDns:" + ipInfoResult.primaryDns + 207 "secondDns: " + ipInfoResult.secondDns + "serverIp: " + ipInfoResult.serverIp); 208 await wifiMg.getLinkedInfo() 209 .then((result) => { 210 console.info("[wifi_test]get wifi link promise:" + JSON.stringify(result)); 211 done(); 212 }).catch((error) => { 213 console.info("[wifi_test]promise then error." + JSON.stringify(error)); 214 expect().assertFail(); 215 }); 216 function getLinked(){ 217 return new Promise((resolve, reject) => { 218 wifiMg.getLinkedInfo( 219 (err, result) => { 220 if(err) { 221 console.log("[wifi_test]wifi getLinkedInfo failed " + err); 222 } 223 let clen = Object.keys(result).length; 224 expect(clen).assertLarger(0); 225 console.info("[wifi_test]getLinkedInfo callback result: " + JSON.stringify(result)); 226 console.info("ssid: " + result.ssid + "bssid:" + result.bssid + "band: " + result.band + 227 "isHidden: " + result.isHidden + "isRestricted: " + result.isRestricted + 228 "chload: " + result.chload + "rssi " + result.rssi + "netWorkId: " + result.netWorkId + 229 "linkSpeed: " + result.linkSpeed + "frequency:" 230 + result.frequency + "snr:" + result.snr + 231 "macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress + 232 "suppState: " + result.suppState + "connState: " + result.connState 233 + "macType: " + result.macType + "rxLinkSpeed: " + result.rxLinkSpeed 234 + "maxSupportedTxLinkSpeed: " + result.maxSupportedTxLinkSpeed 235 + "maxSupportedRxLinkSpeed: " + result.maxSupportedRxLinkSpeed 236 + "wifiStandard: " + result.wifiStandard 237 + " supportedWifiCategory :"+result.supportedWifiCategory 238 + " isHiLinkNetwork: "+result.isHiLinkNetwork); 239 let standard = wifiMg.getLinkedInfo().WifiStandard; 240 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_UNDEFINED) { 241 expect(true).assertEqual(standard == 0); 242 } 243 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11A) { 244 expect(true).assertEqual(standard == 1); 245 } 246 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11B) { 247 expect(true).assertEqual(standard == 2); 248 } 249 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11G) { 250 expect(true).assertEqual(standard == 3); 251 } 252 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11N) { 253 expect(true).assertEqual(standard == 4); 254 } 255 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11AC) { 256 expect(true).assertEqual(standard == 5); 257 } 258 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11AX) { 259 expect(true).assertEqual(standard == 6); 260 } 261 if (standard == wifiMg.WifiStandard.WIFI_STANDARD_11AD) { 262 expect(true).assertEqual(standard == 7); 263 } 264 let state = wifiMg.getLinkedInfo().ConnState; 265 if (state == wifiMg.ConnState.SCANNING) { 266 expect(true).assertEqual(state == 0); 267 } 268 if (state == wifiMg.ConnState.CONNECTING) { 269 expect(true).assertEqual(state == 1); 270 } 271 if (state == wifiMg.ConnState.AUTHENTICATING) { 272 expect(true).assertEqual(state == 2); 273 } 274 if (state == wifiMg.ConnState.OBTAINING_IPADDR) { 275 expect(true).assertEqual(state == 3); 276 } 277 if (state == wifiMg.ConnState.CONNECTED) { 278 expect(true).assertEqual(state == 4); 279 } 280 if (state == wifiMg.ConnState.DISCONNECTING) { 281 expect(true).assertEqual(state == 5); 282 } 283 if (state == wifiMg.ConnState.DISCONNECTED) { 284 expect(true).assertEqual(state == 6); 285 } 286 if (state == wifiMg.ConnState.UNKNOWN) { 287 expect(true).assertEqual(state == 7); 288 } 289 resolve(); 290 }); 291 }); 292 } 293 await getLinked(); 294 done(); 295 }) 296 297 /** 298 * @tc.number SUB_Communication_WiFi_XTS_Sta_0034 299 * @tc.name testgetScanResultsSync 300 * @tc.desc Test getScanResults Sync API functionality. 301 * @tc.type Function 302 * @tc.size LargeTest 303 * @tc.level Level 0 304 */ 305 it('SUB_Communication_WiFi_XTS_Sta_0034', 0, async function(done) { 306 try 307 { 308 let scanResult = wifiMg.scan(); 309 }catch(error){ 310 console.info("[error] it's the scan fail reason: "+JSON.stringify(error)); 311 expect(true).assertEqual(error.code=='2501000'); 312 } 313 await sleep(3000); 314 let getScanInfoListResult = wifiMg.getScanResultsSync(); 315 let clen = Object.keys(getScanInfoListResult).length; 316 console.info("[wifi_test]wifi getScanInfoListResult length result : " + JSON.stringify(clen)); 317 let getScanInfoResult = wifiMg.getScanInfoList(); 318 //console.info("[wifi_test]wifi getScanInfoList result : " + JSON.stringify(getScanInfoResult)); 319 clen = Object.keys(getScanInfoResult).length; 320 console.info("[wifi_test]wifi getScanInfoList length result : " + JSON.stringify(clen)); 321 let result = getScanInfoListResult; 322 if (clen >= 0) { 323 expect(true).assertEqual(clen >= 0); 324 for (let j = 0; j < clen && j<3; ++j) { 325 console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid + 326 "bssidType: " + result[j].bssidType + 327 "securityType: " + result[j].securityType + 328 "rssi: " + result[j].rssi + "band: " + result[j].band + 329 "frequency: " + result[j].frequency + "channelWidth: " + result[j].channelWidth + 330 "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities 331 + "centerFrequency0: " + result[j].centerFrequency0 332 + "centerFrequency1: " + result[j].centerFrequency1 333 + "eid: " + result[j].infoElems.eid + "content: " + result[j].infoElems.content 334 +" supportedWifiCategory: "+result[j].supportedWifiCategory+" isHiLinkNetwork: "+result[j].isHiLinkNetwork); 335 } 336 } 337 done(); 338 }) 339 340 /** 341 * @tc.number SUB_Communication_WiFi_XTS_Sta_0035 342 * @tc.name testisBandTypeSupported 343 * @tc.desc Test isBandTypeSupported API functionality. 344 * @tc.type Function 345 * @tc.size LargeTest 346 * @tc.level Level 0 347 */ 348 it('SUB_Communication_WiFi_XTS_Sta_0035', 0, async function(done) { 349 try { 350 let isBandTypeSupported = wifiMg.isBandTypeSupported(wifiMg.WifiBandType.WIFI_BAND_NONE); 351 console.info("[wifi_test]isBandTypeSupported." + JSON.stringify(isBandTypeSupported)); 352 } catch (error) { 353 console.error(`isBandTypeSupported failed, code is ${error.code}, message is ${error.message}`); 354 expect(error.code).assertEqual("401"); 355 } 356 let isBandTypeSupported1 = wifiMg.isBandTypeSupported(wifiMg.WifiBandType.WIFI_BAND_2G); 357 console.info("[wifi_test]isBandTypeSupported1." + JSON.stringify(isBandTypeSupported1)); 358 expect(typeof (isBandTypeSupported1)).assertEqual('boolean'); 359 let isBandTypeSupported2 = wifiMg.isBandTypeSupported(wifiMg.WifiBandType.WIFI_BAND_5G); 360 console.info("[wifi_test]isBandTypeSupported2." + JSON.stringify(isBandTypeSupported2)); 361 expect(typeof (isBandTypeSupported2)).assertEqual('boolean'); 362 let isBandTypeSupported3 = wifiMg.isBandTypeSupported(wifiMg.WifiBandType.WIFI_BAND_6G); 363 console.info("[wifi_test]isBandTypeSupported3." + JSON.stringify(isBandTypeSupported3)); 364 expect(typeof (isBandTypeSupported3)).assertEqual('boolean'); 365 let isBandTypeSupported4 = wifiMg.isBandTypeSupported(wifiMg.WifiBandType.WIFI_BAND_60G); 366 console.info("[wifi_test]isBandTypeSupported4." + JSON.stringify(isBandTypeSupported4)); 367 expect(typeof (isBandTypeSupported4)).assertEqual('boolean'); 368 done(); 369 }) 370 371 /** 372 * @tc.number SUB_Communication_WiFi_XTS_Sta_0036 373 * @tc.name testgetScanResults 374 * @tc.desc Test getScanResults promise and callback API functionality. 375 * @tc.type Function 376 * @tc.size LargeTest 377 * @tc.level Level 0 378 */ 379 it('SUB_Communication_WiFi_XTS_Sta_0036', 0, async function (done) { 380 await wifiMg.getScanResults() 381 .then(result => { 382 let clen = Object.keys(result).length; 383 expect(true).assertEqual(clen >= 0); 384 console.info("[wifi_test]getScanResults promise result:" + JSON.stringify(result)); 385 }); 386 function getScan() { 387 return new Promise((resolve, reject) => { 388 wifiMg.getScanResults( 389 (err, result) => { 390 if (err) { 391 console.log("[wifi_test] wifi getScanResults failed:" + err); 392 } 393 let clen = Object.keys(result).length; 394 if (!(clen == 0)) { 395 expect(clen).assertLarger(0); 396 console.info("[wifi_test] getScanResults callback result: " + JSON.stringify(result)); 397 for (let j = 0; j < clen; ++j) { 398 console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid + 399 "securityType: " + result[j].securityType + 400 "rssi: " + result[j].rssi + "band: " + result[j].band + 401 "frequency: " + result[j].frequency + "channelWidth: " + 402 result[j].channelWidth + 403 "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities); 404 } 405 } 406 resolve(); 407 }); 408 }); 409 } 410 await getScan(); 411 done(); 412 }) 413 414 /** 415 * @tc.number Communication_WiFi_XTS_Sta_0037 416 * @tc.name testgetIpv6Info 417 * @tc.desc Test getIpv6Info API functionality. 418 * @tc.type Function 419 * @tc.size LargeTest 420 * @tc.level Level 0 421 */ 422 it('Communication_WiFi_XTS_Sta_0037', 0, function () { 423 let ipv6InfoResult = wifiMg.getIpv6Info(); 424 console.info("[wifi_test]ipv6InfoResult." + JSON.stringify(ipv6InfoResult)); 425 expect(JSON.stringify(ipv6InfoResult)).assertContain("gateway"); 426 console.info("linkIpv6Address: " + ipv6InfoResult.linkIpv6Address + "globalIpv6Address: " + 427 ipv6InfoResult.globalIpv6Address 428 + "randomGlobalIpv6Address: " + ipv6InfoResult.randomGlobalIpv6Address + 429 "gateway: " + ipv6InfoResult.gateway + 430 "netmask: " + ipv6InfoResult.netmask + "primaryDns:" + ipv6InfoResult.primaryDNS + 431 "secondDns: " + ipv6InfoResult.secondDNS + "uniqueIpv6Address" + ipv6InfoResult.uniqueIpv6Address + 432 "randomUniqueIpv6Address" + ipv6InfoResult.randomUniqueIpv6Address); 433 }) 434 435 /** 436 * @tc.number Communication_WiFi_XTS_Sta_0099 437 * @tc.name testWifiCategory 438 * @tc.desc Test enum WifiCategory API12. 439 * @tc.type Function 440 * @tc.size LargeTest 441 * @tc.level Level 0 442 */ 443 it('Communication_WiFi_XTS_Sta_0099', 0, function () { 444 try { 445 let WifiCategoryDefault = wifiMg.WifiCategory.DEFAULT; 446 console.info("[wifi_test]DEFAULT: " + JSON.stringify(WifiCategoryDefault)); 447 expect(WifiCategoryDefault).assertEqual(1); 448 let WifiCategoryWifi6 = wifiMg.WifiCategory.WIFI6; 449 console.info("[wifi_test]WIFI6: " + JSON.stringify(WifiCategoryWifi6)); 450 expect(WifiCategoryWifi6).assertEqual(2); 451 let WifiCategoryWifi6Plus = wifiMg.WifiCategory.WIFI6_PLUS; 452 console.info("[wifi_test]WIFI6_PLUS: " + JSON.stringify(WifiCategoryWifi6Plus)); 453 expect(WifiCategoryWifi6Plus).assertEqual(3); 454 } catch (error) { 455 console.error('[wifi_test]testWifiCategory failed: ' + error); 456 expect(false).assertTrue(); 457 } 458 }) 459 console.log("*************[wifi_test] start wifi js unit test end*************"); 460 }) 461} 462