提交 0804f27e 编写于 作者: G gaoxi785

update config

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 183f3631
{ {
"app": { "app": {
"bundleName": "com.example.actscontactstageapitest", "bundleName": "com.example.actscontactstageapitest",
"vendor": "huawei", "vendor": "example",
"versionCode": 1000000, "versionCode": 1000000,
"versionName": "1.0.0", "versionName": "1.0.0",
"debug": true,
"icon": "$media:icon", "icon": "$media:icon",
"label": "$string:app_name", "label": "$string:app_name",
"description": "$string:description_application",
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 10, "minAPIVersion": 10,
"targetAPIVersion": 10, "targetAPIVersion": 10,
"car": { "car": {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "600000", "test-timeout": "600000",
"bundle-name": "com.example.actscontactstageapitest", "bundle-name": "com.example.actscontactstageapitest",
"module-name": "entry", "module-name": "entry_test",
"shell-timeout": "600000", "shell-timeout": "600000",
"testcase-timeout": 70000 "testcase-timeout": 70000
}, },
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
import contactstage from './contactstage.test' import contactStage from './contactstage.test';
export default function testsuite() { export default function testsuite() {
contactstage(); contactStage();
} }
\ No newline at end of file
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
import contact from '@ohos.contact'; import contact from '@ohos.contact';
import { afterAll, beforeAll, describe, expect, it } from '@ohos/hypium'; 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() { export default function ContactInterfaceStageTest() {
...@@ -30,27 +31,36 @@ export default function ContactInterfaceStageTest() { ...@@ -30,27 +31,36 @@ export default function ContactInterfaceStageTest() {
} }
} }
async function driveFn() { beforeAll( async function () {
console.info("come in driveFn"); console.info("beforeAll case");
let driver = Driver.create(); 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));
}
});
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)); console.info("driver is " + JSON.stringify(driver));
sleep(2000); let button = await driver.findComponent(uitest.ON.text('允许'));
let button = await driver.findComponent(ON.text('允许')); if (button != undefined) {
console.info("button is " + JSON.stringify(button)); console.info("button is " + JSON.stringify(button));
await button.click(); await button.click();
sleep(5000);
} }
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");
} }
console.info("getPermission end");
} catch (error) {
console.info(`getPermission failed, error: ${error}`);
}
sleep(3000);
}); });
afterAll(async function () { afterAll(async function () {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"module": { "module": {
"name": "entry_test", "name": "entry_test",
"type": "feature", "type": "feature",
"description": "$string:MainAbility_label", "description": "$string:module_test_desc",
"mainElement": "TestAbility", "mainElement": "TestAbility",
"deviceTypes": [ "deviceTypes": [
"tablet", "tablet",
...@@ -17,13 +17,12 @@ ...@@ -17,13 +17,12 @@
{ {
"name": "TestAbility", "name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ets", "srcEntrance": "./ets/TestAbility/TestAbility.ets",
"description": "$string:MainAbility_label", "description": "$string:TestAbility_desc",
"icon": "$media:icon", "icon": "$media:icon",
"label": "$string:entry_label", "label": "$string:TestAbility_label",
"exported": true,
"startWindowIcon": "$media:icon", "startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white", "startWindowBackground": "$color:start_window_background",
"visible": true,
"orientation": "portrait",
"skills": [ "skills": [
{ {
"entities": [ "entities": [
......
{ {
"string": [ "string": [
{ {
"name": "phone_entry_dsc", "name": "module_test_desc",
"value": "i am an entry for phone" "value": "test ability description"
}, },
{ {
"name": "phone_entry_main", "name": "TestAbility_desc",
"value": "the phone entry ability" "value": "the test ability"
}, },
{ {
"name": "entry_label", "name": "TestAbility_label",
"value": "ActsContactStageAPITest" "value": "test label"
},
{
"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"
} }
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册