Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
aa3f49c0
U
uni-api
项目概览
DCloud
/
uni-api
通知
670
Star
23
Fork
12
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
aa3f49c0
编写于
3月 24, 2023
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加自動化测试相关代码
上级
6d5e61ef
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
1072 addition
and
18 deletion
+1072
-18
autotest.utils.js
autotest.utils.js
+1
-0
env.js
env.js
+1
-0
jest.config.js
jest.config.js
+11
-0
pages.json
pages.json
+8
-1
pages/autotest/uni-wifi/uni-wifi.test.js
pages/autotest/uni-wifi/uni-wifi.test.js
+245
-0
pages/autotest/uni-wifi/uni-wifi.vue
pages/autotest/uni-wifi/uni-wifi.vue
+724
-0
uni_modules/uni-wifi/utssdk/app-android/index.uts
uni_modules/uni-wifi/utssdk/app-android/index.uts
+19
-17
uni_modules/uni-wifi/utssdk/interface.uts
uni_modules/uni-wifi/utssdk/interface.uts
+28
-0
uni_modules/uni-wifi/utssdk/uni.autotest.js
uni_modules/uni-wifi/utssdk/uni.autotest.js
+35
-0
未找到文件。
autotest.utils.js
0 → 100644
浏览文件 @
aa3f49c0
"
use strict
"
;
function
t
(
t
,
r
){
const
s
=
t
.
split
(
"
.
"
),
e
=
r
.
split
(
"
.
"
),
n
=
Math
.
max
(
s
.
length
,
e
.
length
);
for
(
let
t
=
0
;
t
<
n
;
t
++
){
const
r
=
parseInt
(
s
[
t
]
||
"
0
"
),
n
=
parseInt
(
e
[
t
]
||
"
0
"
);
if
(
r
>
n
)
return
1
;
if
(
r
<
n
)
return
-
1
}
return
0
}
function
r
(
r
,
s
){
if
(
"
*
"
===
s
||
s
===
r
)
return
!
0
;
switch
(
s
.
slice
(
0
,
2
)){
case
"
>=
"
:
return
t
(
r
,
s
.
substring
(
2
))
>=
0
;
case
"
<=
"
:
return
t
(
r
,
s
.
substring
(
2
))
<=
0
;
case
"
!=
"
:
return
0
!==
t
(
r
,
s
.
substring
(
2
))}
switch
(
s
.
charAt
(
0
)){
case
"
>
"
:
return
t
(
r
,
s
.
substring
(
1
))
>
0
;
case
"
<
"
:
return
t
(
r
,
s
.
substring
(
1
))
<
0
;
case
"
=
"
:
return
0
===
t
(
r
,
s
.
substring
(
1
));
case
"
^
"
:
return
parseInt
(
r
.
split
(
"
.
"
)[
0
])
===
parseInt
(
s
.
substring
(
1
).
split
(
"
.
"
)[
0
])
&&
t
(
r
,
s
.
substring
(
1
))
>=
0
;
case
"
~
"
:
return
t
(
r
,(
s
=
s
.
substring
(
1
).
trim
())
+
"
.0
"
)
>=
0
&&
t
(
r
,
`
${
s
[
0
]}
.
${
parseInt
(
s
[
2
])
+
1
}
`
)
<
0
;
default
:
return
-
1
!==
t
(
r
,
s
)}}
exports
.
invokeApi
=
function
(
t
,
r
,
s
,...
e
){
if
(
r
||
function
(
t
){
return
!
(
"
[object Object]
"
!==
Object
.
prototype
.
toString
.
call
(
t
)
||!
[
"
success
"
,
"
fail
"
].
find
((
r
=>
"
function
"
==
typeof
t
[
r
])))}(
s
)){
const
{
success
:
r
,
fail
:
n
,...
i
}
=
s
;
return
new
Promise
(((
s
,
u
)
=>
{
t
({...
i
,
success
(
t
){
r
&&
r
(
t
),
s
(
t
)},
fail
(
t
){
n
&&
n
(
t
),
u
(
t
)}},...
e
)}))}
return
t
(
s
,...
e
)},
exports
.
platformMatch
=
function
(
t
,
s
,
e
){
let
n
=!
0
;
e
&&
(
n
=
r
(
s
.
uniRuntimeVersion
,
e
));
const
i
=
t
[
s
.
uniPlatform
];
if
(
n
&&
i
){
if
(
i
[
s
.
osName
]){
const
t
=
i
[
s
.
osName
];
return
r
(
s
[
t
.
versionKey
]
||
"
*
"
,
t
.
version
||
"
*
"
)}
return
r
(
s
[
i
.
versionKey
]
||
"
*
"
,
i
.
version
||
"
*
"
)}
return
!
1
},
exports
.
satisfies
=
r
;
env.js
0 → 100644
浏览文件 @
aa3f49c0
module
.
exports
=
{
"
compile
"
:
true
,
"
h5
"
:{
"
options
"
:{
"
headless
"
:
true
},
"
executablePath
"
:
""
},
"
mp-weixin
"
:{
"
port
"
:
9420
,
"
account
"
:
""
,
"
args
"
:
""
,
"
cwd
"
:
""
,
"
launch
"
:
true
,
"
teardown
"
:
"
disconnect
"
,
"
remote
"
:
false
,
"
executablePath
"
:
""
},
"
app-plus
"
:{
"
android
"
:{
"
id
"
:
"
WDHVB20804034055
"
,
"
executablePath
"
:
"
D:
\\
Do
\\
tools
\\
HX
\\
lastest_dev
\\
HBuilderX.3.7.7.20230315-alpha
\\
HBuilderX
\\
plugins
\\
launcher
\\
base
\\
android_base.apk
"
},
"
version
"
:
"
D:
\\
Do
\\
tools
\\
HX
\\
lastest_dev
\\
HBuilderX.3.7.7.20230315-alpha
\\
HBuilderX
\\
plugins
\\
launcher
\\
base
\\
version.txt
"
,
"
ios
"
:{
"
id
"
:
""
,
"
executablePath
"
:
""
}}}
\ No newline at end of file
jest.config.js
0 → 100644
浏览文件 @
aa3f49c0
module
.
exports
=
{
testTimeout
:
10000
,
reporters
:
[
'
default
'
],
watchPathIgnorePatterns
:
[
'
/node_modules/
'
,
'
/dist/
'
,
'
/.git/
'
],
moduleFileExtensions
:
[
'
js
'
,
'
json
'
],
rootDir
:
__dirname
,
testMatch
:
[
"
<rootDir>/pages/**/*test.[jt]s?(x)
"
],
testPathIgnorePatterns
:
[
'
/node_modules/
'
]
}
pages.json
浏览文件 @
aa3f49c0
...
@@ -5,6 +5,13 @@
...
@@ -5,6 +5,13 @@
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"uni-app"
"navigationBarTitleText"
:
"uni-app"
}
}
},
{
"path"
:
"pages/autotest/uni-wifi/uni-wifi"
,
"style"
:
{
"navigationBarTitleText"
:
"uni-wifi"
,
"enablePullDownRefresh"
:
false
}
}
}
],
],
"globalStyle"
:
{
"globalStyle"
:
{
...
...
pages/autotest/uni-wifi/uni-wifi.test.js
0 → 100644
浏览文件 @
aa3f49c0
describe
(
'
uni-wifi
'
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/autotest/uni-wifi/uni-wifi
'
);
await
page
.
waitFor
(
3000
);
});
it
(
'
startWifi0
'
,
async
()
=>
{
const
result0
=
await
page
.
callMethod
(
'
startWifi00
'
);
expect
(
result0
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result0
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result0
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result0
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result1
=
await
page
.
callMethod
(
'
startWifi01
'
);
expect
(
result1
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result1
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result1
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result1
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result2
=
await
page
.
callMethod
(
'
startWifi02
'
);
expect
(
result2
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result2
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result2
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result2
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result3
=
await
page
.
callMethod
(
'
startWifi03
'
);
expect
(
result3
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result3
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result3
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result3
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result4
=
await
page
.
callMethod
(
'
startWifi04
'
);
expect
(
result4
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result4
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result4
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result4
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result5
=
await
page
.
callMethod
(
'
startWifi05
'
);
expect
(
result5
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result5
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result5
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result5
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result6
=
await
page
.
callMethod
(
'
startWifi06
'
);
expect
(
result6
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result6
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result6
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result6
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result7
=
await
page
.
callMethod
(
'
startWifi07
'
);
expect
(
result7
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result7
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result7
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result7
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result8
=
await
page
.
callMethod
(
'
startWifi08
'
);
expect
(
result8
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result8
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result8
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result8
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result9
=
await
page
.
callMethod
(
'
startWifi09
'
);
expect
(
result9
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result9
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result9
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result9
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result10
=
await
page
.
callMethod
(
'
startWifi010
'
);
expect
(
result10
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result10
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result10
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result10
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result11
=
await
page
.
callMethod
(
'
startWifi011
'
);
expect
(
result11
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result11
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result11
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result11
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result12
=
await
page
.
callMethod
(
'
startWifi012
'
);
expect
(
result12
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result12
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result12
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result12
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result13
=
await
page
.
callMethod
(
'
startWifi013
'
);
expect
(
result13
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result13
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result13
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result13
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result14
=
await
page
.
callMethod
(
'
startWifi014
'
);
expect
(
result14
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result14
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result14
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result14
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result15
=
await
page
.
callMethod
(
'
startWifi015
'
);
expect
(
result15
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result15
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result15
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result15
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result16
=
await
page
.
callMethod
(
'
startWifi016
'
);
expect
(
result16
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result16
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result16
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result16
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result17
=
await
page
.
callMethod
(
'
startWifi017
'
);
expect
(
result17
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result17
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result17
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result17
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result18
=
await
page
.
callMethod
(
'
startWifi018
'
);
expect
(
result18
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result18
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result18
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result18
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result19
=
await
page
.
callMethod
(
'
startWifi019
'
);
expect
(
result19
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result19
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result19
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result19
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result20
=
await
page
.
callMethod
(
'
startWifi020
'
);
expect
(
result20
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result20
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result20
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result20
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result21
=
await
page
.
callMethod
(
'
startWifi021
'
);
expect
(
result21
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result21
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result21
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result21
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
});
it
(
'
stopWifi1
'
,
async
()
=>
{
const
result0
=
await
page
.
callMethod
(
'
stopWifi10
'
);
expect
(
result0
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result0
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result0
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result0
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result1
=
await
page
.
callMethod
(
'
stopWifi11
'
);
expect
(
result1
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result1
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result1
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result1
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result2
=
await
page
.
callMethod
(
'
stopWifi12
'
);
expect
(
result2
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result2
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result2
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result2
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result3
=
await
page
.
callMethod
(
'
stopWifi13
'
);
expect
(
result3
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result3
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result3
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result3
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result4
=
await
page
.
callMethod
(
'
stopWifi14
'
);
expect
(
result4
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result4
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result4
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result4
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result5
=
await
page
.
callMethod
(
'
stopWifi15
'
);
expect
(
result5
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result5
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result5
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result5
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result6
=
await
page
.
callMethod
(
'
stopWifi16
'
);
expect
(
result6
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result6
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result6
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result6
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result7
=
await
page
.
callMethod
(
'
stopWifi17
'
);
expect
(
result7
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result7
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result7
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result7
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result8
=
await
page
.
callMethod
(
'
stopWifi18
'
);
expect
(
result8
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result8
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result8
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result8
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result9
=
await
page
.
callMethod
(
'
stopWifi19
'
);
expect
(
result9
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result9
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result9
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result9
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result10
=
await
page
.
callMethod
(
'
stopWifi110
'
);
expect
(
result10
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result10
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result10
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result10
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result11
=
await
page
.
callMethod
(
'
stopWifi111
'
);
expect
(
result11
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result11
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result11
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result11
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result12
=
await
page
.
callMethod
(
'
stopWifi112
'
);
expect
(
result12
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result12
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result12
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result12
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result13
=
await
page
.
callMethod
(
'
stopWifi113
'
);
expect
(
result13
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result13
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result13
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result13
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result14
=
await
page
.
callMethod
(
'
stopWifi114
'
);
expect
(
result14
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result14
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result14
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result14
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result15
=
await
page
.
callMethod
(
'
stopWifi115
'
);
expect
(
result15
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result15
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result15
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result15
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result16
=
await
page
.
callMethod
(
'
stopWifi116
'
);
expect
(
result16
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result16
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result16
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result16
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result17
=
await
page
.
callMethod
(
'
stopWifi117
'
);
expect
(
result17
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result17
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result17
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result17
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result18
=
await
page
.
callMethod
(
'
stopWifi118
'
);
expect
(
result18
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result18
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result18
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result18
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result19
=
await
page
.
callMethod
(
'
stopWifi119
'
);
expect
(
result19
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result19
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result19
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result19
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result20
=
await
page
.
callMethod
(
'
stopWifi120
'
);
expect
(
result20
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result20
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result20
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result20
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
const
result21
=
await
page
.
callMethod
(
'
stopWifi121
'
);
expect
(
result21
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result21
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result21
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result21
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
});
it
(
'
connectWifi2
'
,
async
()
=>
{
const
result_assert0
=
await
page
.
callMethod
(
'
connectWifi2_assert0
'
);
expect
(
result_assert0
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result_assert0
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result_assert0
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result_assert0
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
});
it
(
'
getWifiList3
'
,
async
()
=>
{
const
result_assert0
=
await
page
.
callMethod
(
'
getWifiList3_assert0
'
);
expect
(
result_assert0
.
res
).
not
.
toHaveProperty
(
'
_errMsg
'
);
expect
(
result_assert0
.
res
.
errCode
).
toEqual
(
expect
.
any
(
Number
));
expect
(
result_assert0
.
res
.
errSubject
).
toEqual
(
expect
.
any
(
String
));
expect
(
result_assert0
.
res
.
errMsg
).
toEqual
(
expect
.
any
(
String
));
});
});
\ No newline at end of file
pages/autotest/uni-wifi/uni-wifi.vue
0 → 100644
浏览文件 @
aa3f49c0
<
template
>
<view>
</view>
</
template
>
<
script
>
import
{
startWifi
,
stopWifi
}
from
"
@/uni_modules/uni-wifi/utssdk/uni.autotest.js
"
;
import
{
invokeApi
}
from
"
D:/source/uni-api/autotest.utils.js
"
;
export
default
{
methods
:
{
startWifi00
:
async
function
startWifi00
()
{
const
inputs
=
[
function
()
{
""
;
}];
let
startWifi00_res
;
try
{
startWifi00_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi00_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi00_res
};
},
startWifi01
:
async
function
startWifi01
()
{
const
inputs
=
[[]];
let
startWifi01_res
;
try
{
startWifi01_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi01_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi01_res
};
},
startWifi02
:
async
function
startWifi02
()
{
const
inputs
=
[
new
Uint8Array
([
0
,
1
]).
buffer
];
let
startWifi02_res
;
try
{
startWifi02_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi02_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi02_res
};
},
startWifi03
:
async
function
startWifi03
()
{
const
inputs
=
[
"
abc
"
];
let
startWifi03_res
;
try
{
startWifi03_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi03_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi03_res
};
},
startWifi04
:
async
function
startWifi04
()
{
const
inputs
=
[
"
0
"
];
let
startWifi04_res
;
try
{
startWifi04_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi04_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi04_res
};
},
startWifi05
:
async
function
startWifi05
()
{
const
inputs
=
[
"
false
"
];
let
startWifi05_res
;
try
{
startWifi05_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi05_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi05_res
};
},
startWifi06
:
async
function
startWifi06
()
{
const
inputs
=
[
"
\
u6587
"
];
let
startWifi06_res
;
try
{
startWifi06_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi06_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi06_res
};
},
startWifi07
:
async
function
startWifi07
()
{
const
inputs
=
[
"
/
"
];
let
startWifi07_res
;
try
{
startWifi07_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi07_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi07_res
};
},
startWifi08
:
async
function
startWifi08
()
{
const
inputs
=
[
"
\"
"
];
let
startWifi08_res
;
try
{
startWifi08_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi08_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi08_res
};
},
startWifi09
:
async
function
startWifi09
()
{
const
inputs
=
[
"
%
"
];
let
startWifi09_res
;
try
{
startWifi09_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi09_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi09_res
};
},
startWifi010
:
async
function
startWifi010
()
{
const
inputs
=
[
"
;
"
];
let
startWifi010_res
;
try
{
startWifi010_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi010_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi010_res
};
},
startWifi011
:
async
function
startWifi011
()
{
const
inputs
=
[
-
1.1
];
let
startWifi011_res
;
try
{
startWifi011_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi011_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi011_res
};
},
startWifi012
:
async
function
startWifi012
()
{
const
inputs
=
[
-
1
];
let
startWifi012_res
;
try
{
startWifi012_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi012_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi012_res
};
},
startWifi013
:
async
function
startWifi013
()
{
const
inputs
=
[
-
0.1
];
let
startWifi013_res
;
try
{
startWifi013_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi013_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi013_res
};
},
startWifi014
:
async
function
startWifi014
()
{
const
inputs
=
[
0
];
let
startWifi014_res
;
try
{
startWifi014_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi014_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi014_res
};
},
startWifi015
:
async
function
startWifi015
()
{
const
inputs
=
[
0.1
];
let
startWifi015_res
;
try
{
startWifi015_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi015_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi015_res
};
},
startWifi016
:
async
function
startWifi016
()
{
const
inputs
=
[
1
];
let
startWifi016_res
;
try
{
startWifi016_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi016_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi016_res
};
},
startWifi017
:
async
function
startWifi017
()
{
const
inputs
=
[
1.1
];
let
startWifi017_res
;
try
{
startWifi017_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi017_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi017_res
};
},
startWifi018
:
async
function
startWifi018
()
{
const
inputs
=
[
-
9007199254740991
];
let
startWifi018_res
;
try
{
startWifi018_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi018_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi018_res
};
},
startWifi019
:
async
function
startWifi019
()
{
const
inputs
=
[
9007199254740991
];
let
startWifi019_res
;
try
{
startWifi019_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi019_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi019_res
};
},
startWifi020
:
async
function
startWifi020
()
{
const
inputs
=
[
true
];
let
startWifi020_res
;
try
{
startWifi020_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi020_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi020_res
};
},
startWifi021
:
async
function
startWifi021
()
{
const
inputs
=
[
false
];
let
startWifi021_res
;
try
{
startWifi021_res
=
await
invokeApi
(
uni
.
startWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
startWifi021_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
startWifi021_res
};
},
stopWifi10
:
async
function
stopWifi10
()
{
const
inputs
=
[
function
()
{
""
;
}];
let
stopWifi10_res
;
try
{
stopWifi10_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi10_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi10_res
};
},
stopWifi11
:
async
function
stopWifi11
()
{
const
inputs
=
[[]];
let
stopWifi11_res
;
try
{
stopWifi11_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi11_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi11_res
};
},
stopWifi12
:
async
function
stopWifi12
()
{
const
inputs
=
[
new
Uint8Array
([
0
,
1
]).
buffer
];
let
stopWifi12_res
;
try
{
stopWifi12_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi12_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi12_res
};
},
stopWifi13
:
async
function
stopWifi13
()
{
const
inputs
=
[
"
abc
"
];
let
stopWifi13_res
;
try
{
stopWifi13_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi13_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi13_res
};
},
stopWifi14
:
async
function
stopWifi14
()
{
const
inputs
=
[
"
0
"
];
let
stopWifi14_res
;
try
{
stopWifi14_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi14_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi14_res
};
},
stopWifi15
:
async
function
stopWifi15
()
{
const
inputs
=
[
"
false
"
];
let
stopWifi15_res
;
try
{
stopWifi15_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi15_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi15_res
};
},
stopWifi16
:
async
function
stopWifi16
()
{
const
inputs
=
[
"
\
u6587
"
];
let
stopWifi16_res
;
try
{
stopWifi16_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi16_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi16_res
};
},
stopWifi17
:
async
function
stopWifi17
()
{
const
inputs
=
[
"
/
"
];
let
stopWifi17_res
;
try
{
stopWifi17_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi17_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi17_res
};
},
stopWifi18
:
async
function
stopWifi18
()
{
const
inputs
=
[
"
\"
"
];
let
stopWifi18_res
;
try
{
stopWifi18_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi18_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi18_res
};
},
stopWifi19
:
async
function
stopWifi19
()
{
const
inputs
=
[
"
%
"
];
let
stopWifi19_res
;
try
{
stopWifi19_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi19_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi19_res
};
},
stopWifi110
:
async
function
stopWifi110
()
{
const
inputs
=
[
"
;
"
];
let
stopWifi110_res
;
try
{
stopWifi110_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi110_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi110_res
};
},
stopWifi111
:
async
function
stopWifi111
()
{
const
inputs
=
[
-
1.1
];
let
stopWifi111_res
;
try
{
stopWifi111_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi111_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi111_res
};
},
stopWifi112
:
async
function
stopWifi112
()
{
const
inputs
=
[
-
1
];
let
stopWifi112_res
;
try
{
stopWifi112_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi112_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi112_res
};
},
stopWifi113
:
async
function
stopWifi113
()
{
const
inputs
=
[
-
0.1
];
let
stopWifi113_res
;
try
{
stopWifi113_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi113_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi113_res
};
},
stopWifi114
:
async
function
stopWifi114
()
{
const
inputs
=
[
0
];
let
stopWifi114_res
;
try
{
stopWifi114_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi114_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi114_res
};
},
stopWifi115
:
async
function
stopWifi115
()
{
const
inputs
=
[
0.1
];
let
stopWifi115_res
;
try
{
stopWifi115_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi115_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi115_res
};
},
stopWifi116
:
async
function
stopWifi116
()
{
const
inputs
=
[
1
];
let
stopWifi116_res
;
try
{
stopWifi116_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi116_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi116_res
};
},
stopWifi117
:
async
function
stopWifi117
()
{
const
inputs
=
[
1.1
];
let
stopWifi117_res
;
try
{
stopWifi117_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi117_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi117_res
};
},
stopWifi118
:
async
function
stopWifi118
()
{
const
inputs
=
[
-
9007199254740991
];
let
stopWifi118_res
;
try
{
stopWifi118_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi118_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi118_res
};
},
stopWifi119
:
async
function
stopWifi119
()
{
const
inputs
=
[
9007199254740991
];
let
stopWifi119_res
;
try
{
stopWifi119_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi119_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi119_res
};
},
stopWifi120
:
async
function
stopWifi120
()
{
const
inputs
=
[
true
];
let
stopWifi120_res
;
try
{
stopWifi120_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi120_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi120_res
};
},
stopWifi121
:
async
function
stopWifi121
()
{
const
inputs
=
[
false
];
let
stopWifi121_res
;
try
{
stopWifi121_res
=
await
invokeApi
(
uni
.
stopWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
stopWifi121_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
return
{
res
:
stopWifi121_res
};
},
connectWifi2_assert0
:
async
function
connectWifi2_assert0
()
{
const
inputs
=
[{
maunal
:
false
,
SSID
:
"
Xiaomi_20D0
"
,
password
:
"
BBB111
"
}];
const
uniAutoTest
=
{
isRandom
:
false
,
inputs
};
await
startWifi
(
uniAutoTest
);
let
connectWifi2_assert0_res
;
try
{
connectWifi2_assert0_res
=
await
invokeApi
(
uni
.
connectWifi
,
true
,
...
inputs
);
}
catch
(
e
)
{
connectWifi2_assert0_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
await
stopWifi
(
uniAutoTest
);
return
{
res
:
connectWifi2_assert0_res
};
},
getWifiList3_assert0
:
async
function
getWifiList3_assert0
()
{
const
inputs
=
[];
const
uniAutoTest
=
{
isRandom
:
false
,
inputs
};
await
startWifi
(
uniAutoTest
);
let
getWifiList3_assert0_res
;
try
{
getWifiList3_assert0_res
=
await
invokeApi
(
uni
.
getWifiList
,
true
,
...
inputs
);
}
catch
(
e
)
{
getWifiList3_assert0_res
=
{
_expectError
:
true
,
_errMsg
:
getErrMsg
(
e
)
};
}
await
stopWifi
(
uniAutoTest
);
return
{
res
:
getWifiList3_assert0_res
};
}
}
};
function
getErrMsg
(
e
){
return
e
?
e
.
message
||
e
:
'
There is no error information
'
}
</
script
>
\ No newline at end of file
uni_modules/uni-wifi/utssdk/app-android/index.uts
浏览文件 @
aa3f49c0
...
@@ -17,7 +17,7 @@ import AuthAlgorithm from 'android.net.wifi.WifiConfiguration.AuthAlgorithm';
...
@@ -17,7 +17,7 @@ import AuthAlgorithm from 'android.net.wifi.WifiConfiguration.AuthAlgorithm';
import KeyMgmt from 'android.net.wifi.WifiConfiguration.KeyMgmt';
import KeyMgmt from 'android.net.wifi.WifiConfiguration.KeyMgmt';
import TextUtils from 'android.text.TextUtils';
import TextUtils from 'android.text.TextUtils';
import { UniWifiResult, GetConnectedWifiOptions, WifiConnectOption, WifiOption, UniWifiInfo,UniWifiPartialInfo, UniWifiCallback, StartWifi, StopWifi, GetWifiList, GetConnectedWifi, OnGetWifiList, OnWifiConnectedWithPartialInfo, OnOffWifiConnectedWithPartialInfo, OnWifiConnected, ConnectWifi, OffGetWifiList, OffWifiConnected, SetWifiList } from "../interface.uts"
import { UniWifiResult, GetConnectedWifiOptions, WifiConnectOption, WifiOption, UniWifiInfo,
UniWifiPartialInfo, UniWifiCallback, StartWifi, StopWifi, GetWifiList, GetConnectedWifi, OnGetWifiList, OnWifiConnectedWithPartialInfo, OnOffWifiConnectedWithPartialInfo, OnWifiConnected, ConnectWifi, OffGetWifiList, OffWifiConnected, SetWifiList } from "../interface.uts"
...
@@ -113,7 +113,7 @@ export type AndroidUniWifiInfo = {
...
@@ -113,7 +113,7 @@ export type AndroidUniWifiInfo = {
securityType : string;
securityType : string;
}
}
function wrapUniWifiInfoFromAndroid(androidInfo
:AndroidUniWifiInfo): UniWifiInfo
{
function wrapUniWifiInfoFromAndroid(androidInfo
: AndroidUniWifiInfo) : UniWifiInfo
{
let ret : UniWifiInfo = {
let ret : UniWifiInfo = {
SSID: androidInfo.SSID,
SSID: androidInfo.SSID,
BSSID: androidInfo.BSSID,
BSSID: androidInfo.BSSID,
...
@@ -131,7 +131,7 @@ function wrapUniWifiInfoFromScan(scanResult : ScanResult) : AndroidUniWifiInfo {
...
@@ -131,7 +131,7 @@ function wrapUniWifiInfoFromScan(scanResult : ScanResult) : AndroidUniWifiInfo {
secure: false,
secure: false,
signalStrength: 0,
signalStrength: 0,
frequency: 0,
frequency: 0,
securityType:"NONE"
securityType:
"NONE"
}
}
if (scanResult != null) {
if (scanResult != null) {
// 如果是通过扫描列表得到的数据,进行封装
// 如果是通过扫描列表得到的数据,进行封装
...
@@ -316,8 +316,8 @@ function getSecurityType(result : ScanResult) : string {
...
@@ -316,8 +316,8 @@ function getSecurityType(result : ScanResult) : string {
}
}
function zeroCountNum(source
?
: string) : number {
function zeroCountNum(source
?
: string) : number {
if
(source == null)
{
if
(source == null)
{
return 0
return 0
}
}
var splitted = source.split(":")
var splitted = source.split(":")
...
@@ -329,6 +329,8 @@ function zeroCountNum(source? : string) : number {
...
@@ -329,6 +329,8 @@ function zeroCountNum(source? : string) : number {
}
}
return countNum
return countNum
}
}
/**
/**
* 自定义wifi变化广播监听器
* 自定义wifi变化广播监听器
*/
*/
...
@@ -724,10 +726,10 @@ export function connectWifi(option : WifiConnectOption) {
...
@@ -724,10 +726,10 @@ export function connectWifi(option : WifiConnectOption) {
wifiManager.saveConfiguration()
wifiManager.saveConfiguration()
//scanWifiInfo 根据 partialInfo 填充给返回字段
//scanWifiInfo 根据 partialInfo 填充给返回字段
if (option.partialInfo != null && option.partialInfo == true) {
if (option.partialInfo != null && option.partialInfo == true) {
let wifiPartialInfo
:
UniWifiInfo = {
let wifiPartialInfo
:
UniWifiInfo = {
SSID: scanWifiInfo.SSID
SSID: scanWifiInfo.SSID
}
}
result.wifi =wifiPartialInfo
result.wifi =
wifiPartialInfo
} else {
} else {
result.wifi = wrapUniWifiInfoFromAndroid(scanWifiInfo)
result.wifi = wrapUniWifiInfoFromAndroid(scanWifiInfo)
}
}
...
@@ -748,9 +750,9 @@ export function connectWifi(option : WifiConnectOption) {
...
@@ -748,9 +750,9 @@ export function connectWifi(option : WifiConnectOption) {
export function stopWifi(option : WifiOption) {
export function stopWifi(option : WifiOption) {
// 需要先开启wifi,才能使用后续的功能
// 需要先开启wifi,才能使用后续的功能
if (Global.mReceiver == null) {
if (Global.mReceiver == null) {
var result
:
UniWifiResult = {
var result
:
UniWifiResult = {
errCode: 12000,
errCode: 12000,
errSubject:"uni-stopWifi",
errSubject:
"uni-stopWifi",
errMsg: "stopWifi:not init"
errMsg: "stopWifi:not init"
}
}
option.fail?.(result)
option.fail?.(result)
...
@@ -765,9 +767,9 @@ export function stopWifi(option : WifiOption) {
...
@@ -765,9 +767,9 @@ export function stopWifi(option : WifiOption) {
//TODO handle the exception
//TODO handle the exception
}
}
var result
:
UniWifiResult = {
var result
:
UniWifiResult = {
errCode: 0,
errCode: 0,
errSubject:"uni-stopWifi",
errSubject:
"uni-stopWifi",
errMsg: "stopWifi:ok"
errMsg: "stopWifi:ok"
}
}
option.success?.(result)
option.success?.(result)
...
@@ -781,11 +783,11 @@ export function stopWifi(option : WifiOption) {
...
@@ -781,11 +783,11 @@ export function stopWifi(option : WifiOption) {
@Suppress("DEPRECATION")
@Suppress("DEPRECATION")
export function getConnectedWifi(option : GetConnectedWifiOptions) {
export function getConnectedWifi(option : GetConnectedWifiOptions) {
let wifiInfo
:
UniWifiInfo = {
let wifiInfo
:
UniWifiInfo = {
SSID:""
SSID:
""
}
}
var res
:
UniWifiResult = {
var res
:
UniWifiResult = {
errCode: 12000,
errCode: 12000,
errMsg: "getConnectedWifi:fail:not invoke startWifi",
errMsg: "getConnectedWifi:fail:not invoke startWifi",
errSubject: "uni-getConnectedWifi",
errSubject: "uni-getConnectedWifi",
...
@@ -823,7 +825,7 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
...
@@ -823,7 +825,7 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
wifiInfo = wrapUniWifiInfoFromConnectInfo(winfo);
wifiInfo = wrapUniWifiInfoFromConnectInfo(winfo);
// 判断一下是否wifi 关闭了
// 判断一下是否wifi 关闭了
if (option.partialInfo!) {
if (option.partialInfo!) {
let ret
:
UniWifiInfo = {
let ret
:
UniWifiInfo = {
SSID: wifiInfo.SSID
SSID: wifiInfo.SSID
}
}
res.wifi = ret;
res.wifi = ret;
...
...
uni_modules/uni-wifi/utssdk/interface.uts
浏览文件 @
aa3f49c0
...
@@ -80,6 +80,34 @@ export type SetWifiList = (option: WifiOption) => void
...
@@ -80,6 +80,34 @@ export type SetWifiList = (option: WifiOption) => void
interface Uni {
interface Uni {
startWifi : StartWifi,
startWifi : StartWifi,
stopWifi : StopWifi,
stopWifi : StopWifi,
/**
* @autotest {
generated: false,
cases:[
{
before: 'startWifi',
after: 'stopWifi',
input: [{
maunal:false,
SSID:"Xiaomi_20D0",
password:"BBB111"
}]
}
]
}
*/
connectWifi: ConnectWifi,
/**
* @autotest {
generated: false,
cases:[
{
before: 'startWifi',
after: 'stopWifi'
}
]
}
*/
getWifiList : GetWifiList,
getWifiList : GetWifiList,
onGetWifiList : OnGetWifiList,
onGetWifiList : OnGetWifiList,
offGetWifiList : OffGetWifiList,
offGetWifiList : OffGetWifiList,
...
...
uni_modules/uni-wifi/utssdk/uni.autotest.js
0 → 100644
浏览文件 @
aa3f49c0
function
startWifi
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
startWifi
({
success
:
()
=>
{
console
.
log
(
'
startWifi success
'
);
resolve
()
},
fail
:
()
=>
{
console
.
log
(
'
startWifi fail
'
);
reject
()
}
})
})
}
function
stopWifi
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
stopWifi
({
success
:
()
=>
{
console
.
log
(
'
stopWifi success
'
);
resolve
()
},
fail
:
()
=>
{
console
.
log
(
'
stopWifi success
'
);
fail
()
}
})
})
}
module
.
exports
=
{
startWifi
,
stopWifi
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录