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

update config

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 183f3631
{
"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": {
......
......@@ -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
},
......
......@@ -13,8 +13,8 @@
* limitations under the License.
*/
import contactstage from './contactstage.test'
import contactStage from './contactstage.test';
export default function testsuite() {
contactstage();
contactStage();
}
\ No newline at end of file
......@@ -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 () {
......
......@@ -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": [
......
{
"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.
先完成此消息的编辑!
想要评论请 注册