diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/VerificationTest.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/VerificationTest.ets index ea5f751b6173b7e20b93c4a6bbacc7832da870a4..c01b51faf5e3054bc8a7e5429711a1b028d3ab00 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/VerificationTest.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/VerificationTest.ets @@ -183,7 +183,8 @@ export default function verificationTest(abilityContext){ screenDensity = data.parameters.screenDensity } if (data.event == "Stage_MainAbility4_onDestroy") { - expect(screenDensity).assertEqual(240); + expect(typeof screenDensity).assertEqual("number"); + expect(screenDensity).assertLarger(0); commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) } } diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets index cfd337ca1c1dd5a3eec304f568ef4c71f7781c62..5b86592fd8dc3a81a56bb820a53d60befd86c601 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets @@ -83,7 +83,8 @@ export default function test() { console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_0200 featureAbility.startAbility end`); await sleepTime(3000) @@ -123,7 +124,8 @@ export default function test() { console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_0300 featureAbility.startAbility end`); await sleepTime(3000) @@ -163,7 +165,8 @@ export default function test() { console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_0400 featureAbility.startAbility end`); await sleepTime(3000) @@ -203,7 +206,8 @@ export default function test() { console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_0500 featureAbility.startAbility end`); await sleepTime(3000) @@ -243,7 +247,8 @@ export default function test() { console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_0600 featureAbility.startAbility end`); await sleepTime(3000) @@ -283,7 +288,8 @@ export default function test() { console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_0700 featureAbility.startAbility end`); await sleepTime(3000) @@ -324,7 +330,8 @@ export default function test() { console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1000 featureAbility.startAbility end`); await sleepTime(3000) @@ -385,8 +392,9 @@ export default function test() { data: formId1 }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1100 publish' + JSON.stringify(err)); - }); + console.info('FMS_acquireForm_1100 publish' + JSON.stringify(err)); + done() + }); } } } @@ -410,11 +418,10 @@ export default function test() { console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1100 featureAbility.startAbility end`); - await sleepTime(3000) - done() }); /** @@ -439,7 +446,7 @@ export default function test() { data: formId1 }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1200 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_1200 publish' + JSON.stringify(err)); }); } } @@ -470,7 +477,8 @@ export default function test() { data: formId1 }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1200 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_1200 publish' + JSON.stringify(err)); + done() }); } } @@ -496,6 +504,8 @@ export default function test() { console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1200 featureAbility.startAbility end`); await sleepTime(3000) @@ -519,9 +529,9 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1400 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_1400 publish' + JSON.stringify(err)); + done() }); - done() } async function onAcquiredCallBack(_, data) { console.info("!!!====>FMS_acquireForm_1400 onAcquiredCallBack data:====>" + JSON.stringify(data)); @@ -549,6 +559,8 @@ export default function test() { console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1400 featureAbility.startAbility again end`); await sleepTime(3000) @@ -575,6 +587,8 @@ export default function test() { console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1400 featureAbility.startAbility end`); }); @@ -600,10 +614,10 @@ export default function test() { data: formId1 }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1500 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_1500 publish' + JSON.stringify(err)); + done() }); } - done() } async function onAcquiredCallBack(_, data) { console.info("!!!====>FMS_acquireForm_1500 onAcquiredCallBack data:====>" + JSON.stringify(data)); @@ -632,6 +646,8 @@ export default function test() { console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1500 featureAbility.startAbility again end`); } @@ -676,7 +692,8 @@ export default function test() { console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1500 featureAbility.startAbility end`); await sleepTime(3000) @@ -734,6 +751,8 @@ export default function test() { console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1600_normal1 featureAbility.startAbility end`); @@ -783,6 +802,8 @@ export default function test() { console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1600_normal2 featureAbility.startAbility end`); @@ -834,6 +855,8 @@ export default function test() { console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1600_Temp1 featureAbility.startAbility end`); @@ -886,6 +909,8 @@ export default function test() { console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1600_Temp2 featureAbility.startAbility end`); @@ -946,6 +971,8 @@ export default function test() { console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1800_normal1 featureAbility.startAbility end`); @@ -1128,10 +1155,10 @@ export default function test() { data: formId1 }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err)); + done() }); } - done() } commonEvent.subscribe(subscriberOnAcquired, onAcquiredCallBack); @@ -1162,7 +1189,8 @@ export default function test() { data: formId1 }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_1900 publish' + JSON.stringify(err)); + done() }); } } @@ -1189,6 +1217,8 @@ export default function test() { console.info(`FMS_acquireForm_1900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_1900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_1900 featureAbility.startAbility end`); @@ -1211,9 +1241,9 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_2100 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_2100 publish' + JSON.stringify(err)); + done() }); - done() } async function onAcquiredCallBack(_, data) { console.info("!!!====>FMS_acquireForm_2100 onAcquiredCallBack data:====>" + JSON.stringify(data)); @@ -1241,6 +1271,8 @@ export default function test() { console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2100 featureAbility.startAbility again end`); } @@ -1265,6 +1297,8 @@ export default function test() { console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2100 featureAbility.startAbility end`); }); @@ -1285,9 +1319,9 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_2200 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_2200 publish' + JSON.stringify(err)); + done() }); - done() } commonEvent.subscribe(subscriberCast, onCastCallBack); @@ -1312,6 +1346,8 @@ export default function test() { console.info(`FMS_acquireForm_2200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2200 featureAbility.startAbility end`); }); @@ -1332,8 +1368,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_2300 publish' + JSON.stringify(err)); - done() + console.info('FMS_acquireForm_2300 publish' + JSON.stringify(err)); + done() }); } commonEvent.subscribe(subscriberCast, onCastCallBack); @@ -1358,7 +1394,8 @@ export default function test() { console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2300 featureAbility.startAbility end`); }); @@ -1379,8 +1416,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_2400 publish' + JSON.stringify(err)); - done() + console.info('FMS_acquireForm_2400 publish' + JSON.stringify(err)); + done() }); } async function onAcquiredCallBack(_, data) { @@ -1409,7 +1446,8 @@ export default function test() { console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2400 featureAbility.startAbility again end`); } @@ -1434,6 +1472,8 @@ export default function test() { console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2400 featureAbility.startAbility end`); }); @@ -1454,8 +1494,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_2500 publish' + JSON.stringify(err)); - done() + console.info('FMS_acquireForm_2500 publish' + JSON.stringify(err)); + done() }); } commonEvent.subscribe(subscriberCast, onCastCallBack); @@ -1480,7 +1520,8 @@ export default function test() { console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); - done() + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2500 featureAbility.startAbility end`); await sleep(3000) @@ -1502,12 +1543,18 @@ export default function test() { expect(data.data).assertEqual("undefined"); commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2600")) formId1 = data.parameters.formId; + console.info("!!!====>FMS_acquireForm_2600 formId1 " + formId1 + " formId2 " + formId2); if (formId1 && formId2) { + console.info("!!!====>FMS_acquireForm_2600 2 formId1 " + formId1 + " formId2 " + formId2); expect(formId1).assertEqual(formId2); let commonEventPublishData = { data: formId1 }; commonEvent.publish(deleteForm_Event, () => delPublishCallBack("FMS_acquireForm_2600", done)); + }else{ + console.info("!!!====>FMS_acquireForm_2600 formId1 not equal formId2"); + expect().assertFail(); + done() } } @@ -1516,6 +1563,7 @@ export default function test() { expect(data.event).assertEqual("FMS_FormOnAcquired_commonEvent"); commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_acquireForm_2600")) + formId2 = data.data; console.info(`FMS_acquireForm_2600 featureAbility.startAbility again start`); await featureAbility.startAbility({ want: { @@ -1537,6 +1585,8 @@ export default function test() { console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_2600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_2600 featureAbility.startAbility again end`); } diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets index 59d7e28a15d9f0ae4ae11be36baba1b31d3df993..d1e4165606d329b53b7fe75925c0660fdea0b7cf 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets @@ -58,9 +58,11 @@ export default function test() { console.info("!!!====>FMS_acquireForm_3800 onErrorCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_3800")); - console.info(`FMS_acquireForm_3800 end`); - done(); + commonEvent.unsubscribe(subscriberOnError, () => { + console.info(`FMS_acquireForm_3800 unsubscribe callback`); + done(); + }); + } commonEvent.subscribe(subscriberOnError, onErrorCallBack); console.info(`FMS_acquireForm_3800 featureAbility.startAbility start`); @@ -82,6 +84,8 @@ export default function test() { console.info(`FMS_acquireForm_3800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_3800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_3800 featureAbility.startAbility end`); }); @@ -96,9 +100,10 @@ export default function test() { console.info("!!!====>FMS_acquireForm_3900 onErrorCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); expect(data.data).assertEqual("invalid params received on operating form."); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_3900")); - console.info(`FMS_acquireForm_3900 end`); - done(); + commonEvent.unsubscribe(subscriberOnError, () => { + console.info(`FMS_acquireForm_3900 unsubscribe callback`); + done(); + }); } commonEvent.subscribe(subscriberOnError, onErrorCallBack); console.info(`FMS_acquireForm_3900 featureAbility.startAbility start`); @@ -120,6 +125,8 @@ export default function test() { console.info(`FMS_acquireForm_3900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_3900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_3900 featureAbility.startAbility end`); }); @@ -144,7 +151,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_acquireForm_4000 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_4000 publish' + JSON.stringify(err)); + done() }); } function onAcquiredCallBack(_, data) { @@ -174,6 +182,8 @@ export default function test() { console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4000 featureAbility.startAbility again end`); } @@ -202,6 +212,8 @@ export default function test() { console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4000 featureAbility.startAbility end`); }); @@ -273,6 +285,8 @@ export default function test() { console.info(`FMS_acquireForm_4200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4200 featureAbility.startAbility end`); @@ -313,6 +327,8 @@ export default function test() { console.info(`FMS_acquireForm_4300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4300 featureAbility.startAbility end`); }); @@ -327,10 +343,12 @@ export default function test() { function onErrorCallBack(_, data) { console.info("!!!====>FMS_acquireForm_4400 onErrorCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnError_commonEvent"); - commonEvent.unsubscribe(subscriberOnError, () => unsubscribeOnErrorCallback("FMS_acquireForm_4400")); expect(data.data).assertEqual("the dimension not exist in the form."); - console.info(`FMS_acquireForm_4400 end`); - done(); + commonEvent.unsubscribe(subscriberOnError, () => { + console.info(`FMS_acquireForm_4400 unsubscribe callback`); + done(); + }); + } commonEvent.subscribe(subscriberOnError, onErrorCallBack); console.info(`FMS_acquireForm_4400 featureAbility.startAbility start`); @@ -353,6 +371,8 @@ export default function test() { console.info(`FMS_acquireForm_4400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4400 featureAbility.startAbility end`); }); @@ -374,7 +394,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData,(err) => { - console.info('FMS_acquireForm_4900 publish' + JSON.stringify(err)); + console.info('FMS_acquireForm_4900 publish' + JSON.stringify(err)); + done() }); } function onAcquiredCallBack(_, data) { @@ -404,6 +425,8 @@ export default function test() { console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4900 featureAbility.startAbility again end`); } @@ -428,6 +451,8 @@ export default function test() { console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`FMS_acquireForm_4900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`FMS_acquireForm_4900 featureAbility.startAbility end`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets index 18845d9315a96a872bce4b97e8a6427a6f0494ac..2b2dbf69f1f59ecc7c9b98382fc0768e32b0a267 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets @@ -68,7 +68,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_deleteForm_0200 publish' + JSON.stringify(err)); + console.info('FMS_deleteForm_0200 publish' + JSON.stringify(err)); + done() }); }; commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); @@ -100,6 +101,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); }; @@ -146,7 +149,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_deleteForm_0300 publish' + JSON.stringify(err)); + console.info('FMS_deleteForm_0300 publish' + JSON.stringify(err)); + done() }); }; commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); @@ -172,6 +176,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -194,7 +200,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_deleteForm_0400 publish' + JSON.stringify(err)); + console.info('FMS_deleteForm_0400 publish' + JSON.stringify(err)); + done() }); }; commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); @@ -220,6 +227,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -244,7 +253,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_deleteForm_0500 publish' + JSON.stringify(err)); + console.info('FMS_deleteForm_0500 publish' + JSON.stringify(err)); + done() }); }; commonEvent.subscribe(subscriberOnDeleted, onDeletedCallback); @@ -276,6 +286,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); }; @@ -300,6 +312,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -419,6 +433,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -507,6 +523,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); }; @@ -540,6 +558,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -640,6 +660,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); }; @@ -680,6 +702,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -706,7 +730,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_deleteForm_0900 publish' + JSON.stringify(err)); + console.info('FMS_deleteForm_0900 publish' + JSON.stringify(err)); + done() }); } @@ -741,6 +766,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); }; @@ -767,6 +794,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); @@ -810,6 +839,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); } @@ -936,6 +967,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility again end`); }; @@ -969,6 +1002,8 @@ export default function test() { console.info(`${tcNumber} featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.info(`${tcNumber} featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.info(`${tcNumber} featureAbility.startAbility end`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets index e6b305b3568c8807bda51128392946550910c5b0..2c380757d3636eff8006211e23efe3f5ecf6dca1 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/MainAbility/test/GetFormsInfoFuzz.test.ets @@ -93,8 +93,8 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { }); describe(`${describeName}`, () => { - const callbackName = `FMS_fuzzTest_getinfomodule`; - const promiseName = `FMS_fuzzTest_getinfomodule`; + const callbackName = `FMS_fuzzTest_getinfomodule_callback`; + const promiseName = `FMS_fuzzTest_getinfomodule_promise`; const length = DATA_TYPE_LIST.length; for (let i = 0; i < length; ++i) { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets index f30de9acb1e54ad937e2f814856a5b3014c635f0..a4d7ee31fee727a6267a729a3b1d3ea9cb130a51 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -17,13 +17,16 @@ import formHost from '@ohos.application.formHost'; import { describe, expect, it } from 'deccjsunit/index'; import FormInfo from '@ohos.application.formInfo'; +function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); +} export const getAllFormsInfoTest = (describeName, filterParameter) => { const ERR_OK_CODE = 0; const ERR_OK = `success`; describe(`${describeName}`, () => { - const callbackName = `FMS_getFormsInfo_0400 callback`; - const promiseName = `FMS_getFormsInfo_0400 promise`; + const callbackName = `FMS_getFormsInfo_0400_callback`; + const promiseName = `FMS_getFormsInfo_0400_promise`; var tempDataB = undefined; /** @@ -103,6 +106,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName} should not reach here`); expect().assertFail(); + done() } }); function checkDataB(formInfo){ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets index 09d8329125cc09a8e458d579f4ecdadc32913a36..c6729cded35792779ddf4762228df60e3c12ad13 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets @@ -64,7 +64,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_releaseForm_0200 publish' + JSON.stringify(err)); + console.info('FMS_releaseForm_0200 publish' + JSON.stringify(err)); + done() }); } @@ -120,6 +121,8 @@ export default function test() { console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0200 featureAbility.startAbility end`); }); @@ -166,6 +169,8 @@ export default function test() { console.log(`FMS_releaseForm_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0300 featureAbility.startAbility end`); }); @@ -211,6 +216,8 @@ export default function test() { console.log(`FMS_releaseForm_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0400 featureAbility.startAbility end`); }); @@ -234,7 +241,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_releaseForm_0500 publish' + JSON.stringify(err)); + console.info('FMS_releaseForm_0500 publish' + JSON.stringify(err)); + done() }); } function onAcquiredCallBack(_, data) { @@ -264,6 +272,8 @@ export default function test() { console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0500 featureAbility.startAbility again end`); } @@ -287,6 +297,8 @@ export default function test() { console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0500 featureAbility.startAbility end`); }); @@ -311,7 +323,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_releaseForm_0600 publish' + JSON.stringify(err)); + console.info('FMS_releaseForm_0600 publish' + JSON.stringify(err)); + done() }); } function onDeletedCallBack(_, data) { @@ -343,6 +356,8 @@ export default function test() { console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0600 featureAbility.startAbility again end`); } @@ -371,6 +386,8 @@ export default function test() { console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_0600 featureAbility.startAbility end`); }); @@ -445,6 +462,8 @@ export default function test() { console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); } @@ -485,6 +504,8 @@ export default function test() { console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); } @@ -509,6 +530,8 @@ export default function test() { console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); }); @@ -531,7 +554,8 @@ export default function test() { data: data.parameters.formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_releaseForm_1400 publish' + JSON.stringify(err)); + console.info('FMS_releaseForm_1400 publish' + JSON.stringify(err)); + done() }); } commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); @@ -557,6 +581,8 @@ export default function test() { console.log(`FMS_releaseForm_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_releaseForm_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_releaseForm_1400 featureAbility.startAbility end`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets index 49efafefa51decb23515cce68cd68a20a330f404..b0521cab47a78567b35960b74f7059998f69288a 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets @@ -97,6 +97,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_0200 featureAbility.startAbility again end`); }); @@ -144,6 +146,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate _0300 featureAbility.startAbility end`); }); @@ -161,12 +165,8 @@ export default function test() { expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); expect(data.data).assertEqual("13"); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0400")) - - setTimeout(function () { - console.info('FMS_disableFormsUpdate_0400 delPublishCallBack end'); - console.log(`FMS_disableFormsUpdate_0400 end`); - done(); - }, 100) + console.log(`FMS_disableFormsUpdate_0400 end`); + done(); } commonEvent.subscribe(subscriberOnState, onStateCallBack); console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbility start`); @@ -190,6 +190,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate _0400 featureAbility.startAbility end`); }); @@ -207,12 +209,9 @@ export default function test() { expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); expect(data.data).assertEqual("13"); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_disableFormsUpdate_0500")) - - setTimeout(function () { - console.info('FMS_disableFormsUpdate_0500 delPublishCallBack end'); - console.log(`FMS_disableFormsUpdate_0500 end`); - done(); - }, 100) + console.log(`FMS_disableFormsUpdate_0500 end`); + done(); + } commonEvent.subscribe(subscriberOnState, onStateCallBack); console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbility start`); @@ -236,6 +235,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_0500 featureAbility.startAbility end`); }); @@ -262,7 +263,8 @@ export default function test() { data: hostFormId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_disableFormsUpdate_0600 publish' + JSON.stringify(err)); + console.info('FMS_disableFormsUpdate_0600 publish' + JSON.stringify(err)); + done() }); } @@ -290,6 +292,8 @@ export default function test() { console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_disableFormsUpdate_0600")); } @@ -315,6 +319,8 @@ export default function test() { console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_disableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); }); /** @@ -336,8 +342,8 @@ export default function test() { expect(data.data).assertEqual("13"); commonEvent.unsubscribe(subscriberOnState, () => { console.info("====>FMS_disableFormsUpdate_0700 unSubscribeOnDisableCallback====>"); + done() }); - done(); } const onDeleteCallback = async (_, data) => { @@ -364,6 +370,8 @@ export default function test() { console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); commonEvent.unsubscribe(subscriberDel, () => { @@ -394,6 +402,8 @@ export default function test() { console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_disableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); }); /** @@ -416,7 +426,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_disableFormsUpdate_0800 publish' + JSON.stringify(err)); + console.info('FMS_disableFormsUpdate_0800 publish' + JSON.stringify(err)); + done() }); } @@ -442,6 +453,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_0800 featureAbility.startAbility end`); }); @@ -466,7 +479,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_disableFormsUpdate_0900 publish' + JSON.stringify(err)); + console.info('FMS_disableFormsUpdate_0900 publish' + JSON.stringify(err)); + done() }); } async function OnEnableCallBack(_, data) { @@ -497,6 +511,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility end`); } @@ -523,6 +539,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_disableFormsUpdate_0900 featureAbility.startAbility end`); }); @@ -574,7 +592,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_disableFormsUpdate_1000 publish' + JSON.stringify(err)); + console.info('FMS_disableFormsUpdate_1000 publish' + JSON.stringify(err)); + done() }); }, 10000); } @@ -610,6 +629,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility notify disable end`); } @@ -636,6 +657,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_1000 featureAbility.startAbility servicea end`); }); @@ -688,7 +711,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_disableFormsUpdate_1100 publish' + JSON.stringify(err)); + console.info('FMS_disableFormsUpdate_1100 publish' + JSON.stringify(err)); + done() }); }, 10000); } @@ -724,6 +748,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility notify disable end`); } @@ -750,6 +776,8 @@ export default function test() { console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail() + done() }); console.log(`FMS_disableFormsUpdate_1100 featureAbility.startAbility servicea end`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets index 26a756d3ccb9b94d9dfa4432687e71ae9758a78b..886ff89ca9911b7cde1fdd096cacd5dd7afe0d8c 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets @@ -68,12 +68,12 @@ export default function test() { console.info("!!!====>FMS_enableFormsUpdate_0200 onStateCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); expect(data.data).assertEqual("2"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0200")); - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0200 onStateCallBack end'); - console.log(`FMS_enableFormsUpdate_0200 end`); + console.info('FMS_enableFormsUpdate_0200 onStateCallBack end'); + console.log(`FMS_enableFormsUpdate_0200 end`); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info('FMS_enableFormsUpdate_0200 unsubscribe callback'); done(); - }, 1000); + }) } commonEvent.subscribe(subscriberOnState, onStateCallBack); @@ -98,6 +98,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0200 featureAbility.startAbility again end`); }); @@ -114,13 +116,10 @@ export default function test() { console.info("!!!====>FMS_enableFormsUpdate_0300 onStateCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); expect(data.data).assertEqual("7"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0300")) - - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0300 delPublishCallBack end'); - console.log(`FMS_enableFormsUpdate_0300 end`); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info('FMS_enableFormsUpdate_0300 unsubscribe callback'); done(); - }, 100) + }) } commonEvent.subscribe(subscriberOnState, onStateCallBack); @@ -145,6 +144,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0300 featureAbility.startAbility end`); }); @@ -161,13 +162,10 @@ export default function test() { console.info("!!!====>FMS_enableFormsUpdate_0400 onStateCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0400")) - - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0400 delPublishCallBack end'); - console.log(`FMS_enableFormsUpdate_0400 end`); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info('FMS_enableFormsUpdate_0400 unsubscribe callback'); done(); - }, 100) + }) } commonEvent.subscribe(subscriberOnState, onStateCallBack); @@ -192,6 +190,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0400 featureAbility.startAbility end`); }); @@ -208,13 +208,10 @@ export default function test() { console.info("!!!====>FMS_enableFormsUpdate_0500 onStateCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormOnState_commonEvent"); expect(data.data).assertEqual("13"); - commonEvent.unsubscribe(subscriberOnState, () => unsubscribeOnStateCallback("FMS_enableFormsUpdate_0500")) - - setTimeout(function () { - console.info('FMS_enableFormsUpdate_0500 delPublishCallBack end'); - console.log(`FMS_enableFormsUpdate_0500 end`); + commonEvent.unsubscribe(subscriberOnState, () => { + console.info('FMS_enableFormsUpdate_0500 unsubscribe callback'); done(); - }, 100) + }) } commonEvent.subscribe(subscriberOnState, onStateCallBack); @@ -239,6 +236,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0500 featureAbility.startAbility end`); }); @@ -264,7 +263,8 @@ export default function test() { data: hostFormId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_enableFormsUpdate_0600 publish' + JSON.stringify(err)); + console.info('FMS_enableFormsUpdate_0600 publish' + JSON.stringify(err)); + done() }); } @@ -292,6 +292,8 @@ export default function test() { console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeOnAcquiredCallback("FMS_enableFormsUpdate_0600")); } @@ -317,6 +319,8 @@ export default function test() { console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_enableFormsUpdate_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); }); /** @@ -338,8 +342,8 @@ export default function test() { expect(data.data).assertEqual("13"); commonEvent.unsubscribe(subscriberOnState, () => { console.info("====>FMS_enableFormsUpdate_0700 unSubscribeOnEnableCallback====>"); + done(); }); - done(); } const onDeleteCallback = async (_, data) => { @@ -366,6 +370,8 @@ export default function test() { console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); commonEvent.unsubscribe(subscriberDel, () => { @@ -396,6 +402,8 @@ export default function test() { console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_enableFormsUpdate_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); }); @@ -431,7 +439,8 @@ export default function test() { data: formIds[0] }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_enableFormsUpdate_0900 publish' + JSON.stringify(err)); + console.info('FMS_enableFormsUpdate_0900 publish' + JSON.stringify(err)); + done() }); }, 2000); } @@ -478,6 +487,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notifyVisible end`); }, 10000); @@ -511,6 +522,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility notify disable end`); } @@ -535,6 +548,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_0900 featureAbility.startAbility servicea end`); }); @@ -571,7 +586,8 @@ export default function test() { data: formIds[0] }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_enableFormsUpdate_1000 publish' + JSON.stringify(err)); + console.info('FMS_enableFormsUpdate_1000 publish' + JSON.stringify(err)); + done() }); }, 2000); } @@ -619,6 +635,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notifyVisible end`); }, 10000); @@ -651,6 +669,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility notify disable end`); } @@ -675,6 +695,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1000 featureAbility.startAbility servicea end`); }); @@ -707,7 +729,7 @@ export default function test() { setTimeout(function () { console.info('FMS_enableFormsUpdate_1200 delPublishCallBack2 end'); console.log(`FMS_enableFormsUpdate_1200 end`); - done(); + done() }, 1000); } @@ -778,6 +800,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notifyVisible end`); }, 10000); @@ -813,6 +837,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility notify disable end`); } @@ -845,6 +871,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility serviceb end`); } @@ -869,6 +897,8 @@ export default function test() { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_enableFormsUpdate_1200 featureAbility.startAbility servicea end`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets index d24d94f6efa42913aa3d7adf15d968178371e9fa..2b88bb784585dd67c33b13963dc9ef5757a05378 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets @@ -257,7 +257,8 @@ export default function test() { data: formId }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_notifyInvisibleForms_0600 publish' + JSON.stringify(err)); + console.info('FMS_notifyInvisibleForms_0600 publish' + JSON.stringify(err)); + done() }); } @@ -288,6 +289,7 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + }); console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again end`); } @@ -312,6 +314,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_0600 featureAbility.startAbility end`); }); @@ -431,7 +435,8 @@ export default function test() { data: formIdInvisible }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_notifyInvisibleForms_0800 publish' + JSON.stringify(err)); + console.info('FMS_notifyInvisibleForms_0800 publish' + JSON.stringify(err)); + done() }); } } @@ -448,7 +453,8 @@ export default function test() { data: formIdInvisible }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_notifyInvisibleForms_0600 publish' + JSON.stringify(err)); + console.info('FMS_notifyInvisibleForms_0800 publish' + JSON.stringify(err)); + done() }); } } diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets index 6e24fc901dc854c8163d12a37cdaf228f31eb8c2..e972f88887c2201dd5982887e26b52f7ba13eac5 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets @@ -72,7 +72,8 @@ export default function test() { data: formIdInvisible }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_notifyInvisibleForms_0900 publish' + JSON.stringify(err)); + console.info('FMS_notifyInvisibleForms_0900 publish' + JSON.stringify(err)); + done() }); } } @@ -89,7 +90,8 @@ export default function test() { data: formIdInvisible }; commonEvent.publish(deleteForm_Event, commonEventPublishData, (err) => { - console.info('FMS_notifyInvisibleForms_0900 publish' + JSON.stringify(err)); + console.info('FMS_notifyInvisibleForms_0900 publish' + JSON.stringify(err)); + done() }); } } @@ -123,6 +125,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again end`); } @@ -150,6 +154,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_0900 featureAbility.startAbility end`); }); @@ -214,6 +220,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1000 featureAbility.startAbility end`); }); @@ -303,6 +311,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again end`); } @@ -330,6 +340,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1100 featureAbility.startAbility end`); }); @@ -395,6 +407,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility end`); @@ -477,6 +491,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility end`); @@ -598,6 +614,8 @@ export default function test() { console.debug(`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.debug(`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); }); @@ -686,6 +704,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible end`); } @@ -717,6 +737,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb end`); } @@ -741,6 +763,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea end`); }); @@ -790,6 +814,8 @@ export default function test() { console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`); }).catch((err: any) => { console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`); + expect().assertFail(); + done(); }); console.log(`FMS_notifyInvisibleForms_1500 featureAbility.startAbility end`); });