Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8f77c8ad
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看板
提交
8f77c8ad
编写于
10月 22, 2021
作者:
O
openharmony_ci
提交者:
Gitee
10月 22, 2021
浏览文件
操作
浏览文件
下载
差异文件
!959 【communication】修改WIFI JS L2测试用例4
Merge pull request !959 from 权力/cherry-pick-1634813680
上级
59a41a4d
edd80933
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
130 addition
and
128 deletion
+130
-128
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
...on/wifi_standard/src/main/js/default/test/WifiSta.test.js
+130
-128
未找到文件。
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
浏览文件 @
8f77c8ad
...
...
@@ -48,172 +48,174 @@ var ipConfig = {
"
domains
"
:
[
"
aaa
"
],
}
describe
(
'
ACTS_WifiTest
'
,
function
()
{
beforeEach
(
function
()
{
})
afterEach
(
function
()
{
})
/**
/**
* @tc.number wifi_native_js_unit_test_001
* @tc.name Test wifi.isWifiActive.
* @tc.desc Test wifi.isWifiActive API functionality.
*/
it
(
'
wifi_native_js_unit_test_001
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi active test.
"
);
var
isactive
=
wifi
.
isWifiActive
();
expect
(
isactive
).
assertTrue
();
})
it
(
'
wifi_native_js_unit_test_001
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi active test.
"
);
var
isactive
=
wifi
.
isWifiActive
();
expect
(
isactive
).
assertTrue
();
})
/**
/**
* @tc.number wifi_native_js_unit_test_003
* @tc.name Test wifi.getSignalLevel.
* @tc.desc Test wifi.getSignalLevel API functionality.
*/
it
(
'
wifi_native_js_unit_test_003
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi get signal level test.
"
);
var
result
=
wifi
.
getSignalLevel
(
1
,
1
)
expect
(
result
).
assertEqual
(
4
);
sleep
(
3000
);
})
it
(
'
wifi_native_js_unit_test_003
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi get signal level test.
"
);
var
result
=
wifi
.
getSignalLevel
(
1
,
1
)
expect
(
result
).
assertEqual
(
4
);
sleep
(
3000
);
})
/**
/**
* @tc.number wifi_native_js_unit_test_005
* @tc.name Test wifi.getScanInfos 0.
* @tc.desc Test wifi.getScanInfos API functionality.
*/
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
();
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
(
20000
);
wifi
.
getScanInfos
(
(
result
)
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan info call back:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] add device config callback:
"
+
JSON
.
stringify
(
result
));
expect
(
JSON
.
stringify
(
result
)).
assertContain
(
'
ssid
'
);
sleep
(
5000
);
for
(
var
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
console
.
info
(
"
securityType:
"
+
result
[
j
].
securityType
);
console
.
info
(
"
rssi:
"
+
result
[
j
].
rssi
);
console
.
info
(
"
band:
"
+
result
[
j
].
band
);
console
.
info
(
"
frequency:
"
+
result
[
j
].
frequency
);
console
.
info
(
"
timestamp:
"
+
result
[
j
].
timestamp
);
}
});
done
();
})
sleep
(
20000
);
wifi
.
getScanInfos
(
(
result
)
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan info call back:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] add device config callback:
"
+
JSON
.
stringify
(
result
));
expect
(
JSON
.
stringify
(
result
)).
assertContain
(
'
ssid
'
);
sleep
(
5000
);
for
(
var
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
console
.
info
(
"
securityType:
"
+
result
[
j
].
securityType
);
console
.
info
(
"
rssi:
"
+
result
[
j
].
rssi
);
console
.
info
(
"
band:
"
+
result
[
j
].
band
);
console
.
info
(
"
frequency:
"
+
result
[
j
].
frequency
);
console
.
info
(
"
timestamp:
"
+
result
[
j
].
timestamp
);
}
});
done
();
})
sleep
(
20000
);
/**
/**
* @tc.number wifi_native_js_unit_test_006
* @tc.name Test wifi.getScanInfos 1.
* @tc.desc Test wifi.getScanInfos API functionality.
*/
it
(
'
wifi_native_js_unit_test_006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[2].
"
);
wifi
.
getScanInfos
()
.
then
(
result
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan promise result:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] test_006 promise...
"
+
JSON
.
stringify
(
result
));
expect
(
JSON
.
stringify
(
result
)).
assertContain
(
'
ssid
'
);
sleep
(
5000
);
for
(
var
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
console
.
info
(
"
securityType:
"
+
result
[
j
].
securityType
);
console
.
info
(
"
rssi:
"
+
result
[
j
].
rssi
);
console
.
info
(
"
band:
"
+
result
[
j
].
band
);
console
.
info
(
"
frequency:
"
+
result
[
j
].
frequency
);
console
.
info
(
"
timestamp:
"
+
result
[
j
].
timestamp
);
console
.
info
(
"
capabilities:
"
+
result
[
j
].
capabilities
);
console
.
info
(
"
channelWidth:
"
+
result
[
j
].
channelWidth
);
}
});
done
();
})
it
(
'
wifi_native_js_unit_test_006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[2].
"
);
wifi
.
getScanInfos
()
.
then
(
result
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan promise result:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] test_006 promise...
"
+
JSON
.
stringify
(
result
));
expect
(
JSON
.
stringify
(
result
)).
assertContain
(
'
ssid
'
);
sleep
(
5000
);
for
(
var
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
console
.
info
(
"
securityType:
"
+
result
[
j
].
securityType
);
console
.
info
(
"
rssi:
"
+
result
[
j
].
rssi
);
console
.
info
(
"
band:
"
+
result
[
j
].
band
);
console
.
info
(
"
frequency:
"
+
result
[
j
].
frequency
);
console
.
info
(
"
timestamp:
"
+
result
[
j
].
timestamp
);
console
.
info
(
"
capabilities:
"
+
result
[
j
].
capabilities
);
console
.
info
(
"
channelWidth:
"
+
result
[
j
].
channelWidth
);
}
});
done
();
})
/**
/**
* @tc.number wifi_native_js_unit_test_007
* @tc.name Test wifi.removeDeviceconfig 1.
* @tc.desc Test wifi.addDeviceconfig API functionality.
*/
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
();
if
(
!
active
){
var
enable
=
wifi
.
enableWifi
();
except
(
enable
).
assertTrue
();
sleep
(
3000
);
}
wifi
.
addDeviceConfig
(
wifiConfig
,
(
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
);
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
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
console
.
info
(
"
securityType:
"
+
result
[
j
].
securityType
);
console
.
info
(
"
isHiddenSsid:
"
+
result
[
j
].
isHiddenSsid
);
console
.
info
(
"
preSharedKey:
"
+
result
[
j
].
preSharedKey
);
console
.
info
(
"
ipType:
"
+
result
[
j
].
ipType
);
console
.
info
(
"
creatorUid:
"
+
result
[
j
].
creatorUid
);
console
.
info
(
"
netId:
"
+
result
[
j
].
netId
);
console
.
info
(
"
disableReason:
"
+
result
[
j
].
disableReason
);
console
.
info
(
"
randomMacType:
"
+
result
[
j
].
randomMacType
);
console
.
info
(
"
randomMacAddr:
"
+
result
[
j
].
randomMacAddr
);
console
.
info
(
"
staticIp:
"
+
result
[
j
].
staticIp
);
}
var
discon
=
wifi
.
disconnect
();
except
(
discon
).
assertTrue
();
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
();
if
(
!
active
){
var
enable
=
wifi
.
enableWifi
();
except
(
enable
).
assertTrue
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
done
();
})
}
wifi
.
addDeviceConfig
(
wifiConfig
,
(
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
);
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
);
console
.
info
(
"
bssid:
"
+
result
[
j
].
bssid
);
console
.
info
(
"
securityType:
"
+
result
[
j
].
securityType
);
console
.
info
(
"
isHiddenSsid:
"
+
result
[
j
].
isHiddenSsid
);
console
.
info
(
"
preSharedKey:
"
+
result
[
j
].
preSharedKey
);
console
.
info
(
"
ipType:
"
+
result
[
j
].
ipType
);
console
.
info
(
"
creatorUid:
"
+
result
[
j
].
creatorUid
);
console
.
info
(
"
netId:
"
+
result
[
j
].
netId
);
console
.
info
(
"
disableReason:
"
+
result
[
j
].
disableReason
);
console
.
info
(
"
randomMacType:
"
+
result
[
j
].
randomMacType
);
console
.
info
(
"
randomMacAddr:
"
+
result
[
j
].
randomMacAddr
);
console
.
info
(
"
staticIp:
"
+
result
[
j
].
staticIp
);
}
var
discon
=
wifi
.
disconnect
();
except
(
discon
).
assertTrue
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
done
();
})
/**
/**
* @tc.number wifi_native_js_unit_test_008
* @tc.name Test wifi.deviceconfig 2.
* @tc.desc Test wifi.adddeviceconfig API functionality.
*/
it
(
'
wifi_native_js_unit_test_008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test]wifi add device config test[2].
"
);
var
active
=
wifi
.
isWifiActive
();
if
(
!
active
){
var
enable
=
wifi
.
enableWifi
();
except
(
enable
).
assertTrue
();
sleep
(
3000
);
}
wifi
.
addDeviceConfig
(
wifiConfig
)
.
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
(
5000
);
var
conn
=
wifi
.
connectToNetwork
(
result
);
expect
(
conn
).
assertTrue
();
sleep
(
5000
);
var
discon
=
wifi
.
disconnect
();
except
(
discon
).
assertTrue
();
it
(
'
wifi_native_js_unit_test_008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test]wifi add device config test[2].
"
);
var
active
=
wifi
.
isWifiActive
();
if
(
!
active
){
var
enable
=
wifi
.
enableWifi
();
except
(
enable
).
assertTrue
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
done
();
})
}
wifi
.
addDeviceConfig
(
wifiConfig
)
.
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
(
5000
);
var
conn
=
wifi
.
connectToNetwork
(
result
);
expect
(
conn
).
assertTrue
();
sleep
(
5000
);
var
discon
=
wifi
.
disconnect
();
except
(
discon
).
assertTrue
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
done
();
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录