提交 5b3f7afb 编写于 作者: O openharmony_ci 提交者: Gitee

!463 修改测试用例

Merge pull request !463 from chensi10/master
{ {
"app": { "app": {
"bundleName": "com.example.napi_test_suite", "bundleName": "com.example.myapplication",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1, "code": 1,
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.myapplication",
"package": "com.example.napi_test_suite",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"phone" "phone"
...@@ -31,18 +29,45 @@ ...@@ -31,18 +29,45 @@
"skills": [ "skills": [
{ {
"entities": [ "entities": [
"entity.system.home" "entity.system.home",
"flag.home.intent.from.system"
], ],
"actions": [ "actions": [
"action.system.home" "action.system.home"
] ]
} }
], ],
"name": "com.example.napi_test_suite.MainAbility", "name": "com.example.myapplication.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"theme":"$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "MyApplication",
"type": "page", "type": "page",
"formEntity": [
"homeScreen",
"searchbox"
],
"defaultFormHeight": 100,
"minFormHeight": 200,
"defaultFormWidth": 300,
"minFormWidth": 400,
"metaData": {
"parameters" : [{
"name" : "string",
"type" : "Float",
"description" : "string_parameters_description"
}],
"results" : [{
"name" : "string",
"type" : "Float",
"description" : "string_results_description"
}],
"customizeData" : [{
"name" : "string",
"value" : "string",
"extra" : ""
}]
},
"launchType": "standard" "launchType": "standard"
} }
], ],
...@@ -69,11 +94,13 @@ ...@@ -69,11 +94,13 @@
"description": "WeChat permission in detail" "description": "WeChat permission in detail"
} }
], ],
"colorMode": "light",
"js": [ "js": [
{ {
"pages": [ "pages": [
"pages/index/index" "pages/index/index"
], ],
"colorMode": "light",
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
......
...@@ -124,4 +124,325 @@ describe('appInfoTest', function () { ...@@ -124,4 +124,325 @@ describe('appInfoTest', function () {
done() done()
}) })
it('getBundleInfo_0100', 0, async function (done) {
var datainfo = await demo.getBundleInfo('com.example.myapplication1',1)
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
expect(datainfo.appInfo.descriptionId).assertEqual(16777217)
done()
})
it('getBundleInfo_0400', 0, async function (done) {
var datainfo = await demo.getBundleInfo('error',1);
expect(datainfo.name.length).assertEqual(0)
done();
})
it('getBundleInfo_0500', 0, async function (done) {
var datainfo = await demo.getBundleInfo();
expect(datainfo.name.length).assertEqual(0)
done();
})
it('getBundleInfo_0600', 0, async function (done) {
await demo.getBundleInfo('com.example.myapplication1',1,OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
expect(datainfo.appInfo.descriptionId).assertEqual(16777217)
}
done()
})
it('getBundleInfo_0900', 0, async function (done) {
await demo.getBundleInfo('error',1,OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertEqual(0)
}
done()
})
it('getBundleInfo_1000', 0, async function (done) {
await demo.getBundleInfo(OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertEqual(0)
}
done()
})
it('getBundleArchiveInfo_0100', 0, async function (done) {
var datainfo = await demo.getBundleArchiveInfo('/data/bmsJstest1.hap',1)
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
done()
})
it('getBundleArchiveInfo_0400', 0, async function (done) {
var datainfo = await demo.getBundleArchiveInfo('/data/error.hap',1)
expect(datainfo.name.length).assertEqual(0)
done()
})
it('getBundleArchiveInfo_0500', 0, async function (done) {
var datainfo = await demo.getBundleArchiveInfo(' ',1)
expect(datainfo.name.length).assertEqual(0)
done()
})
it('getBundleArchiveInfo_0600', 0, async function (done) {
await demo.getBundleArchiveInfo('/data/bmsJstest1.hap',1,OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
}
done()
})
it('getBundleArchiveInfo_0900', 0, async function (done) {
await demo.getBundleArchiveInfo('/data/error.', 1,OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertEqual(0)
}
done()
})
it('getBundleArchiveInfo_1000', 0, async function (done) {
await demo.getBundleArchiveInfo(' ', 1,OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertEqual(0)
}
done()
})
it('queryAbilityByWant_0100', 0, async function (done) {
var datainfo =
await demo.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId: "0",
bundleName : "com.example.myapplication1",
abilityName : ".MainAbility",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.description.length).assertLarger(0)
expect(datainfo.applicationInfo.icon.length).assertLarger(0)
expect(datainfo.applicationInfo.label.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0400', 0, async function (done) {
var datainfo =
await demo.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId : "0",
bundleName : "com.example.myapplication1",
abilityName : "",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
expect(datainfo.name.length).assertEqual(0)
done();
})
it('queryAbilityByWant_0500', 0, async function (done) {
var datainfo =
await demo.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId : "0",
bundleName : "",
abilityName : "",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
expect(datainfo.name.length).assertEqual(0)
done();
})
it('queryAbilityByWant_0600', 0, async function (done) {
await demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication1",
abilityName: ".MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.description.length).assertLarger(0)
expect(datainfo.applicationInfo.icon.length).assertLarger(0)
expect(datainfo.applicationInfo.label.length).assertLarger(0)
done()
}
})
it('queryAbilityByWant_0900', 0, async function (done) {
await demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication1",
abilityName: "",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertEqual(0)
done();
}
})
it('queryAbilityByWant_1000', 0, async function (done) {
await demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "",
abilityName: "",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertEqual(0)
done()
}
})
it('getPermissionDef_0100', 0, async function(done){
await demo.getPermissionDef('com.permission.CAMERA').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("com.permission.CAMERA");
expect(infos.grantMode).assertEqual(1);
expect(infos.availableScope).assertEqual(2);
expect(infos.label).assertEqual("CAMERA permission");
expect(infos.description).assertEqual("CAMERA permission in detail");
});
done();
})
it('getPermissionDef_0600', 0, async function(done){
console.info("neu========================getPermissionDef_0100: for begin");
await demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent);
function OnReceiveEvent(err, data) {
expect(data.name).assertEqual("com.permission.CAMERA");
expect(data.grantMode).assertEqual(1);
expect(data.availableScope).assertEqual(2);
expect(data.label).assertEqual("CAMERA permission");
expect(data.description).assertEqual("CAMERA permission in detail");
}
done();
})
it('getPermissionDef_0400', 0, async function(done){
await demo.getPermissionDef('').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("");
expect(infos.grantMode).assertEqual("");
expect(infos.availableScope).assertEqual(0);
expect(infos.label).assertEqual("");
expect(infos.description).assertEqual("");
});
done();
})
it('getPermissionDef_0900', 0, async function(done)
{
await demo.getPermissionDef('', OnReceiveEvent);
function OnReceiveEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.name).assertEqual("");
expect(data.availableScope).assertEqual(0);
expect(data.grantMode).assertEqual("");
expect(data.label).assertEqual("");
expect(data.description).assertEqual("");
}
done();
})
}) })
{ {
"app": { "app": {
"bundleName": "com.example.napi_test_suite", "bundleName": "com.example.myapplication_2",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1, "code": 1,
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.myapplication",
"package": "com.example.napi_test_suite",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"phone" "phone"
...@@ -31,18 +29,45 @@ ...@@ -31,18 +29,45 @@
"skills": [ "skills": [
{ {
"entities": [ "entities": [
"entity.system.home" "entity.system.home",
"flag.home.intent.from.system"
], ],
"actions": [ "actions": [
"action.system.home" "action.system.home"
] ]
} }
], ],
"name": "com.example.napi_test_suite.MainAbility", "name": "com.example.myapplication.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"theme":"$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "MyApplication",
"type": "page", "type": "page",
"formEntity": [
"homeScreen",
"searchbox"
],
"defaultFormHeight": 100,
"minFormHeight": 200,
"defaultFormWidth": 300,
"minFormWidth": 400,
"metaData": {
"parameters" : [{
"name" : "string",
"type" : "Float",
"description" : "string_parameters_description"
}],
"results" : [{
"name" : "string",
"type" : "Float",
"description" : "string_results_description"
}],
"customizeData" : [{
"name" : "string",
"value" : "string",
"extra" : ""
}]
},
"launchType": "standard" "launchType": "standard"
} }
], ],
...@@ -69,11 +94,13 @@ ...@@ -69,11 +94,13 @@
"description": "WeChat permission in detail" "description": "WeChat permission in detail"
} }
], ],
"colorMode": "light",
"js": [ "js": [
{ {
"pages": [ "pages": [
"pages/index/index" "pages/index/index"
], ],
"colorMode": "light",
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
......
...@@ -129,7 +129,7 @@ describe('appInfoTest', function () { ...@@ -129,7 +129,7 @@ describe('appInfoTest', function () {
}) })
it('getApplicationInfo_0200', 0, async function (done) { it('getApplicationInfo_0200', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1) var datainfo = await demo.getApplicationInfo('com.example.myapplication2', 8, 1)
expect(typeof datainfo).assertEqual("object") expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0) expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0)
...@@ -142,7 +142,7 @@ describe('appInfoTest', function () { ...@@ -142,7 +142,7 @@ describe('appInfoTest', function () {
}) })
it('getApplicationInfo_0700', 0, async function (done) { it('getApplicationInfo_0700', 0, async function (done) {
await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => { await demo.getApplicationInfo('com.example.myapplication2', 8, 1, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object") expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0) expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0)
...@@ -155,4 +155,166 @@ describe('appInfoTest', function () { ...@@ -155,4 +155,166 @@ describe('appInfoTest', function () {
done() done()
}) })
it('getBundleInfo_0200', 0, async function (done) {
var datainfo = await demo.getBundleInfo('com.example.myapplication2',1)
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
expect(datainfo.appInfo.descriptionId).assertEqual(16777217)
done()
})
it('getBundleInfo_0700', 0, async function (done) {
await demo.getBundleInfo('com.example.myapplication2',1,OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
expect(datainfo.appInfo.descriptionId).assertEqual(16777217)
}
done()
})
it('getBundleArchiveInfo_0200', 0, async function (done) {
var datainfo = await demo.getBundleArchiveInfo('/data/bmsJstest2.hap',1)
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
done()
})
it('getBundleArchiveInfo_0700', 0, async function (done) {
await demo.getBundleArchiveInfo('/data/bmsJstest2.hap',1,OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
}
done()
})
it('queryAbilityByWant_0200', 0, async function (done) {
var datainfo =
await demo.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId: "0",
bundleName : "com.example.myapplication2",
abilityName : ".MainAbility",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.description.length).assertLarger(0)
expect(datainfo.applicationInfo.icon.length).assertLarger(0)
expect(datainfo.applicationInfo.label.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0700', 0, async function (done) {
await demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication2",
abilityName: ".MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.description.length).assertLarger(0)
expect(datainfo.applicationInfo.icon.length).assertLarger(0)
expect(datainfo.applicationInfo.label.length).assertLarger(0)
done()
}
})
it('getPermissionDef_0200', 0, async function(done){
await demo.getPermissionDef('com.permission.CAMERA').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("com.permission.CAMERA");
expect(infos.grantMode).assertEqual(1);
expect(infos.availableScope).assertEqual(2);
expect(infos.label).assertEqual("CAMERA permission");
expect(infos.description).assertEqual("CAMERA permission in detail");
});
await demo.getPermissionDef('com.permission.music').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("com.permission.music");
expect(infos.grantMode).assertEqual(1);
expect(infos.availableScope).assertEqual(2);
expect(infos.label).assertEqual("music permission");
expect(infos.description).assertEqual("music permission in detail");
});
done();
})
it('getPermissionDef_0700', 0, async function(done){
await demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent1);
await demo.getPermissionDef('com.permission.music', OnReceiveEvent2);
function OnReceiveEvent1(err, data) {
expect(data.name).assertEqual("com.permission.CAMERA");
expect(data.grantMode).assertEqual(1);
expect(data.availableScope).assertEqua(2);
expect(data.label).assertEqual("CAMERA permission");
expect(data.description).assertEqual("CAMERA permission in detail");
}
function OnReceiveEvent2(err, data) {
expect(data.name).assertEqual("com.permission.music");
expect(data.grantMode).assertEqual(1);
expect(data.availableScope).assertEqual(2);
expect(data.label).assertEqual("music permission");
expect(data.description).assertEqual("music permission in detail");
}
done();
})
}) })
{ {
"app": { "app": {
"bundleName": "com.example.napi_test_suite", "bundleName": "com.example.myapplication_3",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1, "code": 1,
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.myapplication",
"package": "com.example.napi_test_suite",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"phone" "phone"
...@@ -31,18 +29,45 @@ ...@@ -31,18 +29,45 @@
"skills": [ "skills": [
{ {
"entities": [ "entities": [
"entity.system.home" "entity.system.home",
"flag.home.intent.from.system"
], ],
"actions": [ "actions": [
"action.system.home" "action.system.home"
] ]
} }
], ],
"name": "com.example.napi_test_suite.MainAbility", "name": "com.example.myapplication.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"theme":"$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "MyApplication",
"type": "page", "type": "page",
"formEntity": [
"homeScreen",
"searchbox"
],
"defaultFormHeight": 100,
"minFormHeight": 200,
"defaultFormWidth": 300,
"minFormWidth": 400,
"metaData": {
"parameters" : [{
"name" : "string",
"type" : "Float",
"description" : "string_parameters_description"
}],
"results" : [{
"name" : "string",
"type" : "Float",
"description" : "string_results_description"
}],
"customizeData" : [{
"name" : "string",
"value" : "string",
"extra" : ""
}]
},
"launchType": "standard" "launchType": "standard"
} }
], ],
...@@ -69,11 +94,13 @@ ...@@ -69,11 +94,13 @@
"description": "WeChat permission in detail" "description": "WeChat permission in detail"
} }
], ],
"colorMode": "light",
"js": [ "js": [
{ {
"pages": [ "pages": [
"pages/index/index" "pages/index/index"
], ],
"colorMode": "light",
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
......
...@@ -129,7 +129,7 @@ describe('appInfoTest', function () { ...@@ -129,7 +129,7 @@ describe('appInfoTest', function () {
}) })
it('getApplicationInfo_0300', 0, async function (done) { it('getApplicationInfo_0300', 0, async function (done) {
var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1) var datainfo = await demo.getApplicationInfo('com.example.myapplication4', 8, 1)
expect(typeof datainfo).assertEqual("object") expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0) expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0)
...@@ -142,7 +142,7 @@ describe('appInfoTest', function () { ...@@ -142,7 +142,7 @@ describe('appInfoTest', function () {
}) })
it('getApplicationInfo_0800', 0, async function (done) { it('getApplicationInfo_0800', 0, async function (done) {
await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => { await demo.getApplicationInfo('com.example.myapplication4', 8, 1, (error, datainfo) => {
expect(typeof datainfo).assertEqual("object") expect(typeof datainfo).assertEqual("object")
expect(datainfo.name.length).assertLarger(0) expect(datainfo.name.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0)
...@@ -155,4 +155,188 @@ describe('appInfoTest', function () { ...@@ -155,4 +155,188 @@ describe('appInfoTest', function () {
done() done()
}) })
it('getBundleInfo_0300', 0, async function (done) {
var datainfo = await demo.getBundleInfo('com.example.myapplication4',1)
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
expect(datainfo.appInfo.descriptionId).assertEqual(16777217)
done()
})
it('getBundleInfo_0800', 0, async function (done) {
await demo.getBundleInfo('com.example.myapplication4',1,OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
expect(datainfo.appInfo.descriptionId).assertEqual(16777217)
}
done()
})
it('getBundleArchiveInfo_0300', 0, async function (done) {
var datainfo = await demo.getBundleArchiveInfo('/data/bmsJstest4.hap',1)
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
done()
})
it('getBundleArchiveInfo_0800', 0, async function (done) {
await demo.getBundleArchiveInfo('/data/bmsJstest4.hap',1,OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.vendor.length).assertLarger(0)
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual(1.0)
expect(datainfo.appInfo.name.length).assertLarger(0)
expect(datainfo.appInfo.description.length).assertLarger(0)
expect(datainfo.appInfo.label.length).assertLarger(0)
expect(datainfo.appInfo.icon.length).assertLarger(0)
}
done()
})
it('queryAbilityByWant_0300', 0, async function (done) {
var datainfo =
await demo.queryAbilityByWant({
want:{
action: "action.system.home",
entities:["entity.system.home"],
elementName: {
deviceId: "0",
bundleName : "com.example.myapplication4",
abilityName : ".MainAbility",
},}},{
params:{
flags: 8 ,
userId:"0" ,
}
})
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.description.length).assertLarger(0)
expect(datainfo.applicationInfo.icon.length).assertLarger(0)
expect(datainfo.applicationInfo.label.length).assertLarger(0)
done();
})
it('queryAbilityByWant_0800', 0, async function (done) {
await demo.queryAbilityByWant({
want: {
action: "action.system.home",
entities: ["entity.system.home"],
elementName: {
deviceId: "0",
bundleName: "com.example.myapplication4",
abilityName: ".MainAbility",
},
}
}, {
params: {
flags: 8,
userId: "0",
}
},OnReceiveEvent)
function OnReceiveEvent(err,datainfo) {
expect(datainfo.name.length).assertLarger(0)
expect(datainfo.label.length).assertLarger(0)
expect(datainfo.description.length).assertLarger(0)
expect(datainfo.icon.length).assertLarger(0)
expect(datainfo.moduleName.length).assertLarger(0)
expect(datainfo.bundleName.length).assertLarger(0)
expect(datainfo.applicationInfo.name.length).assertLarger(0)
expect(datainfo.applicationInfo.description.length).assertLarger(0)
expect(datainfo.applicationInfo.icon.length).assertLarger(0)
expect(datainfo.applicationInfo.label.length).assertLarger(0)
done()
}
})
it('getPermissionDef_0300', 0, async function(done){
await demo.getPermissionDef('com.permission.CAMERA').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("com.permission.CAMERA");
expect(infos.grantMode).assertEqual(1);
expect(infos.availableScope).assertEqual(2);
expect(infos.label).assertEqual("CAMERA permission");
expect(infos.description).assertEqual("CAMERA permission in detail");
});
await demo.getPermissionDef('com.permission.music').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("com.permission.music");
expect(infos.grantMode).assertEqual(1);
expect(infos.availableScope).assertEqual(2);
expect(infos.label).assertEqual("music permission");
expect(infos.description).assertEqual("music permission in detail");
});
await demo.getPermissionDef('com.permission.WeChat').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("com.permission.WeChat");
expect(infos.grantMode).assertEqual(1);
expect(infos.availableScope).assertEqual(2);
expect(infos.label).assertEqual("WeChat permission");
expect(infos.description).assertEqual("WeChat permission in detail");
});
done();
})
it('getPermissionDef_0800', 0, async function(done){
await demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent1);
await demo.getPermissionDef('com.permission.music', OnReceiveEvent2);
await demo.getPermissionDef('com.permission.WeChat', OnReceiveEvent3);
function OnReceiveEvent1(err, data) {
expect(data.name).assertEqual("com.permission.CAMERA");
expect(data.grantMode).assertEqual(1);
expect(data.availableScope).assertEqual(2);
expect(data.label).assertEqual("CAMERA permission");
expect(data.description).assertEqual("CAMERA permission in detail");
}
function OnReceiveEvent2(err, data) {
expect(data.name).assertEqual("com.permission.music");
expect(data.grantMode).assertEqual(1);
expect(data.availableScope).assertEqual(2);
expect(data.label).assertEqual("music permission");
expect(data.description).assertEqual("music permission in detail");
}
function OnReceiveEvent3(err, data) {
expect(data.name).assertEqual("com.permission.WeChat");
expect(data.grantMode).assertEqual(1);
expect(data.availableScope).assertEqual(2);
expect(data.label).assertEqual("WeChat permission");
expect(data.description).assertEqual("WeChat permission in detail");
}
done();
})
}) })
{
"app": {
"bundleName": "com.example.napi_test_suite",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.napi_test_suite",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.napi_test_suite.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "CAMERA permission",
"description": "CAMERA permission in detail"
},
{
"name": "com.permission.music",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "music permission",
"description": "music permission in detail"
},
{
"name": "com.permission.WeChat",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "WeChat permission",
"description": "WeChat permission in detail"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import demo from '@ohos.bundle'
describe('appInfoTest', function () {
it('getPermissionDef_0500', 0, async function(done){
await demo.getPermissionDef('error').then((infos) => {
expect(typeof infos).assertEqual("object");
expect(infos.name).assertEqual("");
expect(infos.grantMode).assertEqual("");
expect(infos.availableScope).assertEqual(0);
expect(infos.label).assertEqual("");
expect(infos.description).assertEqual("");
});
done();
})
it('getPermissionDef_1000', 0, async function(done){
await demo.getPermissionDef('error', OnReceiveEvent);
function OnReceiveEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.name).assertEqual("");
expect(data.availableScope).assertEqual(0);
expect(data.grantMode).assertEqual("");
expect(data.label).assertEqual("");
3.
expect(data.description).assertEqual("");
}
done();
})
it('install_0100', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.uninstall('com.example.myapplication1', {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication2', {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication4', {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication5', {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication6', {
param: {
userId: 0,
isKeepData: false
}
});
data.install(['/data/bmsJstest1.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication1', {
param: {
userId: 0,
isKeepData: false
}
});
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('install_0200', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install(['/data/bmsJstest2.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/bmsJstest3.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication2', {
param: {
userId: 0,
isKeepData: false
}
});
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('install_0300', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install(['/data/bmsJstest4.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/bmsJstest5.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.install(['/data/bmsJstest6.hap'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication4', {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication5', {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication6', {
param: {
userId: 0,
isKeepData: false
}
});
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('install_0400', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install(['error'], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID");
}
});
done();
})
it('install_0500', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install([''], {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID");
}
});
done();
})
it('uninstall_0100', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install(['/data/bmsJstest1.hap'], {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication1', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0200', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install(['/data/bmsJstest1.hap'], {
param: {
userId: 0,
isKeepData: false
}
});
data.install(['/data/bmsJstest2.hap'], {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication1', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication2', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0300', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.install(['/data/bmsJstest4.hap'], {
param: {
userId: 0,
isKeepData: false
}
});
data.install(['/data/bmsJstest5.hap'], {
param: {
userId: 0,
isKeepData: false
}
});
data.install(['/data/bmsJstest6.hap'], {
param: {
userId: 0,
isKeepData: false
}
});
data.uninstall('com.example.myapplication4', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication5', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
data.uninstall('com.example.myapplication6', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("SUCCESS");
}
});
done();
})
it('uninstall_0400', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.uninstall('', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE_ABORTED");
}
});
done();
})
it('uninstall_0500', 0, async function (done) {
await demo.getBundleInstaller().then((data) => {
data.uninstall('', {
param: {
userId: 0,
isKeepData: false
}
}, OnReceiveinstallEvent);
function OnReceiveinstallEvent(err, data) {
expect(typeof data).assertEqual("object");
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE_ABORTED");
}
});
done();
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册