Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
07fc31cb
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看板
提交
07fc31cb
编写于
11月 25, 2021
作者:
O
openharmony_ci
提交者:
Gitee
11月 25, 2021
浏览文件
操作
浏览文件
下载
差异文件
!1177 【communication】补充WIFI JS L2测试用例2
Merge pull request !1177 from 权力/cherry-pick-1637839086
上级
e0a1395c
f8ad2603
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
35 deletion
+45
-35
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
...on/wifi_standard/src/main/js/default/test/WifiSta.test.js
+45
-35
未找到文件。
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
浏览文件 @
07fc31cb
...
...
@@ -20,18 +20,25 @@ import wifi from '@ohos.wifi_native_js'
// delay x ms
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
break
;
for
(
var
start
=
(
new
Date
()).
getTime
();(
new
Date
()).
getTime
()
-
start
<=
delay
;
)
{
}
}
var
WifiSecurityType
=
{
WIFI_SEC_TYPE_INVALID
:
0
,
WIFI_SEC_TYPE_OPEN
:
1
,
WIFI_SEC_TYPE_WEP
:
2
,
WIFI_SEC_TYPE_PSK
:
3
,
WIFI_SEC_TYPE_SAE
:
4
,
}
var
wifiConfig
=
{
var
wifi
Device
Config
=
{
"
ssid
"
:
"
TEST
"
,
"
bssid
"
:
"
A1:B1:C1:D1:E1:F1
"
,
"
preSharedKey
"
:
"
12345678
"
,
"
isHiddenSsid
"
:
"
false
"
,
"
securityType
"
:
3
,
"
securityType
"
:
WifiSecurityType
.
WIFI_SEC_TYPE_SAE
,
"
netId
"
:
0
,
"
ipType
"
:
1
,
"
creatorUid
"
:
7
,
...
...
@@ -70,7 +77,7 @@ describe('ACTS_WifiTest', function () {
expect
(
enable
).
assertTrue
();
}
sleep
(
3000
0
);
sleep
(
3000
);
})
/**
...
...
@@ -93,7 +100,7 @@ describe('ACTS_WifiTest', function () {
it
(
'
wifi_native_js_unit_test_005
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[1].
"
);
var
result
=
wifi
.
scan
();
sleep
(
2000
0
);
sleep
(
2000
);
wifi
.
getScanInfos
(
(
result
)
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
...
...
@@ -101,7 +108,7 @@ describe('ACTS_WifiTest', function () {
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] add device config callback:
"
+
JSON
.
stringify
(
result
));
expect
(
JSON
.
stringify
(
result
)).
assertContain
(
'
ssid
'
);
sleep
(
5
000
);
sleep
(
3
000
);
for
(
var
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
...
...
@@ -114,7 +121,7 @@ describe('ACTS_WifiTest', function () {
});
done
();
})
sleep
(
2000
0
);
sleep
(
2000
);
/**
* @tc.number wifi_native_js_unit_test_006
...
...
@@ -131,7 +138,7 @@ describe('ACTS_WifiTest', function () {
console
.
info
(
"
[wifi_test] test_006 promise...
"
+
JSON
.
stringify
(
result
));
expect
(
JSON
.
stringify
(
result
)).
assertContain
(
'
ssid
'
);
sleep
(
5
000
);
sleep
(
2
000
);
for
(
var
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
...
...
@@ -155,20 +162,20 @@ describe('ACTS_WifiTest', function () {
it
(
'
wifi_native_js_unit_test_007
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[wifi_test] wifi add device config test[1]
'
);
var
active
=
wifi
.
isWifiActive
();
sleep
(
3000
0
);
console
.
log
(
"
[wifi_test] wifi active result:
"
+
active
);
sleep
(
3000
);
console
.
log
(
"
[wifi_test] wifi active result
1
:
"
+
active
);
if
(
!
active
){
var
enable
=
wifi
.
enableWifi
();
sleep
(
3000
0
);
ex
cep
t
(
enable
).
assertTrue
();
sleep
(
3000
);
ex
pec
t
(
enable
).
assertTrue
();
}
wifi
.
addDeviceConfig
(
wifiConfig
,
wifi
.
addDeviceConfig
(
wifi
Device
Config
,
(
result
)
=>
{
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] test_007 wifi addDeviceconfig callback:
"
+
JSON
.
stringify
(
result
));
var
conn
=
wifi
.
connectToNetwork
(
result
);
expect
(
conn
).
assertTrue
();
sleep
(
5000
0
);
sleep
(
5000
);
console
.
info
(
"
[wifi_test] test_007 wifi addDeviceconfig callback:
"
+
result
);
for
(
var
j
=
0
;
j
<
JSON
.
stringify
(
result
).
length
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
...
...
@@ -184,13 +191,13 @@ describe('ACTS_WifiTest', function () {
console
.
info
(
"
randomMacAddr:
"
+
result
[
j
].
randomMacAddr
);
console
.
info
(
"
staticIp:
"
+
result
[
j
].
staticIp
);
}
var
discon
=
wifi
.
disconnect
();
except
(
discon
).
assertTrue
();
sleep
(
30000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
done
();
var
discon1
=
wifi
.
disconnect
();
console
.
log
(
"
[wifi_test] wifi discon1 result:
"
+
discon1
);
expect
(
discon1
).
assertTrue
();
sleep
(
3000
);
done
();
})
/**
...
...
@@ -203,29 +210,32 @@ describe('ACTS_WifiTest', function () {
var
active
=
wifi
.
isWifiActive
();
if
(
!
active
){
var
enable
=
wifi
.
enableWifi
();
except
(
enable
).
assertTrue
();
sleep
(
30000
);
sleep
(
3000
);
expect
(
enable
).
assertTrue
();
}
wifi
.
addDeviceConfig
(
wifiConfig
)
wifi
.
addDeviceConfig
(
wifi
Device
Config
)
.
then
(
result
=>
{
console
.
info
(
"
[wifi_test] test_008 wifi addDeviceconfig promise result:
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] test_008 wifi addDeviceconfig promise result:
"
+
result
)
sleep
(
5
000
);
sleep
(
3
000
);
var
conn
=
wifi
.
connectToNetwork
(
result
);
expect
(
conn
).
assertTrue
();
sleep
(
5000
);
var
discon
=
wifi
.
disconnect
();
except
(
discon
).
assertTrue
();
sleep
(
2000
);
var
discon2
=
wifi
.
disconnect
();
console
.
log
(
"
[wifi_test] wifi discon2 result:
"
+
discon2
);
expect
(
discon2
).
assertTrue
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
sleep
(
30000
);
console
.
log
(
"
[wifi_test] wifi active result:
"
+
disable
);
except
(
disable
).
assertTrue
();
sleep
(
3000
);
console
.
log
(
"
[wifi_test] wifi disable result:
"
+
disable
);
expect
(
disable
).
assertTrue
();
});
done
();
})
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录