From 94cc751e2cc58c60d32f7dcc8854806de5818d90 Mon Sep 17 00:00:00 2001 From: hu0475 Date: Sun, 16 Jul 2023 18:19:27 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=96=B0=E5=A2=9EonNewWant=E6=B5=8B=E8=AF=95'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hu0475 --- .../main/ets/test/abilityLifeCycle.test.ets | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) 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 604b98623..4022cd7a2 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 -- GitLab