From d0410485ce8df2a81e33cc14377d8867321f8074 Mon Sep 17 00:00:00 2001 From: chengxingzhen Date: Tue, 2 Aug 2022 20:46:18 +0800 Subject: [PATCH] =?UTF-8?q?XTS=E5=A4=B1=E8=B4=A5=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengxingzhen --- .../src/main/ets/TestAbility/pages/index.ets | 1 - .../ets/test/getAbilityInfoJsunit.test.ets | 27 -------- .../actsstserviceabilityclientcase/BUILD.gn | 7 ++- .../actsstserviceabilityclientcase/Test.json | 9 +-- .../entry/src/main/config.json | 39 ++++++++++-- .../main/js/{default => MainAbility}/app.js | 0 .../{default => MainAbility}/i18n/en-US.json | 0 .../{default => MainAbility}/i18n/zh-CN.json | 0 .../pages/index/index.css | 0 .../pages/index/index.hml | 0 .../pages/index/index.js | 22 ++----- .../entry/src/main/js/TestAbility/app.js | 31 +++++++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 +++ .../src/main/js/TestAbility/i18n/zh-CN.json | 8 +++ .../main/js/TestAbility/pages/index/index.css | 50 +++++++++++++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++++++ .../main/js/TestAbility/pages/index/index.js | 26 ++++++++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 ++++++++++++++++++ ...ActsStServiceAbilityClientCaseTest.test.js | 9 ++- .../entry/src/main/js/test/List.test.js | 6 +- .../resources/base/element/string.json | 8 +++ .../{js => }/resources/base/media/icon.png | Bin .../src/main/ets/Application/AbilityStage.ts | 2 +- .../src/main/ets/MainAbility/MainAbility.ts | 2 +- .../entry/src/main/ets/test/Ability.test.ets | 35 ++++++----- .../entry/src/main/module.json | 2 +- .../entry/src/main/module.json | 2 +- .../entry/src/main/ets/test/Ability.test.ets | 30 ++++----- .../entry/src/main/module.json | 2 +- .../ets/MainAbility/pages/index/index.ets | 2 - .../entry/src/main/ets/test/Ability.test.ets | 22 +++---- .../entry/src/main/module.json | 2 +- .../src/main/ets/MainAbility/MainAbility.ts | 2 +- .../entry/src/main/config.json | 1 + .../main/js/test/FeatureAbilityJsunit.test.js | 17 +++-- 35 files changed, 330 insertions(+), 122 deletions(-) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/{default => MainAbility}/app.js (100%) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/{default => MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/{default => MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/{default => MainAbility}/pages/index/index.css (100%) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/{default => MainAbility}/pages/index/index.hml (100%) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/{default => MainAbility}/pages/index/index.js (54%) create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/{js => }/resources/base/element/string.json (54%) rename ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/{js => }/resources/base/media/icon.png (100%) diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets index 52663437c..ebe2a118a 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/TestAbility/pages/index.ets @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import router from '@system.router'; @Entry @Component diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets index a19602275..e91baa031 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets @@ -46,20 +46,6 @@ export default function getHapModuleInfoJsunit() { done(); }); - async function startAbility2() { - var str = { - "want": { - "bundleName": "com.ohos.acecollaboration", - "abilityName": "com.ohos.acecollaboration.MainAbility2", - }, - }; - ability_featureAbility.startAbility(str).then((data) => { - console.info('context_getAbilityInfo_test_0300 startMainAbility2 succeeded: ' + JSON.stringify(data)); - }).catch((error) => { - console.error('context_getAbilityInfo_test_0300 startMainAbility2 failed. Cause: ' + JSON.stringify(error)); - }); - } - /** * @tc.number: context_getAbilityInfo_test_0200 * @tc.name: getAbilityInfo:Query the current attributionability details. @@ -88,19 +74,6 @@ export default function getHapModuleInfoJsunit() { done(); }) - - /** - * @tc.number: context_getAbilityInfo_test_0300_1 - * @tc.name: getAbilityInfo:Query the current attributionability details. - * @tc.desc: Check the return value of the interface - * @tc.level 0 - */ - it('context_getAbilityInfo_test_0300_1', 0, async function (done) { - console.info('[context_getAbilityInfo_test_0300] STARTability'); - startAbility2(); - done(); - }); - /** * @tc.number: context_getAbilityInfo_test_0400 * @tc.name: getAbilityInfo:Query the current attributionability details. diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/BUILD.gn b/ability/ability_runtime/actsstserviceabilityclientcase/BUILD.gn index 90f40cc40..14beae6bc 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/BUILD.gn +++ b/ability/ability_runtime/actsstserviceabilityclientcase/BUILD.gn @@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsStServiceAbilityClientCaseTest") { hap_name = "ActsStServiceAbilityClientCaseTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./entry/src/main/config.json" + source_dir = "./entry/src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] + sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" } diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/Test.json b/ability/ability_runtime/actsstserviceabilityclientcase/Test.json index cd03f2a6b..2daec4214 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/Test.json +++ b/ability/ability_runtime/actsstserviceabilityclientcase/Test.json @@ -1,10 +1,11 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "com.amsst.actsstserviceabilityclientcasetest", - "shell-timeout": "60000" + "type": "OHJSUnitTest", + "test-timeout": "300000", + "bundle-name": "com.amsst.actsstserviceabilityclientcasetest", + "package-name": "com.amsst.actsstserviceabilityclientcasetest", + "shell-timeout": "600000" }, "kits": [ { diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json index a969be745..da803ed69 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json @@ -15,14 +15,16 @@ "deviceConfig": {}, "module": { "package": "com.amsst.actsstserviceabilityclientcasetest", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": "com.amsst.actsstserviceabilityclientcasetest.MainAbility", "deviceType": [ "phone" ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree": true }, "abilities": [ { @@ -37,12 +39,27 @@ } ], "name": "com.amsst.actsstserviceabilityclientcasetest.MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", "type": "page", "launchType": "standard", "visible": true + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" } ], "reqPermissions": [ @@ -80,12 +97,26 @@ "pages": [ "pages/index/index" ], - "name": "default", + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", "window": { "designWidth": 720, "autoDesignWidth": false } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/app.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/app.js rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.css diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.js similarity index 54% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.js index 8ea0eedbb..0b672f833 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/MainAbility/pages/index/index.js @@ -12,10 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file' -import app from '@system.app' -import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' - +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') export default { data: { title: "" @@ -24,21 +22,9 @@ export default { this.title = this.$t('strings.world'); }, onShow() { - console.info('====onShow finish====<') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - const reportExtend = new ReportExtend(file) - core.addService('expect', expectExtend) - core.addService('report', reportExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() + console.info('====onShow start====<') }, onReady() { + console.info('onReady'); }, } \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/app.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..d5ee271df --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..55561b837 --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..cce1af067 --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..56e3f23b7 --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..6069a046a --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..d94b75c08 --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..b9e78ce7c --- /dev/null +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js index ad64aff76..d6eca4fef 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js @@ -14,10 +14,11 @@ */ import featureAbility from '@ohos.ability.featureAbility' import commonEvent from '@ohos.commonEvent' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -const errCode = 1; +const errCode = 1; +export default function ActsStServiceAbilityTest() { describe('ActsStServiceAbilityTest', function () { let bundleName = "com.amsst.stserviceabilityserver"; let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; @@ -270,6 +271,7 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){ console.log('ACTS_AJsServiceAbility_0600==== { console.debug("=ACTS_AJsServiceAbility_0600 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") @@ -429,4 +431,5 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){ done(); } }) -}) \ No newline at end of file +}) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js index 83c4d53ae..b19458af6 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/List.test.js @@ -12,4 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./ActsStServiceAbilityClientCaseTest.test.js') \ No newline at end of file +import ActsStServiceAbilityTest from './ActsStServiceAbilityClientCaseTest.test.js' + +export default function testsuite() { + ActsStServiceAbilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/resources/base/element/string.json similarity index 54% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/resources/base/element/string.json index a3d6946de..392f4c583 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/element/string.json +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/resources/base/element/string.json @@ -7,6 +7,14 @@ { "name": "mainability_description", "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" } ] } \ No newline at end of file diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts index 4ca501100..cdc3a115e 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/Application/AbilityStage.ts @@ -18,6 +18,6 @@ export default class MyAbilityStage extends AbilityStage { onCreate() { console.log("MyAbilityStage onCreate") // globalThis.stageOnCreateRun = 1; - globalThis.stageContext = this.context; + globalThis.abilityStageContext = this.context; } } diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts index d4c4a376c..5d9cb94eb 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -29,7 +29,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility onWindowStageCreate") - globalThis.abilityStageContext = this.context + globalThis.abilityContext = this.context windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets index 99a54c3b5..bbefdd9c2 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/ets/test/Ability.test.ets @@ -25,7 +25,7 @@ export default function abilityTest() { */ it('ACTS_getApplicationInfo_0300', 0, async function (done) { console.log("ACTS_getApplicationInfo_0300 --- start ability=====>'+ abilityContext.applicationInfo") - checkApplicationInfo(globalThis.abilityStageContext.applicationInfo); + checkApplicationInfo(globalThis.abilityContext.applicationInfo); done(); }) @@ -93,33 +93,33 @@ export default function abilityTest() { expect(typeof (data.removable)).assertEqual("boolean"); console.log("checkApplicationInfo_expect_typeof_end") - expect(data.name).assertEqual("com.example.staticglobalThis.abilityStageContext"); + expect(data.name).assertEqual("com.example.staticabilitystagecontext"); expect(data.description).assertEqual("$string:description_application"); expect(data.descriptionId).assertLarger(0); expect(data.systemApp).assertEqual(true); expect(data.enabled).assertEqual(true); expect(data.label).assertEqual("$string:app_name"); expect(data.labelId.length).assertLarger(0); - expect(data.icon).assertEqual(""); + expect(data.icon).assertEqual("$media:icon"); expect(data.iconId.length).assertLarger(0); expect(data.process).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.moduleSourceDirs.length).assertEqual(1); expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticglobalThis.abilityStageContext/com.example.staticglobalThis.abilityStageContext"); + "com.example.staticabilitystagecontext/com.example.staticabilitystagecontext"); expect(data.moduleInfos.length).assertEqual(1); - expect(data.moduleInfos[0].moduleName).assertEqual("com.example.staticglobalThis.abilityStageContext"); + expect(data.moduleInfos[0].moduleName).assertEqual("com.example.staticabilitystagecontext"); expect(data.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticglobalThis.abilityStageContext/com.example.staticglobalThis.abilityStageContext"); + "com.example.staticabilitystagecontext/com.example.staticabilitystagecontext"); expect(data.entryDir).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticglobalThis.abilityStageContext/com.example.staticglobalThis.abilityStageContext"); + "com.example.staticabilitystagecontext/com.example.staticabilitystagecontext"); expect(data.codePath).assertEqual("/data/app/el1/bundle/public/" + - "com.example.staticglobalThis.abilityStageContext"); + "com.example.staticabilitystagecontext"); expect(data.removable).assertEqual(true); console.log("checkApplicationInfo end " + data); } function checkHapModuleInfo(data) { - console.log("checkHapModuleInfo start " + data); + console.log("checkHapModuleInfo start " + JSON.stringify(data)); console.log("checkHapModuleInfo name : " + data.name); console.log("checkHapModuleInfo description : " + data.description); console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); @@ -154,22 +154,23 @@ export default function abilityTest() { expect(typeof (data.moduleName)).assertEqual("string"); expect(typeof (data.mainAbilityName)).assertEqual("string"); console.log("checkHapModuleInfo_expect_typeof_end") - expect(data.name).assertEqual("com.example.staticglobalThis.abilityStageContext"); + expect(data.name).assertEqual("com.example.staticabilitystagecontext"); expect(data.description).assertEqual("$string:phone_entry_dsc"); - expect(data.descriptionId).assertEqual(undefined); + expect(data.descriptionId).assertEqual(16777221); expect(data.icon).assertEqual("$media:icon"); expect(data.label).assertEqual("$string:entry_label"); - expect(data.labelId).assertEqual(undefined); - expect(data.iconId).assertEqual(undefined); + expect(data.labelId).assertEqual(16777219); + expect(data.iconId).assertEqual(16777224); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0); - expect(data.reqCapabilities[0]).assertEqual(undefined); expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes[0]).assertEqual("phone"); - expect(data.moduleName).assertEqual("com.example.staticglobalThis.abilityStageContext") - expect(data.mainAbilityName).assertEqual("MainAbility"); - expect(data.installationFree).assertEqual(undefined); + expect(data.moduleName).assertEqual("com.example.staticabilitystagecontext") + expect(data.mainAbilityName).assertEqual("com.example.staticabilitystagecontext.MainAbility"); + expect(data.installationFree).assertEqual(false); + expect(data.mainElementName).assertEqual('com.example.staticabilitystagecontext.MainAbility'); + expect(data.hashValue).assertEqual(''); console.log("checkHapModuleInfo end " + data); } }) diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json index c3fd9d3d8..f9b841630 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json @@ -4,7 +4,7 @@ "type": "entry", "srcEntrance": "./ets/Application/AbilityStage.ts", "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", + "mainElement": "com.example.staticabilitystagecontext.MainAbility", "deviceTypes": [ "phone" ], diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json index 7c9e5a728..d9a51d0c3 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json @@ -4,7 +4,7 @@ "type": "entry", "srcEntrance": "./ets/Application/AbilityStage.ts", "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", + "mainElement": "com.example.staticextensioninfotest.MainAbility", "deviceTypes": [ "phone" ], diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets index 45879adaf..53d5695b4 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets @@ -118,20 +118,21 @@ export default function abilityTest() { console.log("checkHapModuleInfo_expect_typeof_end") expect(data.name).assertEqual("phone"); expect(data.description).assertEqual("$string:phone_entry_dsc"); - expect(data.descriptionId).assertEqual(undefined); + expect(data.descriptionId).assertEqual(16777221); expect(data.icon).assertEqual("$media:icon"); expect(data.label).assertEqual("$string:entry_label"); - expect(data.labelId).assertEqual(undefined); - expect(data.iconId).assertEqual(undefined); + expect(data.labelId).assertEqual(16777219); + expect(data.iconId).assertEqual(16777224); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0); - expect(data.reqCapabilities[0]).assertEqual(undefined); expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.moduleName).assertEqual("phone") - expect(data.mainAbilityName).assertEqual("MainAbility"); - expect(data.installationFree).assertEqual(undefined); + expect(data.mainAbilityName).assertEqual("com.example.staticextensioninfo.MainAbility"); + expect(data.installationFree).assertEqual(false); + expect(data.mainElementName).assertEqual('com.example.staticextensioninfo.MainAbility'); + expect(data.hashValue).assertEqual(''); console.log("checkHapModuleInfo end " + data); } function checkApplicationInfo(data) { @@ -191,7 +192,7 @@ export default function abilityTest() { expect(data.enabled).assertEqual(true); expect(data.label).assertEqual("$string:app_name"); expect(data.labelId).assertEqual("16777216"); - expect(data.icon).assertEqual(""); + expect(data.icon).assertEqual("$media:icon"); expect(data.iconId).assertEqual("16777224"); expect(data.process).assertEqual(""); expect(data.supportedModes).assertEqual(0); @@ -299,20 +300,21 @@ export default function abilityTest() { console.log("checkHapModuleInfo_expect_typeof_end") expect(data.name).assertEqual("phone"); expect(data.description).assertEqual("$string:phone_entry_dsc"); - expect(data.descriptionId).assertEqual(undefined); + expect(data.descriptionId).assertEqual(16777221); expect(data.icon).assertEqual("$media:icon"); expect(data.label).assertEqual("$string:entry_label"); - expect(data.labelId).assertEqual(undefined); - expect(data.iconId).assertEqual(undefined); + expect(data.labelId).assertEqual(16777219); + expect(data.iconId).assertEqual(16777224); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0); - expect(data.reqCapabilities[0]).assertEqual(undefined); expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.moduleName).assertEqual("phone") - expect(data.mainAbilityName).assertEqual("MainAbility"); - expect(data.installationFree).assertEqual(undefined); + expect(data.mainAbilityName).assertEqual("com.example.staticextensioninfotest.MainAbility"); + expect(data.installationFree).assertEqual(false); + expect(data.mainElementName).assertEqual('com.example.staticextensioninfotest.MainAbility'); + expect(data.hashValue).assertEqual(''); console.log("checkHapModuleInfo end " + data); } function checkApplicationInfo_0200(data) { @@ -372,7 +374,7 @@ export default function abilityTest() { expect(data.enabled).assertEqual(true); expect(data.label).assertEqual("$string:app_name"); expect(data.labelId.length).assertLarger(0); - expect(data.icon).assertEqual(""); + expect(data.icon).assertEqual("$media:icon"); expect(data.iconId.length).assertLarger(0); expect(data.process).assertEqual(""); expect(data.supportedModes).assertEqual(0); diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json index 0fb12a5a8..930219639 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json @@ -4,7 +4,7 @@ "type": "entry", "srcEntrance": "./ets/Application/AbilityStage.ts", "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", + "mainElement": "com.example.staticextensioninfo.MainAbility", "deviceTypes": [ "phone" ], diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/pages/index/index.ets index 52f3af9da..0cd40d5a5 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -12,9 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file'; -import router from '@ohos.router'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import { Hypium } from '@ohos/hypium' import testsuite from '../../../test/List.test' diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets index aa3947a87..9f0e309ac 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets @@ -20,9 +20,6 @@ import commonEvent from '@ohos.commonEvent' var subscriberInfo_MainAbility_ability = { events: ["MainAbility_Start_CommonEvent_ability", "SecondAbility_Start_CommonEvent_ability"], }; -var subscriberInfo_MainAbility_ability_0300 = { - events: ["MainAbility_Start_CommonEvent_ability_0300","SecondAbility_Start_CommonEvent_ability_0300"], -}; export default function abilityTest() { describe('ActsStaticInfoMationQueryTest', function () { @@ -101,10 +98,10 @@ export default function abilityTest() { commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } } - commonEvent.createSubscriber(subscriberInfo_MainAbility_ability).then(async (data) => { + await commonEvent.createSubscriber(subscriberInfo_MainAbility_ability).then(async (data) => { console.debug("ACTS_getAbilityInfo_0200====>Create Subscriber====>"); Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); + await commonEvent.subscribe(Subscriber, SubscribeCallBack); Subscriber.getSubscribeInfo().then((data)=>{ console.log('ACTS_getAbilityInfo_0200 - Subscriber: ' + JSON.stringify(data)) }) @@ -287,7 +284,7 @@ export default function abilityTest() { expect(data.enabled).assertEqual(true); expect(data.label).assertEqual("$string:app_name"); expect(data.labelId.length).assertLarger(0); - expect(data.icon).assertEqual(""); + expect(data.icon).assertEqual("$media:icon"); expect(data.iconId.length).assertLarger(0); expect(data.process).assertEqual(""); expect(data.supportedModes).assertEqual(0); @@ -343,20 +340,21 @@ export default function abilityTest() { console.log("checkHapModuleInfo_expect_typeof_end") expect(data.name).assertEqual("com.example.staticinfomationquery"); expect(data.description).assertEqual("$string:phone_entry_dsc"); - expect(data.descriptionId).assertEqual(undefined); + expect(data.descriptionId).assertEqual(16777221); expect(data.icon).assertEqual("$media:icon"); expect(data.label).assertEqual("$string:entry_label"); - expect(data.labelId).assertEqual(undefined); - expect(data.iconId).assertEqual(undefined); + expect(data.labelId).assertEqual(16777219); + expect(data.iconId).assertEqual(16777224); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0); - expect(data.reqCapabilities[0]).assertEqual(undefined); expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.moduleName).assertEqual("com.example.staticinfomationquery") - expect(data.mainAbilityName).assertEqual("MainAbility"); - expect(data.installationFree).assertEqual(undefined); + expect(data.mainAbilityName).assertEqual("com.example.staticinfomationquery.MainAbility"); + expect(data.installationFree).assertEqual(false); + expect(data.mainElementName).assertEqual('com.example.staticinfomationquery.MainAbility'); + expect(data.hashValue).assertEqual(''); console.log("checkHapModuleInfo end " + data); } }) diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json index 9428138b0..ac0e4ad2b 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json @@ -4,7 +4,7 @@ "type": "entry", "srcEntrance": "./ets/Application/AbilityStage.ts", "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", + "mainElement": "com.example.staticinfomationquery.MainAbility", "deviceTypes": [ "phone" ], diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts index 8bb08101a..054401cd3 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -43,7 +43,7 @@ export default class MainAbility extends Ability { onForeground() { // Ability has brought to foreground - if (globalThis.abilityWant.action == 'getAbilityContext') { + if (globalThis.abilityWant.action == 'getglobalThis.abilityContext') { commonEvent.publish("MainAbility_Start_CommonEvent_ability", { parameters: { hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json index 0ce612080..fc48f59c8 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json @@ -20,6 +20,7 @@ "module": { "package": "com.example.actsfeatureabilitytest", "name": ".MyApplication", + "mainAbility": "com.example.actsfeatureabilitytest.MainAbility", "deviceType": [ "phone" ], 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 8465f43e9..31899e565 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 @@ -327,13 +327,13 @@ describe('ActsFeatureAbilityTest', function () { function SubscribeCallBack(err, data) { clearTimeout(id); + expect(promise).assertEqual(0); expect(data.event).assertEqual("ACTS_StartAbility_0200_CommonEvent"); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); } - commonEvent.createSubscriber(subscriberInfoActsStartAbility0200).then(async (data) => { + await commonEvent.createSubscriber(subscriberInfoActsStartAbility0200).then(async (data) => { console.debug("====>Create Subscriber====>"); Subscriber = data; await commonEvent.subscribe(Subscriber, SubscribeCallBack); @@ -407,7 +407,6 @@ describe('ActsFeatureAbilityTest', function () { }, } ); - expect(promise).assertEqual(0); }) /** @@ -687,7 +686,6 @@ describe('ActsFeatureAbilityTest', function () { expect(data.event).assertEqual("ACTS_StartAbility_0600_CommonEvent"); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); } commonEvent.createSubscriber(subscriberInfoActsStartAbility0600).then(async (data) => { @@ -1104,7 +1102,7 @@ describe('ActsFeatureAbilityTest', function () { expect(data.moduleName).assertEqual("entry"); expect(data.process).assertEqual("processTestAbility"); expect(data.targetAbility).assertEqual(""); - expect(data.backgroundModes).assertEqual(0); + expect(data.backgroundModes).assertEqual(1); expect(data.isVisible).assertEqual(true); expect(data.formEnabled).assertEqual(false); expect(data.type).assertEqual(1); @@ -1185,20 +1183,20 @@ describe('ActsFeatureAbilityTest', function () { expect(typeof (data.moduleName)).assertEqual("string"); expect(typeof (data.mainAbilityName)).assertEqual("string"); expect(typeof (data.installationFree)).assertEqual("boolean"); - expect(data.name).assertEqual("com.example.actsfeatureabilitytest"); + expect(data.name).assertEqual("com.example.actsfeatureabilitytest.MyApplication"); expect(data.description).assertEqual("descriptionTest"); expect(data.descriptionId).assertEqual(0); expect(data.icon).assertEqual("$media:icon"); expect(data.label).assertEqual("$string:app_name"); - expect(data.labelId).assertEqual(0); - expect(data.iconId).assertEqual(0); + expect(data.labelId).assertEqual(16777216); + expect(data.iconId).assertEqual(16777219); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.moduleName).assertEqual("entry") - expect(data.mainAbilityName).assertEqual(""); + expect(data.mainAbilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); expect(data.installationFree).assertEqual(false); console.info("checkHapModuleInfo end " + data); } @@ -1578,7 +1576,6 @@ describe('ActsFeatureAbilityTest', function () { expect(data.event).assertEqual("ACTS_StartAbility_1300_CommonEvent"); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); } commonEvent.createSubscriber(subscriberInfoStartAbilityThirteen).then(async (data) => { -- GitLab