Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
65d99275
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看板
提交
65d99275
编写于
10月 13, 2021
作者:
O
openharmony_ci
提交者:
Gitee
10月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
!883 【communication】修改WIFI JS L2测试用例2
Merge pull request !883 from 权力/myfeature1
上级
2f1d3553
2cc81da3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
216 addition
and
1 deletion
+216
-1
communication/wifi_standard/src/main/js/default/test/List.test.js
...ation/wifi_standard/src/main/js/default/test/List.test.js
+1
-1
communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
...on/wifi_standard/src/main/js/default/test/WifiSta.test.js
+215
-0
未找到文件。
communication/wifi_standard/src/main/js/default/test/List.test.js
浏览文件 @
65d99275
...
...
@@ -13,4 +13,4 @@
* limitations under the License.
*/
require
(
'
./Wifi.test.js
'
)
require
(
'
./Wifi
Sta
.test.js
'
)
communication/wifi_standard/src/main/js/default/test/Wifi.test.js
→
communication/wifi_standard/src/main/js/default/test/Wifi
Sta
.test.js
浏览文件 @
65d99275
...
...
@@ -13,86 +13,79 @@
* limitations under the License.
*/
import
wifi_native_js
from
'
@ohos.wifi_native_js
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
wifi
from
'
@ohos.wifi_native_js
'
// delay x ms
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
continue
;
break
;
}
}
describe
(
'
appInfoTest
'
,
function
()
{
var
wifiConfig
=
{
"
ssid
"
:
"
TEST
"
,
"
bssid
"
:
"
A1:B1:C1:D1:E1:F1
"
,
"
preSharedKey
"
:
"
12345678
"
,
"
isHiddenSsid
"
:
"
false
"
,
"
securityType
"
:
3
,
"
netId
"
:
0
,
"
ipType
"
:
1
,
"
creatorUid
"
:
7
,
"
disableReason
"
:
0
,
"
randomMacType
"
:
0
,
"
randomMacAddr
"
:
"
11:22:33:44:55:66
"
,
"
staticIp
"
:
{
"
ipAddress
"
:
1284752956
,
"
gateway
"
:
1284752936
},
}
var
ipConfig
=
{
"
ipAddress
"
:
1284752956
,
"
gateway
"
:
17017024
,
"
dnsServers
"
:
12345678
,
"
domains
"
:
[
"
aaa
"
],
}
beforeEach
(
function
()
{
})
afterEach
(
function
()
{
})
console
.
log
(
"
*************[wifi_test]start wifi js unit test[ver:18]*************
"
);
/**
/**
* @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
()
{
it
(
'
wifi_native_js_unit_test_001
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi active test.
"
);
expect
(
wifi_native_js
.
isWifiActive
()).
assertTrue
();
})
/**
* @tc.number wifi_native_js_unit_test_002
* @tc.name Test wifi.scan.
* @tc.desc Test wifi.scan API functionality.
*/
it
(
'
wifi_native_js_unit_test_002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] wifi scan test.
"
);
expect
(
wifi_native_js
.
scan
()).
assertTrue
();
sleep
(
3000
);
wifi_native_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_native_js
.
getSignalLevel
(
result
[
i
].
rssi
,
result
[
i
].
band
));
}
})
sleep
(
3000
);
expect
(
wifi_native_js
.
scan
()).
assertTrue
();
sleep
(
3000
);
wifi_native_js
.
getScanInfos
().
then
(
result
=>
{
console
.
info
(
"
[wifi_test] wifi scan result call promise.
"
);
expect
(
Object
.
keys
(
result
).
length
).
assertLarger
(
0
);
});
done
();
})
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
()
{
it
(
'
wifi_native_js_unit_test_003
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] wifi get signal level test.
"
);
expect
(
wifi_native_js
.
getSignalLevel
(
1
,
1
)).
assertEqual
(
4
);
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
)
{
it
(
'
wifi_native_js_unit_test_005
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[1].
"
);
wifi_native_js
.
getScanInfos
(
result
=>
{
wifi
.
getScanInfos
(
(
result
)
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan info call back:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
...
...
@@ -110,18 +103,18 @@ describe('appInfoTest', function () {
}
});
done
();
})
sleep
(
20000
);
})
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
)
{
it
(
'
wifi_native_js_unit_test_006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[wifi_test] Wifi get scan infos callback test[2].
"
);
wifi_native_js
.
getScanInfos
().
then
(
result
=>
{
wifi
.
getScanInfos
()
.
then
(
result
=>
{
var
clen
=
Object
.
keys
(
result
).
length
;
console
.
log
(
"
[wifi_test] wifi received scan promise result:
"
+
clen
);
expect
(
result
).
assertLarger
(
0
);
...
...
@@ -140,8 +133,83 @@ describe('appInfoTest', function () {
}
});
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
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
done
();
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
/**
* @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
();
sleep
(
3000
);
var
disable
=
wifi
.
disableWifi
();
except
(
disable
).
assertTrue
();
});
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录