提交 4aec1050 编写于 作者: K kirl75

Solve the problem of process manager test case failure

Signed-off-by: Nkirl75 <kirl.liu@huawei.com>
上级 1776854f
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import fileio from '@ohos.fileio';
import commonEvent from "@ohos.commonevent" import commonEvent from "@ohos.commonevent"
import abilitymanager from '@ohos.app.abilitymanager' import abilitymanager from '@ohos.app.abilitymanager'
import abilityManager from '@ohos.application.appManager' import abilityManager from '@ohos.application.appManager'
...@@ -49,24 +50,25 @@ var systemAAbilityName = "com.acts.pmsystemappaapi7.MainAbility"; ...@@ -49,24 +50,25 @@ var systemAAbilityName = "com.acts.pmsystemappaapi7.MainAbility";
var systemBAbilityName = "com.acts.pmsystemappbapi7.MainAbility"; var systemBAbilityName = "com.acts.pmsystemappbapi7.MainAbility";
var vendorAAbilityName = "com.acts.pmvendorappaapi7.MainAbility"; var vendorAAbilityName = "com.acts.pmvendorappaapi7.MainAbility";
var systemAMultiAbilityName = "com.acts.pmsystemappamultiapi7.MainAbility"; var systemAMultiAbilityName = "com.acts.pmsystemappamultiapi7.MainAbility";
var vendorServiceAbilityName = "com.acts.pmvendorappserviceapi7.ServiceAbility";
var systemAProcessName = systemABundleName; var systemAProcessName = systemABundleName;
var systemAMultiProcessName = systemAMultiBundleName; var systemAMultiProcessName = systemAMultiBundleName;
var systemBProcessName = systemBBundleName; var systemBProcessName = systemBBundleName;
var vendorAProcessName = vendorABundleName; var vendorAProcessName = vendorABundleName;
var uriSystemA = 'internal://cache/../../com.acts.pmsystemappaapi7/'; var uriSystemA = '/data/accounts/account_0/appdata/com.acts.pmsystemappa/com.acts.pmsystemappa';
var uriSystemB = 'internal://cache/../../com.acts.pmsystemappbapi7/'; var uriSystemAMulti = '/data/accounts/account_0/appdata/com.acts.pmsystemappa/com.acts.pmsystemappamulti';
var uriVendorA = 'internal://cache/../../com.acts.pmvendorappaapi7/'; var uriSystemB = '/data/accounts/account_0/appdata/com.acts.pmsystemappb/com.acts.pmsystemappb';
var uriVendorA = '/data/accounts/account_0/appdata/com.acts.pmvendorappa/com.acts.pmvendorappa';
describe('ActsAmsProcessManageJsApi7Test', function () { describe('ActsAmsProcessManageJsTestApi7', function () {
beforeEach(async (done) => { beforeEach(async (done) => {
await clearMissionId(); await clearMissionId();
setTimeout(async function () { setTimeout(async function () {
try { try {
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
console.log('======>ACTS_ProcessManage beforeEach installer<=======' + JSON.stringify(installer)); console.log('======>ACTS_ProcessManage beforeEach installer<======='
+ JSON.stringify(installer));
var count = 0; var count = 0;
for (let i = 0; i < PATHS_COUNT; i++) { for (let i = 0; i < PATHS_COUNT; i++) {
installer.install(BUNDLE_PATHS[i], { installer.install(BUNDLE_PATHS[i], {
...@@ -75,11 +77,16 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -75,11 +77,16 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
isKeepData: false isKeepData: false
}, (err, data) => { }, (err, data) => {
count++; count++;
console.log('======>ACTS_ProcessManage beforeEach install finish<=======' + err.code); console.log('======>ACTS_ProcessManage beforeEach install finish<======='
console.log('======>ACTS_ProcessManage beforeEach install finish<=======' + data.status); + err.code);
console.log('======>ACTS_ProcessManage beforeEach install finish<=======' + data.statusMessage); console.log('======>ACTS_ProcessManage beforeEach install finish<======='
+ data.status);
console.log('======>ACTS_ProcessManage beforeEach install finish<======='
+ data.statusMessage);
if (count == PATHS_COUNT) { if (count == PATHS_COUNT) {
setTimeout(function () {
done(); done();
}, 2000);
} }
}) })
} }
...@@ -106,15 +113,20 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -106,15 +113,20 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
isKeepData: false isKeepData: false
}, (err, data) => { }, (err, data) => {
count++; count++;
console.log('======>ACTS_ProcessManage afterEach uninstall finish<=======' + err.code); console.log('======>ACTS_ProcessManage afterEach uninstall finish<======='
console.log('======>ACTS_ProcessManage afterEach uninstall finish<=======' + data.status); + err.code);
console.log('======>ACTS_ProcessManage afterEach uninstall finish<=======' + data.statusMessage); console.log('======>ACTS_ProcessManage afterEach uninstall finish<======='
+ data.status);
console.log('======>ACTS_ProcessManage afterEach uninstall finish<======='
+ data.statusMessage);
if (count == BUNDLE_COUNT) { if (count == BUNDLE_COUNT) {
setTimeout(function () {
done(); done();
}, 2000);
} }
}) })
} }
}, 500); }, 1000);
}) })
function getMissionId() { function getMissionId() {
...@@ -211,7 +223,8 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -211,7 +223,8 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
file.list({ file.list({
uri: uri, uri: uri,
success: function (data) { success: function (data) {
console.log('====>ActsProcessManageJsTest call list success data ====>' + JSON.stringify(data)); console.log('====>ActsProcessManageJsTest call list success data ====>'
+ JSON.stringify(data));
callBack(null, data.fileList.length); callBack(null, data.fileList.length);
}, },
fail: function (data, code) { fail: function (data, code) {
...@@ -442,7 +455,7 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -442,7 +455,7 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0400 end'); console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0400 end');
done(); done();
}, 4000); }, 6000);
}) })
/* /*
...@@ -663,7 +676,7 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -663,7 +676,7 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0800 end'); console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0800 end');
done(); done();
}, 4000); }, 6000);
}) })
...@@ -813,13 +826,27 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -813,13 +826,27 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriSystemA, async (err, nums) => { fileio.opendir(uriSystemA).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0100 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0100 getFileNums nums = ' }).catch(function (err) {
+ nums); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0100 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0100 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
});
fileio.opendir(uriSystemAMulti).then(function (dir) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0100 opendir Multi successfully:"
+ JSON.stringify(dir));
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0100 opendir Multi failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0100 opendir Multi failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0100 end');
done(); done();
}); });
}, 2000); }, 2000);
}) })
...@@ -867,10 +894,14 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -867,10 +894,14 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriSystemB, async (err, nums) => { fileio.opendir(uriSystemB).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0200 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 getFileNums nums = ' + nums); }).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0200 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0200 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0200 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0200 end');
done(); done();
}); });
...@@ -923,10 +954,15 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -923,10 +954,15 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 subscribeCallBack missionexist:" console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 subscribeCallBack missionexist:"
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriVendorA, async (err, nums) => {
expect(err).assertEqual(null); fileio.opendir(uriVendorA).then(function (dir) {
expect(nums).assertEqual(4); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0300 opendir successfully:"
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 getFileNums nums = ' + nums); + JSON.stringify(dir));
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0300 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0300 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0300 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0300 end');
done(); done();
}); });
...@@ -1003,11 +1039,23 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1003,11 +1039,23 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
expect(flagMissionA).assertEqual(0); expect(flagMissionA).assertEqual(0);
expect(flagMissionAMulti).assertEqual(0); expect(flagMissionAMulti).assertEqual(0);
getAppDataPathFileNums(uriSystemA, async (err, nums) => { fileio.opendir(uriSystemA).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0400 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 getFileNums nums = ' }).catch(function (err) {
+ nums); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0400 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0400 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
});
fileio.opendir(uriSystemAMulti).then(function (dir) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0400 opendir Multi successfully:"
+ JSON.stringify(dir));
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0400 opendir Multi failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0400 opendir Multi failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0400 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0400 end');
done(); done();
}); });
...@@ -1045,11 +1093,24 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1045,11 +1093,24 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriSystemA, async (err, nums) => { fileio.opendir(uriSystemA).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0500 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0500 getFileNums nums = ' }).catch(function (err) {
+ nums); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0500 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0500 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
});
fileio.opendir(uriSystemAMulti).then(function (dir) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0500 opendir Multi successfully:"
+ JSON.stringify(dir));
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0500 opendir Multi failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0500 opendir Multi failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0500 end');
done(); done();
}); });
}, 6000); }, 6000);
...@@ -1102,11 +1163,14 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1102,11 +1163,14 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriSystemB, async (err, nums) => { fileio.opendir(uriSystemB).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0600 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 getFileNums nums = ' + nums); }).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0600 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0600 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0600 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0600 end');
done(); done();
}); });
...@@ -1161,13 +1225,17 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1161,13 +1225,17 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 missionexist:====>" console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 missionexist:====>"
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriVendorA, async (err, nums) => {
expect(err).assertEqual(null); fileio.opendir(uriVendorA).then(function (dir) {
expect(nums).assertEqual(4); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0700 opendir successfully:"
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 getFileNums nums = ' + nums); + JSON.stringify(dir));
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0700 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0700 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0700 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0700 end');
done(); done();
}); });
}, 6000); }, 6000);
} }
...@@ -1242,11 +1310,23 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1242,11 +1310,23 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
expect(flagMissionA).assertEqual(0); expect(flagMissionA).assertEqual(0);
expect(flagMissionAMulti).assertEqual(0); expect(flagMissionAMulti).assertEqual(0);
getAppDataPathFileNums(uriSystemA, async (err, nums) => { fileio.opendir(uriSystemA).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0800 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 getFileNums nums = ' }).catch(function (err) {
+ nums); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0800 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0800 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
});
fileio.opendir(uriSystemAMulti).then(function (dir) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0800 opendir Multi successfully:"
+ JSON.stringify(dir));
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0800 opendir Multi failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_0800 opendir Multi failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0800 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0800 end');
done(); done();
}); });
...@@ -1342,10 +1422,16 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1342,10 +1422,16 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
+ JSON.stringify(data)); + JSON.stringify(data));
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
setTimeout(async function () { setTimeout(async function () {
getAppDataPathFileNums(uriSystemA, async (err, nums) => { fileio.opendir(uriSystemA).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_1300 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_1300 getFileNums nums = ' + nums); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1300 end');
done();
}).catch(function (err) {
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_1300 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_1300 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1300 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1300 end');
done(); done();
}); });
...@@ -1400,12 +1486,14 @@ describe('ActsAmsProcessManageJsApi7Test', function () { ...@@ -1400,12 +1486,14 @@ describe('ActsAmsProcessManageJsApi7Test', function () {
+ JSON.stringify(missionexist)); + JSON.stringify(missionexist));
expect(missionexist).assertEqual(false); expect(missionexist).assertEqual(false);
getAppDataPathFileNums(uriVendorA, async (err, nums) => { fileio.opendir(uriVendorA).then(function (dir) {
expect(err).assertEqual(null); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_1400 opendir successfully:"
expect(nums).assertEqual(4); + JSON.stringify(dir));
console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 getAppDataPathFileNums nums = ' }).catch(function (err) {
+ nums); console.info("ACTS_ProcessManage_clearUpApplicationDataFA_1400 opendir failed error:" + err);
console.info("ACTS_ProcessManage_clearUpApplicationDataFA_1400 opendir failed JSON error:"
+ JSON.stringify(err));
expect(err.code).assertEqual('2');
console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1400 end'); console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1400 end');
done(); done();
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册