From d9ec4c6ac6b4a923bebb402d6a0df4f20ae99982 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Mar 2022 20:02:44 +0800 Subject: [PATCH] add user Signed-off-by: unknown --- .../js/test/amsMissionSnapshotTest.test.js | 4 +- .../main/js/test/FeatureAbilityJsunit.test.js | 56 +++++++++++++------ 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js index b6fd0d0f9..3d27fa646 100644 --- a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js +++ b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js @@ -38,7 +38,7 @@ describe('ActsMissionSnapshotTest', function () { console.debug('ACTS_MissionSnapshot_0100==== { - expect(err.code).assertEqual(2097172); + expect(err.code != 0).assertTrue(); console.debug("=ACTS_MissionSnapshot_0100 err.code,data=======>" + err.code + ("json data【") + JSON.stringify(data) + (" 】") + " , " + data); console.debug('ACTS_MissionSnapshot_0100====" + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(err.code).assertEqual(2097172); + expect(err.code != 0).assertTrue(); console.debug('ACTS_MissionSnapshot_0400==== ACTS_HasWindowFocus_0200 =====>') - }, TIMEOUT) + console.info('====>ACTS_HasWindowFocus_0200 start=====>') + featureAbility.startAbility( + { + want: + { + bundleName: "com.example.getcallingbundlepromisetest", + abilityName: "com.example.getcallingbundlepromisetest.MainAbility", + }, + }, (err, data)=>{ + console.info('====>ACTS_HasWindowFocus_0200 startAbility err: '+ JSON.stringify(err)) + setTimeout(async function () { + console.info('====>ACTS_HasWindowFocus_0200 =====>') + var info = await featureAbility.hasWindowFocus(); + console.info('====>ACTS_HasWindowFocus_0200 info ' + info); + expect(info).assertEqual(false); + done(); + }, TIMEOUT) + } + ); }) /** @@ -1531,17 +1542,28 @@ describe('ActsFeatureAbilityTest', function () { * @tc.desc: Check the return value of the interface (by AsyncCallback) */ it('ACTS_HasWindowFocus_0400', 0, async function (done) { - var result = featureAbility.hasWindowFocus( - (error, data) => { - console.log("ACTS_HasWindowFocus_0400 asyncCallback code: " + error.code + " data: " + data) - expect(error.code).assertEqual(0); - expect(data).assertEqual(false); - done(); + console.info('====>ACTS_HasWindowFocus_0400 start=====>') + featureAbility.startAbility( + { + want: + { + bundleName: "com.example.getcallingbundlepromisetest", + abilityName: "com.example.getcallingbundlepromisetest.MainAbility", + }, + }, (err, data)=>{ + console.info('====>ACTS_HasWindowFocus_0400 startAbility err: '+ JSON.stringify(err)) + setTimeout(async function () { + console.info('====> ACTS_HasWindowFocus_0400 =====>') + featureAbility.hasWindowFocus( + (error, data)=>{ + console.log("ACTS_HasWindowFocus_0400 asyncCallback code: " + error.code + " data: " + data) + expect(error.code).assertEqual(0); + expect(data).assertEqual(false); + done(); + }); + }, TIMEOUT) } ); - setTimeout(function () { - console.info('====> ACTS_HasWindowFocus_0400 =====>') - }, TIMEOUT) }) /** -- GitLab