Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
99f04dc2
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
99f04dc2
编写于
6月 20, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 20, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9042 【XTS】【communication】wifi流水线问题修改及接口覆盖新增
Merge pull request !9042 from 权力/myfeature
上级
7c57e541
c9535866
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
282 addition
and
226 deletion
+282
-226
communication/wifi_ErrorCode202/src/main/js/test/ActWifiErrorCode202.test.js
...ErrorCode202/src/main/js/test/ActWifiErrorCode202.test.js
+4
-4
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
...dard/src/main/js/test/WifiManagerStationFunctions.test.js
+278
-222
未找到文件。
communication/wifi_ErrorCode202/src/main/js/test/ActWifiErrorCode202.test.js
浏览文件 @
99f04dc2
...
...
@@ -447,10 +447,10 @@ export default function actsWifiErrorCode202Test() {
it
(
'
SUB_Communication_WiFi_XTS_ErrorCode_0096
'
,
0
,
async
function
(
done
)
{
try
{
let
hotSpotConfig
=
{
"
ssid
"
:
"
HotspotTest
"
,
"
band
"
:
2
,
"
preSharedKey
"
:
null
,
"
securityType
"
:
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_
OPEN
,
"
ssid
"
:
"
test202
"
,
"
band
"
:
1
,
"
preSharedKey
"
:
"
12345678
"
,
"
securityType
"
:
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_
PSK
,
"
maxConn
"
:
8
,
};
let
setHotspotConfig
=
wifiMg
.
setHotspotConfig
(
hotSpotConfig
);
...
...
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
浏览文件 @
99f04dc2
...
...
@@ -67,239 +67,295 @@ export default function actsWifiManagerFunctionsTest() {
afterEach
(
function
()
{
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0021
* @tc.name testGetSignalLevel
* @tc.desc Test getSignalLevel API functionality..
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0021
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] check the 2.4G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
1
)).
assertEqual
(
4
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
1
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
75
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
75
,
1
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
76
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
76
,
1
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
82
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
82
,
1
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
83
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
83
,
1
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
88
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
88
,
1
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
89
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
89
,
1
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
1
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] check the 5G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
2
)).
assertEqual
(
4
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
2
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
72
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
72
,
2
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
73
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
73
,
2
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
79
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
79
,
2
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
80
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
80
,
2
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
85
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
85
,
2
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
86
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
86
,
2
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
2
)).
assertEqual
(
0
);
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0021
* @tc.name testGetSignalLevel
* @tc.desc Test getSignalLevel API functionality..
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0021
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] check the 2.4G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
1
)).
assertEqual
(
4
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
1
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
75
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
75
,
1
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
76
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
76
,
1
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
82
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
82
,
1
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
83
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
83
,
1
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
88
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
88
,
1
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
89
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
89
,
1
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
1
)).
assertEqual
(
0
);
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0017
* @tc.name testgetCountryCode
* @tc.desc Test getCountryCode API function.
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0017
'
,
0
,
function
()
{
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
getCountryCodeResult
=
wifiMg
.
getCountryCode
();
console
.
info
(
"
[wifi_test]getCountryCode :
"
+
JSON
.
stringify
(
getCountryCodeResult
));
let
countrylenth
=
getCountryCodeResult
.
length
;
console
.
info
(
"
[wifi_test]getCountryCode.length :
"
+
JSON
.
stringify
(
countrylenth
));
expect
(
true
).
assertEqual
(
countrylenth
==
2
);
console
.
info
(
"
[wifi_test] check the 5G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
2
)).
assertEqual
(
4
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
2
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
72
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
72
,
2
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
73
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
73
,
2
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
79
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
79
,
2
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
80
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
80
,
2
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
85
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
85
,
2
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
86
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
86
,
2
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
2
)).
assertEqual
(
0
);
})
let
WIDTH_20MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_20MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_20MHZ :
"
+
JSON
.
stringify
(
WIDTH_20MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_20MHZ
==
0
);
let
WIDTH_40MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_40MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_40MHZ :
"
+
JSON
.
stringify
(
WIDTH_40MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_40MHZ
==
1
);
let
WIDTH_80MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ :
"
+
JSON
.
stringify
(
WIDTH_80MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ
==
2
);
let
WIDTH_160MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_160MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_160MHZ :
"
+
JSON
.
stringify
(
WIDTH_160MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_160MHZ
==
3
);
let
WIDTH_80MHZ_PLUS
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ_PLUS
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ_PLUS :
"
+
JSON
.
stringify
(
WIDTH_80MHZ_PLUS
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ_PLUS
==
4
);
let
WIDTH_INVALID
=
wifiMg
.
WifiChannelWidth
.
WIDTH_INVALID
;
console
.
info
(
"
[wifi_test]WIDTH_INVALID :
"
+
JSON
.
stringify
(
WIDTH_INVALID
));
expect
(
true
).
assertEqual
(
WIDTH_INVALID
==
5
);
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0017
* @tc.name testgetCountryCode
* @tc.desc Test getCountryCode API function.
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0017
'
,
0
,
function
()
{
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
getCountryCodeResult
=
wifiMg
.
getCountryCode
();
console
.
info
(
"
[wifi_test]getCountryCode :
"
+
JSON
.
stringify
(
getCountryCodeResult
));
let
countrylenth
=
getCountryCodeResult
.
length
;
console
.
info
(
"
[wifi_test]getCountryCode.length :
"
+
JSON
.
stringify
(
countrylenth
));
expect
(
true
).
assertEqual
(
countrylenth
==
2
);
let
WIDTH_20MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_20MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_20MHZ :
"
+
JSON
.
stringify
(
WIDTH_20MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_20MHZ
==
0
);
let
WIDTH_40MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_40MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_40MHZ :
"
+
JSON
.
stringify
(
WIDTH_40MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_40MHZ
==
1
);
let
WIDTH_80MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ :
"
+
JSON
.
stringify
(
WIDTH_80MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ
==
2
);
let
WIDTH_160MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_160MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_160MHZ :
"
+
JSON
.
stringify
(
WIDTH_160MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_160MHZ
==
3
);
let
WIDTH_80MHZ_PLUS
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ_PLUS
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ_PLUS :
"
+
JSON
.
stringify
(
WIDTH_80MHZ_PLUS
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ_PLUS
==
4
);
let
WIDTH_INVALID
=
wifiMg
.
WifiChannelWidth
.
WIDTH_INVALID
;
console
.
info
(
"
[wifi_test]WIDTH_INVALID :
"
+
JSON
.
stringify
(
WIDTH_INVALID
));
expect
(
true
).
assertEqual
(
WIDTH_INVALID
==
5
);
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0020
* @tc.name testFeatureSupported
* @tc.desc Test FeatureSupported API function.
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0020
'
,
0
,
function
()
{
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
wifiUtils
=
{
WIFI_FEATURE_INFRA
:
0x0001
,
WIFI_FEATURE_INFRA_5G
:
0x0002
,
WIFI_GAS_ANQP
:
0x0004
,
WIFI_WIFI_DIRECT
:
0x0008
,
WIFI_FEATURE_MOBILE_HOTSPOT
:
0x0010
,
WIFI_FEATURE_AWARE
:
0x0040
,
WIFI_FEATURE_AP_STA
:
0x8000
,
WIFI_FEATURE_WPA3_SAE
:
0x8000000
,
WIFI_FEATURE_WPA3_SUITE_B
:
0x10000000
,
WIFI_FEATURE_OWE
:
0x20000000
}
let
isSupport1
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport1
);
let
isSupport2
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA_5G
);
console
.
info
(
"
[wifi_test] isFeatureSupported2 ->
"
+
isSupport2
);
let
isSupport3
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_GAS_ANQP
);
console
.
info
(
"
[wifi_test] isFeatureSupported3 ->
"
+
isSupport3
);
let
isSupport4
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_WIFI_DIRECT
);
console
.
info
(
"
[wifi_test] isFeatureSupported4 ->
"
+
isSupport4
);
let
isSupport5
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_MOBILE_HOTSPOT
);
console
.
info
(
"
[wifi_test] isFeatureSupported5 ->
"
+
isSupport5
);
let
isSupport6
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AWARE
);
console
.
info
(
"
[wifi_test] isFeatureSupported6 ->
"
+
isSupport6
);
let
isSupport7
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AP_STA
);
console
.
info
(
"
[wifi_test] isFeatureSupported7 ->
"
+
isSupport7
);
let
isSupport8
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SAE
);
console
.
info
(
"
[wifi_test] isFeatureSupported8 ->
"
+
isSupport8
);
let
isSupport9
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SUITE_B
);
console
.
info
(
"
[wifi_test] isFeatureSupported9 ->
"
+
isSupport9
);
let
isSupport
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_OWE
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport
);
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0020
* @tc.name testFeatureSupported
* @tc.desc Test FeatureSupported API function.
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0020
'
,
0
,
function
()
{
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
wifiUtils
=
{
WIFI_FEATURE_INFRA
:
0x0001
,
WIFI_FEATURE_INFRA_5G
:
0x0002
,
WIFI_GAS_ANQP
:
0x0004
,
WIFI_WIFI_DIRECT
:
0x0008
,
WIFI_FEATURE_MOBILE_HOTSPOT
:
0x0010
,
WIFI_FEATURE_AWARE
:
0x0040
,
WIFI_FEATURE_AP_STA
:
0x8000
,
WIFI_FEATURE_WPA3_SAE
:
0x8000000
,
WIFI_FEATURE_WPA3_SUITE_B
:
0x10000000
,
WIFI_FEATURE_OWE
:
0x20000000
}
let
isSupport1
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport1
);
let
isSupport2
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA_5G
);
console
.
info
(
"
[wifi_test] isFeatureSupported2 ->
"
+
isSupport2
);
let
isSupport3
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_GAS_ANQP
);
console
.
info
(
"
[wifi_test] isFeatureSupported3 ->
"
+
isSupport3
);
let
isSupport4
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_WIFI_DIRECT
);
console
.
info
(
"
[wifi_test] isFeatureSupported4 ->
"
+
isSupport4
);
let
isSupport5
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_MOBILE_HOTSPOT
);
console
.
info
(
"
[wifi_test] isFeatureSupported5 ->
"
+
isSupport5
);
let
isSupport6
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AWARE
);
console
.
info
(
"
[wifi_test] isFeatureSupported6 ->
"
+
isSupport6
);
let
isSupport7
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AP_STA
);
console
.
info
(
"
[wifi_test] isFeatureSupported7 ->
"
+
isSupport7
);
let
isSupport8
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SAE
);
console
.
info
(
"
[wifi_test] isFeatureSupported8 ->
"
+
isSupport8
);
let
isSupport9
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SUITE_B
);
console
.
info
(
"
[wifi_test] isFeatureSupported9 ->
"
+
isSupport9
);
let
isSupport
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_OWE
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport
);
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0004
* @tc.name testGetLinkedInfo
* @tc.desc Test Test getLinkedInfo and getIpInfo information.
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0004
'
,
0
,
async
function
(
done
)
{
let
isConnectedResult
=
wifiMg
.
isConnected
();
let
ipInfoResult
=
wifiMg
.
getIpInfo
();
expect
(
JSON
.
stringify
(
ipInfoResult
)).
assertContain
(
"
gateway
"
);
let
ipAddress
=
resolveIP
(
ipInfoResult
.
ipAddress
);
console
.
info
(
"
[wifi_test]ipAddress result:
"
+
ipAddress
);
console
.
info
(
"
gateway:
"
+
ipInfoResult
.
gateway
+
"
ipAddress:
"
+
ipInfoResult
.
ipAddress
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
netmask:
"
+
ipInfoResult
.
netmask
+
"
primaryDns:
"
+
ipInfoResult
.
primaryDns
+
"
secondDns:
"
+
ipInfoResult
.
secondDns
+
"
serverIp:
"
+
ipInfoResult
.
serverIp
);
await
wifiMg
.
getLinkedInfo
()
.
then
((
result
)
=>
{
console
.
info
(
"
[wifi_test]get wifi link promise:
"
+
JSON
.
stringify
(
result
));
done
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[wifi_test]promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0004
* @tc.name testGetLinkedInfo
* @tc.desc Test Test getLinkedInfo and getIpInfo information.
* @tc.type Function
* @tc.level Level 1
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0004
'
,
0
,
async
function
(
done
)
{
let
isConnectedResult
=
wifiMg
.
isConnected
();
let
ipInfoResult
=
wifiMg
.
getIpInfo
();
expect
(
JSON
.
stringify
(
ipInfoResult
)).
assertContain
(
"
gateway
"
);
let
ipAddress
=
resolveIP
(
ipInfoResult
.
ipAddress
);
console
.
info
(
"
[wifi_test]ipAddress result:
"
+
ipAddress
);
console
.
info
(
"
gateway:
"
+
ipInfoResult
.
gateway
+
"
ipAddress:
"
+
ipInfoResult
.
ipAddress
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
netmask:
"
+
ipInfoResult
.
netmask
+
"
primaryDns:
"
+
ipInfoResult
.
primaryDns
+
"
secondDns:
"
+
ipInfoResult
.
secondDns
+
"
serverIp:
"
+
ipInfoResult
.
serverIp
);
await
wifiMg
.
getLinkedInfo
()
.
then
((
result
)
=>
{
console
.
info
(
"
[wifi_test]get wifi link promise:
"
+
JSON
.
stringify
(
result
));
done
();
}).
catch
((
error
)
=>
{
console
.
info
(
"
[wifi_test]promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
function
getLinked
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getLinkedInfo
(
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
log
(
"
[wifi_test]wifi getLinkedInfo failed
"
+
err
);
}
let
clen
=
Object
.
keys
(
result
).
length
;
expect
(
clen
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test]getLinkedInfo callback result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
ssid:
"
+
result
.
ssid
+
"
bssid:
"
+
result
.
bssid
+
"
band:
"
+
result
.
band
+
"
isHidden:
"
+
result
.
isHidden
+
"
isRestricted:
"
+
result
.
isRestricted
+
"
chload:
"
+
result
.
chload
+
"
rssi
"
+
result
.
rssi
+
"
netWorkId:
"
+
result
.
netWorkId
+
"
linkSpeed:
"
+
result
.
linkSpeed
+
"
frequency:
"
+
result
.
frequency
+
"
snr:
"
+
result
.
snr
+
"
macAddress:
"
+
result
.
macAddress
+
"
ipAddress:
"
+
result
.
ipAddress
+
"
suppState:
"
+
result
.
suppState
+
"
connState:
"
+
result
.
connState
+
"
macType:
"
+
result
.
macType
+
"
rxLinkSpeed:
"
+
result
.
rxLinkSpeed
+
"
maxSupportedTxLinkSpeed:
"
+
result
.
maxSupportedTxLinkSpeed
+
"
maxSupportedRxLinkSpeed:
"
+
result
.
maxSupportedRxLinkSpeed
+
"
wifiStandard:
"
+
result
.
wifiStandard
);
let
standard
=
wifiMg
.
getLinkedInfo
().
WifiStandard
;
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_UNDEFINED
)
{
expect
(
true
).
assertEqual
(
standard
==
0
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11A
)
{
expect
(
true
).
assertEqual
(
standard
==
1
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11B
)
{
expect
(
true
).
assertEqual
(
standard
==
2
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11G
)
{
expect
(
true
).
assertEqual
(
standard
==
3
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11N
)
{
expect
(
true
).
assertEqual
(
standard
==
4
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AC
)
{
expect
(
true
).
assertEqual
(
standard
==
5
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AX
)
{
expect
(
true
).
assertEqual
(
standard
==
6
);
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AD
)
{
expect
(
true
).
assertEqual
(
standard
==
7
);
}
let
state
=
wifiMg
.
getLinkedInfo
().
ConnState
;
if
(
state
==
wifiMg
.
ConnState
.
SCANNING
)
{
expect
(
true
).
assertEqual
(
state
==
0
);
}
if
(
state
==
wifiMg
.
ConnState
.
CONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
1
);
}
if
(
state
==
wifiMg
.
ConnState
.
AUTHENTICATING
)
{
expect
(
true
).
assertEqual
(
state
==
2
);
}
if
(
state
==
wifiMg
.
ConnState
.
OBTAINING_IPADDR
)
{
expect
(
true
).
assertEqual
(
state
==
3
);
}
if
(
state
==
wifiMg
.
ConnState
.
CONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
4
);
}
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
5
);
}
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
6
);
}
if
(
state
==
wifiMg
.
ConnState
.
UNKNOWN
)
{
expect
(
true
).
assertEqual
(
state
==
7
);
}
resolve
();
});
});
}
await
getLinked
();
done
();
})
function
getLinked
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getLinkedInfo
(
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
log
(
"
[wifi_test]wifi getLinkedInfo failed
"
+
err
);
}
let
clen
=
Object
.
keys
(
result
).
length
;
expect
(
clen
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test]getLinkedInfo callback result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
ssid:
"
+
result
.
ssid
+
"
bssid:
"
+
result
.
bssid
+
"
band:
"
+
result
.
band
+
"
isHidden:
"
+
result
.
isHidden
+
"
isRestricted:
"
+
result
.
isRestricted
+
"
chload:
"
+
result
.
chload
+
"
rssi
"
+
result
.
rssi
+
"
netWorkId:
"
+
result
.
netWorkId
+
"
linkSpeed:
"
+
result
.
linkSpeed
+
"
frequency:
"
+
result
.
frequency
+
"
snr:
"
+
result
.
snr
+
"
macAddress:
"
+
result
.
macAddress
+
"
ipAddress:
"
+
result
.
ipAddress
+
"
suppState:
"
+
result
.
suppState
+
"
connState:
"
+
result
.
connState
+
"
macType:
"
+
result
.
macType
);
let
state
=
wifiMg
.
getLinkedInfo
().
ConnState
;
if
(
state
==
wifiMg
.
ConnState
.
SCANNING
)
{
expect
(
true
).
assertEqual
(
state
==
0
);
}
if
(
state
==
wifiMg
.
ConnState
.
CONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
1
);
}
if
(
state
==
wifiMg
.
ConnState
.
AUTHENTICATING
)
{
expect
(
true
).
assertEqual
(
state
==
2
);
}
if
(
state
==
wifiMg
.
ConnState
.
OBTAINING_IPADDR
)
{
expect
(
true
).
assertEqual
(
state
==
3
);
}
if
(
state
==
wifiMg
.
ConnState
.
CONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
4
);
}
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
5
);
}
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
6
);
}
if
(
state
==
wifiMg
.
ConnState
.
UNKNOWN
)
{
expect
(
true
).
assertEqual
(
state
==
7
);
}
resolve
();
});
});
}
await
getLinked
();
done
();
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0034
* @tc.name testgetScanResultsSync
* @tc.desc Test getScanResults Sync API functionality.
* @tc.type Function
* @tc.level Level 0
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0034
'
,
0
,
async
function
(
done
)
{
let
scanResult
=
wifiMg
.
scan
();
await
sleep
(
3000
);
let
getScanInfoListResult
=
wifiMg
.
getScanInfoList
();
console
.
info
(
"
[wifi_test]wifi getScanInfoList result :
"
+
JSON
.
stringify
(
getScanInfoListResult
));
let
clen
=
Object
.
keys
(
getScanInfoListResult
).
length
;
console
.
info
(
"
[wifi_test]wifi getScanInfoList length result :
"
+
JSON
.
stringify
(
clen
));
let
result
=
getScanInfoListResult
;
if
(
clen
>=
0
)
{
expect
(
true
).
assertEqual
(
clen
>=
0
);
for
(
let
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
+
"
bssid:
"
+
result
[
j
].
bssid
+
"
securityType:
"
+
result
[
j
].
securityType
+
"
rssi:
"
+
result
[
j
].
rssi
+
"
band:
"
+
result
[
j
].
band
+
"
frequency:
"
+
result
[
j
].
frequency
+
"
channelWidth:
"
+
result
[
j
].
channelWidth
+
"
timestamp
"
+
result
[
j
].
timestamp
+
"
capabilities
"
+
result
[
j
].
capabilities
+
"
centerFrequency0:
"
+
result
[
j
].
centerFrequency0
+
"
centerFrequency1:
"
+
result
[
j
].
centerFrequency1
+
"
eid:
"
+
result
[
j
].
infoElems
.
eid
+
"
content:
"
+
result
[
j
].
infoElems
.
content
);
}
}
done
();
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_003
4
* @tc.name test
getScanResultsSync
* @tc.desc Test
getScanResults Sync
API functionality.
* @tc.number SUB_Communication_WiFi_XTS_Sta_003
5
* @tc.name test
isBandTypeSupported
* @tc.desc Test
isBandTypeSupported
API functionality.
* @tc.type Function
* @tc.level Level 0
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0034
'
,
0
,
async
function
(
done
)
{
let
scanResult
=
wifiMg
.
scan
();
await
sleep
(
3000
);
let
getScanInfoListResult
=
wifiMg
.
getScanInfoList
();
console
.
info
(
"
[wifi_test]wifi getScanInfoList result :
"
+
JSON
.
stringify
(
getScanInfoListResult
));
let
clen
=
Object
.
keys
(
getScanInfoListResult
).
length
;
console
.
info
(
"
[wifi_test]wifi getScanInfoList length result :
"
+
JSON
.
stringify
(
clen
));
let
result
=
getScanInfoListResult
;
if
(
clen
>=
0
)
{
expect
(
true
).
assertEqual
(
clen
>=
0
);
for
(
let
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
+
"
bssid:
"
+
result
[
j
].
bssid
+
"
securityType:
"
+
result
[
j
].
securityType
+
"
rssi:
"
+
result
[
j
].
rssi
+
"
band:
"
+
result
[
j
].
band
+
"
frequency:
"
+
result
[
j
].
frequency
+
"
channelWidth:
"
+
result
[
j
].
channelWidth
+
"
timestamp
"
+
result
[
j
].
timestamp
+
"
capabilities
"
+
result
[
j
].
capabilities
+
"
centerFrequency0:
"
+
result
[
j
].
centerFrequency0
+
"
centerFrequency1:
"
+
result
[
j
].
centerFrequency1
+
"
eid:
"
+
result
[
j
].
infoElems
.
eid
+
"
content:
"
+
result
[
j
].
infoElems
.
content
);
}
it
(
'
SUB_Communication_WiFi_XTS_Sta_0035
'
,
0
,
async
function
(
done
)
{
try
{
let
isBandTypeSupported
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_NONE
);
console
.
info
(
"
[wifi_test]isBandTypeSupported.
"
+
JSON
.
stringify
(
isBandTypeSupported
));
}
catch
(
error
)
{
console
.
error
(
`isBandTypeSupported failed, code is
${
error
.
code
}
, message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
"
401
"
);
}
let
isBandTypeSupported1
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_2G
);
console
.
info
(
"
[wifi_test]isBandTypeSupported1.
"
+
JSON
.
stringify
(
isBandTypeSupported1
));
expect
(
typeof
(
isBandTypeSupported1
)).
assertEqual
(
'
boolean
'
);
let
isBandTypeSupported2
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_5G
);
console
.
info
(
"
[wifi_test]isBandTypeSupported2.
"
+
JSON
.
stringify
(
isBandTypeSupported2
));
expect
(
typeof
(
isBandTypeSupported2
)).
assertEqual
(
'
boolean
'
);
let
isBandTypeSupported3
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_6G
);
console
.
info
(
"
[wifi_test]isBandTypeSupported3.
"
+
JSON
.
stringify
(
isBandTypeSupported3
));
expect
(
typeof
(
isBandTypeSupported3
)).
assertEqual
(
'
boolean
'
);
let
isBandTypeSupported4
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_60G
);
console
.
info
(
"
[wifi_test]isBandTypeSupported4.
"
+
JSON
.
stringify
(
isBandTypeSupported4
));
expect
(
typeof
(
isBandTypeSupported4
)).
assertEqual
(
'
boolean
'
);
done
();
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录