提交 019b7d49 编写于 作者: O openharmony_ci 提交者: Gitee

!1163 xts

Merge pull request !1163 from blackleon/fms_1124_1
......@@ -18,10 +18,10 @@ group("formmanager") {
if (is_standard_system) {
deps = [
"formsystemtesthost/FormFuzzTest:FormFuzzTest",
"formsystemtesthost/getallformsinfo10:GetAllFormsInfo10",
"formsystemtesthost/getallformsinfo201:GetAllFormsInfo201",
"formsystemtesthost/getallformsinfo211:GetAllFormsInfo211",
"formsystemtesthost/getallformsinfo212:GetAllFormsInfo212",
"formsystemtesthost/actsformsoneandonetest:ActsFormsOneAndOneTest",
"formsystemtesthost/actsformsoneandtwotest:ActsFormsOneAndTwoTest",
"formsystemtesthost/actsformszeroandonetest:ActsFormsZeroAndOneTest",
"formsystemtesthost/actsformszerotest:ActsFormsZeroTest",
"formsystemtestservice/formsystemtestservicea:ActsFormSystemTestServiceA",
"formsystemtestservice/formsystemtestserviceb:ActsFormSystemTestServiceB",
"formsystemtestservice/formsystemtestservicec:ActsFormSystemTestServiceC",
......
......@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("GetAllFormsInfo201") {
ohos_js_hap_suite("ActsFormsOneAndOneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo201"
hap_name = "ActsFormsOneAndOneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.getallformsinfo211",
"package": "com.example.formsoneandone",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo211.hap",
"ActsFormsOneAndOneTest.hap",
"ActsFormSystemTestServiceB.hap",
"ActsFormSystemTestServiceC.hap"
],
......
{
"app": {
"bundleName": "com.example.getallformsinfo",
"bundleName": "com.example.formsoneandone",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,9 +14,9 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo",
"package": "com.example.formsoneandone",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo.MainAbility",
"mainAbility": "com.example.formsoneandone.MainAbility",
"deviceType": [
"phone"
],
......@@ -39,7 +39,7 @@
}
],
"visible": true,
"name": "com.example.getallformsinfo.MainAbility",
"name": "com.example.formsoneandone.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
......
......@@ -14,11 +14,11 @@
*/
import formManager from '@ohos.ability.formManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
describe('ActsFormsOneAndOneTest', function () {
console.log("ActsFormsOneAndOneTest===start");
/**
* @tc.name getAllFormsInfo test
......@@ -27,38 +27,47 @@ describe('getAllFormsInfoTest', function () {
*/
it('FMS_getFormsInfo_0500_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0500_callback begin");
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0500_callback async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0500_callback async::result, result:" + result);
console.log("FMS_getFormsInfo_0500_callback, the forms number:" + data.length);
var dataB = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviceb";
});
var dataC = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestservicec";
});
console.log("FMS_getFormsInfo_0500_callback async::sucess, dataB json:" + JSON.stringify(dataB));
console.log("FMS_getFormsInfo_0500_callback async::sucess, dataA json:" + JSON.stringify(dataC));
console.log("FMS_getFormsInfo_0500_callback getAllFormsInfo async::result, result:" + result);
expect(result).assertEqual(1);
for(var i = 0; i < data.length; i++) {
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].updateDuration).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("10:30");
expect(data[i].formVisibleNotify).assertEqual(1);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
function expe(datainfo) {
for(var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].description).assertEqual("form_description");
expect(datainfo[i].type).assertEqual(1);
expect(datainfo[i].colorMode).assertEqual(-1);
expect(datainfo[i].jsComponentName).assertEqual("card");
expect(datainfo[i].isDefault).assertEqual(1);
expect(datainfo[i].updateEnabled).assertEqual(1);
expect(datainfo[i].updateDuration).assertEqual(1);
expect(datainfo[i].scheduledUpdateTime).assertEqual("10:30");
expect(datainfo[i].formVisibleNotify).assertEqual(1);
expect(datainfo[i].defaultDimension).assertEqual(1);
expect(datainfo[i].supportDimensions[0]).assertEqual(1);
expect(datainfo[i].supportDimensions[1]).assertEqual(2);
expect(datainfo[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(datainfo[i].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0500_callback=========expe, formName:" + datainfo[i].name);
}
expect(data[0].name).assertEqual("FormB_Js001");
expect(data[1].name).assertEqual("FormC_Js001");
}
expe(dataB);
expe(dataC);
expect(dataB[0].name).assertEqual("FormB_Js001");
expect(dataC[0].name).assertEqual("FormC_Js001");
console.log("FMS_getFormsInfo_0500_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0500_callback==================end');
}, TIMEOUT)
......@@ -71,39 +80,48 @@ describe('getAllFormsInfoTest', function () {
* @tc.desc All form configuration information is queried successfully (by Promise)
*/
it('FMS_getFormsInfo_0500_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0500_promise begin--------111");
console.log("FMS_getFormsInfo_0500_promise begin");
var promise = formManager.getAllFormsInfo();
promise.then((data) => {
console.log("FMS_getFormsInfo_0500_promise async::sucess, data json:" + JSON.stringify(data));
console.log("FMS_getFormsInfo_0500_promise, the forms number:" + data.length);
var dataB = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviceb";
});
var dataC = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestservicec";
});
console.log("FMS_getFormsInfo_0500_promise async::sucess, dataB json:" + JSON.stringify(dataB));
console.log("FMS_getFormsInfo_0500_promise async::sucess, dataA json:" + JSON.stringify(dataC));
for(var i = 0; i < data.length; i++) {
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].updateDuration).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("10:30");
expect(data[i].formVisibleNotify).assertEqual(1);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
function expe(datainfo) {
for(var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].description).assertEqual("form_description");
expect(datainfo[i].type).assertEqual(1);
expect(datainfo[i].colorMode).assertEqual(-1);
expect(datainfo[i].jsComponentName).assertEqual("card");
expect(datainfo[i].isDefault).assertEqual(1);
expect(datainfo[i].updateEnabled).assertEqual(1);
expect(datainfo[i].updateDuration).assertEqual(1);
expect(datainfo[i].scheduledUpdateTime).assertEqual("10:30");
expect(datainfo[i].formVisibleNotify).assertEqual(1);
expect(datainfo[i].defaultDimension).assertEqual(1);
expect(datainfo[i].supportDimensions[0]).assertEqual(1);
expect(datainfo[i].supportDimensions[1]).assertEqual(2);
expect(datainfo[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(datainfo[i].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0500_promise=========expe, formName:" + datainfo[i].name);
}
expect(data[0].name).assertEqual("FormB_Js001");
expect(data[1].name).assertEqual("FormC_Js001");
}
expe(dataB);
expe(dataC);
expect(dataB[0].name).assertEqual("FormB_Js001");
expect(dataC[0].name).assertEqual("FormC_Js001");
console.log("FMS_getFormsInfo_0500_promise result end");
done();
}
);
});
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0500_promise==================end');
}, TIMEOUT)
})
})
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./GetAllFormsInfo10Jsunit.test.js')
\ No newline at end of file
require('./FormsOneAndOneJsunit.test.js')
\ No newline at end of file
......@@ -2,7 +2,7 @@
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo212"
"value": "formsoneandone"
},
{
"name": "mainability_description",
......
......@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("GetAllFormsInfo211") {
ohos_js_hap_suite("ActsFormsOneAndTwoTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo211"
hap_name = "ActsFormsOneAndTwoTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.example.getallformsinfo",
"package": "com.example.formsoneandtwo",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo212.hap",
"ActsFormsOneAndTwoTest.hap",
"ActsFormSystemTestServiceA.hap",
"ActsFormSystemTestServiceB.hap"
],
......
{
"app": {
"bundleName": "com.example.getallformsinfo10",
"bundleName": "com.example.formsoneandtwo",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,9 +14,9 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo10",
"package": "com.example.formsoneandtwo",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo10.MainAbility",
"mainAbility": "com.example.formsoneandtwo.MainAbility",
"deviceType": [
"phone"
],
......@@ -39,7 +39,7 @@
}
],
"visible": true,
"name": "com.example.getallformsinfo10.MainAbility",
"name": "com.example.formsoneandtwo.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
......
......@@ -14,11 +14,11 @@
*/
import formManager from '@ohos.ability.formManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 5000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
describe('ActsFormsOneAndTwoTest', function () {
console.log("ActsFormsOneAndTwoTest===start");
/**
* @tc.name getAllFormsInfo test
......@@ -30,41 +30,50 @@ describe('getAllFormsInfoTest', function () {
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0600_callback async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0600_callback async::result, result:" + result);
console.log("FMS_getFormsInfo_0600_callback, the forms number:" + data.length);
var dataA = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestservicea";
});
var dataB = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviceb";
});
console.log("FMS_getFormsInfo_0600_callback, the formA number:" + dataA.length);
console.log("FMS_getFormsInfo_0600_callback async::sucess, dataA json:" + JSON.stringify(dataA));
console.log("FMS_getFormsInfo_0600_callback async::sucess, dataB json:" + JSON.stringify(dataB));
console.log("FMS_getFormsInfo_0600_callback getAllFormsInfo async::result, result:" + result);
expect(result).assertEqual(1);
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].updateDuration).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("10:30");
expect(data[i].formVisibleNotify).assertEqual(1);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
function expe(datainfo) {
for(var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].description).assertEqual("form_description");
expect(datainfo[i].type).assertEqual(1);
expect(datainfo[i].colorMode).assertEqual(-1);
expect(datainfo[i].jsComponentName).assertEqual("card");
expect(datainfo[i].isDefault).assertEqual(1);
expect(datainfo[i].updateEnabled).assertEqual(1);
expect(datainfo[i].updateDuration).assertEqual(1);
expect(datainfo[i].scheduledUpdateTime).assertEqual("10:30");
expect(datainfo[i].formVisibleNotify).assertEqual(1);
expect(datainfo[i].defaultDimension).assertEqual(1);
expect(datainfo[i].supportDimensions[0]).assertEqual(1);
expect(datainfo[i].supportDimensions[1]).assertEqual(2);
expect(datainfo[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(datainfo[i].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0600_promise=========expe, formName:" + datainfo[i].name);
}
expect(data[0].name).assertEqual("FormA_Js001");
expect(data[1].name).assertEqual("FormA_Js002");
expect(data[2].name).assertEqual("FormB_Js001");
}
expe(dataA);
expe(dataB);
expect(dataA[0].name).assertEqual("FormA_Js001");
expect(dataA[1].name).assertEqual("FormA_Js002");
expect(dataB[0].name).assertEqual("FormB_Js001");
console.log("FMS_getFormsInfo_0600_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0600_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0600_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_0600_callback end, ret:" + ret);
})
/**
......@@ -77,33 +86,44 @@ describe('getAllFormsInfoTest', function () {
var promise = formManager.getAllFormsInfo();
promise.then((data) => {
console.log("FMS_getFormsInfo_0600_promise async::sucess, data json:" + JSON.stringify(data));
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].updateDuration).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("10:30");
expect(data[i].formVisibleNotify).assertEqual(1);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0600_promise, the forms number:" + data.length);
var dataA = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestservicea";
});
var dataB = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviceb";
});
console.log("FMS_getFormsInfo_0600_promise, the formA number:" + dataA.length);
console.log("FMS_getFormsInfo_0600_promise async::sucess, dataA json:" + JSON.stringify(dataA));
console.log("FMS_getFormsInfo_0600_promise async::sucess, dataB json:" + JSON.stringify(dataB));
function expe(datainfo) {
for(var i = 0; i < datainfo.length; i++) {
expect(datainfo[i].description).assertEqual("form_description");
expect(datainfo[i].type).assertEqual(1);
expect(datainfo[i].colorMode).assertEqual(-1);
expect(datainfo[i].jsComponentName).assertEqual("card");
expect(datainfo[i].isDefault).assertEqual(1);
expect(datainfo[i].updateEnabled).assertEqual(1);
expect(datainfo[i].updateDuration).assertEqual(1);
expect(datainfo[i].scheduledUpdateTime).assertEqual("10:30");
expect(datainfo[i].formVisibleNotify).assertEqual(1);
expect(datainfo[i].defaultDimension).assertEqual(1);
expect(datainfo[i].supportDimensions[0]).assertEqual(1);
expect(datainfo[i].supportDimensions[1]).assertEqual(2);
expect(datainfo[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(datainfo[i].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0600_promise=========expe, formName:" + datainfo[i].name);
}
expect(data[0].name).assertEqual("FormA_Js001");
expect(data[1].name).assertEqual("FormA_Js002");
expect(data[2].name).assertEqual("FormB_Js001");
}
expe(dataA);
expe(dataB);
expect(dataA[0].name).assertEqual("FormA_Js001");
expect(dataA[1].name).assertEqual("FormA_Js002");
expect(dataB[0].name).assertEqual("FormB_Js001");
console.log("FMS_getFormsInfo_0600_promise result end");
done();
}
);
});
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0600_promise==================end');
}, TIMEOUT)
......@@ -133,7 +153,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0900_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0900_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_0900_callback end, ret:" + ret);
})
/**
......@@ -184,7 +204,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1000_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1000_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1000_callback end, ret:" + ret);
})
/**
......@@ -254,7 +274,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1100_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1100_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1100_callback end, ret:" + ret);
})
/**
......@@ -293,8 +313,7 @@ describe('getAllFormsInfoTest', function () {
expect(data[1].name).assertEqual("FormA_Js002");
console.log("FMS_getFormsInfo_1100_promise result end");
done();
}
);
});
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1100_promise==================end');
......@@ -326,7 +345,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1400_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1400_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1400_callback end, ret:" + ret);
})
/**
......@@ -380,7 +399,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1500_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1500_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1500_callback end, ret:" + ret);
})
/**
......@@ -434,7 +453,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1600_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1600_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1600_callback end, ret:" + ret);
})
/**
......@@ -488,7 +507,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1700_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1700_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1700_callback end, ret:" + ret);
})
/**
......@@ -561,7 +580,7 @@ describe('getAllFormsInfoTest', function () {
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1800_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1800_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_1800_callback end, ret:" + ret);
})
/**
......
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./GetAllFormsInfo211Jsunit.test.js')
\ No newline at end of file
require('./FormsOneAndTwoJsunit.test.js')
\ No newline at end of file
......@@ -2,7 +2,7 @@
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo201"
"value": "formsoneandtwo"
},
{
"name": "mainability_description",
......
......@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("GetAllFormsInfo212") {
ohos_js_hap_suite("ActsFormsZeroAndOneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo212"
hap_name = "ActsFormsZeroAndOneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.getallformsinfo201",
"package": "com.example.formszeroandone",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo201.hap",
"ActsFormsZeroAndOneTest.hap",
"ActsFormSystemTestServiceB.hap",
"ActsFormSystemTestServiceD.hap"
],
......
{
"app": {
"bundleName": "com.example.getallformsinfo201",
"bundleName": "com.example.formszeroandone",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,9 +14,9 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo201",
"package": "com.example.formszeroandone",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo201.MainAbility",
"mainAbility": "com.example.formszeroandone.MainAbility",
"deviceType": [
"phone"
],
......@@ -39,7 +39,7 @@
}
],
"visible": true,
"name": "com.example.getallformsinfo201.MainAbility",
"name": "com.example.formszeroandone.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
......
......@@ -14,11 +14,11 @@
*/
import formManager from '@ohos.ability.formManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
describe('ActsFormsZeroAndOneTest', function () {
console.log("ActsFormsZeroAndOneTest===start");
/**
* @tc.name getAllFormsInfo test
......@@ -30,27 +30,30 @@ describe('getAllFormsInfoTest', function () {
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0400_callback async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0400_callback, the forms number:" + data.length);
console.log("FMS_getFormsInfo_0400_callback async::sucess, data json:" + JSON.stringify(data));
var dataB = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviceb";
});
console.log("FMS_getFormsInfo_0400_callback async::sucess, dataB json:" + JSON.stringify(dataB));
console.log("FMS_getFormsInfo_0400_callback async::result, result:" + result);
expect(result).assertEqual(1);
expect(data[0].description).assertEqual("form_description");
expect(data[0].type).assertEqual(1);
expect(data[0].colorMode).assertEqual(-1);
expect(data[0].jsComponentName).assertEqual("card");
expect(data[0].isDefault).assertEqual(1);
expect(data[0].updateEnabled).assertEqual(1);
expect(data[0].updateDuration).assertEqual(1);
expect(data[0].scheduledUpdateTime).assertEqual("10:30");
expect(data[0].formVisibleNotify).assertEqual(1);
expect(data[0].defaultDimension).assertEqual(1);
expect(data[0].supportDimensions[0]).assertEqual(1);
expect(data[0].supportDimensions[1]).assertEqual(2);
expect(data[0].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[0].metaData.customizeData[0].value).assertEqual("myTest");
expect(data[0].name).assertEqual("FormB_Js001");
expect(dataB[0].name).assertEqual("FormB_Js001");
expect(dataB[0].description).assertEqual("form_description");
expect(dataB[0].type).assertEqual(1);
expect(dataB[0].colorMode).assertEqual(-1);
expect(dataB[0].jsComponentName).assertEqual("card");
expect(dataB[0].isDefault).assertEqual(1);
expect(dataB[0].updateEnabled).assertEqual(1);
expect(dataB[0].updateDuration).assertEqual(1);
expect(dataB[0].scheduledUpdateTime).assertEqual("10:30");
expect(dataB[0].formVisibleNotify).assertEqual(1);
expect(dataB[0].defaultDimension).assertEqual(1);
expect(dataB[0].supportDimensions[0]).assertEqual(1);
expect(dataB[0].supportDimensions[1]).assertEqual(2);
expect(dataB[0].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(dataB[0].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0400_callback result end");
done();
}
......@@ -68,28 +71,32 @@ describe('getAllFormsInfoTest', function () {
* @tc.desc All form configuration information is queried successfully (by Promise)
*/
it('FMS_getFormsInfo_0400_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0400_promise begin--------111");
console.log("FMS_getFormsInfo_0400_promise begin");
var promise = formManager.getAllFormsInfo();
promise.then((data) => {
console.log("FMS_getFormsInfo_0400_promise, the forms number:" + data.length);
console.log("FMS_getFormsInfo_0400_promise async::sucess, data json:" + JSON.stringify(data));
var dataB = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviceb";
});
console.log("FMS_getFormsInfo_0400_promise async::sucess, dataB json:" + JSON.stringify(dataB));
expect(data[0].description).assertEqual("form_description");
expect(data[0].type).assertEqual(1);
expect(data[0].colorMode).assertEqual(-1);
expect(data[0].jsComponentName).assertEqual("card");
expect(data[0].isDefault).assertEqual(1);
expect(data[0].updateEnabled).assertEqual(1);
expect(data[0].updateDuration).assertEqual(1);
expect(data[0].scheduledUpdateTime).assertEqual("10:30");
expect(data[0].formVisibleNotify).assertEqual(1);
expect(data[0].defaultDimension).assertEqual(1);
expect(data[0].supportDimensions[0]).assertEqual(1);
expect(data[0].supportDimensions[1]).assertEqual(2);
expect(data[0].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[0].metaData.customizeData[0].value).assertEqual("myTest");
expect(data[0].name).assertEqual("FormB_Js001");
expect(dataB[0].name).assertEqual("FormB_Js001");
expect(dataB[0].description).assertEqual("form_description");
expect(dataB[0].type).assertEqual(1);
expect(dataB[0].colorMode).assertEqual(-1);
expect(dataB[0].jsComponentName).assertEqual("card");
expect(dataB[0].isDefault).assertEqual(1);
expect(dataB[0].updateEnabled).assertEqual(1);
expect(dataB[0].updateDuration).assertEqual(1);
expect(dataB[0].scheduledUpdateTime).assertEqual("10:30");
expect(dataB[0].formVisibleNotify).assertEqual(1);
expect(dataB[0].defaultDimension).assertEqual(1);
expect(dataB[0].supportDimensions[0]).assertEqual(1);
expect(dataB[0].supportDimensions[1]).assertEqual(2);
expect(dataB[0].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(dataB[0].metaData.customizeData[0].value).assertEqual("myTest");
console.log("FMS_getFormsInfo_0400_promise result end");
done();
}
......
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./GetAllFormsInfo201Jsunit.test.js')
\ No newline at end of file
require('./FormsZeroAndOneJsunit.test.js')
\ No newline at end of file
......@@ -2,7 +2,7 @@
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo10"
"value": "formszeroandone"
},
{
"name": "mainability_description",
......
......@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("GetAllFormsInfo10") {
ohos_js_hap_suite("ActsFormsZeroTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo10"
hap_name = "ActsFormsZeroTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
......@@ -3,13 +3,13 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.getallformsinfo10",
"package": "com.example.formszero",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo10.hap",
"ActsFormsZeroTest.hap",
"ActsFormSystemTestServiceD.hap"
],
"type": "AppInstallKit",
......
{
"app": {
"bundleName": "com.example.getallformsinfo211",
"bundleName": "com.example.formszero",
"vendor": "example",
"version": {
"code": 1,
......@@ -14,9 +14,9 @@
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo211",
"package": "com.example.formszero",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo211.MainAbility",
"mainAbility": "com.example.formszero.MainAbility",
"deviceType": [
"phone"
],
......@@ -39,7 +39,7 @@
}
],
"visible": true,
"name": "com.example.getallformsinfo211.MainAbility",
"name": "com.example.formszero.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
......
......@@ -14,11 +14,11 @@
*/
import formManager from '@ohos.ability.formManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
describe('ActsFormsZeroTest', function () {
console.log("ActsFormsZeroTest===start");
/**
* @tc.name getAllFormsInfo test
......@@ -27,22 +27,25 @@ describe('getAllFormsInfoTest', function () {
*/
it('FMS_getFormsInfo_0300_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0300_callback begin");
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0300_callback async::sucess, data json:"
+ JSON.stringify(data));
var dataD = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviced";
});
console.log("FMS_getFormsInfo_0300_callback, dataB json:" + JSON.stringify(data));
console.log("FMS_getFormsInfo_0300_callback, dataB json:" + JSON.stringify(dataD));
console.log("FMS_getFormsInfo_0300_callback, the all forms number:" + data.length);
console.log("FMS_getFormsInfo_0300_callback, the formD number:" + dataD.length);
console.log("FMS_getFormsInfo_0300_callback async::result, result:" + result);
expect(result).assertEqual(0);
expect(dataD.length).assertEqual(0);
console.log("FMS_getFormsInfo_0300_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0300_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0300_callback end, ret:"+ret);
console.log("FMS_getFormsInfo_0300_callback end, ret:" + ret);
})
/**
......@@ -52,19 +55,36 @@ describe('getAllFormsInfoTest', function () {
*/
it('FMS_getFormsInfo_0300_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0300_promise begin");
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0300_promise, data json:" + JSON.stringify(data));
console.log("FMS_getFormsInfo_0300_promise, the all forms number:" + data.length);
console.log("FMS_getFormsInfo_0300_promise async::result, result:" + result);
console.log("FMS_getFormsInfo_0300_promise result end");
if (data.length != 0){
var dataD = data.filter((p) => {
return p.bundleName == "com.form.formsystemtestserviced";
});
console.log("FMS_getFormsInfo_0300_promise, dataB json:" + JSON.stringify(dataD));
console.log("FMS_getFormsInfo_0300_promise, the formD number:" + dataD.length);
expect(dataD.length).assertEqual(0);
console.log("FMS_getFormsInfo_0300_promise result end");
done();
} else {
var promise = formManager.getAllFormsInfo();
promise.then((result) => {
console.log("FMS_getFormsInfo_0300_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_0300_promise result end");
done();
});
}
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0300_promise==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0300_promise end, ret:" + ret);
})
})
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./GetAllFormsInfo212Jsunit.test.js')
\ No newline at end of file
require('./FormsZeroJsunit.test.js')
\ No newline at end of file
......@@ -2,7 +2,7 @@
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo211"
"value": "formszero"
},
{
"name": "mainability_description",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册