提交 d0410485 编写于 作者: C chengxingzhen

XTS失败用例适配

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 5c434a46
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router';
@Entry @Entry
@Component @Component
......
...@@ -46,20 +46,6 @@ export default function getHapModuleInfoJsunit() { ...@@ -46,20 +46,6 @@ export default function getHapModuleInfoJsunit() {
done(); 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.number: context_getAbilityInfo_test_0200
* @tc.name: getAbilityInfo:Query the current attributionability details. * @tc.name: getAbilityInfo:Query the current attributionability details.
...@@ -88,19 +74,6 @@ export default function getHapModuleInfoJsunit() { ...@@ -88,19 +74,6 @@ export default function getHapModuleInfoJsunit() {
done(); 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.number: context_getAbilityInfo_test_0400
* @tc.name: getAbilityInfo:Query the current attributionability details. * @tc.name: getAbilityInfo:Query the current attributionability details.
......
...@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsStServiceAbilityClientCaseTest") { ...@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsStServiceAbilityClientCaseTest") {
hap_name = "ActsStServiceAbilityClientCaseTest" hap_name = "ActsStServiceAbilityClientCaseTest"
} }
ohos_js_assets("hjs_demo_js_assets") { 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") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "60000", "test-timeout": "300000",
"package": "com.amsst.actsstserviceabilityclientcasetest", "bundle-name": "com.amsst.actsstserviceabilityclientcasetest",
"shell-timeout": "60000" "package-name": "com.amsst.actsstserviceabilityclientcasetest",
"shell-timeout": "600000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -15,14 +15,16 @@ ...@@ -15,14 +15,16 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.amsst.actsstserviceabilityclientcasetest", "package": "com.amsst.actsstserviceabilityclientcasetest",
"name": ".MyApplication", "name": ".entry",
"mainAbility": "com.amsst.actsstserviceabilityclientcasetest.MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
"distro": { "distro": {
"deliveryWithInstall": true, "deliveryWithInstall": true,
"moduleName": "entry", "moduleName": "entry",
"moduleType": "entry" "moduleType": "entry",
"installationFree": true
}, },
"abilities": [ "abilities": [
{ {
...@@ -37,12 +39,27 @@ ...@@ -37,12 +39,27 @@
} }
], ],
"name": "com.amsst.actsstserviceabilityclientcasetest.MainAbility", "name": "com.amsst.actsstserviceabilityclientcasetest.MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "$string:app_name",
"type": "page", "type": "page",
"launchType": "standard", "launchType": "standard",
"visible": true "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": [ "reqPermissions": [
...@@ -80,12 +97,26 @@ ...@@ -80,12 +97,26 @@
"pages": [ "pages": [
"pages/index/index" "pages/index/index"
], ],
"name": "default", "name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
} }
] ],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
} }
} }
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file' const injectRef = Object.getPrototypeOf(global) || global
import app from '@system.app' injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default { export default {
data: { data: {
title: "" title: ""
...@@ -24,21 +22,9 @@ export default { ...@@ -24,21 +22,9 @@ export default {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
console.info('====onShow finish====<') console.info('====onShow start====<')
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() { onReady() {
console.info('onReady');
}, },
} }
\ No newline at end of file
/*
* 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");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
/*
* 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
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* 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');
}
}
/*
* 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);
})
}
};
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
*/ */
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import commonEvent from '@ohos.commonEvent' 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 () { describe('ActsStServiceAbilityTest', function () {
let bundleName = "com.amsst.stserviceabilityserver"; let bundleName = "com.amsst.stserviceabilityserver";
let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility";
...@@ -270,6 +271,7 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){ ...@@ -270,6 +271,7 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){
console.log('ACTS_AJsServiceAbility_0600====<begin'); console.log('ACTS_AJsServiceAbility_0600====<begin');
try { try {
var mConnIdJsAsyncCallback; var mConnIdJsAsyncCallback;
var currentAlertTimeout;
commonEvent.createSubscriber(CommonEventSubscribeInfo0600).then(async (data) => { commonEvent.createSubscriber(CommonEventSubscribeInfo0600).then(async (data) => {
console.debug("=ACTS_AJsServiceAbility_0600 createSubscriber .then(data)=======>" console.debug("=ACTS_AJsServiceAbility_0600 createSubscriber .then(data)=======>"
+ ("json data【") + JSON.stringify(data) + ("") + ("json data【") + JSON.stringify(data) + ("")
...@@ -430,3 +432,4 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){ ...@@ -430,3 +432,4 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){
} }
}) })
}) })
}
\ No newline at end of file
...@@ -12,4 +12,8 @@ ...@@ -12,4 +12,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./ActsStServiceAbilityClientCaseTest.test.js') import ActsStServiceAbilityTest from './ActsStServiceAbilityClientCaseTest.test.js'
\ No newline at end of file
export default function testsuite() {
ActsStServiceAbilityTest()
}
\ No newline at end of file
...@@ -7,6 +7,14 @@ ...@@ -7,6 +7,14 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
} }
] ]
} }
\ No newline at end of file
...@@ -18,6 +18,6 @@ export default class MyAbilityStage extends AbilityStage { ...@@ -18,6 +18,6 @@ export default class MyAbilityStage extends AbilityStage {
onCreate() { onCreate() {
console.log("MyAbilityStage onCreate") console.log("MyAbilityStage onCreate")
// globalThis.stageOnCreateRun = 1; // globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context; globalThis.abilityStageContext = this.context;
} }
} }
...@@ -29,7 +29,7 @@ export default class MainAbility extends Ability { ...@@ -29,7 +29,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate") console.log("MainAbility onWindowStageCreate")
globalThis.abilityStageContext = this.context globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
} }
......
...@@ -25,7 +25,7 @@ export default function abilityTest() { ...@@ -25,7 +25,7 @@ export default function abilityTest() {
*/ */
it('ACTS_getApplicationInfo_0300', 0, async function (done) { it('ACTS_getApplicationInfo_0300', 0, async function (done) {
console.log("ACTS_getApplicationInfo_0300 --- start ability=====>'+ abilityContext.applicationInfo") console.log("ACTS_getApplicationInfo_0300 --- start ability=====>'+ abilityContext.applicationInfo")
checkApplicationInfo(globalThis.abilityStageContext.applicationInfo); checkApplicationInfo(globalThis.abilityContext.applicationInfo);
done(); done();
}) })
...@@ -93,33 +93,33 @@ export default function abilityTest() { ...@@ -93,33 +93,33 @@ export default function abilityTest() {
expect(typeof (data.removable)).assertEqual("boolean"); expect(typeof (data.removable)).assertEqual("boolean");
console.log("checkApplicationInfo_expect_typeof_end") 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.description).assertEqual("$string:description_application");
expect(data.descriptionId).assertLarger(0); expect(data.descriptionId).assertLarger(0);
expect(data.systemApp).assertEqual(true); expect(data.systemApp).assertEqual(true);
expect(data.enabled).assertEqual(true); expect(data.enabled).assertEqual(true);
expect(data.label).assertEqual("$string:app_name"); expect(data.label).assertEqual("$string:app_name");
expect(data.labelId.length).assertLarger(0); expect(data.labelId.length).assertLarger(0);
expect(data.icon).assertEqual(""); expect(data.icon).assertEqual("$media:icon");
expect(data.iconId.length).assertLarger(0); expect(data.iconId.length).assertLarger(0);
expect(data.process).assertEqual(""); expect(data.process).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.moduleSourceDirs.length).assertEqual(1); expect(data.moduleSourceDirs.length).assertEqual(1);
expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + 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.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/" + 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/" + 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/" + expect(data.codePath).assertEqual("/data/app/el1/bundle/public/" +
"com.example.staticglobalThis.abilityStageContext"); "com.example.staticabilitystagecontext");
expect(data.removable).assertEqual(true); expect(data.removable).assertEqual(true);
console.log("checkApplicationInfo end " + data); console.log("checkApplicationInfo end " + data);
} }
function checkHapModuleInfo(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 name : " + data.name);
console.log("checkHapModuleInfo description : " + data.description); console.log("checkHapModuleInfo description : " + data.description);
console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); console.log("checkHapModuleInfo descriptionId : " + data.descriptionId);
...@@ -154,22 +154,23 @@ export default function abilityTest() { ...@@ -154,22 +154,23 @@ export default function abilityTest() {
expect(typeof (data.moduleName)).assertEqual("string"); expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.mainAbilityName)).assertEqual("string"); expect(typeof (data.mainAbilityName)).assertEqual("string");
console.log("checkHapModuleInfo_expect_typeof_end") 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.description).assertEqual("$string:phone_entry_dsc");
expect(data.descriptionId).assertEqual(undefined); expect(data.descriptionId).assertEqual(16777221);
expect(data.icon).assertEqual("$media:icon"); expect(data.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:entry_label"); expect(data.label).assertEqual("$string:entry_label");
expect(data.labelId).assertEqual(undefined); expect(data.labelId).assertEqual(16777219);
expect(data.iconId).assertEqual(undefined); expect(data.iconId).assertEqual(16777224);
expect(data.backgroundImg).assertEqual(""); expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities.length).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual(undefined);
expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes.length).assertEqual(1);
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("com.example.staticglobalThis.abilityStageContext") expect(data.moduleName).assertEqual("com.example.staticabilitystagecontext")
expect(data.mainAbilityName).assertEqual("MainAbility"); expect(data.mainAbilityName).assertEqual("com.example.staticabilitystagecontext.MainAbility");
expect(data.installationFree).assertEqual(undefined); expect(data.installationFree).assertEqual(false);
expect(data.mainElementName).assertEqual('com.example.staticabilitystagecontext.MainAbility');
expect(data.hashValue).assertEqual('');
console.log("checkHapModuleInfo end " + data); console.log("checkHapModuleInfo end " + data);
} }
}) })
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts", "srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "com.example.staticabilitystagecontext.MainAbility",
"deviceTypes": [ "deviceTypes": [
"phone" "phone"
], ],
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts", "srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "com.example.staticextensioninfotest.MainAbility",
"deviceTypes": [ "deviceTypes": [
"phone" "phone"
], ],
......
...@@ -118,20 +118,21 @@ export default function abilityTest() { ...@@ -118,20 +118,21 @@ export default function abilityTest() {
console.log("checkHapModuleInfo_expect_typeof_end") console.log("checkHapModuleInfo_expect_typeof_end")
expect(data.name).assertEqual("phone"); expect(data.name).assertEqual("phone");
expect(data.description).assertEqual("$string:phone_entry_dsc"); 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.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:entry_label"); expect(data.label).assertEqual("$string:entry_label");
expect(data.labelId).assertEqual(undefined); expect(data.labelId).assertEqual(16777219);
expect(data.iconId).assertEqual(undefined); expect(data.iconId).assertEqual(16777224);
expect(data.backgroundImg).assertEqual(""); expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities.length).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual(undefined);
expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes.length).assertEqual(1);
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("phone") expect(data.moduleName).assertEqual("phone")
expect(data.mainAbilityName).assertEqual("MainAbility"); expect(data.mainAbilityName).assertEqual("com.example.staticextensioninfo.MainAbility");
expect(data.installationFree).assertEqual(undefined); expect(data.installationFree).assertEqual(false);
expect(data.mainElementName).assertEqual('com.example.staticextensioninfo.MainAbility');
expect(data.hashValue).assertEqual('');
console.log("checkHapModuleInfo end " + data); console.log("checkHapModuleInfo end " + data);
} }
function checkApplicationInfo(data) { function checkApplicationInfo(data) {
...@@ -191,7 +192,7 @@ export default function abilityTest() { ...@@ -191,7 +192,7 @@ export default function abilityTest() {
expect(data.enabled).assertEqual(true); expect(data.enabled).assertEqual(true);
expect(data.label).assertEqual("$string:app_name"); expect(data.label).assertEqual("$string:app_name");
expect(data.labelId).assertEqual("16777216"); expect(data.labelId).assertEqual("16777216");
expect(data.icon).assertEqual(""); expect(data.icon).assertEqual("$media:icon");
expect(data.iconId).assertEqual("16777224"); expect(data.iconId).assertEqual("16777224");
expect(data.process).assertEqual(""); expect(data.process).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
...@@ -299,20 +300,21 @@ export default function abilityTest() { ...@@ -299,20 +300,21 @@ export default function abilityTest() {
console.log("checkHapModuleInfo_expect_typeof_end") console.log("checkHapModuleInfo_expect_typeof_end")
expect(data.name).assertEqual("phone"); expect(data.name).assertEqual("phone");
expect(data.description).assertEqual("$string:phone_entry_dsc"); 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.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:entry_label"); expect(data.label).assertEqual("$string:entry_label");
expect(data.labelId).assertEqual(undefined); expect(data.labelId).assertEqual(16777219);
expect(data.iconId).assertEqual(undefined); expect(data.iconId).assertEqual(16777224);
expect(data.backgroundImg).assertEqual(""); expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities.length).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual(undefined);
expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes.length).assertEqual(1);
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("phone") expect(data.moduleName).assertEqual("phone")
expect(data.mainAbilityName).assertEqual("MainAbility"); expect(data.mainAbilityName).assertEqual("com.example.staticextensioninfotest.MainAbility");
expect(data.installationFree).assertEqual(undefined); expect(data.installationFree).assertEqual(false);
expect(data.mainElementName).assertEqual('com.example.staticextensioninfotest.MainAbility');
expect(data.hashValue).assertEqual('');
console.log("checkHapModuleInfo end " + data); console.log("checkHapModuleInfo end " + data);
} }
function checkApplicationInfo_0200(data) { function checkApplicationInfo_0200(data) {
...@@ -372,7 +374,7 @@ export default function abilityTest() { ...@@ -372,7 +374,7 @@ export default function abilityTest() {
expect(data.enabled).assertEqual(true); expect(data.enabled).assertEqual(true);
expect(data.label).assertEqual("$string:app_name"); expect(data.label).assertEqual("$string:app_name");
expect(data.labelId.length).assertLarger(0); expect(data.labelId.length).assertLarger(0);
expect(data.icon).assertEqual(""); expect(data.icon).assertEqual("$media:icon");
expect(data.iconId.length).assertLarger(0); expect(data.iconId.length).assertLarger(0);
expect(data.process).assertEqual(""); expect(data.process).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts", "srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "com.example.staticextensioninfo.MainAbility",
"deviceTypes": [ "deviceTypes": [
"phone" "phone"
], ],
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file';
import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium' import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test' import testsuite from '../../../test/List.test'
......
...@@ -20,9 +20,6 @@ import commonEvent from '@ohos.commonEvent' ...@@ -20,9 +20,6 @@ import commonEvent from '@ohos.commonEvent'
var subscriberInfo_MainAbility_ability = { var subscriberInfo_MainAbility_ability = {
events: ["MainAbility_Start_CommonEvent_ability", "SecondAbility_Start_CommonEvent_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() { export default function abilityTest() {
describe('ActsStaticInfoMationQueryTest', function () { describe('ActsStaticInfoMationQueryTest', function () {
...@@ -101,10 +98,10 @@ export default function abilityTest() { ...@@ -101,10 +98,10 @@ export default function abilityTest() {
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); 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====>"); console.debug("ACTS_getAbilityInfo_0200====>Create Subscriber====>");
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
Subscriber.getSubscribeInfo().then((data)=>{ Subscriber.getSubscribeInfo().then((data)=>{
console.log('ACTS_getAbilityInfo_0200 - Subscriber: ' + JSON.stringify(data)) console.log('ACTS_getAbilityInfo_0200 - Subscriber: ' + JSON.stringify(data))
}) })
...@@ -287,7 +284,7 @@ export default function abilityTest() { ...@@ -287,7 +284,7 @@ export default function abilityTest() {
expect(data.enabled).assertEqual(true); expect(data.enabled).assertEqual(true);
expect(data.label).assertEqual("$string:app_name"); expect(data.label).assertEqual("$string:app_name");
expect(data.labelId.length).assertLarger(0); expect(data.labelId.length).assertLarger(0);
expect(data.icon).assertEqual(""); expect(data.icon).assertEqual("$media:icon");
expect(data.iconId.length).assertLarger(0); expect(data.iconId.length).assertLarger(0);
expect(data.process).assertEqual(""); expect(data.process).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
...@@ -343,20 +340,21 @@ export default function abilityTest() { ...@@ -343,20 +340,21 @@ export default function abilityTest() {
console.log("checkHapModuleInfo_expect_typeof_end") console.log("checkHapModuleInfo_expect_typeof_end")
expect(data.name).assertEqual("com.example.staticinfomationquery"); expect(data.name).assertEqual("com.example.staticinfomationquery");
expect(data.description).assertEqual("$string:phone_entry_dsc"); 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.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:entry_label"); expect(data.label).assertEqual("$string:entry_label");
expect(data.labelId).assertEqual(undefined); expect(data.labelId).assertEqual(16777219);
expect(data.iconId).assertEqual(undefined); expect(data.iconId).assertEqual(16777224);
expect(data.backgroundImg).assertEqual(""); expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities.length).assertEqual(0); expect(data.reqCapabilities.length).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual(undefined);
expect(data.deviceTypes.length).assertEqual(1); expect(data.deviceTypes.length).assertEqual(1);
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("com.example.staticinfomationquery") expect(data.moduleName).assertEqual("com.example.staticinfomationquery")
expect(data.mainAbilityName).assertEqual("MainAbility"); expect(data.mainAbilityName).assertEqual("com.example.staticinfomationquery.MainAbility");
expect(data.installationFree).assertEqual(undefined); expect(data.installationFree).assertEqual(false);
expect(data.mainElementName).assertEqual('com.example.staticinfomationquery.MainAbility');
expect(data.hashValue).assertEqual('');
console.log("checkHapModuleInfo end " + data); console.log("checkHapModuleInfo end " + data);
} }
}) })
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts", "srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "com.example.staticinfomationquery.MainAbility",
"deviceTypes": [ "deviceTypes": [
"phone" "phone"
], ],
......
...@@ -43,7 +43,7 @@ export default class MainAbility extends Ability { ...@@ -43,7 +43,7 @@ export default class MainAbility extends Ability {
onForeground() { onForeground() {
// Ability has brought to foreground // Ability has brought to foreground
if (globalThis.abilityWant.action == 'getAbilityContext') { if (globalThis.abilityWant.action == 'getglobalThis.abilityContext') {
commonEvent.publish("MainAbility_Start_CommonEvent_ability", { commonEvent.publish("MainAbility_Start_CommonEvent_ability", {
parameters: { parameters: {
hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo), hapModuleInfo: JSON.stringify(globalThis.abilityContext.currentHapModuleInfo),
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"module": { "module": {
"package": "com.example.actsfeatureabilitytest", "package": "com.example.actsfeatureabilitytest",
"name": ".MyApplication", "name": ".MyApplication",
"mainAbility": "com.example.actsfeatureabilitytest.MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
......
...@@ -327,13 +327,13 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -327,13 +327,13 @@ describe('ActsFeatureAbilityTest', function () {
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
clearTimeout(id); clearTimeout(id);
expect(promise).assertEqual(0);
expect(data.event).assertEqual("ACTS_StartAbility_0200_CommonEvent"); expect(data.event).assertEqual("ACTS_StartAbility_0200_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
} }
commonEvent.createSubscriber(subscriberInfoActsStartAbility0200).then(async (data) => { await commonEvent.createSubscriber(subscriberInfoActsStartAbility0200).then(async (data) => {
console.debug("====>Create Subscriber====>"); console.debug("====>Create Subscriber====>");
Subscriber = data; Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
...@@ -407,7 +407,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -407,7 +407,6 @@ describe('ActsFeatureAbilityTest', function () {
}, },
} }
); );
expect(promise).assertEqual(0);
}) })
/** /**
...@@ -687,7 +686,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -687,7 +686,6 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.event).assertEqual("ACTS_StartAbility_0600_CommonEvent"); expect(data.event).assertEqual("ACTS_StartAbility_0600_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
} }
commonEvent.createSubscriber(subscriberInfoActsStartAbility0600).then(async (data) => { commonEvent.createSubscriber(subscriberInfoActsStartAbility0600).then(async (data) => {
...@@ -1104,7 +1102,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1104,7 +1102,7 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.moduleName).assertEqual("entry"); expect(data.moduleName).assertEqual("entry");
expect(data.process).assertEqual("processTestAbility"); expect(data.process).assertEqual("processTestAbility");
expect(data.targetAbility).assertEqual(""); expect(data.targetAbility).assertEqual("");
expect(data.backgroundModes).assertEqual(0); expect(data.backgroundModes).assertEqual(1);
expect(data.isVisible).assertEqual(true); expect(data.isVisible).assertEqual(true);
expect(data.formEnabled).assertEqual(false); expect(data.formEnabled).assertEqual(false);
expect(data.type).assertEqual(1); expect(data.type).assertEqual(1);
...@@ -1185,20 +1183,20 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1185,20 +1183,20 @@ describe('ActsFeatureAbilityTest', function () {
expect(typeof (data.moduleName)).assertEqual("string"); expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.mainAbilityName)).assertEqual("string"); expect(typeof (data.mainAbilityName)).assertEqual("string");
expect(typeof (data.installationFree)).assertEqual("boolean"); 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.description).assertEqual("descriptionTest");
expect(data.descriptionId).assertEqual(0); expect(data.descriptionId).assertEqual(0);
expect(data.icon).assertEqual("$media:icon"); expect(data.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:app_name"); expect(data.label).assertEqual("$string:app_name");
expect(data.labelId).assertEqual(0); expect(data.labelId).assertEqual(16777216);
expect(data.iconId).assertEqual(0); expect(data.iconId).assertEqual(16777219);
expect(data.backgroundImg).assertEqual(""); expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1");
expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2");
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("entry") expect(data.moduleName).assertEqual("entry")
expect(data.mainAbilityName).assertEqual(""); expect(data.mainAbilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility");
expect(data.installationFree).assertEqual(false); expect(data.installationFree).assertEqual(false);
console.info("checkHapModuleInfo end " + data); console.info("checkHapModuleInfo end " + data);
} }
...@@ -1578,7 +1576,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1578,7 +1576,6 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.event).assertEqual("ACTS_StartAbility_1300_CommonEvent"); expect(data.event).assertEqual("ACTS_StartAbility_1300_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
done();
} }
commonEvent.createSubscriber(subscriberInfoStartAbilityThirteen).then(async (data) => { commonEvent.createSubscriber(subscriberInfoStartAbilityThirteen).then(async (data) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册