提交 91a7a589 编写于 作者: J jiyong_sd

modified FA-J

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: Ie17da593db9f4d9ec2d9a3b073d2d99a657b65a6
上级 4080f9ad
文件模式从 100755 更改为 100644
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsAccessTokenTest") { ohos_js_hap_suite("ActsBmsAccessTokenTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsAccessTokenTest" hap_name = "ActsBmsAccessTokenTest"
} }
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 = "./src/main/config.json"
ohos_resources("hjs_demo_resources") { source_dir = "./src/main/js"}
sources = [ "./entry/src/main/js/resources" ] ohos_resources("hjs_demo_resources") {
hap_profile = "./entry/src/main/config.json" sources = [ "./src/main/resources" ]
} hap_profile = "./src/main/config.json"
}
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "120000", "test-timeout": "120000",
"package": "com.example.actsbmsaccesstokentest", "shell-timeout": "120000",
"shell-timeout": "60000" "bundle-name": "com.example.actsbmsaccesstokentest",
}, "package-name": "com.example.actsbmsaccesstokentest"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"ActsBmsAccessTokenTest.hap" "test-file-name": [
], "ActsBmsAccessTokenTest.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
}, "cleanup-apps": true
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"remount", "run-command": [
"mkdir /data/test" "remount",
] "mkdir /data/test"
}, ]
{ },
"type": "PushKit", {
"push": [ "type": "PushKit",
"bmsAccessTokenTest1.hap->/data/test/bmsAccessTokenTest1.hap", "push": [
"bmsAccessTokenTest2.hap->/data/test/bmsAccessTokenTest2.hap", "bmsAccessTokenTest1.hap->/data/test/bmsAccessTokenTest1.hap",
"bmsAccessTokenTest3.hap->/data/test/bmsAccessTokenTest3.hap", "bmsAccessTokenTest2.hap->/data/test/bmsAccessTokenTest2.hap",
"bmsAccessTokenTest4.hap->/data/test/bmsAccessTokenTest4.hap", "bmsAccessTokenTest3.hap->/data/test/bmsAccessTokenTest3.hap",
"bmsAccessTokenTest5.hap->/data/test/bmsAccessTokenTest5.hap" "bmsAccessTokenTest4.hap->/data/test/bmsAccessTokenTest4.hap",
] "bmsAccessTokenTest5.hap->/data/test/bmsAccessTokenTest5.hap"
}, ]
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"bm install -p /data/test/bmsAccessTokenTest1.hap", "run-command": [
"bm install -p /data/test/bmsAccessTokenTest4.hap", "bm install -p /data/test/bmsAccessTokenTest1.hap",
"bm install -p /data/test/bmsAccessTokenTest3.hap", "bm install -p /data/test/bmsAccessTokenTest4.hap",
"bm install -p /data/test/bmsAccessTokenTest2.hap", "bm install -p /data/test/bmsAccessTokenTest3.hap",
"bm install -p /data/test/bmsAccessTokenTest5.hap" "bm install -p /data/test/bmsAccessTokenTest2.hap",
], "bm install -p /data/test/bmsAccessTokenTest5.hap"
"teardown-command":[ ],
"bm uninstall -n com.example.bmsaccesstoken1", "teardown-command": [
"bm uninstall -n com.example.bmsaccesstoken2", "bm uninstall -n com.example.bmsaccesstoken1",
"bm uninstall -n com.example.bmsaccesstoken3", "bm uninstall -n com.example.bmsaccesstoken2",
"rm -rf /data/test/" "bm uninstall -n com.example.bmsaccesstoken3",
] "rm -rf /data/test/"
} ]
] }
} ]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsaccesstokentest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsaccesstokentest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsbmsaccesstokentest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsaccesstokentest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsaccesstokentest",
"name": ".entry",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"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": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
export default { data: {
data: { title: 'Test AccessToken'
title: 'Test AccessToken' },
}, onInit() {
onInit() { this.title = 'Test AccessToken';
this.title = 'Test AccessToken'; },
}, onShow() {
onShow() { console.info('onReady finish')
console.info('onReady finish') },
const core = Core.getInstance() onReady() {
const expectExtend = new ExpectExtend({ },
'id': 'extend' onBackPress(){
}) }
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
onBackPress(){
}
} }
\ 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
.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;
}
@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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</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);
})
}
};
...@@ -15,13 +15,14 @@ ...@@ -15,13 +15,14 @@
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import account from '@ohos.account.osAccount' import account from '@ohos.account.osAccount'
import { describe,beforeAll, it, expect } from 'deccjsunit/index' import { describe,beforeAll, it, expect } from '@ohos/hypium'
const BUNDLE_NAME1 = 'com.example.bmsaccesstoken1'; const BUNDLE_NAME1 = 'com.example.bmsaccesstoken1';
const BUNDLE_NAME2 = 'com.example.bmsaccesstoken2'; const BUNDLE_NAME2 = 'com.example.bmsaccesstoken2';
const BUNDLE_NAME3 = 'com.example.bmsaccesstoken3'; const BUNDLE_NAME3 = 'com.example.bmsaccesstoken3';
let userId = 0; let userId = 0;
export default function ActsBmsAccessTokenTest() {
describe('ActsBmsAccessTokenTest', function () { describe('ActsBmsAccessTokenTest', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
...@@ -190,3 +191,4 @@ describe('ActsBmsAccessTokenTest', function () { ...@@ -190,3 +191,4 @@ describe('ActsBmsAccessTokenTest', function () {
}); });
}); });
}
...@@ -13,4 +13,7 @@ ...@@ -13,4 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
require('./ActsBmsJsUnPermissionTest.test.js') import ActsBmsAccessTokenTest from './ActsBmsAccessTokenTest.test.js'
\ No newline at end of file export default function testsuite() {
ActsBmsAccessTokenTest()
}
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
} },
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
] ]
} }
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsBmsGetInfosTest") { ohos_js_hap_suite("ActsBmsGetInfosTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsGetInfosTest" hap_name = "ActsBmsGetInfosTest"
subsystem_name = "bundlemanager" subsystem_name = "bundlemanager"
part_name = "bundle_framework" part_name = "bundle_framework"
} }
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 = "./src/main/config.json"
ohos_resources("hjs_demo_resources") { source_dir = "./src/main/js"}
sources = [ "./entry/src/main/js/resources" ] ohos_resources("hjs_demo_resources") {
hap_profile = "./entry/src/main/config.json" sources = [ "./src/main/resources" ]
} hap_profile = "./src/main/config.json"
}
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "180000", "test-timeout": "180000",
"package": "com.example.actsbmsgetinfostest", "shell-timeout": "60000",
"shell-timeout": "60000" "bundle-name": "com.example.actsbmsgetinfostest",
}, "package-name": "com.example.actsbmsgetinfostest"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"bmsSystemBundleTest1.hap", "test-file-name": [
"bmsVendorBundleTest1.hap", "bmsSystemBundleTest1.hap",
"ActsBmsGetInfosTest.hap" "bmsVendorBundleTest1.hap",
], "ActsBmsGetInfosTest.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
}, "cleanup-apps": true
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"remount", "run-command": [
"mkdir /data/test" "remount",
] "mkdir /data/test"
}, ]
{ },
"type": "PushKit", {
"push": [ "type": "PushKit",
"bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap", "push": [
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap", "bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap",
"bmsThirdBundleTest3.hap->/data/test/bmsThirdBundleTest3.hap", "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap",
"bmsThirdBundleTest4.hap->/data/test/bmsThirdBundleTest4.hap", "bmsThirdBundleTest3.hap->/data/test/bmsThirdBundleTest3.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap", "bmsThirdBundleTest4.hap->/data/test/bmsThirdBundleTest4.hap",
"bmsThirdBundleTest6.hap->/data/test/bmsThirdBundleTest6.hap", "bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap", "bmsThirdBundleTest6.hap->/data/test/bmsThirdBundleTest6.hap",
"bmsSystemBundleTest2.hap->/data/test/bmsSystemBundleTest2.hap" "bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap",
] "bmsSystemBundleTest2.hap->/data/test/bmsSystemBundleTest2.hap"
}, ]
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"bm install -p /data/test/bmsThirdBundleTest1.hap", "run-command": [
"bm install -p /data/test/bmsThirdBundleTest2.hap", "bm install -p /data/test/bmsThirdBundleTest1.hap",
"bm install -p /data/test/bmsThirdBundleTest3.hap", "bm install -p /data/test/bmsThirdBundleTest2.hap",
"bm install -p /data/test/bmsThirdBundleTest4.hap", "bm install -p /data/test/bmsThirdBundleTest3.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap", "bm install -p /data/test/bmsThirdBundleTest4.hap",
"bm install -p /data/test/bmsThirdBundleTest6.hap", "bm install -p /data/test/bmsThirdBundleTest5.hap",
"bm install -p /data/test/bmsSystemBundleTest2.hap" "bm install -p /data/test/bmsThirdBundleTest6.hap",
], "bm install -p /data/test/bmsSystemBundleTest2.hap"
"teardown-command":[ ],
"bm uninstall -n com.example.third1", "teardown-command": [
"bm uninstall -n com.example.third2", "bm uninstall -n com.example.third1",
"bm uninstall -n com.example.third4", "bm uninstall -n com.example.third2",
"bm uninstall -n com.example.third5", "bm uninstall -n com.example.third4",
"bm uninstall -n com.example.third6", "bm uninstall -n com.example.third5",
"bm uninstall -n com.example.system2", "bm uninstall -n com.example.third6",
"rm -rf /data/test/" "bm uninstall -n com.example.system2",
] "rm -rf /data/test/"
} ]
] }
]
} }
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsgetinfostest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsgetinfostest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsbmsgetinfostest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsgetinfostest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsgetinfostest",
"name": ".entry",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"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": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 {Core, ExpectExtend} from 'deccjsunit' import {Core, ExpectExtend} from 'deccjsunit'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default { export default {
data: { data: {
title: 'Test actsbmsgetinfostest' title: 'Test actsbmsgetinfostest'
}, },
onInit() { onInit() {
this.title = 'Test actsbmsgetinfostest'; this.title = 'Test actsbmsgetinfostest';
}, },
onShow() { onShow() {
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() },
const expectExtend = new ExpectExtend({ onReady() {
'id': 'extend' },
}) onBackPress(){
core.addService('expect', expectExtend) }
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
onBackPress(){
}
} }
\ 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
.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;
}
@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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</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);
})
}
};
...@@ -43,6 +43,7 @@ const VOIP = 128; ...@@ -43,6 +43,7 @@ const VOIP = 128;
const TASKKEEPING = 256; const TASKKEEPING = 256;
let userId = 0; let userId = 0;
export default function ActsBmsGetBackGroundModes() {
describe('ActsBmsGetBackGroundModes', function () { describe('ActsBmsGetBackGroundModes', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
...@@ -204,4 +205,4 @@ describe('ActsBmsGetBackGroundModes', function () { ...@@ -204,4 +205,4 @@ describe('ActsBmsGetBackGroundModes', function () {
done(); done();
}); });
}) })}
\ No newline at end of file
...@@ -23,6 +23,7 @@ const ACTION_NAME = 'action.system.home'; ...@@ -23,6 +23,7 @@ const ACTION_NAME = 'action.system.home';
const ENTITY_NAME = 'entity.system.home'; const ENTITY_NAME = 'entity.system.home';
let userId = 0; let userId = 0;
export default function ActsBmsQueryAbilityByWant() {
describe('ActsBmsQueryAbilityByWant', function () { describe('ActsBmsQueryAbilityByWant', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
...@@ -180,4 +181,4 @@ describe('ActsBmsQueryAbilityByWant', function () { ...@@ -180,4 +181,4 @@ describe('ActsBmsQueryAbilityByWant', function () {
expect(data.enabled).assertEqual(true); expect(data.enabled).assertEqual(true);
} }
}) })}
\ No newline at end of file
...@@ -12,5 +12,9 @@ ...@@ -12,5 +12,9 @@
* 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('./ActsBmsQueryAbilityByWant.test.js') import ActsBmsGetBackGroundModes from './ActsBmsQueryAbilityByWant.test.js'
require('./ActsBmsGetBackGroundModes.test.js') import ActsBmsQueryAbilityByWant from './ActsBmsGetBackGroundModes.test.js'
export default function testsuite() {
ActsBmsGetBackGroundModes()
ActsBmsQueryAbilityByWant()
}
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
} },
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
] ]
} }
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsHapModuleTest") { ohos_js_hap_suite("ActsBmsHapModuleTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsHapModuleTest" hap_name = "ActsBmsHapModuleTest"
} }
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 = "./src/main/config.json"
ohos_resources("hjs_demo_resources") { source_dir = "./src/main/js"}
sources = [ "./entry/src/main/js/resources" ] ohos_resources("hjs_demo_resources") {
hap_profile = "./entry/src/main/config.json" sources = [ "./src/main/resources" ]
} hap_profile = "./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": "60000",
"package": "com.example.actsbmshapmoduletest", "shell-timeout": "60000",
"shell-timeout": "60000" "bundle-name": "com.example.actsbmshapmoduletest",
}, "package-name": "com.example.actsbmshapmoduletest"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"ActsBmsHapModuleTest.hap", "test-file-name": [
"bmsSystemBundleTest1.hap" "ActsBmsHapModuleTest.hap",
], "bmsSystemBundleTest1.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
}, "cleanup-apps": true
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"remount", "run-command": [
"mkdir /data/test" "remount",
] "mkdir /data/test"
}, ]
{ },
"type": "PushKit", {
"push": [ "type": "PushKit",
"bmsMainAbilityFirstScene.hap->/data/test/bmsMainAbilityFirstScene.hap", "push": [
"bmsMainAbilitySecondScene.hap->/data/test/bmsMainAbilitySecondScene.hap", "bmsMainAbilityFirstScene.hap->/data/test/bmsMainAbilityFirstScene.hap",
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap", "bmsMainAbilitySecondScene.hap->/data/test/bmsMainAbilitySecondScene.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap" "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap",
] "bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap"
}, ]
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"chmod 644 /data/test/*.hap", "run-command": [
"bm install -p /data/test/bmsMainAbilityFirstScene.hap", "chmod 644 /data/test/*.hap",
"bm install -p /data/test/bmsMainAbilitySecondScene.hap", "bm install -p /data/test/bmsMainAbilityFirstScene.hap",
"bm install -p /data/test/bmsThirdBundleTest2.hap", "bm install -p /data/test/bmsMainAbilitySecondScene.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap" "bm install -p /data/test/bmsThirdBundleTest2.hap",
], "bm install -p /data/test/bmsThirdBundleTest5.hap"
"teardown-command":[ ],
"bm uninstall -n com.example.third2", "teardown-command": [
"bm uninstall -n com.example.third5", "bm uninstall -n com.example.third2",
"bm uninstall -n com.example.bmsmainabilityfirstscene", "bm uninstall -n com.example.third5",
"rm -rf /data/test/" "bm uninstall -n com.example.bmsmainabilityfirstscene",
] "rm -rf /data/test/"
} ]
] }
} ]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmshapmoduletest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmshapmoduletest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsbmshapmoduletest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmshapmoduletest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmshapmoduletest",
"name": ".entry",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"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": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
export default { data: {
data: { title: 'Test HapModuleInfo'
title: 'Test HapModuleInfo' },
}, onInit() {
onInit() { this.title = 'Test HapModuleInfo';
this.title = 'Test HapModuleInfo'; },
}, onShow() {
onShow() { console.info('onReady finish')
console.info('onReady finish') },
const core = Core.getInstance() onReady() {
const expectExtend = new ExpectExtend({ }
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
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
.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;
}
@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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</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,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
const BUNDLE_NAME1 = 'com.example.bmsmainabilityfirstscene'; const BUNDLE_NAME1 = 'com.example.bmsmainabilityfirstscene';
const BUNDLE_NAME2 = 'com.example.third2'; const BUNDLE_NAME2 = 'com.example.third2';
...@@ -27,6 +27,7 @@ const MODULE_NAME = 'entry'; ...@@ -27,6 +27,7 @@ const MODULE_NAME = 'entry';
const LABEL = '$string:app_name'; const LABEL = '$string:app_name';
const DEVICE_TYPES = 'phone'; const DEVICE_TYPES = 'phone';
export default function ActsBmsHapModuleTest() {
describe('ActsBmsHapModuleTest', function () { describe('ActsBmsHapModuleTest', function () {
/* /*
...@@ -221,4 +222,4 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -221,4 +222,4 @@ describe('ActsBmsHapModuleTest', function () {
expect(info.hashValue).assertEqual(""); expect(info.hashValue).assertEqual("");
} }
}) })}
\ No newline at end of file
...@@ -13,4 +13,7 @@ ...@@ -13,4 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
require('./ActsBmsAccessTokenTest.test.js') import ActsBmsHapModuleTest from './ActsBmsHapModuleTest.test.js'
\ No newline at end of file export default function testsuite() {
ActsBmsHapModuleTest()
}
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
} },
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
] ]
} }
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsJsTest") { ohos_js_hap_suite("ActsBmsJsTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsJsTest" hap_name = "ActsBmsJsTest"
} }
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 = "./src/main/config.json"
ohos_resources("hjs_demo_resources") { source_dir = "./src/main/js"}
sources = [ "./entry/src/main/js/resources" ] ohos_resources("hjs_demo_resources") {
hap_profile = "./entry/src/main/config.json" sources = [ "./src/main/resources" ]
} hap_profile = "./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": "60000",
"package": "com.example.actsbmsjstest", "shell-timeout": "60000",
"shell-timeout": "60000" "bundle-name": "com.example.actsbmsjstest",
}, "package-name": "com.example.actsbmsjstest"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"ActsBmsJsTest.hap" "test-file-name": [
], "ActsBmsJsTest.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
}, "cleanup-apps": true
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"remount", "run-command": [
"mkdir /data/test" "remount",
] "mkdir /data/test"
}, ]
{ },
"type": "PushKit", {
"push": [ "type": "PushKit",
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap", "push": [
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap", "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap",
"bmsThirdBundleJs.hap->/data/test/bmsThirdBundleJs.hap", "bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsThirdBundleC.hap->/data/test/bmsThirdBundleC.hap" "bmsThirdBundleJs.hap->/data/test/bmsThirdBundleJs.hap",
] "bmsThirdBundleC.hap->/data/test/bmsThirdBundleC.hap"
}, ]
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"chmod 644 /data/test/*.hap", "run-command": [
"bm install -p /data/test/bmsThirdBundleTest2.hap", "chmod 644 /data/test/*.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap", "bm install -p /data/test/bmsThirdBundleTest2.hap",
"bm install -p /data/test/bmsThirdBundleJs.hap", "bm install -p /data/test/bmsThirdBundleTest5.hap",
"bm install -p /data/test/bmsThirdBundleC.hap" "bm install -p /data/test/bmsThirdBundleJs.hap",
], "bm install -p /data/test/bmsThirdBundleC.hap"
"teardown-command":[ ],
"bm uninstall -n com.example.third2", "teardown-command": [
"bm uninstall -n com.example.third5", "bm uninstall -n com.example.third2",
"bm uninstall -n com.example.js", "bm uninstall -n com.example.third5",
"bm uninstall -n com.example.c", "bm uninstall -n com.example.js",
"rm -rf /data/test/" "bm uninstall -n com.example.c",
] "rm -rf /data/test/"
} ]
] }
} ]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsjstest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsjstest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true,
"srcPath": "default"
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsjstest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsjstest",
"name": ".entry",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"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": "standard"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.GET_BUNDLE_INFO"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
export default { data: {
data: { title: "Test Multi Js Ability"
title: "Test Multi Js Ability" },
}, onInit() {
onInit() { this.title = "Test Multi Js Ability";
this.title = "Test Multi Js Ability"; },
}, onShow() {
onShow() { },
}, onReady() {
onReady() { console.info('onShow finish')
console.info('onShow finish') const core = Core.getInstance()
const core = Core.getInstance() const expectExtend = new ExpectExtend({
const expectExtend = new ExpectExtend({ 'id': 'extend'
'id': 'extend' })
}) core.addService('expect', expectExtend)
core.addService('expect', expectExtend) core.init()
core.init() const configService = core.getDefaultService('config')
const configService = core.getDefaultService('config') configService.setConfig(this)
configService.setConfig(this) require('../../../test/List.test')
require('../../../test/List.test') core.execute()
core.execute() }
}
} }
\ 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
.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;
}
@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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</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);
})
}
};
/* /*
* Copyright (c) 2022 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 pkg from '@system.package' import pkg from '@system.package'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
const NUM_TWO = 2; const NUM_TWO = 2;
const ERR_CODE = 202; const ERR_CODE = 202;
const ERR_MERSSAGE = 'value is not an available number'; const ERR_MERSSAGE = 'value is not an available number';
describe('ActsBmsHasInstalldTest', function () { export default function ActsBmsHasInstalldTest() {
describe('ActsBmsHasInstalldTest', function () {
/**
* @tc.number hasInstalled_0100 /**
* @tc.name Package::hasInstalled * @tc.number hasInstalled_0100
* @tc.desc Test hasInstalled interface. * @tc.name Package::hasInstalled
*/ * @tc.desc Test hasInstalled interface.
it('hasInstalled_0100', 0, async function (done) { */
pkg.hasInstalled({ it('hasInstalled_0100', 0, async function (done) {
bundleName: 'com.ohos.launcher', pkg.hasInstalled({
success: function success(data) { bundleName: 'com.ohos.launcher',
console.info('hasInstalled success function in'); success: function success(data) {
expect(data.result).assertTrue(); console.info('hasInstalled success function in');
done(); expect(data.result).assertTrue();
}, done();
fail: function fail(data, code) { },
console.info('hasInstalled fail function in'); fail: function fail(data, code) {
expect().assertFail(); console.info('hasInstalled fail function in');
done(); expect().assertFail();
}, done();
complete: function complete() { },
console.info('hasInstalled complete function in'); complete: function complete() {
expect().assertFail(); console.info('hasInstalled complete function in');
done(); expect().assertFail();
} done();
}); }
}); });
});
/**
* @tc.number hasInstalled_0200 /**
* @tc.name Package::hasInstalled * @tc.number hasInstalled_0200
* @tc.desc Test hasInstalled interface. * @tc.name Package::hasInstalled
*/ * @tc.desc Test hasInstalled interface.
it('hasInstalled_0200', 0, async function (done) { */
pkg.hasInstalled({ it('hasInstalled_0200', 0, async function (done) {
bundleName: 'wrongName', pkg.hasInstalled({
success: function success(data) { bundleName: 'wrongName',
console.info('hasInstalled success function in'); success: function success(data) {
expect(data.result).assertFalse(); console.info('hasInstalled success function in');
done(); expect(data.result).assertFalse();
}, done();
fail: function fail(data, code) { },
console.info('hasInstalled fail function in'); fail: function fail(data, code) {
expect().assertFail(); console.info('hasInstalled fail function in');
done(); expect().assertFail();
}, done();
complete: function complete() { },
console.info('hasInstalled complete function in'); complete: function complete() {
expect().assertFail(); console.info('hasInstalled complete function in');
done(); expect().assertFail();
} done();
}); }
}); });
});
/**
* @tc.number hasInstalled_0300 /**
* @tc.name Package::hasInstalled * @tc.number hasInstalled_0300
* @tc.desc Test hasInstalled interface. * @tc.name Package::hasInstalled
*/ * @tc.desc Test hasInstalled interface.
it('hasInstalled_0300', 0, async function (done) { */
pkg.hasInstalled({ it('hasInstalled_0300', 0, async function (done) {
bundleName: 'wrongName', pkg.hasInstalled({
success: function success(data) { bundleName: 'wrongName',
console.info('hasInstalled success function in'); success: function success(data) {
expect(data.result).assertFalse(); console.info('hasInstalled success function in');
done(); expect(data.result).assertFalse();
} done();
}); }
}); });
});
/**
* @tc.number hasInstalled_0400 /**
* @tc.name Package::hasInstalled * @tc.number hasInstalled_0400
* @tc.desc Test hasInstalled interface. * @tc.name Package::hasInstalled
*/ * @tc.desc Test hasInstalled interface.
it('hasInstalled_0400', 0, async function (done) { */
let flag = 0; it('hasInstalled_0400', 0, async function (done) {
pkg.hasInstalled({ let flag = 0;
bundleName: NUM_TWO, pkg.hasInstalled({
success: function success(data) { bundleName: NUM_TWO,
console.info('hasInstalled success function in'); success: function success(data) {
expect().assertFail(); console.info('hasInstalled success function in');
done(); expect().assertFail();
}, done();
fail: function fail(data, code) { },
flag += 2; fail: function fail(data, code) {
console.info('hasInstalled fail function in'); flag += 2;
expect(data).assertEqual(ERR_MERSSAGE); console.info('hasInstalled fail function in');
expect(code).assertEqual(ERR_CODE); expect(data).assertEqual(ERR_MERSSAGE);
}, expect(code).assertEqual(ERR_CODE);
complete: function complete() { },
flag += 3; complete: function complete() {
console.info('hasInstalled complete function in'); flag += 3;
expect(flag).assertEqual(5) console.info('hasInstalled complete function in');
done(); expect(flag).assertEqual(5)
} done();
}); }
}); });
});
/*
* @tc.number: hasInstalled_0500 /*
* @tc.name: test hasInstalled bundleName is number * @tc.number: hasInstalled_0500
* @tc.desc: test hasInstalled bundleName is number without function fail * @tc.name: test hasInstalled bundleName is number
* @tc.level 3 * @tc.desc: test hasInstalled bundleName is number without function fail
*/ * @tc.level 3
it('hasInstalled_0500', 0, async function (done) { */
pkg.hasInstalled({ it('hasInstalled_0500', 0, async function (done) {
bundleName: NUM_TWO, pkg.hasInstalled({
success: function success(data) { bundleName: NUM_TWO,
console.info('hasInstalled success' + JSON.stringify(data)); success: function success(data) {
expect(error).assertFail(); console.info('hasInstalled success' + JSON.stringify(data));
done(); expect(error).assertFail();
}, done();
complete: function complete() { },
console.info('hasInstalled complete'); complete: function complete() {
done(); console.info('hasInstalled complete');
} done();
}) }
}); })
});
/*
* @tc.number: hasInstalled_0600 /*
* @tc.name: test hasInstalled bundleName is number * @tc.number: hasInstalled_0600
* @tc.desc: test hasInstalled bundleName is number without function complete * @tc.name: test hasInstalled bundleName is number
* @tc.level 3 * @tc.desc: test hasInstalled bundleName is number without function complete
*/ * @tc.level 3
it('hasInstalled_0600', 0, async function (done) { */
pkg.hasInstalled({ it('hasInstalled_0600', 0, async function (done) {
bundleName: NUM_TWO, pkg.hasInstalled({
success: function success(data) { bundleName: NUM_TWO,
console.info('hasInstalled success' + JSON.stringify(data)); success: function success(data) {
expect(error).assertFail(); console.info('hasInstalled success' + JSON.stringify(data));
done(); expect(error).assertFail();
}, done();
fail: function fail(data, code) { },
console.info('hasInstalled fail'); fail: function fail(data, code) {
expect(data).assertEqual("value is not an available number"); console.info('hasInstalled fail');
expect(code).assertEqual(202); expect(data).assertEqual("value is not an available number");
done(); expect(code).assertEqual(202);
} done();
}) }
}); })
}) });
\ No newline at end of file })}
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import pkg from '@system.package' import pkg from '@system.package'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
const NUM_TWO = 2; const NUM_TWO = 2;
const NUM_FOUR = 4; const NUM_FOUR = 4;
...@@ -31,6 +31,7 @@ const ABILITIY_NAME6 = "com.example.third2.MainAbilityA"; ...@@ -31,6 +31,7 @@ const ABILITIY_NAME6 = "com.example.third2.MainAbilityA";
const ABILITIY_NAME7 = "com.example.third5.MainAbilityA"; const ABILITIY_NAME7 = "com.example.third5.MainAbilityA";
const ABILITIY_NAME8 = "com.example.third5.MainAbilityB"; const ABILITIY_NAME8 = "com.example.third5.MainAbilityB";
export default function ActsBmsJsTest() {
describe('ActsBmsJsTest', function () { describe('ActsBmsJsTest', function () {
/* /*
...@@ -228,4 +229,4 @@ describe('ActsBmsJsTest', function () { ...@@ -228,4 +229,4 @@ describe('ActsBmsJsTest', function () {
expect(info.metaData[0].extra).assertEqual("$string:mainability_description"); expect(info.metaData[0].extra).assertEqual("$string:mainability_description");
expect(info.enabled).assertEqual(true); expect(info.enabled).assertEqual(true);
} }
}) })}
\ 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.
*/
import ActsBmsHasInstalldTest from './ActsBmsJsTest.test.js'
import ActsBmsJsTest from './ActsBmsHasInstalldTest.test.js'
export default function testsuite() {
ActsBmsHasInstalldTest()
ActsBmsJsTest()
}
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
} },
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
] ]
} }
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsJsUnPermissionTest") { ohos_js_hap_suite("ActsBmsJsUnPermissionTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsJsUnPermissionTest" hap_name = "ActsBmsJsUnPermissionTest"
} }
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 = "./src/main/config.json"
ohos_resources("hjs_demo_resources") { source_dir = "./src/main/js"}
sources = [ "./entry/src/main/js/resources" ] ohos_resources("hjs_demo_resources") {
hap_profile = "./entry/src/main/config.json" sources = [ "./src/main/resources" ]
} hap_profile = "./src/main/config.json"
}
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "120000", "test-timeout": "120000",
"package": "com.example.actsbmsjsunpermissiontest", "shell-timeout": "120000",
"shell-timeout": "60000" "bundle-name": "com.example.actsbmsjsunpermissiontest",
}, "package-name": "com.example.actsbmsjsunpermissiontest"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"ActsBmsJsUnPermissionTest.hap", "test-file-name": [
"bmsJstest1.hap" "ActsBmsJsUnPermissionTest.hap",
], "bmsJstest1.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
}, "cleanup-apps": true
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"remount", "run-command": [
"mkdir /data/test" "remount",
] "mkdir /data/test"
}, ]
{ },
"type": "PushKit", {
"push": [ "type": "PushKit",
"bmsJstest1.hap->/data/test/bmsJstest1.hap" "push": [
] "bmsJstest1.hap->/data/test/bmsJstest1.hap"
}, ]
{ },
"type": "ShellKit", {
"run-command": [ "type": "ShellKit",
"chmod 644 /data/test/*.hap", "run-command": [
"bm install -p /data/test/bmsJstest1.hap" "chmod 644 /data/test/*.hap",
], "bm install -p /data/test/bmsJstest1.hap"
"teardown-command":[ ],
"bm uninstall -n com.example.myapplication1" "teardown-command": [
] "bm uninstall -n com.example.myapplication1"
} ]
] }
} ]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsjsunpermissiontest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsjsunpermissiontest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsbmsjsunpermissiontest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsbmsjsunpermissiontest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsjsunpermissiontest",
"name": ".entry",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"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": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
export default { data: {
data: { title: 'Test JsUnPermission'
title: 'Test JsUnPermission' },
}, onInit() {
onInit() { this.title = 'Test JsUnPermission';
this.title = 'Test JsUnPermission'; },
}, onShow() {
onShow() { console.info('onReady finish')
console.info('onReady finish') },
const core = Core.getInstance() onReady() {
const expectExtend = new ExpectExtend({ },
'id': 'extend' onBackPress(){
}) }
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
onBackPress(){
}
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册