diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets index 05ba5e1ace3e176a83bbf4b309914aaa0088c368..93b1791ecefaeef9eac44898534ddb9e73d7fd53 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets @@ -16,7 +16,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import commonEvent from '@ohos.commonEvent' import abilityManager from '@ohos.application.abilityManager'; import appManager from '@ohos.application.appManager' -import missionManager from '@ohos.application.missionManager' const TIMEOUT = 1000; var subscriberInfo = { @@ -35,6 +34,9 @@ var processNameA = "com.example.multiinstancehapa"; var processNameB = "com.example.multiinstancehapb"; var processNameC = "com.example.multiinstancehapc"; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} export default function abilityTest() { describe('ActsProcessMultiInstanceTest', function () { @@ -151,6 +153,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapba.MainAbility", @@ -158,6 +161,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0100 - startAbilityhapba: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbb.MainAbility", @@ -260,6 +264,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbc.MainAbility", @@ -267,6 +272,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0200 - startAbilityhapbc: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbd.MainAbility", @@ -374,6 +380,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbd.MainAbility", @@ -381,6 +388,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0300 - startAbilityhapbd: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbe.MainAbility", @@ -485,6 +493,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapba.MainAbility", @@ -492,6 +501,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0400 - startAbilityhapba: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbf.MainAbility", @@ -596,6 +606,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapa", abilityName: "com.example.multiinstancehapaa.MainAbility", @@ -603,6 +614,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0500 - startAbilityhapaa: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbe.MainAbility", @@ -710,6 +722,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapa", abilityName: "com.example.multiinstancehapaa.MainAbility", @@ -717,6 +730,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0600 - startAbilityhapaa: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbf.MainAbility", @@ -823,6 +837,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapa", abilityName: "com.example.multiinstancehapab.MainAbility", @@ -830,6 +845,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0700 - startAbilityhapab: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbc.MainAbility",