diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts index 6d4dc7c06648df436d0c1b7fd7683f5e66b6f030..a7588ad77f5f08bc17b9b26c76461798cca2d735 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,12 +13,23 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { onCreate(want,launchParam){ // Ability is creating, initialize resources for this ability console.log("AbilityMultiInstanceTest onCreate") globalThis.abilityWant = want; + + globalThis.abilityContext = this.context + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -29,7 +40,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("AbilityMultiInstanceTest onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) console.log("AbilityMultiInstanceTest onWindowStageCreate finish") } diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets index 8104a9e406943f5c5320809295495863e5ec128e..88f0dd53fa9780e4262830d1922a633c8fc1fd88 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets @@ -13,20 +13,11 @@ * limitations under the License. */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../test/List.test' @Entry @Component struct Index { aboutToAppear(){ - let abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - let abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets index 8b530adededf7147f149694a410055b5b55f0cac..c13edd358fd36710b9247a9c50a67ce8afd77d9c 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets @@ -91,6 +91,25 @@ async function startAbilityProcess(abilityContext, parameters) { export default function abilityTest(abilityContext) { describe('ActsAbilityTest', function () { + let TAG1 = "ACTS_AbilityMultiInstance_Single == "; + afterEach(async (done) => { + console.log(TAG1 + "afterEach called"); + let wantInfo = { + bundleName: "com.example.abilitymultiinstance", + abilityName: "com.example.abilitymultiinstance.MainAbility" + } + await abilityContext.startAbility(wantInfo).then((data) => { + console.log(TAG1 + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG1 + "startAbility err : " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log(TAG1 + "afterEach end"); + done(); + }, 500); + }) + /* * @tc.number: ACTS_AbilityMultiInstance_Multi_0100 * @tc.name: Connects a service ability, which is used to start a cloned page ability. diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets index 44f8b82751c7dfa698bc482f14dd6869f95a10bd..8b1994ebac6db56add8a511f9edf68e2a3479e6e 100644 --- a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets @@ -17,15 +17,39 @@ import { BY,UiDriver,UiComponent } from '@ohos.uitest'; import commonEvent from '@ohos.commonEvent'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; import power from '@ohos.power'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function OnAndOffScreenTest() { describe('OnAndOffScreenTest', function () { let TAG = ""; - let TAG1 = "SUB_AA_OpenHarmony == "; + let TAG1 = "SUB_AA_OpenHarmony == OnAndOffScreenTest : "; let sleepTimeOne = 1000; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) async function slideScreen(TAG) { console.log(TAG + "slideScreen start"); diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json index f81b1543a04f1b750c63ed035fc6e161102f855b..8bbef22e51d17149acb2a3bc06604361c121431a 100644 --- a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json @@ -22,6 +22,7 @@ "startWindowIcon": "$media:icon", "startWindowBackground": "$color:white", "visible": true, + "launchType": "singleton", "skills": [ { "entities": [ diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets index c3ce871f466e59b661be8eccf92fb85eb0c1785f..c4ca0cb700844fa2cbcb8f9cb3ccf5e8f82f722e 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets @@ -29,6 +29,16 @@ export default function FaSetDisplayOrientationTest() { afterEach(async (done) => { console.log(TAG1 + "afterEach called"); + let wantInfo = { + bundleName: "com.example.supportfunctionhaptest", + abilityName: "MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantInfo).then((data) => { + console.log(TAG1 + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG1 + "startAbility err : " + JSON.stringify(err)); + }) + let cmd1 = "aa force-stop ohos.acts.aafwk.test.fasupportfunction"; let cmd2 = "aa force-stop ohos.acts.aafwk.test.fasupportfunctionthree"; diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets index 84203ede6f7b8c265c7c1127cccbeec0cd917c6c..ca61879ab195fc366be1bb330c6d17c6c19d9daf 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets @@ -16,6 +16,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; import commonEvent from '@ohos.commonEvent'; import power from '@ohos.power'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function FaShowOnLockTest() { @@ -26,6 +27,30 @@ export default function FaShowOnLockTest() { let sleepTimeOne = 1000; let sleepTimeTwo = 2000; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + beforeEach(async (done) => { console.log(TAG1 + "beforeEach called"); let status = undefined; diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json index f81b1543a04f1b750c63ed035fc6e161102f855b..8bbef22e51d17149acb2a3bc06604361c121431a 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json @@ -22,6 +22,7 @@ "startWindowIcon": "$media:icon", "startWindowBackground": "$color:white", "visible": true, + "launchType": "singleton", "skills": [ { "entities": [ diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets index 2f92b8b0047c723e9a21906ebff8cb523c1be9e6..acc8ff7f6421555793e2b9dd5837e5416fc91576 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets @@ -16,6 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " import commonEvent from '@ohos.commonEvent' import appManager from '@ohos.application.appManager' import osaccount from '@ohos.account.osAccount' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; var subscriberInfo_MainAbility = { events: ["ACTS_InterfaceMultiUsers_0100_Start_CommonEvent","ACTS_TerminateSelf_CommonEvent"] @@ -39,6 +40,31 @@ export default function abilityTest() { // }) // }) // }) + + let id = undefined; + beforeAll(async (done) => { + console.log("ACTS_InterfaceMultiUsers beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("ACTS_InterfaceMultiUsers Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("ACTS_InterfaceMultiUsers requestId is : " + id); + setTimeout(function () { + console.log("ACTS_InterfaceMultiUsers beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("ACTS_InterfaceMultiUsers afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("ACTS_InterfaceMultiUsers afterAll end"); + done(); + }, 1000); + }) + console.debug("====>in ACTS_InterfaceMultiUsers====>"); /* * @tc.number : ACTS_startAbility_0100 diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js index adb2b8c92d7624582f8ebf94b3774b8e71530d33..67affdfdb61ce75865a235fe940a385123e8a354 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -84,7 +84,7 @@ describe('ActsFeatureAbilityTest', function () { console.info('beforeEach called') }) - afterEach(function() { + afterEach(async function(done) { /* * @tc.teardown: teardown invoked after each testcases @@ -94,6 +94,22 @@ describe('ActsFeatureAbilityTest', function () { setTimeout(() => {}, 500); backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()); setTimeout(() => {}, 500); + + let wantInfo = { + want: { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("ACTS_wantConstant startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ACTS_wantConstant startAbility err : " + JSON.stringify(err)); + }) + setTimeout(function () { + console.log("ACTS_wantConstant afterEach end"); + done(); + }, 500); }) /** diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js index 216bba81aa959df662b32a6abc62b14a7ac76422..e420df97c8342fc2166d92cc5007f9d7e7a10f89 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js @@ -23,6 +23,24 @@ const errCode1 = 202; export default function startAbilityTest() { describe('StartAbilityTest', function () { + afterEach(async function(done) { + let wantInfo = { + want: { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("SUB_AA_JsApi_StartAbility startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("SUB_AA_JsApi_StartAbility startAbility err : " + JSON.stringify(err)); + }) + setTimeout(function () { + console.log("SUB_AA_JsApi_StartAbility afterEach end"); + done(); + }, 500); + }) + /* * @tc.number: SUB_AA_JsApi_StartAbility_0100 * @tc.name: testAbility0100. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets index cb718c637486144af0d2aefc788dec26c7440b57..aef4000c84217a23b188e633069f1212276b5045 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets @@ -57,6 +57,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberCast, () => unsubscribeCallback("afterEach unsubscribe subscriberCast")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formacquiretest", + abilityName: "com.ohos.st.formacquiretest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_acquireForm startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_acquireForm startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets index 0eb17e84a984fd4246ae47a760f8f45b8176c4f8..04066271e9c56a3ca09920a536ad2d8d9e5c3e4e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets @@ -60,6 +60,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberCast, () => unsubscribeCallback("afterEach unsubscribe subscriberCast")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formacquiretest2", + abilityName: "com.ohos.st.formacquiretest2.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_acquireForm2 startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_acquireForm2 startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets index 151d24e4dc983d02670595f24a2bc6128f5f9ffa..3cedbffb31f86a9cd303bb2c8686dba9acc96d36 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets @@ -16,7 +16,8 @@ import featureAbility from '@ohos.ability.featureAbility'; import commonEvent from '@ohos.commonEvent'; import systemTime from '@ohos.systemTime'; -import { beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import { beforeAll, afterAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; const onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -45,6 +46,30 @@ let subscriberSupply; export default function test() { describe(`FmsDeleteFormTest`, () => { + let id = undefined; + beforeAll(async (done) => { + console.log("FMS_deleteForm beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("FMS_deleteForm Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("FMS_deleteForm requestId is : " + id); + setTimeout(function () { + console.log("FMS_deleteForm beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("FMS_deleteForm afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("FMS_deleteForm afterAll end"); + done(); + }, 1000); + }) + beforeEach(async () => { subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets index 09ee65d6bbb73ad412e0a563beeb7a806e643dd7..14374575c40ba8a0e9095819a293f13e8101aa20 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets @@ -60,6 +60,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRefresh")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formdynamicrefreshtest", + abilityName: "com.ohos.st.formdynamicrefreshtest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_timedRefresh startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_timedRefresh startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets index bef74bca0e9e49878bf3fb8c1c0e6c4ed39b4941..98f9179159dd6764a1998a989bfba2484c12866f 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets @@ -56,6 +56,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeCallback("afterEach unsubscribe subscriberOnReleased")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formreleasetest", + abilityName: "com.ohos.st.formreleasetest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_releaseForm startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_releaseForm startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets index 793cff053aacea7e6fe55865d12eafa7d918000c..33e7f385c0384bcc8444ff956ede02bfb535753e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets @@ -15,7 +15,8 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import { beforeAll, afterAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -47,8 +48,28 @@ var subscriberSupply; export default function test() { describe(`FmsStateFormTest`, () => { + let id = undefined; beforeAll(async (done) => { - done(); + console.log("FMS_disableFormsUpdate beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("FMS_disableFormsUpdate Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("FMS_disableFormsUpdate requestId is : " + id); + setTimeout(function () { + console.log("FMS_disableFormsUpdate beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("FMS_disableFormsUpdate afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("FMS_disableFormsUpdate afterAll end"); + done(); + }, 1000); }) beforeEach(async () => { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets index e412b411248bd8f72052713898d8728bab9a8d4e..205120afe381f18eedac2f3cee9482e2b3c1c92f 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets @@ -15,7 +15,8 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import { beforeAll, afterAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -47,8 +48,28 @@ var subscriberSupply; export default function test() { describe(`FmsStateFormTest`, () => { + let id = undefined; beforeAll(async (done) => { - done(); + console.log("FMS_enableFormsUpdate beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("FMS_enableFormsUpdate Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("FMS_enableFormsUpdate requestId is : " + id); + setTimeout(function () { + console.log("FMS_enableFormsUpdate beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("FMS_enableFormsUpdate afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("FMS_enableFormsUpdate afterAll end"); + done(); + }, 1000); }) beforeEach(async () => { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets index 3fc87b2f5f905356ba6a29ff22910c06958ee026..d1e1fdea513f42d0ee64fd001bf40d893be35e58 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets @@ -60,6 +60,18 @@ export default function test() { commonEvent.unsubscribe(subscriberDel, () => unsubscribeCallback("afterEach unsubscribe subscriberDel")); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formstatenotifyinvisibletest", + abilityName: "com.ohos.st.formstatenotifyinvisibletest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_notifyInvisibleForms startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_notifyInvisibleForms startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) /** diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets index 84d1c284602236796f1efe13be40f322e81da042..6dd14fbb13b53216e190fdf36de9a66fd5977627 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets @@ -54,6 +54,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formstatenotifyinvisibletest2", + abilityName: "com.ohos.st.formstatenotifyinvisibletest2.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_notifyInvisibleForms2 startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_notifyInvisibleForms2 startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) /** diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets index 9458578b86097e315be87c59333d4632f88dd423..ffd33691ea972b305ee93931f7b257e1409b9fda 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets @@ -57,6 +57,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formstatenotifyvisibletest", + abilityName: "com.ohos.st.formstatenotifyvisibletest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_notifyVisibleForms startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_notifyVisibleForms startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) /** diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts index 553641481ef812ee7fe5997aed5239dfa725310b..717657a0c8f0bf4ccfb444169ff61435adc644aa 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,6 +13,9 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { @@ -20,6 +23,14 @@ export default class MainAbility extends Ability { // Ability is creating, initialize resources for this ability console.log("MainAbility onCreate") globalThis.abilityWant = want; + globalThis.abilityContext = this.context + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -30,7 +41,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets index 18591878efec8e048ce0aca66617cd847c5e6617..d10df7d7f9eaf60fa1082f1767a352ce5bb9a9ab 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -13,20 +13,10 @@ * limitations under the License. */ import router from '@ohos.router'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../../test/List.test' @Entry @Component struct Index { aboutToAppear() { - console.info("start run testcase!!!!") - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets index fdfab03ef658f7c572dd10cf99bc13cbb716b05f..daf5122ee552106eeb4e9d079466e4a9e2957ae5 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets @@ -42,6 +42,22 @@ export default function killProcessWithAccountTest() { }) }) + afterEach(async (done) => { + console.log("ACTS_KillProcessWithAccount afterEach called"); + let wantInfo = { + bundleName: "com.acts.killprocesswithaccount", + abilityName: "com.acts.killprocesswithaccount.MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ACTS_KillProcessWithAccount startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ACTS_KillProcessWithAccount startAbility err : " + JSON.stringify(err)); + }) + setTimeout(function () { + console.log("ACTS_KillProcessWithAccount afterEach end"); + done(); + }, 500); + }) beforeEach(async (done) => { console.log('======>beforeEach killProcessWithAccountTest<=======' + flag); diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json index cf635c27fcebe0b370f622173adb8a542a22492b..fd1246168032775b132d19462c889d646d19bb75 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json @@ -21,6 +21,7 @@ "label": "$string:entry_label", "visible": true, "orientation": "portrait", + "launchType": "singleton", "skills": [ { "actions": [ diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts index 5d9cb94eb1b16f32da7f1ba0b9896c87323bca11..03bed122d3c2e0b39d8aaff168f1b14e030d01ed 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,12 +13,24 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { onCreate(want,launchParam){ // Ability is creating, initialize resources for this ability console.log("MainAbility onCreate") globalThis.abilityWant = want; + + globalThis.abilityContext = this.context + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -29,7 +41,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets index bebda07c2cf21dccd43f7cc4b980205ca56a6168..acd879f64b9dada49873347dd652cda4ea9fb2ea 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -13,9 +13,6 @@ * limitations under the License. */ import router from '@ohos.router'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../../test/List.test' @Entry @@ -23,13 +20,6 @@ import testsuite from '../../../test/List.test' struct Index { aboutToAppear(){ - console.info("start run testcase!!!!") - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { 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 860b27faba41b3ff9a5cf999a46bc3747eb62b18..05ba5e1ace3e176a83bbf4b309914aaa0088c368 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 @@ -43,7 +43,20 @@ export default function abilityTest() { await appManager.killProcessesByBundleName("com.example.multiinstancehapa"); await appManager.killProcessesByBundleName("com.example.multiinstancehapb"); - done(); + let wantInfo = { + bundleName: "com.example.processmultiinstance", + abilityName: "com.example.processmultiinstance.MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ACTS_Process_MultiInstance startAbility data: " + JSON.stringify(data)); + }).catch((err) => { + console.log("ACTS_Process_MultiInstance startAbility err: " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log("ACTS_Process_MultiInstance afterEach end"); + done(); + }, 500); }) /** diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json index 0152946dc4cd7e2cd788feae646b840fcd02f670..694171f9526bfe9f85b8643f0e859627df692e63 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json @@ -21,6 +21,7 @@ "label": "$string:entry_label", "visible": true, "orientation": "portrait", + "launchType": "singleton", "skills": [ { "actions": [