From dd59b038496546f195569e589cd63739b3f07d57 Mon Sep 17 00:00:00 2001 From: chengxingzhen Date: Tue, 16 Aug 2022 17:56:27 +0800 Subject: [PATCH] =?UTF-8?q?XTS=E9=80=82=E9=85=8D=E6=96=B0=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengxingzhen --- .../main/js/MainAbility/pages/index/index.js | 16 ----- .../actsfeatureabilitytest/BUILD.gn | 7 ++- .../actsfeatureabilitytest/Test.json | 8 ++- .../entry/src/main/config.json | 37 ++++++++++- .../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 | 33 ++++++++++ .../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 ++++++++++++++++++ .../main/js/test/FeatureAbilityJsunit.test.js | 21 ++++--- .../entry/src/main/js/test/List.test.js | 9 ++- .../main/js/test/StartAbilityJsunit.test.js | 7 ++- .../resources/base/element/string.json | 8 +++ .../{js => }/resources/base/media/icon.png | Bin .../finishwithresultemptytest/BUILD.gn | 9 ++- .../BUILD.gn | 9 ++- .../finishwithresulttest/BUILD.gn | 9 ++- .../getcallingbundletest/BUILD.gn | 9 ++- .../sceneproject/startability/BUILD.gn | 9 ++- .../startabilityforresult/BUILD.gn | 9 ++- .../terminateabilitytest/BUILD.gn | 9 ++- 29 files changed, 307 insertions(+), 96 deletions(-) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/{default => MainAbility}/app.js (100%) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/{default => MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/{default => MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/{default => MainAbility}/pages/index/index.css (100%) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/{default => MainAbility}/pages/index/index.hml (100%) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/{default => MainAbility}/pages/index/index.js (56%) create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/{js => }/resources/base/element/string.json (64%) rename ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/{js => }/resources/base/media/icon.png (100%) diff --git a/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/MainAbility/pages/index/index.js index 8ea0eedbb..dcf2e52ed 100644 --- a/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/MainAbility/pages/index/index.js +++ b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/js/MainAbility/pages/index/index.js @@ -12,9 +12,6 @@ * 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' export default { data: { @@ -25,19 +22,6 @@ export default { }, 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() }, onReady() { }, diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/BUILD.gn b/ability/ability_runtime/featureability/actsfeatureabilitytest/BUILD.gn index 89b4782ea..712188a49 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/BUILD.gn +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/BUILD.gn @@ -21,14 +21,15 @@ ohos_js_hap_suite("ActsFeatureAbilityTest") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsFeatureAbilityTest" - subsystem_name = "ability" part_name = "ability_runtime" } 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/featureability/actsfeatureabilitytest/Test.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/Test.json index 1410989d0..f2af25373 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/Test.json +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsfeatureabilitytest", - "shell-timeout": "600000" + "bundle-name": "com.example.actsfeatureabilitytest", + "package-name": "com.example.actsfeatureabilitytest", + "shell-timeout": "600000", + "testcase-timeout":"30000" }, "kits": [ { 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 fc48f59c8..78165bae4 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json @@ -14,7 +14,7 @@ }, "deviceConfig": { "default": { - "process": "processTest" + "process": "processTestAbility" } }, "module": { @@ -47,6 +47,8 @@ "dataTransfer" ], "name": "com.example.actsfeatureabilitytest.MainAbility", + "srcPath": "MainAbility", + "srcLanguage": "js", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", @@ -57,6 +59,23 @@ "deviceCapability": ["SystemCapability.Ability.AbilityBase"], "uri": "uriTest", "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", + "permissions": ["ohos.permission.ACCELEROMETER"], + "deviceCapability": ["SystemCapability.Ability.AbilityBase"], + "uri": "uriTest", + "process": "processTestAbility" } ], "reqCapabilities": ["reqCapabilitiesTest1","reqCapabilitiesTest2"], @@ -114,7 +133,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/app.js rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.css diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.js similarity index 56% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.js index 130fe7cec..a0634f246 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/MainAbility/pages/index/index.js @@ -13,12 +13,6 @@ * limitations under the License. */ -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -let once = true - export default { data: { title: '' @@ -27,23 +21,7 @@ export default { this.title = this.$t('strings.world'); }, onActive() { - if (!once) { - return; - } - once = false; console.info('onShow finish'); - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - id: 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - this.timeout = 10000; - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() }, onReady() { console.info('onReady'); diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/app.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..23f62e884 --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/app.js @@ -0,0 +1,33 @@ +/* + * 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('abilityDelegator' + abilityDelegator) + console.info('abilityDelegator' + abilityDelegator) + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..55561b837 --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/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/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..cce1af067 --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/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/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..56e3f23b7 --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/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/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..6069a046a --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..d94b75c08 --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/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/featureability/actsfeatureabilitytest/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..b9e78ce7c --- /dev/null +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/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/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 31899e565..6563e4db5 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 @@ -14,7 +14,7 @@ */ import featureAbility from '@ohos.ability.featureAbility' import wantconstant from '@ohos.ability.wantConstant' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import commonEvent from '@ohos.commonEvent' import particleAbility from '@ohos.ability.particleAbility' import backgroundTaskManager from '@ohos.backgroundTaskManager' @@ -57,7 +57,7 @@ let subscriberInfoActsGetCallingBundle0100 = { function sleep(time) { return new Promise((resolve)=>setTimeout(resolve,time)); } - +export default function actsFeatureAbilityTest() { describe('ActsFeatureAbilityTest', function () { beforeAll(function() { @@ -847,7 +847,7 @@ describe('ActsFeatureAbilityTest', function () { // expect(info.labelId).assertEqual(0); //create by DevEco when building HAP. expect(info.icon).assertEqual("$media:icon"); // expect(info.iconId).assertEqual(0); //create by DevEco when building HAP. - expect(info.process).assertEqual("processTest"); + expect(info.process).assertEqual("processTestAbility"); expect(info.supportedModes).assertEqual(0); expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); @@ -964,7 +964,7 @@ describe('ActsFeatureAbilityTest', function () { expect(info.deviceId).assertEqual(""); expect(info.bundleName).assertEqual("com.example.actsfeatureabilitytest"); - expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); + expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.TestAbility"); expect(info.uri).assertEqual(""); expect(info.shortName).assertEqual(""); console.info("getElementName : end"); @@ -1094,15 +1094,15 @@ describe('ActsFeatureAbilityTest', function () { expect(data.bundleName).assertEqual("com.example.actsfeatureabilitytest"); - expect(data.name).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); - expect(data.label).assertEqual("$string:app_name"); - expect(data.description).assertEqual("$string:mainability_description"); + expect(data.name).assertEqual("com.example.actsfeatureabilitytest.TestAbility"); + expect(data.label).assertEqual("$string:TestAbility_label"); + expect(data.description).assertEqual("$string:TestAbility_desc"); expect(data.icon).assertEqual("$media:icon"); expect(data.moduleName).assertEqual("entry"); expect(data.process).assertEqual("processTestAbility"); expect(data.targetAbility).assertEqual(""); - expect(data.backgroundModes).assertEqual(1); + expect(data.backgroundModes).assertEqual(0); expect(data.isVisible).assertEqual(true); expect(data.formEnabled).assertEqual(false); expect(data.type).assertEqual(1); @@ -1188,8 +1188,8 @@ describe('ActsFeatureAbilityTest', function () { expect(data.descriptionId).assertEqual(0); expect(data.icon).assertEqual("$media:icon"); expect(data.label).assertEqual("$string:app_name"); - expect(data.labelId).assertEqual(16777216); - expect(data.iconId).assertEqual(16777219); + expect(data.labelId).assertEqual(16777218); + expect(data.iconId).assertEqual(16777221); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); @@ -1731,3 +1731,4 @@ describe('ActsFeatureAbilityTest', function () { } }); }) +} \ No newline at end of file diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js index dcdf3a434..1d18927f3 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/List.test.js @@ -12,5 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./FeatureAbilityJsunit.test.js') -require('./StartAbilityJsunit.test.js') \ No newline at end of file +import actsFeatureAbilityTest from './FeatureAbilityJsunit.test.js' +import startAbilityTest from './StartAbilityJsunit.test.js' + +export default function testsuite() { + actsFeatureAbilityTest() + startAbilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js index 36d5ac0c2..1d63d39b0 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js @@ -13,15 +13,15 @@ * limitations under the License. */ import featureAbility from '@ohos.ability.featureAbility' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' let resultCode = 123; let bundleName = 'ohso.act.aafwk'; let mainAbilityName = 'ohos.acts.aafwk.jsap'; const errCode = 1; const errCode1 = 202; - -describe('ConnectAbilityTest', function () { +export default function startAbilityTest() { +describe('StartAbilityTest', function () { /* * @tc.number: SUB_AA_JsApi_StartAbility_0100 @@ -449,3 +449,4 @@ describe('ConnectAbilityTest', function () { }) }) }) +} diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/resources/base/element/string.json similarity index 64% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/resources/base/element/string.json index 41e918029..03d839278 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/element/string.json +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/resources/base/element/string.json @@ -11,6 +11,14 @@ { "name": "permreason_camera", "value": "permreason camera" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" } ] } \ No newline at end of file diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/BUILD.gn index 7ef8478b4..0551673c6 100644 --- a/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("FinishWithResultEmptyTest") { +ohos_hap("FinishWithResultEmptyTest") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "FinishWithResultEmptyTest" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn index c4f436580..ed6c72f0a 100644 --- a/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("FinishWithResultPromiseParametersTest") { +ohos_hap("FinishWithResultPromiseParametersTest") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "FinishWithResultPromiseParametersTest" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/BUILD.gn index 5133004bd..0dd27e7af 100644 --- a/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("FinishWithResultTest") { +ohos_hap("FinishWithResultTest") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "FinishWithResultTest" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" diff --git a/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/BUILD.gn index 64e8a3c99..72ef3714c 100644 --- a/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("GetCallingBundlePromiseTest") { +ohos_hap("GetCallingBundlePromiseTest") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "GetCallingBundlePromiseTest" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" diff --git a/ability/ability_runtime/featureability/sceneproject/startability/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/startability/BUILD.gn index b4d8b09d4..3b0684b8f 100644 --- a/ability/ability_runtime/featureability/sceneproject/startability/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/startability/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("StartAbility") { +ohos_hap("StartAbility") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "StartAbility" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" diff --git a/ability/ability_runtime/featureability/sceneproject/startabilityforresult/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/BUILD.gn index cc6943159..e1e3ea836 100644 --- a/ability/ability_runtime/featureability/sceneproject/startabilityforresult/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("StartAbilityForResult") { +ohos_hap("StartAbilityForResult") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "StartAbilityForResult" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" diff --git a/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/BUILD.gn b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/BUILD.gn index e9b2ddfa5..3ddfb2615 100644 --- a/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/BUILD.gn +++ b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/BUILD.gn @@ -12,20 +12,19 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap_assist_suite("TerminateAbilityTest") { +ohos_hap("TerminateAbilityTest") { hap_profile = "./src/main/config.json" js_build_mode = "debug" hap_name = "TerminateAbilityTest" - + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - - subsystem_name = "ability" - part_name = "ability_runtime" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./src/main/js/default" -- GitLab