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

!1163 xts

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