Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0804f27e
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看板
提交
0804f27e
编写于
8月 16, 2023
作者:
G
gaoxi785
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update config
Signed-off-by:
N
gaoxi785
<
gaoxi785@huawei.com
>
上级
183f3631
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
53 addition
and
68 deletion
+53
-68
telephony/telephonyjstest/actscontactstageapitest/AppScope/app.json
...telephonyjstest/actscontactstageapitest/AppScope/app.json
+1
-5
telephony/telephonyjstest/actscontactstageapitest/Test.json
telephony/telephonyjstest/actscontactstageapitest/Test.json
+1
-1
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/List.test.ets
...contactstageapitest/entry/src/main/ets/test/List.test.ets
+2
-2
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/contactstage.test.ets
...tageapitest/entry/src/main/ets/test/contactstage.test.ets
+30
-20
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/module.json
...jstest/actscontactstageapitest/entry/src/main/module.json
+5
-6
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/resources/base/element/string.json
...apitest/entry/src/main/resources/base/element/string.json
+14
-34
未找到文件。
telephony/telephonyjstest/actscontactstageapitest/AppScope/app.json
浏览文件 @
0804f27e
{
"app"
:
{
"bundleName"
:
"com.example.actscontactstageapitest"
,
"vendor"
:
"
huawei
"
,
"vendor"
:
"
example
"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"debug"
:
true
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:app_name"
,
"description"
:
"$string:description_application"
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
10
,
"targetAPIVersion"
:
10
,
"car"
:
{
...
...
telephony/telephonyjstest/actscontactstageapitest/Test.json
浏览文件 @
0804f27e
...
...
@@ -4,7 +4,7 @@
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.example.actscontactstageapitest"
,
"module-name"
:
"entry"
,
"module-name"
:
"entry
_test
"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
70000
},
...
...
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/List.test.ets
浏览文件 @
0804f27e
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
import contact
stage from './contactstage.test'
import contact
Stage from './contactstage.test';
export default function testsuite() {
contact
s
tage();
contact
S
tage();
}
\ No newline at end of file
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/contactstage.test.ets
浏览文件 @
0804f27e
...
...
@@ -15,7 +15,8 @@
import contact from '@ohos.contact';
import { afterAll, beforeAll, describe, expect, it } from '@ohos/hypium';
import
{
Driver
,
ON
}
from
'@ohos.UiTest'
;
import uitest from '@ohos.UiTest';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
export default function ContactInterfaceStageTest() {
...
...
@@ -30,27 +31,36 @@ export default function ContactInterfaceStageTest() {
}
}
async
function
driveFn
()
{
console
.
info
(
"come in driveFn"
);
let
driver
=
Driver
.
create
();
console
.
info
(
"driver is "
+
JSON
.
stringify
(
driver
));
sleep
(
2000
);
let
button
=
await
driver
.
findComponent
(
ON
.
text
(
'允许'
));
console
.
info
(
"button is "
+
JSON
.
stringify
(
button
));
await
button
.
click
();
sleep
(
5000
);
}
beforeAll( async function () {
console.info("beforeAll case");
try {
let permissions = ["ohos.permission.WRITE_CONTACTS", "ohos.permission.READ_CONTACTS"];
let atManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(globalThis.context, permissions, (err, result) => {
if (err) {
console.info('getPermission failed: ' + JSON.stringify(err));
} else {
console.info('getPermission suc: ' + JSON.stringify(result));
}
});
beforeAll
(
async
function
()
{
var
permissions
=
[
"ohos.permission.WRITE_CONTACTS"
,
"ohos.permission.READ_CONTACTS"
];
//通过stage方式弹窗
featureAbility
.
getContext
()
.
requestPermissionsFromUser
(
permissions
,
0
,
()
=>
{
console
.
info
(
"start requestPermissionsFromUser"
);
});
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
await
driveFn
();
console
.
log
(
"get user_grant permission"
);
let driver = await uitest.Driver.create();
sleep(500);
for (let i = 0; i < 5; i++) {
await sleep(500);
console.info("driver is " + JSON.stringify(driver));
let button = await driver.findComponent(uitest.ON.text('允许'));
if (button != undefined) {
console.info("button is " + JSON.stringify(button));
await button.click();
}
}
console.info("getPermission end");
} catch (error) {
console.info(`getPermission failed, error: ${error}`);
}
sleep(3000);
});
afterAll(async function () {
...
...
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/module.json
浏览文件 @
0804f27e
...
...
@@ -2,7 +2,7 @@
"module"
:
{
"name"
:
"entry_test"
,
"type"
:
"feature"
,
"description"
:
"$string:
MainAbility_label
"
,
"description"
:
"$string:
module_test_desc
"
,
"mainElement"
:
"TestAbility"
,
"deviceTypes"
:
[
"tablet"
,
...
...
@@ -17,13 +17,12 @@
{
"name"
:
"TestAbility"
,
"srcEntrance"
:
"./ets/TestAbility/TestAbility.ets"
,
"description"
:
"$string:
MainAbility_label
"
,
"description"
:
"$string:
TestAbility_desc
"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"label"
:
"$string:TestAbility_label"
,
"exported"
:
true
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:white"
,
"visible"
:
true
,
"orientation"
:
"portrait"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"skills"
:
[
{
"entities"
:
[
...
...
telephony/telephonyjstest/actscontactstageapitest/entry/src/main/resources/base/element/string.json
浏览文件 @
0804f27e
{
"string"
:
[
{
"name"
:
"phone_entry_dsc"
,
"value"
:
"i am an entry for phone"
},
{
"name"
:
"phone_entry_main"
,
"value"
:
"the phone entry ability"
},
{
"name"
:
"entry_label"
,
"value"
:
"ActsContactStageAPITest"
},
{
"name"
:
"form_description"
,
"value"
:
"my form"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
}
"string"
:
[
{
"name"
:
"module_test_desc"
,
"value"
:
"test ability description"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
}
]
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录