提交 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",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.getallformsinfo.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
{
"app": {
"bundleName": "com.example.formsoneandone",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.formsoneandone",
"name": ".MyApplication",
"mainAbility": "com.example.formsoneandone.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.formsoneandone.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
......@@ -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");
}
expect(data[0].name).assertEqual("FormB_Js001");
expect(data[1].name).assertEqual("FormC_Js001");
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);
}
}
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
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo212"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
{
"string": [
{
"name": "entry_MainAbility",
"value": "formsoneandone"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
......@@ -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",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo10",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo10.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.getallformsinfo10.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
{
"app": {
"bundleName": "com.example.formsoneandtwo",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.formsoneandtwo",
"name": ".MyApplication",
"mainAbility": "com.example.formsoneandtwo.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.formsoneandtwo.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
......@@ -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
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo201"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
{
"string": [
{
"name": "entry_MainAbility",
"value": "formsoneandtwo"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
......@@ -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",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo201",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo201.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.getallformsinfo201.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
{
"app": {
"bundleName": "com.example.formszeroandone",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.formszeroandone",
"name": ".MyApplication",
"mainAbility": "com.example.formszeroandone.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.formszeroandone.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
......@@ -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
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo10"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
{
"string": [
{
"name": "entry_MainAbility",
"value": "formszeroandone"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
......@@ -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",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo211",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo211.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.getallformsinfo211.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
{
"app": {
"bundleName": "com.example.formszero",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.formszero",
"name": ".MyApplication",
"mainAbility": "com.example.formszero.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.formszero.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
......@@ -14,35 +14,38 @@
*/
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
* @tc.number FMS_getFormsInfo_0300
* @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");
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);
})
/**
......@@ -50,21 +53,38 @@ describe('getAllFormsInfoTest', function () {
* @tc.number FMS_getFormsInfo_0300
* @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");
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();
}
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
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo211"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
{
"string": [
{
"name": "entry_MainAbility",
"value": "formszero"
},
{
"name": "mainability_description",
"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.
先完成此消息的编辑!
想要评论请 注册