diff --git a/ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets b/ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets index 604b986238477a639723aab1d2b02e4f95c90a42..4022cd7a209eb2fd93a86e6fa71c5d294b2f3ad9 100644 --- a/ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets +++ b/ability/crossplatform/ability_runtime/ActsUiAbilityEtsTest/src/main/ets/test/abilityLifeCycle.test.ets @@ -438,6 +438,49 @@ export default function abilityTest() { done(); }); + /** + *@tc.number : UI_ABILITY_LIFE_CYCLE_TEST_0007 + *@tc.name : UIAbilityLifeCycleTest0007 + *@tc.desc : start mainability1, after start mainability1 twice, mainability1 is a single ability. + *@tc.size : MediumTest + *@tc.type : Function + *@tc.level : Level 1 + */ + it('UI_ABILITY_LIFE_CYCLE_TEST_0007',0, async (done) => { + console.log("------------UI_ABILITY_LIFE_CYCLE_TEST_0007 START-------------"); + TAG = "UI_ABILITY_LIFE_CYCLE_TEST_0007"; + + var want = { + "bundleName": "com.example.uiabilitylifecycle", + "abilityName": "MainAbility1", + "moduleName": moduleName + } + await globalThis.abilityContext.startAbility(want) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + + await sleep(2000); + + globalThis.abilityContext.startAbility(want) + .then((data) => { + console.info(TAG + ' start successful. Data: ' + data); + }).catch((error) => { + console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error)); + }) + + await sleep(2000); + const result = globalThis.onNewWantStr; + console.info(TAG + 'result: ' + JSON.stringify(result)); + expect(result).assertEqual('MainAbility1 onNewWant'); + + globalThis.ability1context.terminateSelf(); + await sleep(500); + done(); + }) + /** *@tc.number : UI_Ability_Constant_Test_0100 *@tc.name : UI_Ability_Constant_Test_0100