未验证 提交 5645cce5 编写于 作者: O openharmony_ci 提交者: Gitee

!6468 XTS--FreeInstallTest用例优化

Merge pull request !6468 from chengxingzhen/master
...@@ -23,9 +23,9 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry ...@@ -23,9 +23,9 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
export default function ConnectAbilityTest() { export default function ConnectAbilityTest() {
var TAG = ""; let TAG = "";
var Tempassert = ""; let Tempassert = "";
var abilityDelegator = undefined let abilityDelegator = undefined
function sleep(time) { function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time)) return new Promise((resolve) => setTimeout(resolve, time))
...@@ -35,19 +35,19 @@ export default function ConnectAbilityTest() { ...@@ -35,19 +35,19 @@ export default function ConnectAbilityTest() {
beforeAll(async function (done) { beforeAll(async function (done) {
console.info("FreeInstall_FA_ConnectAbility before all called"); console.info("FreeInstall_FA_ConnectAbility before all called");
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var cmd = "bm install -p data/test/MockService.hap"; let cmd = "bm install -p data/test/MockService.hap";
console.info("cmd : " + cmd) console.info("cmd : " + cmd)
console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator)); console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator));
abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => {
console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
await sleep(500); await sleep(500);
var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; let cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
await sleep(500); await sleep(500);
var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; let cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
done(); done();
...@@ -57,11 +57,12 @@ export default function ConnectAbilityTest() { ...@@ -57,11 +57,12 @@ export default function ConnectAbilityTest() {
afterEach(async (done) => { afterEach(async (done) => {
console.info("FreeInstall_FA_ConnectAbility after each called"); console.info("FreeInstall_FA_ConnectAbility after each called");
Tempassert = "" Tempassert = ""
if ("FreeInstall_FA_ConnectAbility_2000" === TAG) { if ("FreeInstall_FA_ConnectAbility_1300" === TAG) {
var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; let cmd14 = "bm uninstall -n com.ohos.hag.famanager";
abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => {
console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
await sleep(2000)
} }
done(); done();
}); });
...@@ -125,20 +126,20 @@ export default function ConnectAbilityTest() { ...@@ -125,20 +126,20 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_0100", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_0100", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_0100-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0100-------------");
TAG = "FreeInstall_FA_ConnectAbility_0100"; TAG = "FreeInstall_FA_ConnectAbility_0100";
var cmd4 = "cp data/test/ConnectFaMyApplication6.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" + let cmd4 = "cp data/test/ConnectFaMyApplication6.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" +
"/entry/files"; "/entry/files";
abilityDelegator.executeShellCommand(cmd4, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd4, (err: any, d: any) => {
console.info(TAG + " executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { let deviceid = "0";
var deviceid = "0"; abilityManager.getTopAbility((err, data) => {
await abilityManager.getTopAbility((err, data) => {
console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err)); console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err));
console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId)); console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId));
deviceid = data.deviceId; deviceid = data.deviceId;
}) })
var request1 = { await sleep(500)
let request1 = {
"deviceId": deviceid, "deviceId": deviceid,
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication6.ServiceAbility", "abilityName": "com.example.myapplication6.ServiceAbility",
...@@ -148,10 +149,9 @@ export default function ConnectAbilityTest() { ...@@ -148,10 +149,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request1); connectabillity(TAG, request1);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0100-------------");
done(); done();
}, 2000)
console.log("------------end FreeInstall_FA_ConnectAbility_0100-------------");
}); });
/* /*
...@@ -163,18 +163,18 @@ export default function ConnectAbilityTest() { ...@@ -163,18 +163,18 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_0200", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_0200", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_0200-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0200-------------");
TAG = "FreeInstall_FA_ConnectAbility_0200"; TAG = "FreeInstall_FA_ConnectAbility_0200";
var cmdapp10 = "bm install -p data/test/ConnectFaMyApplication10.hap"; let cmdapp10 = "bm install -p data/test/ConnectFaMyApplication10.hap";
abilityDelegator.executeShellCommand(cmdapp10, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmdapp10, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { let deviceid = "0";
var deviceid = "0";
await abilityManager.getTopAbility((err, data) => { await abilityManager.getTopAbility((err, data) => {
console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err)); console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err));
console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId)); console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId));
deviceid = data.deviceId; deviceid = data.deviceId;
}) })
var request2 = { await sleep(500)
let request2 = {
"deviceId": deviceid, "deviceId": deviceid,
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication10.ServiceAbility", "abilityName": "com.example.myapplication10.ServiceAbility",
...@@ -182,12 +182,13 @@ export default function ConnectAbilityTest() { ...@@ -182,12 +182,13 @@ export default function ConnectAbilityTest() {
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
} }
connectabillity(TAG, request2); connectabillity(TAG, request2);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2500);
console.log("------------end FreeInstall_FA_ConnectAbility_0200-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0200-------------");
done(); done();
}, 2000)
}); });
/* /*
...@@ -199,13 +200,12 @@ export default function ConnectAbilityTest() { ...@@ -199,13 +200,12 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_0300", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_0300", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_0300-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0300-------------");
TAG = "FreeInstall_FA_ConnectAbility_0300"; TAG = "FreeInstall_FA_ConnectAbility_0300";
var cmd3 = "cp data/test/ConnectFaMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; let cmd3 = "cp data/test/ConnectFaMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
abilityDelegator.executeShellCommand(cmd3, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd3, (err: any, d: any) => {
console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { let request3 = {
var request3 = {
"deviceId": "", "deviceId": "",
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
...@@ -215,10 +215,9 @@ export default function ConnectAbilityTest() { ...@@ -215,10 +215,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request3); connectabillity(TAG, request3);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0300-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0300-------------");
done(); done();
}, 2000)
}); });
/* /*
...@@ -230,12 +229,12 @@ export default function ConnectAbilityTest() { ...@@ -230,12 +229,12 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_0400", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_0400", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_0400-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0400-------------");
TAG = "FreeInstall_FA_ConnectAbility_0400"; TAG = "FreeInstall_FA_ConnectAbility_0400";
var cmdapp11 = "bm install -p data/test/ConnectFaMyApplication11.hap"; let cmdapp11 = "bm install -p data/test/ConnectFaMyApplication11.hap";
abilityDelegator.executeShellCommand(cmdapp11, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmdapp11, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { await sleep(2000)
var request4 = { let request4 = {
"deviceId": "", "deviceId": "",
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication11.ServiceAbility", "abilityName": "com.example.myapplication11.ServiceAbility",
...@@ -245,10 +244,9 @@ export default function ConnectAbilityTest() { ...@@ -245,10 +244,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request4); connectabillity(TAG, request4);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0400-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0400-------------");
done(); done();
}, 2000)
}); });
/* /*
...@@ -261,8 +259,7 @@ export default function ConnectAbilityTest() { ...@@ -261,8 +259,7 @@ export default function ConnectAbilityTest() {
console.log("------------start FreeInstall_FA_ConnectAbility_0500-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0500-------------");
TAG = "FreeInstall_FA_ConnectAbility_0500"; TAG = "FreeInstall_FA_ConnectAbility_0500";
setTimeout(async () => { let request5 = {
var request5 = {
"bundleName": "com.example.different.hmservice", "bundleName": "com.example.different.hmservice",
"abilityName": "com.example.different.ServiceAbility", "abilityName": "com.example.different.ServiceAbility",
"moduleName": "entry", "moduleName": "entry",
...@@ -271,10 +268,9 @@ export default function ConnectAbilityTest() { ...@@ -271,10 +268,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request5); connectabillity(TAG, request5);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0500-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0500-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -287,8 +283,7 @@ export default function ConnectAbilityTest() { ...@@ -287,8 +283,7 @@ export default function ConnectAbilityTest() {
console.log("------------start FreeInstall_FA_ConnectAbility_0600-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0600-------------");
TAG = "FreeInstall_FA_ConnectAbility_0600"; TAG = "FreeInstall_FA_ConnectAbility_0600";
setTimeout(async () => { let request6 = {
var request6 = {
"bundleName": "", "bundleName": "",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication1", "moduleName": "myapplication1",
...@@ -297,10 +292,9 @@ export default function ConnectAbilityTest() { ...@@ -297,10 +292,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request6); connectabillity(TAG, request6);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0600-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0600-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -313,8 +307,7 @@ export default function ConnectAbilityTest() { ...@@ -313,8 +307,7 @@ export default function ConnectAbilityTest() {
console.log("------------start FreeInstall_FA_ConnectAbility_0700-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0700-------------");
TAG = "FreeInstall_FA_ConnectAbility_0700"; TAG = "FreeInstall_FA_ConnectAbility_0700";
setTimeout(async () => { let request7 = {
var request7 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "", "abilityName": "",
"moduleName": "myapplication1", "moduleName": "myapplication1",
...@@ -323,10 +316,9 @@ export default function ConnectAbilityTest() { ...@@ -323,10 +316,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request7); connectabillity(TAG, request7);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0700-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0700-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -339,8 +331,7 @@ export default function ConnectAbilityTest() { ...@@ -339,8 +331,7 @@ export default function ConnectAbilityTest() {
console.log("------------start FreeInstall_FA_ConnectAbility_0800-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0800-------------");
TAG = "FreeInstall_FA_ConnectAbility_0800"; TAG = "FreeInstall_FA_ConnectAbility_0800";
setTimeout(async () => { let request8 = {
var request8 = {
"deviceId": "xxxxxx", "deviceId": "xxxxxx",
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication2.ServiceAbility", "abilityName": "com.example.myapplication2.ServiceAbility",
...@@ -350,10 +341,9 @@ export default function ConnectAbilityTest() { ...@@ -350,10 +341,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request8); connectabillity(TAG, request8);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0800-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0800-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -366,8 +356,7 @@ export default function ConnectAbilityTest() { ...@@ -366,8 +356,7 @@ export default function ConnectAbilityTest() {
console.log("------------start FreeInstall_FA_ConnectAbility_0900-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_0900-------------");
TAG = "FreeInstall_FA_ConnectAbility_0900"; TAG = "FreeInstall_FA_ConnectAbility_0900";
setTimeout(async () => { let request9 = {
var request9 = {
"bundleName": "com.example.xxx.hmservice", "bundleName": "com.example.xxx.hmservice",
"abilityName": "com.example.myapplication2.ServiceAbility", "abilityName": "com.example.myapplication2.ServiceAbility",
"moduleName": "myapplication2", "moduleName": "myapplication2",
...@@ -376,10 +365,9 @@ export default function ConnectAbilityTest() { ...@@ -376,10 +365,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request9); connectabillity(TAG, request9);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_0900-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_0900-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -392,8 +380,7 @@ export default function ConnectAbilityTest() { ...@@ -392,8 +380,7 @@ export default function ConnectAbilityTest() {
console.log("------------start FreeInstall_FA_ConnectAbility_1000-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1000-------------");
TAG = "FreeInstall_FA_ConnectAbility_1000"; TAG = "FreeInstall_FA_ConnectAbility_1000";
setTimeout(async () => { let request10 = {
var request10 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication2.ServiceAbility", "abilityName": "com.example.myapplication2.ServiceAbility",
"moduleName": "myapplication2", "moduleName": "myapplication2",
...@@ -402,10 +389,9 @@ export default function ConnectAbilityTest() { ...@@ -402,10 +389,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request10); connectabillity(TAG, request10);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -417,13 +403,12 @@ export default function ConnectAbilityTest() { ...@@ -417,13 +403,12 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_1100", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1100", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1100-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1100-------------");
TAG = "FreeInstall_FA_ConnectAbility_1100"; TAG = "FreeInstall_FA_ConnectAbility_1100";
var cmdapp2 = "bm install -p data/test/ConnectFaMyApplication2.hap"; let cmdapp2 = "bm install -p data/test/ConnectFaMyApplication2.hap";
abilityDelegator.executeShellCommand(cmdapp2, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmdapp2, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
await sleep(2000)
setTimeout(async () => { let request11 = {
var request11 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication2.ServiceAbility", "abilityName": "com.example.myapplication2.ServiceAbility",
"moduleName": "myapplication2", "moduleName": "myapplication2",
...@@ -432,10 +417,9 @@ export default function ConnectAbilityTest() { ...@@ -432,10 +417,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request11); connectabillity(TAG, request11);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -447,12 +431,11 @@ export default function ConnectAbilityTest() { ...@@ -447,12 +431,11 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_1200", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1200", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1200-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1200-------------");
TAG = "FreeInstall_FA_ConnectAbility_1200"; TAG = "FreeInstall_FA_ConnectAbility_1200";
var cmdrm = "rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*"; let cmdrm = "rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*";
abilityDelegator.executeShellCommand(cmdrm, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmdrm, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { let request12 = {
var request12 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3", "moduleName": "myapplication3",
...@@ -461,10 +444,9 @@ export default function ConnectAbilityTest() { ...@@ -461,10 +444,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request12); connectabillity(TAG, request12);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1200-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1200-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -476,7 +458,7 @@ export default function ConnectAbilityTest() { ...@@ -476,7 +458,7 @@ export default function ConnectAbilityTest() {
it("FreeInstall_FA_ConnectAbility_1300", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1300", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1300-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1300-------------");
TAG = "FreeInstall_FA_ConnectAbility_1300"; TAG = "FreeInstall_FA_ConnectAbility_1300";
var str = { let str = {
"want": { "want": {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.MainAbility2", "abilityName": "com.example.myapplication.MainAbility2",
...@@ -490,8 +472,7 @@ export default function ConnectAbilityTest() { ...@@ -490,8 +472,7 @@ export default function ConnectAbilityTest() {
console.error(TAG + " startmainability2 failed. Cause: " + JSON.stringify(error)); console.error(TAG + " startmainability2 failed. Cause: " + JSON.stringify(error));
}) })
setTimeout(async () => { let request13 = {
var request13 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3", "moduleName": "myapplication3",
...@@ -500,11 +481,9 @@ export default function ConnectAbilityTest() { ...@@ -500,11 +481,9 @@ export default function ConnectAbilityTest() {
connectabillity(TAG, request13); connectabillity(TAG, request13);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1300-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1300-------------");
done(); done();
}, 2000);
}); });
}) })
} }
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import { describe, beforeAll, afterEach, it, expect } from "@ohos/hypium"
import rpc from '@ohos.rpc'; import rpc from '@ohos.rpc';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant' import wantConstant from '@ohos.ability.wantConstant'
...@@ -22,9 +22,9 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry ...@@ -22,9 +22,9 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
export default function ConnectAbilityTest1() { export default function ConnectAbilityTest1() {
var TAG = ""; let TAG = "";
var Tempassert = ""; let Tempassert = "";
var abilityDelegator = undefined let abilityDelegator = undefined
function sleep(time) { function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time)) return new Promise((resolve) => setTimeout(resolve, time))
...@@ -34,17 +34,19 @@ export default function ConnectAbilityTest1() { ...@@ -34,17 +34,19 @@ export default function ConnectAbilityTest1() {
beforeAll(async function (done) { beforeAll(async function (done) {
console.info("FreeInstall_FA_ConnectAbility before all called"); console.info("FreeInstall_FA_ConnectAbility before all called");
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var cmd = "bm install -p data/test/MockService.hap"; let cmd = "bm install -p data/test/MockService.hap";
console.info("cmd : " + cmd) console.info("cmd : " + cmd)
console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator)); console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator));
abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => {
console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; await sleep(500);
let cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; await sleep(500);
let cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
done(); done();
...@@ -54,11 +56,12 @@ export default function ConnectAbilityTest1() { ...@@ -54,11 +56,12 @@ export default function ConnectAbilityTest1() {
afterEach(async function (done) { afterEach(async function (done) {
console.info("FreeInstall_FA_ConnectAbility after each called"); console.info("FreeInstall_FA_ConnectAbility after each called");
Tempassert = "" Tempassert = ""
if ("FreeInstall_FA_ConnectAbility_1600" === TAG) { if ("FreeInstall_FA_ConnectAbility_2000" === TAG) {
var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; let cmd14 = "bm uninstall -n com.ohos.hag.famanager";
abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => {
console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
await sleep(2000)
} }
done(); done();
}); });
...@@ -113,8 +116,6 @@ export default function ConnectAbilityTest1() { ...@@ -113,8 +116,6 @@ export default function ConnectAbilityTest1() {
console.info(msg + "END"); console.info(msg + "END");
} }
/* /*
* @tc.number FreeInstall_FA_ConnectAbility_1500 * @tc.number FreeInstall_FA_ConnectAbility_1500
* @tc.name The application is not in the foreground, * @tc.name The application is not in the foreground,
...@@ -125,11 +126,12 @@ export default function ConnectAbilityTest1() { ...@@ -125,11 +126,12 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1500", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1500", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1500-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1500-------------");
TAG = "FreeInstall_FA_ConnectAbility_1500"; TAG = "FreeInstall_FA_ConnectAbility_1500";
var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap"; let cmddif = "bm install -p data/test/ConnectDifferentApplication.hap";
abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
var str = { await sleep(2000)
let str = {
"want": { "want": {
"bundleName": "com.example.different.hmservice", "bundleName": "com.example.different.hmservice",
"abilityName": "MainAbility", "abilityName": "MainAbility",
...@@ -141,8 +143,7 @@ export default function ConnectAbilityTest1() { ...@@ -141,8 +143,7 @@ export default function ConnectAbilityTest1() {
}).catch((error) => { }).catch((error) => {
console.error(TAG + " startother failed. Cause: " + JSON.stringify(error)); console.error(TAG + " startother failed. Cause: " + JSON.stringify(error));
}) })
setTimeout(async () => { let request15 = {
var request15 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication5.ServiceAbility5", "abilityName": "com.example.myapplication5.ServiceAbility5",
"moduleName": "myapplication5", "moduleName": "myapplication5",
...@@ -151,10 +152,9 @@ export default function ConnectAbilityTest1() { ...@@ -151,10 +152,9 @@ export default function ConnectAbilityTest1() {
connectabillity(TAG, request15); connectabillity(TAG, request15);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1500-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1500-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -167,11 +167,12 @@ export default function ConnectAbilityTest1() { ...@@ -167,11 +167,12 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1600", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1600", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1600-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1600-------------");
TAG = "FreeInstall_FA_ConnectAbility_1600"; TAG = "FreeInstall_FA_ConnectAbility_1600";
var cmdmyapp4 = "bm install -p data/test/ConnectFaMyApplication4.hap"; let cmdmyapp4 = "bm install -p data/test/ConnectFaMyApplication4.hap";
abilityDelegator.executeShellCommand(cmdmyapp4, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmdmyapp4, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
var str = { await sleep(2000)
let str = {
"want": { "want": {
"bundleName": "com.example.different.hmservice", "bundleName": "com.example.different.hmservice",
"abilityName": "MainAbility", "abilityName": "MainAbility",
...@@ -184,8 +185,7 @@ export default function ConnectAbilityTest1() { ...@@ -184,8 +185,7 @@ export default function ConnectAbilityTest1() {
console.error(TAG + " startother failed. Cause: " + JSON.stringify(error)); console.error(TAG + " startother failed. Cause: " + JSON.stringify(error));
}) })
setTimeout(function () { let request16 = {
var request16 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication4.ServiceAbility4", "abilityName": "com.example.myapplication4.ServiceAbility4",
"moduleName": "myapplication4", "moduleName": "myapplication4",
...@@ -194,10 +194,9 @@ export default function ConnectAbilityTest1() { ...@@ -194,10 +194,9 @@ export default function ConnectAbilityTest1() {
connectabillity(TAG, request16); connectabillity(TAG, request16);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1600-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1600-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -209,7 +208,7 @@ export default function ConnectAbilityTest1() { ...@@ -209,7 +208,7 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1400", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1400", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1400-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1400-------------");
TAG = "FreeInstall_FA_ConnectAbility_1400"; TAG = "FreeInstall_FA_ConnectAbility_1400";
var str = { let str = {
"want": { "want": {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication2.MainAbility", "abilityName": "com.example.myapplication2.MainAbility",
...@@ -222,20 +221,18 @@ export default function ConnectAbilityTest1() { ...@@ -222,20 +221,18 @@ export default function ConnectAbilityTest1() {
}).catch((error) => { }).catch((error) => {
console.error(TAG + " startmyapp2 failed. Cause: " + JSON.stringify(error)); console.error(TAG + " startmyapp2 failed. Cause: " + JSON.stringify(error));
}) })
setTimeout(() => { let request14 = {
var request14 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3", "moduleName": "myapplication3",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
} }
connectabillity(TAG, request14); connectabillity(TAG, request14);
setTimeout(async () => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500);
}, 2000)
done();
console.log("------------end FreeInstall_FA_ConnectAbility_1400-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1400-------------");
done()
}, 2000)
}); });
/* /*
...@@ -247,12 +244,12 @@ export default function ConnectAbilityTest1() { ...@@ -247,12 +244,12 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1700", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1700", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1700-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1700-------------");
TAG = "FreeInstall_FA_ConnectAbility_1700"; TAG = "FreeInstall_FA_ConnectAbility_1700";
var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap"; let cmddif = "bm install -p data/test/ConnectDifferentApplication.hap";
await abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => { await abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(() => { await sleep(2000)
var request17 = { let request17 = {
"bundleName": "com.example.different.hmservice", "bundleName": "com.example.different.hmservice",
"abilityName": "com.example.different.ServiceAbility", "abilityName": "com.example.different.ServiceAbility",
"moduleName": "entry", "moduleName": "entry",
...@@ -260,10 +257,9 @@ export default function ConnectAbilityTest1() { ...@@ -260,10 +257,9 @@ export default function ConnectAbilityTest1() {
connectabillity(TAG, request17); connectabillity(TAG, request17);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500);
}, 2000)
console.log("------------end FreeInstall_FA_ConnectAbility_1700-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1700-------------");
done(); done();
}, 2000)
}); });
/* /*
...@@ -275,9 +271,7 @@ export default function ConnectAbilityTest1() { ...@@ -275,9 +271,7 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1800", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1800", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1800-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1800-------------");
TAG = "FreeInstall_FA_ConnectAbility_1800"; TAG = "FreeInstall_FA_ConnectAbility_1800";
let request18 = {
setTimeout(async () => {
var request18 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "xxxxx", "moduleName": "xxxxx",
...@@ -286,10 +280,9 @@ export default function ConnectAbilityTest1() { ...@@ -286,10 +280,9 @@ export default function ConnectAbilityTest1() {
connectabillity(TAG, request18); connectabillity(TAG, request18);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1800-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1800-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -301,13 +294,12 @@ export default function ConnectAbilityTest1() { ...@@ -301,13 +294,12 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1900", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_1900", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1900-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_1900-------------");
TAG = "FreeInstall_FA_ConnectAbility_1900"; TAG = "FreeInstall_FA_ConnectAbility_1900";
var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + let cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files"; "haps/entry/files";
await abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => { await abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { let request19 = {
var request19 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature", "abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3", "moduleName": "myapplication3",
...@@ -316,10 +308,9 @@ export default function ConnectAbilityTest1() { ...@@ -316,10 +308,9 @@ export default function ConnectAbilityTest1() {
connectabillity(TAG, request19); connectabillity(TAG, request19);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onFailed"); expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1900-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_1900-------------");
done(); done();
}, 2000);
}); });
/* /*
...@@ -331,13 +322,13 @@ export default function ConnectAbilityTest1() { ...@@ -331,13 +322,13 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_2000", 0, async function (done) { it("FreeInstall_FA_ConnectAbility_2000", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_2000-------------"); console.log("------------start FreeInstall_FA_ConnectAbility_2000-------------");
TAG = "FreeInstall_FA_ConnectAbility_2000"; TAG = "FreeInstall_FA_ConnectAbility_2000";
var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + let cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files"; "haps/entry/files";
abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
setTimeout(async () => { await sleep(1000)
var request20 = { let request20 = {
"bundleName": "com.example.myapplication.hmservice", "bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication5.ServiceAbility5", "abilityName": "com.example.myapplication5.ServiceAbility5",
"moduleName": "myapplication5", "moduleName": "myapplication5",
...@@ -349,10 +340,9 @@ export default function ConnectAbilityTest1() { ...@@ -349,10 +340,9 @@ export default function ConnectAbilityTest1() {
connectabillity(TAG, request20); connectabillity(TAG, request20);
setTimeout(() => { setTimeout(() => {
expect(Tempassert).assertEqual("onConnect"); expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 4000)
done();
console.log("------------end FreeInstall_FA_ConnectAbility_2000-------------"); console.log("------------end FreeInstall_FA_ConnectAbility_2000-------------");
done()
}, 4000)
}); });
} }
) )
......
...@@ -146,8 +146,8 @@ ...@@ -146,8 +146,8 @@
abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => {
console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
}) })
await sleep(2000)
} }
await sleep(1500);
done(); done();
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册