提交 67614664 编写于 作者: Q qu-xianfei

add gn->hvigor

Signed-off-by: Nqu-xianfei <quxianfei@huawei.com>
Change-Id: Id590215bb45ab2d25642e09526b234e55619fc16
上级 cc9736d3
...@@ -10,30 +10,13 @@ ...@@ -10,30 +10,13 @@
# 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("//build/ohos.gni") import("//build/ohos.gni")
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsScreenLockETSApiTest") {
hap_profile = "./entry/src/main/config.json" ohos_js_app_suite("ActsScreenLockETSApiTest") {
deps = [ hap_name = "ActsScreenLockETSApiTest"
":screenLock_ets_assets", testonly = true
":screenLock_ets_resources", test_hap = true
":screenLock_ets_test_assets",
]
ets2abc = true
subsystem_name = "theme" subsystem_name = "theme"
part_name = "screenlock_mgr" part_name = "screenlock_mgr"
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsScreenLockETSApiTest"
}
ohos_js_assets("screenLock_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("screenLock_ets_resources") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("screenLock_ets_test_assets") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
} }
{ {
"description": "Configuration for screenlock js api Tests", "description": "Configuration for screenlock js api Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "600000", "test-timeout": "600000",
"bundle-name": "com.acts.theme.screenlocktest", "bundle-name": "com.acts.theme.screenlocktest",
"package-name": "com.acts.theme.screenlocktest", "package-name": "com.acts.theme.screenlocktest_test",
"shell-timeout": "600000" "shell-timeout": "600000"
}, },
"kits": [ "kits": [
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"power-shell wakeup", "power-shell wakeup",
"power-shell setmode 602", "power-shell setmode 602",
"uinput -T -m 300 720 300 360 200", "uinput -T -m 300 720 300 360 200",
"uinput -T -m 650 2760 650 1380 200" "uinput -T -m 650 2760 650 1380 200"
] ]
}, },
{ {
"test-file-name": [ "test-file-name": [
"ActsScreenLockETSApiTest.hap" "ActsScreenLockETSApiTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
} }
] ]
} }
{
"app": {
"signingConfigs": [
{
"name": "default",
"material": {
"certpath": "signature/auto_ohos_default_screenlock_ets_com.acts.theme.screenlocktest.cer",
"storePassword": "0000001AC5B5996A831B62A440AD04505F31666E875CE4D3EF3E2D19709A2EE5C770C386FFFB1B2DCC0F",
"keyAlias": "debugKey",
"keyPassword": "0000001A1860A84496A78822C258EAE852EC15702B91488A75B1E9A96C920DF0938861B9832F29474E62",
"profile": "signature/auto_ohos_default_screenlock_ets_com.acts.theme.screenlocktest.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "signature/auto_ohos_default_screenlock_ets_com.acts.theme.screenlocktest.p12"
}
}
],
"compileSdkVersion": 10,
"compatibleSdkVersion": 10,
"products": [
{
"name": "default",
"signingConfig": "default"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
{
"apiType": 'faMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { legacyHapTasks } from '@ohos/hvigor-ohos-plugin';
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{ {
"app": { "app":{
"bundleName": "com.acts.theme.screenlocktest", "bundleName":"com.acts.theme.screenlocktest",
"vendor": "open", "vendor":"open",
"version": { "version":{
"code": 1000000, "code":1000000,
"name": "1.0.0" "name":"1.0.0"
}, }
"apiVersion": { },
"compatible": 7, "deviceConfig":{
"releaseType": "Release",
"target": 9 },
} "module":{
}, "package":"com.acts.theme.screenlocktest",
"deviceConfig": {}, "name":".entry",
"module": { "mainAbility":".MainAbility",
"package": "com.acts.theme.screenlocktest", "deviceType": [
"name": ".MyApplication", "tablet",
"mainAbility": "com.acts.theme.screenlocktest.MainAbility", "default"
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
], ],
"orientation": "unspecified", "distro":{
"visible": true, "deliveryWithInstall":true,
"srcPath": "MainAbility", "installationFree":false,
"name": ".MainAbility", "moduleName":"entry",
"srcLanguage": "ets", "moduleType":"entry"
"icon": "$media:icon", },
"description": "$string:description_mainability", "abilities":[
"formsEnabled": false, {
"label": "$string:entry_MainAbility", "description":"$string:description_mainability",
"type": "page", "formsEnabled":false,
"launchType": "standard" "icon":"$media:icon",
}, "label":"$string:entry_MainAbility",
{ "launchType":"standard",
"orientation": "unspecified", "name":".MainAbility",
"visible": true, "orientation":"unspecified",
"srcPath": "TestAbility", "skills":[
"name": ".TestAbility", {
"srcLanguage": "ets", "actions":[
"icon": "$media:icon", "action.system.home"
"description": "$string:TestAbility_desc", ],
"formsEnabled": false, "entities":[
"label": "$string:TestAbility_label", "entity.system.home"
"type": "page", ]
"launchType": "standard" }
} ],
], "srcLanguage":"ets",
"js": [ "srcPath":"MainAbility",
{ "type":"page",
"mode": { "visible":true
"syntax": "ets", }
"type": "pageAbility" ],
}, "js":[
"pages": [ {
"pages/index" "mode":{
], "syntax":"ets",
"name": ".MainAbility", "type":"pageAbility"
"window": { },
"designWidth": 720, "name":".MainAbility",
"autoDesignWidth": false "pages":[
} "pages/index"
}, ],
{ "window":{
"mode": { "autoDesignWidth":false,
"syntax": "ets", "designWidth":720
"type": "pageAbility" }
}, }
"pages": [ ]
"pages/index" }
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
} }
\ No newline at end of file
// @ts-nocheck
/** /**
* 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");
...@@ -13,21 +12,14 @@ ...@@ -13,21 +12,14 @@
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import hilog from '@ohos.hilog';
import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, },
onDestroy() { onDestroy() {
console.info('Application onDestroy') hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
}, },
} }
\ No newline at end of file
// @ts-nocheck /**
/** * 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. */
*/ @Entry
@Component
@Entry struct Index {
@Component @State message: string = 'Hello World'
struct MyComponent {
aboutToAppear() {
} build() {
Row() {
Column() {
build() { Text(this.message)
Flex({ .fontSize(50)
direction: FlexDirection.Column, .fontWeight(FontWeight.Bold)
alignItems: ItemAlign.Center, }
justifyContent: FlexAlign.Center .width('100%')
}) { }
Text('SCREENLOCK ETS TEST') .height('100%')
.fontSize(50) }
.fontWeight(FontWeight.Bold) }
}
.width('100%')
.height('100%')
}
}
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "entry_MainAbility",
"value": "entry_MainAbility" "value": "entry_MainAbility"
}, },
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "ETS_Empty Ability" "value": "ETS_Empty Ability"
}, },
{ {
"name": "TestAbility_desc", "name": "TestAbility_desc",
"value": "description" "value": "description"
}, },
{ {
"name": "TestAbility_label", "name": "TestAbility_label",
"value": "label" "value": "label"
} }
] ]
} }
\ No newline at end of file
{
"app":{
"bundleName":"com.acts.theme.screenlocktest",
"vendor":"open",
"version":{
"code":1000000,
"name":"1.0.0"
}
},
"deviceConfig":{
},
"module":{
"package":"com.acts.theme.screenlocktest_test",
"name":".entry_test",
"mainAbility":".TestAbility",
"deviceType": [
"tablet",
"default"
],
"distro":{
"deliveryWithInstall":true,
"installationFree":false,
"moduleName":"entry_test",
"moduleType":"feature"
},
"abilities":[
{
"description":"$string:TestAbility_desc",
"formsEnabled":false,
"icon":"$media:icon",
"label":"$string:TestAbility_label",
"launchType":"standard",
"name":".TestAbility",
"orientation":"unspecified",
"skills":[
{
"actions":[
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
],
"srcLanguage":"ets",
"srcPath":"TestAbility",
"type":"page",
"visible":true
}
],
"js":[
{
"mode":{
"syntax":"ets",
"type":"pageAbility"
},
"name":".TestAbility",
"pages":[
"pages/index"
],
"window":{
"autoDesignWidth":false,
"designWidth":720
}
}
]
}
}
\ No newline at end of file
import hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
export default {
onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
//Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
abilityDelegatorArguments.parameters['-s timeout'] = 300000
setTimeout(()=>{
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},3000)
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
},
}
\ No newline at end of file
// @ts-nocheck /**
/** * 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 router from '@system.router';
import router from '@system.router'; import hilog from '@ohos.hilog';
@Entry @Entry
@Component @Component
struct Index { struct Index {
aboutToAppear() { aboutToAppear() {
console.info('TestAbility index aboutToAppear') hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
} }
@State message: string = 'Hello World' @State message: string = 'Hello World'
build() { build() {
Row() { Row() {
Column() { Column() {
Text(this.message) Text(this.message)
.fontSize(50) .fontSize(50)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
Button() { Button() {
Text('next page') Text('next page')
.fontSize(20) .fontSize(20)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule) }.type(ButtonType.Capsule)
.margin({ .margin({
top: 20 top: 20
}) })
.backgroundColor('#0D9FFB') .backgroundColor('#0D9FFB')
.width('35%') .width('35%')
.height('5%') .height('5%')
.onClick(()=>{ .onClick(()=>{
}) })
} }
.width('100%') .width('100%')
} }
.height('100%') .height('100%')
} }
} }
\ No newline at end of file
// @ts-nocheck import hilog from '@ohos.hilog';
/** import TestRunner from '@ohos.application.testRunner';
* Copyright (c) 2021 Huawei Device Co., Ltd. import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
* 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined var abilityDelegator = undefined
var abilityDelegatorArguments = undefined var abilityDelegatorArguments = undefined
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'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback'); hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s',
JSON.stringify(err) ?? '');
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -47,32 +19,35 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -47,32 +19,35 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare') hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
} }
onRun() { onRun() {
console.log('OpenHarmonyTestRunner onRun run') hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) var debug = abilityDelegatorArguments.parameters['-D']
console.info('cmd : '+cmd) if (debug == 'true')
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err)); hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s',
console.info('executeShellCommand : data : ' + d.stdResult); JSON.stringify(err) ?? '');
console.info('executeShellCommand : data : ' + d.exitCode); hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s',
d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s',
d.exitCode ?? '');
}) })
console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
/* /*
* 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 screenLockJSUnit from './screenLockTest.test'; import screenLockJSUnit from './screenLockTest.test';
import ScreenLockPromiseTest from './screenLockPromiseTest.test'; import ScreenLockPromiseTest from './screenLockPromiseTest.test';
export default function testsuite() { export default function testsuite() {
screenLockJSUnit(); screenLockJSUnit();
ScreenLockPromiseTest() ScreenLockPromiseTest()
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import screenLock from '@ohos.screenLock'; import screenLock from '@ohos.screenLock';
import { describe, expect, it, beforeEach} from "hypium/index"; import { describe, expect, it, beforeEach} from "@ohos/hypium";
const SLEEP_TIME = 1000; const SLEEP_TIME = 1000;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import screenLock from '@ohos.screenLock'; import screenLock from '@ohos.screenLock';
import { describe, expect, it, beforeEach} from "hypium/index"; import { describe, expect, it, beforeEach} from "@ohos/hypium";
export default function screenLockJSUnit() { export default function screenLockJSUnit() {
const INTERACTIVE_STATE_END_SLEEP = 0; const INTERACTIVE_STATE_END_SLEEP = 0;
......
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}
此差异已折叠。
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { legacyAppTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
:fail
exit /b 1
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "myapplication454434",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
-----BEGIN CERTIFICATE-----
MIICFzCCAZygAwIBAgIJAK7cmQp75ZEZMAoGCCqGSM49BAMDMGMxCzAJBgNVBAYT
AkNOMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkg
VGVhbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjMw
NjIwMDkzNTExWhcNMzMwNjE3MDkzNTExWjBKMRUwEwYDVQQDDAxpZGVfZGVtb19h
cHAxDTALBgNVBAsTBFVuaXQxFTATBgNVBAoTDE9yZ2FuaXphdGlvbjELMAkGA1UE
BhMCQ04wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATtrMcEFzPIRHAYbc3foxCb
dc+xJABrxzkHsyAT+pJI00rW0wkD5wrIDpSm3+l5p1PuLpKR2z5cJMiJ+/5mz9tG
o1IwUDAdBgNVHQ4EFgQUF0OqHtywFA5+Zg0roFSxDJ9tE7AwDgYDVR0PAQH/BAQD
AgeAMB8GA1UdIwQYMBaAFNuGtyIW1QuhS7fdJXu58QV9oi1HMAoGCCqGSM49BAMD
A2kAMGYCMQD2XwZdQIB/UmrVvPniYCIc6h+4ShN3XzSFkprY0nS3Yf1cow42yxd0
4I13BDMZGQECMQDs4v2MRvHn9op5f6m3Xk74oQctmouPAFPBySTdJEkTvjBmHCWo
opXdkuN7K3aJy8M=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
-----END CERTIFICATE-----
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIBNTCB3AIBADBKMRUwEwYDVQQDDAxpZGVfZGVtb19hcHAxDTALBgNVBAsTBFVu
aXQxFTATBgNVBAoTDE9yZ2FuaXphdGlvbjELMAkGA1UEBhMCQ04wWTATBgcqhkjO
PQIBBggqhkjOPQMBBwNCAATtrMcEFzPIRHAYbc3foxCbdc+xJABrxzkHsyAT+pJI
00rW0wkD5wrIDpSm3+l5p1PuLpKR2z5cJMiJ+/5mz9tGoDAwLgYJKoZIhvcNAQkO
MSEwHzAdBgNVHQ4EFgQUF0OqHtywFA5+Zg0roFSxDJ9tE7AwCgYIKoZIzj0EAwID
SAAwRQIhAKkEYWPuKZfwDDlBKAviv601MdcH+ey2PtDO1GFOYnu+AiB82BKLIrQg
nF+ox7ZfbBypFnrBp70GO4a/19lRR22tSg==
-----END NEW CERTIFICATE REQUEST-----
...@@ -9,31 +9,15 @@ ...@@ -9,31 +9,15 @@
# 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("//build/ohos.gni") import("//build/ohos.gni")
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsWallpaperETSApiTest") {
hap_profile = "./entry/src/main/config.json" ohos_js_app_suite("ActsWallpaperETSApiTest") {
deps = [ hap_name = "ActsWallpaperETSApiTest"
":wallPaper_ets_assets", testonly = true
":wallPaper_ets_resources", test_hap = true
":wallPaper_ets_test_assets",
]
ets2abc = true
subsystem_name = "theme" subsystem_name = "theme"
part_name = "wallpaper_mgr" part_name = "wallpaper_mgr"
certificate_profile = "./signature/ActsWallpaperEtsAPITest.p7b"
hap_name = "ActsWallpaperETSApiTest"
}
ohos_js_assets("wallPaper_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("wallPaper_ets_resources") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("wallPaper_ets_test_assets") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
} }
{ {
"description": "Configuration for wallpaper js api Tests", "description": "Configuration for wallpaper js api Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "600000", "test-timeout": "600000",
"bundle-name": "com.acts.theme.wallpapertest", "bundle-name": "com.acts.theme.wallpapertest",
"package-name": "com.acts.theme.wallpapertest", "package-name": "com.acts.theme.wallpapertest_test",
"shell-timeout": "600000" "shell-timeout": "600000"
}, },
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsWallpaperETSApiTest.hap" "ActsWallpaperETSApiTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
}, },
{ {
"type": "PushKit", "type": "PushKit",
"pre-push": [ "pre-push": [
"mount -o rw,remount /", "mount -o rw,remount /",
"mkdir -p /data/app/el2/100/base/com.acts.theme.wallpapertest/haps" "mkdir -p /data/app/el2/100/base/com.acts.theme.wallpapertest/haps"
], ],
"push": [ "push": [
"./resource/wallpaper/wp.png ->/data/app/el2/100/base/com.acts.theme.wallpapertest/haps/wp.png" "./resource/wallpaper/wp.png ->/data/app/el2/100/base/com.acts.theme.wallpapertest/haps/wp.png"
] ]
} }
] ]
} }
{
"app": {
"signingConfigs": [
{
"name": "default",
"material": {
"certpath": "signature/auto_ohos_default_wallpaper_ets_com.acts.theme.wallpapertest.cer",
"storePassword": "0000001AC92C0795891C6BFE420D3217743BAA253BCC2B9DBE103CB7C6A4BBB8C0483527615579D7C875",
"keyAlias": "debugKey",
"keyPassword": "0000001A388103A0595E1B124ECEF32C847614E9F4C3C838BD56B7767AB10F0F51280B944A5EDEA2F16E",
"profile": "signature/auto_ohos_default_wallpaper_ets_com.acts.theme.wallpapertest.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "signature/auto_ohos_default_wallpaper_ets_com.acts.theme.wallpapertest.p12"
}
}
],
"compileSdkVersion": 10,
"compatibleSdkVersion": 10,
"products": [
{
"name": "default",
"signingConfig": "default"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
{
"apiType": 'faMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { legacyHapTasks } from '@ohos/hvigor-ohos-plugin';
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{ {
"app": { "app":{
"bundleName": "com.acts.theme.wallpapertest", "bundleName":"com.acts.theme.wallpapertest",
"vendor": "open", "vendor":"open",
"version": { "version":{
"code": 1000000, "code":1000000,
"name": "1.0.0" "name":"1.0.0"
}, }
"apiVersion": { },
"compatible": 7, "deviceConfig":{
"releaseType": "Release",
"target": 9 },
} "module":{
}, "package":"com.acts.theme.wallpapertest",
"deviceConfig": {}, "name":".entry",
"module": { "mainAbility":".MainAbility",
"package": "com.acts.theme.wallpapertest", "deviceType":[
"name": ".MyApplication", "tablet",
"mainAbility": "com.acts.theme.wallpapertest.MainAbility", "default"
],
"deviceType": [ "distro":{
"tablet", "deliveryWithInstall":true,
"default" "installationFree":false,
], "moduleName":"entry",
"distro": { "moduleType":"entry"
"deliveryWithInstall": true, },
"moduleName": "entry", "abilities":[
"moduleType": "entry", {
"installationFree": false "description":"$string:description_mainability",
}, "formsEnabled":false,
"abilities": [ "icon":"$media:icon",
{ "label":"$string:entry_MainAbility",
"skills": [ "launchType":"standard",
{ "name":".MainAbility",
"entities": [ "orientation":"unspecified",
"entity.system.home" "skills":[
], {
"actions": [ "actions":[
"action.system.home" "action.system.home"
] ],
} "entities":[
], "entity.system.home"
"orientation": "unspecified", ]
"visible": true, }
"srcPath": "MainAbility", ],
"name": ".MainAbility", "srcLanguage":"ets",
"srcLanguage": "ets", "srcPath":"MainAbility",
"icon": "$media:icon", "type":"page",
"description": "$string:description_mainability", "visible":true
"formsEnabled": false, }
"label": "$string:entry_MainAbility", ],
"type": "page", "js":[
"launchType": "standard" {
}, "mode":{
{ "syntax":"ets",
"orientation": "unspecified", "type":"pageAbility"
"visible": true, },
"srcPath": "TestAbility", "name":".MainAbility",
"name": ".TestAbility", "pages":[
"srcLanguage": "ets", "pages/index"
"icon": "$media:icon", ],
"description": "$string:TestAbility_desc", "window":{
"formsEnabled": false, "autoDesignWidth":false,
"label": "$string:TestAbility_label", "designWidth":720
"type": "page", }
"launchType": "standard" }
} ]
], }
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
} }
\ No newline at end of file
// @ts-nocheck
/** /**
* 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");
...@@ -13,21 +12,14 @@ ...@@ -13,21 +12,14 @@
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import hilog from '@ohos.hilog';
import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, },
onDestroy() { onDestroy() {
console.info('Application onDestroy') hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
}, },
} }
\ No newline at end of file
// @ts-nocheck /**
/** * 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. */
*/ @Entry
@Component
@Entry struct Index {
@Component @State message: string = 'Hello World'
struct MyComponent {
aboutToAppear() { build() {
} Row() {
Column() {
Text(this.message)
build() { .fontSize(50)
Flex({ .fontWeight(FontWeight.Bold)
direction: FlexDirection.Column, }
alignItems: ItemAlign.Center, .width('100%')
justifyContent: FlexAlign.Center }
}) { .height('100%')
Text('WALLPAPER ETS TEST') }
.fontSize(50) }
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
// @ts-nocheck
/**
* 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 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "entry_MainAbility",
"value": "entry_MainAbility" "value": "entry_MainAbility"
}, },
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "ETS_Empty Ability" "value": "ETS_Empty Ability"
}, },
{ {
"name": "TestAbility_desc", "name": "TestAbility_desc",
"value": "description" "value": "description"
}, },
{ {
"name": "TestAbility_label", "name": "TestAbility_label",
"value": "label" "value": "label"
} }
] ]
} }
\ No newline at end of file
{
"app":{
"bundleName":"com.acts.theme.wallpapertest",
"vendor":"open",
"version":{
"code":1000000,
"name":"1.0.0"
}
},
"deviceConfig":{
},
"module":{
"package":"com.acts.theme.wallpapertest_test",
"name":".entry_test",
"mainAbility":".TestAbility",
"deviceType":[
"tablet",
"default"
],
"distro":{
"deliveryWithInstall":true,
"installationFree":false,
"moduleName":"entry_test",
"moduleType":"feature"
},
"abilities":[
{
"description":"$string:TestAbility_desc",
"formsEnabled":false,
"icon":"$media:icon",
"label":"$string:TestAbility_label",
"launchType":"standard",
"name":".TestAbility",
"orientation":"unspecified",
"skills":[
{
"actions":[
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
],
"srcLanguage":"ets",
"srcPath":"TestAbility",
"type":"page",
"visible":true
}
],
"js":[
{
"mode":{
"syntax":"ets",
"type":"pageAbility"
},
"name":".TestAbility",
"pages":[
"pages/index"
],
"window":{
"autoDesignWidth":false,
"designWidth":720
}
}
]
}
}
\ No newline at end of file
// @ts-nocheck /**
/** * 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 hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test' import testsuite from '../test/List.test';
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate');
var abilityDelegator: any var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!') hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) //Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, abilityDelegatorArguments.parameters['-s timeout'] = 300000
onDestroy() { setTimeout(()=>{
console.info('Application onDestroy') Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, },3000)
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
},
} }
\ No newline at end of file
// @ts-nocheck /**
/** * 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 hilog from '@ohos.hilog';
import router from '@system.router';
@Entry
@Entry @Component
@Component struct Index {
struct Index { aboutToAppear() {
aboutToAppear() { hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
console.info('TestAbility index aboutToAppear') }
}
@State message: string = 'Hello World'
@State message: string = 'Hello World' build() {
build() { Row() {
Row() { Column() {
Column() { Text(this.message)
Text(this.message) .fontSize(50)
.fontSize(50) .fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold) Button() {
Button() { Text('next page')
Text('next page') .fontSize(20)
.fontSize(20) .fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule)
}.type(ButtonType.Capsule) .margin({
.margin({ top: 20
top: 20 })
}) .backgroundColor('#0D9FFB')
.backgroundColor('#0D9FFB') .width('35%')
.width('35%') .height('5%')
.height('5%') .onClick(()=>{
.onClick(()=>{ })
}) }
} .width('100%')
.width('100%') }
} .height('100%')
.height('100%') }
}
} }
\ No newline at end of file
// @ts-nocheck import hilog from '@ohos.hilog';
/** import TestRunner from '@ohos.application.testRunner';
* Copyright (c) 2021 Huawei Device Co., Ltd. import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
* 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined var abilityDelegator = undefined
var abilityDelegatorArguments = undefined var abilityDelegatorArguments = undefined
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'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback'); hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s',
JSON.stringify(err) ?? '');
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -47,32 +19,35 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -47,32 +19,35 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare') hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
} }
onRun() { onRun() {
console.log('OpenHarmonyTestRunner onRun run') hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) var debug = abilityDelegatorArguments.parameters['-D']
console.info('cmd : '+cmd) if (debug == 'true')
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err)); hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s',
console.info('executeShellCommand : data : ' + d.stdResult); JSON.stringify(err) ?? '');
console.info('executeShellCommand : data : ' + d.exitCode); hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s',
d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s',
d.exitCode ?? '');
}) })
console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
/* /*
* 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 wallpaperJSUnit from './wallpaperTest.test'; import wallpaperJSUnit from './wallpaperTest.test';
import wallpaperNoPermissionTest from './wallpapernopermissionTest.test'; import wallpaperNoPermissionTest from './wallpapernopermissionTest.test';
export default function testsuite() { export default function testsuite() {
wallpaperJSUnit(); wallpaperJSUnit();
wallpaperNoPermissionTest(); wallpaperNoPermissionTest();
} }
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}
此差异已折叠。
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { legacyAppTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
:fail
exit /b 1
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "myapplication454434",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
-----BEGIN CERTIFICATE-----
MIICFzCCAZygAwIBAgIJAMfN4KDQ8C5oMAoGCCqGSM49BAMDMGMxCzAJBgNVBAYT
AkNOMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkg
VGVhbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjMw
NjIwMTA0NzIxWhcNMzMwNjE3MTA0NzIxWjBKMRUwEwYDVQQDDAxpZGVfZGVtb19h
cHAxDTALBgNVBAsTBFVuaXQxFTATBgNVBAoTDE9yZ2FuaXphdGlvbjELMAkGA1UE
BhMCQ04wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQMWd38Ec33E1nLP9AaaD/G
onMBoV6O0cRrHJ0Fkilf0Skk+KxZh9Ez62zGpiqiyiiANhvaoNxf+0b79cfmZc49
o1IwUDAdBgNVHQ4EFgQU2M/OT/PFvQrhA2WyFeP60aoQQPkwDgYDVR0PAQH/BAQD
AgeAMB8GA1UdIwQYMBaAFNuGtyIW1QuhS7fdJXu58QV9oi1HMAoGCCqGSM49BAMD
A2kAMGYCMQDtp9P0xvYu2gF5sqWLVQvRo2eEGl484b5RiDcMKVsb1CeXIotaxd6L
mRQnMIFCl6gCMQD/RN82055Mdl5EkNHAS8RB8UeifEu2sSDk16TzS4NOplxQG9In
7/XsaiHPCbwgYEg=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
-----END CERTIFICATE-----
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIBNDCB3AIBADBKMRUwEwYDVQQDDAxpZGVfZGVtb19hcHAxDTALBgNVBAsTBFVu
aXQxFTATBgNVBAoTDE9yZ2FuaXphdGlvbjELMAkGA1UEBhMCQ04wWTATBgcqhkjO
PQIBBggqhkjOPQMBBwNCAAQMWd38Ec33E1nLP9AaaD/GonMBoV6O0cRrHJ0Fkilf
0Skk+KxZh9Ez62zGpiqiyiiANhvaoNxf+0b79cfmZc49oDAwLgYJKoZIhvcNAQkO
MSEwHzAdBgNVHQ4EFgQU2M/OT/PFvQrhA2WyFeP60aoQQPkwCgYIKoZIzj0EAwID
RwAwRAIgY3VhD1qasdp+bZOrC9LhMqR3YTjddWfqaBeI5EvXXE0CIEODYErANUio
AChMGlYzKlDxtKVv9xrt5qVRDmiODoe2
-----END NEW CERTIFICATE REQUEST-----
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册