Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
89a87ca0
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看板
提交
89a87ca0
编写于
9月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!823 【communication】增加WIFI JS L2测试用例1
Merge pull request !823 from 权力/myfeature
上级
6573b64b
02fd9644
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
149 addition
and
370 deletion
+149
-370
communication/BUILD.gn
communication/BUILD.gn
+1
-1
communication/wifi_standard/src/main/js/default/test/OsAccount.test.js
.../wifi_standard/src/main/js/default/test/OsAccount.test.js
+0
-184
communication/wifi_standard/src/main/js/default/test/Wifi.test.js
...ation/wifi_standard/src/main/js/default/test/Wifi.test.js
+147
-184
test_packages.gni
test_packages.gni
+1
-1
未找到文件。
communication/BUILD.gn
浏览文件 @
89a87ca0
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
# limitations under the License.
# limitations under the License.
import("//build/ohos_var.gni")
import("//build/ohos_var.gni")
group("
account
") {
group("
communication
") {
testonly = true
testonly = true
if (is_standard_system) {
if (is_standard_system) {
deps = [ "wifi_standard:wifi_standard_test" ]
deps = [ "wifi_standard:wifi_standard_test" ]
...
...
communication/wifi_standard/src/main/js/default/test/OsAccount.test.js
已删除
100755 → 0
浏览文件 @
6573b64b
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
wifi_js
from
'
@ohos.wifi_js
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
// delay x ms
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
continue
;
}
}
describe
(
'
appInfoTest
'
,
function
()
{
beforeEach
(
function
()
{
})
afterEach
(
function
()
{
})
console
.
log
(
"
*************[wifi_test]start wifi js unit test[ver:18]*************
"
);
/**
* @tc.number wifi_js_unit_test_001
* @tc.name Test wifi.isWifiActive.
* @tc.desc Test wifi.isWifiActive API functionality.
*/
it
(
'
wifi_js_unit_test_001
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi active test.
"
);
expect
(
wifi_js
.
isWifiActive
()).
assertTrue
();
})
/**
* @tc.number wifi_js_unit_test_002
* @tc.name Test wifi.scan.
* @tc.desc Test wifi.scan API functionality.
*/
it
(
'
wifi_js_unit_test_002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] wifi scan test.
"
);
expect
(
wifi_js
.
scan
()).
assertTrue
();
sleep
(
3000
);
wifi_js
.
getScanInfos
(
result
=>
{
console
.
info
(
'
[wifi_test] getScanInfos ->
'
+
JSON
.
stringify
(
result
));
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
Object
.
keys
(
result
).
length
;
++
i
)
{
console
.
info
(
"
[wifi_test] rssi:
"
+
result
[
i
].
rssi
+
"
, band:
"
+
result
[
i
].
band
+
"
, level:
"
+
wifi_js
.
getSignalLevel
(
result
[
i
].
rssi
,
result
[
i
].
band
));
}
})
sleep
(
3000
);
expect
(
wifi_js
.
scan
()).
assertTrue
();
sleep
(
3000
);
wifi_js
.
getScanInfos
().
then
(
result
=>
{
console
.
info
(
"
[wifi_test] wifi scan result call promise.
"
);
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
});
done
();
})
/**
* @tc.number wifi_js_unit_test_003
* @tc.name Test wifi.getSignalLevel.
* @tc.desc Test wifi.getSignalLevel API functionality.
*/
it
(
'
wifi_js_unit_test_003
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi get signal level test.
"
);
expect
(
wifi_js
.
getSignalLevel
(
1
,
1
)).
assertEqual
(
4
);
sleep
(
3000
);
})
/**
* @tc.number wifi_js_unit_test_005
* @tc.name Test wifi.getScanInfos 0.
* @tc.desc Test wifi.getScanInfos API functionality.
*/
it
(
'
wifi_js_unit_test_005
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[1].
"
);
wifi_js
.
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_js_unit_test_006
* @tc.name Test wifi.getScanInfos 1.
* @tc.desc Test wifi.getScanInfos API functionality.
*/
it
(
'
wifi_js_unit_test_006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[2].
"
);
wifi_js
.
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
);
}
});
done
();
})
sleep
(
20000
);
/**
* @tc.number wifi_js_unit_test_007
* @tc.name Test wifi.getLinkedInfo 1.
* @tc.desc Test wifi.getLinkedInfo API functionality.
*/
it
(
'
wifi_js_unit_test_007
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] get wifi linked callback test[1].
"
);
wifi_js
.
getLinkedInfo
().
then
(
data
=>
{
console
.
info
(
"
[wifi_test] test_007 wifi link [promise]:
"
+
JSON
.
stringify
(
data
));
expect
(
JSON
.
stringify
(
data
)).
assertContain
(
'
ssid
'
);
sleep
(
5000
);
console
.
info
(
"
[wifi_js] wifi link info
"
+
"
: ssid:
"
+
data
.
ssid
+
"
, bssid:
"
+
data
.
bssid
+
"
, ipAddress:
"
+
data
.
ipAddress
+
"
, isHidden:
"
+
data
.
isHidden
);
});
done
();
})
sleep
(
3000
);
/**
* @tc.number wifi_js_unit_test_008
* @tc.name Test wifi.getLinkedInfo 2.
* @tc.desc Test wifi.getLinkedInfo API functionality.
*/
it
(
'
wifi_js_unit_test_008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[wifi_test] get wifi linked callback test[2]
'
);
wifi
.
getLinkedInfo
(
result
=>
{
console
.
info
(
"
[wifi_js] get wifi link [promise] ->
"
+
JSON
.
stringify
(
data
));
expect
(
JSON
.
stringify
(
data
)).
assertContain
(
'
band
'
);
console
.
info
(
"
[wifi_js] get wifi link [promise].
"
);
done
();
}).
catch
(
error
=>
{
console
.
info
(
"
[wifi_js] promise then error.
"
);
expect
().
assertFail
();
done
();
});
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
})
communication/wifi_standard/src/main/js/default/test/Wifi.test.js
浏览文件 @
89a87ca0
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
wifi_
js
from
'
@ohos.wifi_js
'
import
wifi_
native_js
from
'
@ohos.wifi_native_js
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
...
@@ -35,39 +35,39 @@ describe('appInfoTest', function () {
...
@@ -35,39 +35,39 @@ describe('appInfoTest', function () {
console
.
log
(
"
*************[wifi_test]start wifi js unit test[ver:18]*************
"
);
console
.
log
(
"
*************[wifi_test]start wifi js unit test[ver:18]*************
"
);
/**
/**
* @tc.number wifi_
js_unit_test_001
* @tc.number wifi_
native_js_unit_test_001
* @tc.name Test wifi.isWifiActive.
* @tc.name Test wifi.isWifiActive.
* @tc.desc Test wifi.isWifiActive API functionality.
* @tc.desc Test wifi.isWifiActive API functionality.
*/
*/
it
(
'
wifi_
js_unit_test_001
'
,
0
,
function
()
{
it
(
'
wifi_
native_js_unit_test_001
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi active test.
"
);
console
.
info
(
"
[wifi_test] wifi active test.
"
);
expect
(
wifi_
js
.
isWifiActive
()).
assertTrue
();
expect
(
wifi_
native_js
.
isWifiActive
()).
assertTrue
();
})
})
/**
/**
* @tc.number wifi_
js_unit_test_002
* @tc.number wifi_
native_js_unit_test_002
* @tc.name Test wifi.scan.
* @tc.name Test wifi.scan.
* @tc.desc Test wifi.scan API functionality.
* @tc.desc Test wifi.scan API functionality.
*/
*/
it
(
'
wifi_
js_unit_test_002
'
,
0
,
async
function
(
done
)
{
it
(
'
wifi_
native_js_unit_test_002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] wifi scan test.
"
);
console
.
info
(
"
[wifi_test] wifi scan test.
"
);
expect
(
wifi_
js
.
scan
()).
assertTrue
();
expect
(
wifi_
native_js
.
scan
()).
assertTrue
();
sleep
(
3000
);
sleep
(
3000
);
wifi_
js
.
getScanInfos
(
result
=>
{
wifi_
native_js
.
getScanInfos
(
result
=>
{
console
.
info
(
'
[wifi_test] getScanInfos ->
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[wifi_test] getScanInfos ->
'
+
JSON
.
stringify
(
result
));
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
for
(
var
i
=
0
;
i
<
Object
.
keys
(
result
).
length
;
++
i
)
{
for
(
var
i
=
0
;
i
<
Object
.
keys
(
result
).
length
;
++
i
)
{
console
.
info
(
"
[wifi_test] rssi:
"
+
result
[
i
].
rssi
+
"
, band:
"
+
result
[
i
].
band
+
"
, level:
"
+
wifi_
js
.
getSignalLevel
(
result
[
i
].
rssi
,
result
[
i
].
band
));
console
.
info
(
"
[wifi_test] rssi:
"
+
result
[
i
].
rssi
+
"
, band:
"
+
result
[
i
].
band
+
"
, level:
"
+
wifi_
native_js
.
getSignalLevel
(
result
[
i
].
rssi
,
result
[
i
].
band
));
}
}
})
})
sleep
(
3000
);
sleep
(
3000
);
expect
(
wifi_
js
.
scan
()).
assertTrue
();
expect
(
wifi_
native_js
.
scan
()).
assertTrue
();
sleep
(
3000
);
sleep
(
3000
);
wifi_
js
.
getScanInfos
().
then
(
result
=>
{
wifi_
native_js
.
getScanInfos
().
then
(
result
=>
{
console
.
info
(
"
[wifi_test] wifi scan result call promise.
"
);
console
.
info
(
"
[wifi_test] wifi scan result call promise.
"
);
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
});
});
...
@@ -75,24 +75,24 @@ describe('appInfoTest', function () {
...
@@ -75,24 +75,24 @@ describe('appInfoTest', function () {
})
})
/**
/**
* @tc.number wifi_
js_unit_test_003
* @tc.number wifi_
native_js_unit_test_003
* @tc.name Test wifi.getSignalLevel.
* @tc.name Test wifi.getSignalLevel.
* @tc.desc Test wifi.getSignalLevel API functionality.
* @tc.desc Test wifi.getSignalLevel API functionality.
*/
*/
it
(
'
wifi_
js_unit_test_003
'
,
0
,
function
()
{
it
(
'
wifi_
native_js_unit_test_003
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi get signal level test.
"
);
console
.
info
(
"
[wifi_test] wifi get signal level test.
"
);
expect
(
wifi_
js
.
getSignalLevel
(
1
,
1
)).
assertEqual
(
4
);
expect
(
wifi_
native_js
.
getSignalLevel
(
1
,
1
)).
assertEqual
(
4
);
sleep
(
3000
);
sleep
(
3000
);
})
})
/**
/**
* @tc.number wifi_
js_unit_test_005
* @tc.number wifi_
native_js_unit_test_005
* @tc.name Test wifi.getScanInfos 0.
* @tc.name Test wifi.getScanInfos 0.
* @tc.desc Test wifi.getScanInfos API functionality.
* @tc.desc Test wifi.getScanInfos API functionality.
*/
*/
it
(
'
wifi_
js_unit_test_005
'
,
0
,
async
function
(
done
)
{
it
(
'
wifi_
native_js_unit_test_005
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[1].
"
);
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[1].
"
);
wifi_
js
.
getScanInfos
(
result
=>
{
wifi_
native_js
.
getScanInfos
(
result
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan info call back:
"
+
clen
);
console
.
log
(
"
[wifi_test] wifi received scan info call back:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
expect
(
result
).
assertLarger
(
0
);
...
@@ -114,13 +114,13 @@ describe('appInfoTest', function () {
...
@@ -114,13 +114,13 @@ describe('appInfoTest', function () {
sleep
(
20000
);
sleep
(
20000
);
/**
/**
* @tc.number wifi_
js_unit_test_006
* @tc.number wifi_
native_js_unit_test_006
* @tc.name Test wifi.getScanInfos 1.
* @tc.name Test wifi.getScanInfos 1.
* @tc.desc Test wifi.getScanInfos API functionality.
* @tc.desc Test wifi.getScanInfos API functionality.
*/
*/
it
(
'
wifi_
js_unit_test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
wifi_
native_js_unit_test_006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[2].
"
);
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[2].
"
);
wifi_
js
.
getScanInfos
().
then
(
wifi_
native_js
.
getScanInfos
().
then
(
result
=>
{
result
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan promise result:
"
+
clen
);
console
.
log
(
"
[wifi_test] wifi received scan promise result:
"
+
clen
);
...
@@ -141,43 +141,6 @@ describe('appInfoTest', function () {
...
@@ -141,43 +141,6 @@ describe('appInfoTest', function () {
});
});
done
();
done
();
})
})
sleep
(
20000
);
/**
* @tc.number wifi_js_unit_test_007
* @tc.name Test wifi.getLinkedInfo 1.
* @tc.desc Test wifi.getLinkedInfo API functionality.
*/
it
(
'
wifi_js_unit_test_007
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] get wifi linked callback test[1].
"
);
wifi_js
.
getLinkedInfo
().
then
(
data
=>
{
console
.
info
(
"
[wifi_test] test_007 wifi link [promise]:
"
+
JSON
.
stringify
(
data
));
expect
(
JSON
.
stringify
(
data
)).
assertContain
(
'
ssid
'
);
sleep
(
5000
);
console
.
info
(
"
[wifi_js] wifi link info
"
+
"
: ssid:
"
+
data
.
ssid
+
"
, bssid:
"
+
data
.
bssid
+
"
, ipAddress:
"
+
data
.
ipAddress
+
"
, isHidden:
"
+
data
.
isHidden
);
});
done
();
})
sleep
(
3000
);
/**
* @tc.number wifi_js_unit_test_008
* @tc.name Test wifi.getLinkedInfo 2.
* @tc.desc Test wifi.getLinkedInfo API functionality.
*/
it
(
'
wifi_js_unit_test_008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[wifi_test] get wifi linked callback test[2]
'
);
wifi
.
getLinkedInfo
(
result
=>
{
console
.
info
(
"
[wifi_js] get wifi link [promise] ->
"
+
JSON
.
stringify
(
data
));
expect
(
JSON
.
stringify
(
data
)).
assertContain
(
'
band
'
);
console
.
info
(
"
[wifi_js] get wifi link [promise].
"
);
done
();
}).
catch
(
error
=>
{
console
.
info
(
"
[wifi_js] promise then error.
"
);
expect
().
assertFail
();
done
();
});
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
})
})
...
...
test_packages.gni
浏览文件 @
89a87ca0
...
@@ -24,7 +24,7 @@ _all_test_packages = [
...
@@ -24,7 +24,7 @@ _all_test_packages = [
"${ACTS_ROOT}/appexecfwk:appexecfwk",
"${ACTS_ROOT}/appexecfwk:appexecfwk",
"${ACTS_ROOT}/account:account",
"${ACTS_ROOT}/account:account",
#
"${ACTS_ROOT}/communication:communication",
"${ACTS_ROOT}/communication:communication",
"${ACTS_ROOT}/notification:notification",
"${ACTS_ROOT}/notification:notification",
"${ACTS_ROOT}/aafwk:aafwk",
"${ACTS_ROOT}/aafwk:aafwk",
"${ACTS_ROOT}/location:location",
"${ACTS_ROOT}/location:location",
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录