未验证 提交 c628157c 编写于 作者: O openharmony_ci 提交者: Gitee

!9117 回退 'Pull Request !9044 : 【gn 切hvigor】PART2_FA_theme'

Merge pull request !9117 from openharmony_ci/revert-merge-9044-master
# Copyright (c) 2023 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
...@@ -13,12 +13,27 @@ ...@@ -13,12 +13,27 @@
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") {
ohos_js_app_suite("ActsScreenLockETSApiTest") { hap_profile = "./entry/src/main/config.json"
hap_name = "ActsScreenLockETSApiTest" deps = [
testonly = true ":screenLock_ets_assets",
test_hap = true ":screenLock_ets_resources",
":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" 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_test", "package-name": "com.acts.theme.screenlocktest",
"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
} }
] ]
} }
/**
* Copyright (c) 2023 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.
*/
{
"app": {
"signingConfigs": [
],
"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
/**
* Copyright (c) 2023 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.
*/
{
"apiType": 'faMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
/**
* Copyright (c) 2023 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.
*/
// 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';
/**
* Copyright (c) 2023 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.
*/
{
"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": {
"deviceConfig":{ "compatible": 7,
"releaseType": "Release",
}, "target": 9
"module":{ }
"package":"com.acts.theme.screenlocktest", },
"name":".entry", "deviceConfig": {},
"mainAbility":".MainAbility", "module": {
"deviceType": [ "package": "com.acts.theme.screenlocktest",
"tablet", "name": ".MyApplication",
"default" "mainAbility": "com.acts.theme.screenlocktest.MainAbility",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
], ],
"distro":{ "orientation": "unspecified",
"deliveryWithInstall":true, "visible": true,
"installationFree":false, "srcPath": "MainAbility",
"moduleName":"entry", "name": ".MainAbility",
"moduleType":"entry" "srcLanguage": "ets",
}, "icon": "$media:icon",
"abilities":[ "description": "$string:description_mainability",
{ "formsEnabled": false,
"description":"$string:description_mainability", "label": "$string:entry_MainAbility",
"formsEnabled":false, "type": "page",
"icon":"$media:icon", "launchType": "standard"
"label":"$string:entry_MainAbility", },
"launchType":"standard", {
"name":".MainAbility", "orientation": "unspecified",
"orientation":"unspecified", "visible": true,
"skills":[ "srcPath": "TestAbility",
{ "name": ".TestAbility",
"actions":[ "srcLanguage": "ets",
"action.system.home" "icon": "$media:icon",
], "description": "$string:TestAbility_desc",
"entities":[ "formsEnabled": false,
"entity.system.home" "label": "$string:TestAbility_label",
] "type": "page",
} "launchType": "standard"
], }
"srcLanguage":"ets", ],
"srcPath":"MainAbility", "js": [
"type":"page", {
"visible":true "mode": {
} "syntax": "ets",
], "type": "pageAbility"
"js":[ },
{ "pages": [
"mode":{ "pages/index"
"syntax":"ets", ],
"type":"pageAbility" "name": ".MainAbility",
}, "window": {
"name":".MainAbility", "designWidth": 720,
"pages":[ "autoDesignWidth": false
"pages/index" }
], },
"window":{ {
"autoDesignWidth":false, "mode": {
"designWidth":720 "syntax": "ets",
} "type": "pageAbility"
} },
] "pages": [
} "pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
} }
\ No newline at end of file
// @ts-nocheck
/** /**
* Copyright (c) 2023 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
...@@ -12,14 +13,21 @@ ...@@ -12,14 +13,21 @@
* 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 hilog from '@ohos.hilog'; import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application 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() { onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy'); console.info('Application onDestroy')
}, },
} }
\ No newline at end of file
/** // @ts-nocheck
* Copyright (c) 2023 Huawei Device Co., Ltd. /**
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright (c) 2022 Huawei Device Co., Ltd.
* you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at * 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 *
* * 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, * Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. * See the License for the specific language governing permissions and
*/ * limitations under the License.
@Entry */
@Component
struct Index { @Entry
@State message: string = 'Hello World' @Component
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('SCREENLOCK ETS TEST')
} .fontSize(50)
} .fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/** // @ts-nocheck
* Copyright (c) 2023 Huawei Device Co., Ltd. /**
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright (c) 2022 Huawei Device Co., Ltd.
* you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at * 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 *
* * 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, * Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. * See the License for the specific language governing permissions and
*/ * limitations under the License.
import hilog from '@ohos.hilog'; */
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'; import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'; import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate'); console.info('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()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); console.info('start run testcase!!!')
//Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
abilityDelegatorArguments.parameters['-s timeout'] = 300000 },
setTimeout(()=>{ onDestroy() {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) console.info('Application onDestroy')
},3000) },
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
},
} }
\ No newline at end of file
/** // @ts-nocheck
* Copyright (c) 2023 Huawei Device Co., Ltd. /**
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright (c) 2022 Huawei Device Co., Ltd.
* you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at * 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 *
* * 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, * Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. * See the License for the specific language governing permissions and
*/ * limitations under the License.
import router from '@system.router'; */
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
/** /**
* Copyright (c) 2023 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
...@@ -12,20 +13,33 @@ ...@@ -12,20 +13,33 @@
* 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 TestRunner from '@ohos.application.testRunner'
import TestRunner from '@ohos.application.testRunner'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import AbilityDelegatorRegistry from '@ohos.app.ability.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() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); console.log('onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
JSON.stringify(err) ?? '');
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -33,35 +47,32 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -33,35 +47,32 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare'); console.info('OpenHarmonyTestRunner OnPrepare')
} }
onRun() { onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); console.log('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
var debug = abilityDelegatorArguments.parameters['-D'] cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
if (debug == 'true') console.info('cmd : '+cmd)
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', console.info('executeShellCommand : err : ' + JSON.stringify(err));
JSON.stringify(err) ?? ''); console.info('executeShellCommand : data : ' + d.stdResult);
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', console.info('executeShellCommand : data : ' + d.exitCode);
d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s',
d.exitCode ?? '');
}) })
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
/** /*
* Copyright (c) 2023 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
/** // @ts-nocheck
* Copyright (c) 2023 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
...@@ -13,7 +14,7 @@ ...@@ -13,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 "@ohos/hypium"; import { describe, expect, it, beforeEach} from "hypium/index";
const SLEEP_TIME = 1000; const SLEEP_TIME = 1000;
......
/** /*
* Copyright (c) 2023 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
...@@ -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 "@ohos/hypium"; import { describe, expect, it, beforeEach} from "hypium/index";
export default function screenLockJSUnit() { export default function screenLockJSUnit() {
const INTERACTIVE_STATE_END_SLEEP = 0; const INTERACTIVE_STATE_END_SLEEP = 0;
......
{ {
"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
{
"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
/**
* Copyright (c) 2023 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.
*/
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}
此差异已折叠。
/**
* Copyright (c) 2023 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.
*/
// 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
# Copyright (c) 2023 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.
#!/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}" "$@"
@rem Copyright (C) 2023 Huawei Device Co., Ltd.
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@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
/**
* Copyright (c) 2023 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.
*/
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "myapplication454434",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
# Copyright (c) 2023 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
...@@ -13,12 +13,27 @@ ...@@ -13,12 +13,27 @@
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") {
ohos_js_app_suite("ActsWallpaperETSApiTest") { hap_profile = "./entry/src/main/config.json"
hap_name = "ActsWallpaperETSApiTest" deps = [
testonly = true ":wallPaper_ets_assets",
test_hap = true ":wallPaper_ets_resources",
":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" 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_test", "package-name": "com.acts.theme.wallpapertest",
"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"
] ]
} }
] ]
} }
/**
* Copyright (c) 2023 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.
*/
{
"app": {
"signingConfigs": [
],
"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
/**
* Copyright (c) 2023 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.
*/
{
"apiType": 'faMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
/**
* Copyright (c) 2023 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.
*/
// 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';
/**
* Copyright (c) 2023 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.
*/
{
"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": {
"deviceConfig":{ "compatible": 7,
"releaseType": "Release",
}, "target": 9
"module":{ }
"package":"com.acts.theme.wallpapertest", },
"name":".entry", "deviceConfig": {},
"mainAbility":".MainAbility", "module": {
"deviceType":[ "package": "com.acts.theme.wallpapertest",
"tablet", "name": ".MyApplication",
"default" "mainAbility": "com.acts.theme.wallpapertest.MainAbility",
],
"distro":{ "deviceType": [
"deliveryWithInstall":true, "tablet",
"installationFree":false, "default"
"moduleName":"entry", ],
"moduleType":"entry" "distro": {
}, "deliveryWithInstall": true,
"abilities":[ "moduleName": "entry",
{ "moduleType": "entry",
"description":"$string:description_mainability", "installationFree": false
"formsEnabled":false, },
"icon":"$media:icon", "abilities": [
"label":"$string:entry_MainAbility", {
"launchType":"standard", "skills": [
"name":".MainAbility", {
"orientation":"unspecified", "entities": [
"skills":[ "entity.system.home"
{ ],
"actions":[ "actions": [
"action.system.home" "action.system.home"
], ]
"entities":[ }
"entity.system.home" ],
] "orientation": "unspecified",
} "visible": true,
], "srcPath": "MainAbility",
"srcLanguage":"ets", "name": ".MainAbility",
"srcPath":"MainAbility", "srcLanguage": "ets",
"type":"page", "icon": "$media:icon",
"visible":true "description": "$string:description_mainability",
} "formsEnabled": false,
], "label": "$string:entry_MainAbility",
"js":[ "type": "page",
{ "launchType": "standard"
"mode":{ },
"syntax":"ets", {
"type":"pageAbility" "orientation": "unspecified",
}, "visible": true,
"name":".MainAbility", "srcPath": "TestAbility",
"pages":[ "name": ".TestAbility",
"pages/index" "srcLanguage": "ets",
], "icon": "$media:icon",
"window":{ "description": "$string:TestAbility_desc",
"autoDesignWidth":false, "formsEnabled": false,
"designWidth":720 "label": "$string:TestAbility_label",
} "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) 2023 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
...@@ -12,14 +13,21 @@ ...@@ -12,14 +13,21 @@
* 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 hilog from '@ohos.hilog'; import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application 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() { onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy'); console.info('Application onDestroy')
}, },
} }
\ No newline at end of file
/** // @ts-nocheck
* Copyright (c) 2023 Huawei Device Co., Ltd. /**
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright (c) 2022 Huawei Device Co., Ltd.
* you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at * 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 *
* * 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, * Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. * See the License for the specific language governing permissions and
*/ * limitations under the License.
@Entry */
@Component
struct Index { @Entry
@State message: string = 'Hello World' @Component
struct MyComponent {
build() { aboutToAppear() {
Row() { }
Column() {
Text(this.message)
.fontSize(50) build() {
.fontWeight(FontWeight.Bold) Flex({
} direction: FlexDirection.Column,
.width('100%') alignItems: ItemAlign.Center,
} justifyContent: FlexAlign.Center
.height('100%') }) {
} Text('WALLPAPER ETS TEST')
} .fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/** // @ts-nocheck
* Copyright (c) 2023 Huawei Device Co., Ltd. /**
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright (c) 2022 Huawei Device Co., Ltd.
* you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at * 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 *
* * 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, * Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. * See the License for the specific language governing permissions and
*/ * limitations under the License.
import hilog from '@ohos.hilog'; */
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'; import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'; import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate'); console.info('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()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); console.info('start run testcase!!!')
//Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
abilityDelegatorArguments.parameters['-s timeout'] = 300000 },
setTimeout(()=>{ onDestroy() {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) console.info('Application onDestroy')
},3000) },
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
},
} }
\ No newline at end of file
/** // @ts-nocheck
* Copyright (c) 2023 Huawei Device Co., Ltd. /**
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright (c) 2022 Huawei Device Co., Ltd.
* you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at * 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 *
* * 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, * Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License. * See the License for the specific language governing permissions and
*/ * limitations under the License.
import hilog from '@ohos.hilog'; */
import router from '@system.router';
@Entry
@Component @Entry
struct Index { @Component
aboutToAppear() { struct Index {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); aboutToAppear() {
} console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() { @State message: string = 'Hello World'
Row() { build() {
Column() { Row() {
Text(this.message) Column() {
.fontSize(50) Text(this.message)
.fontWeight(FontWeight.Bold) .fontSize(50)
Button() { .fontWeight(FontWeight.Bold)
Text('next page') Button() {
.fontSize(20) Text('next page')
.fontWeight(FontWeight.Bold) .fontSize(20)
}.type(ButtonType.Capsule) .fontWeight(FontWeight.Bold)
.margin({ }.type(ButtonType.Capsule)
top: 20 .margin({
}) top: 20
.backgroundColor('#0D9FFB') })
.width('35%') .backgroundColor('#0D9FFB')
.height('5%') .width('35%')
.onClick(()=>{ .height('5%')
}) .onClick(()=>{
} })
.width('100%') }
} .width('100%')
.height('100%') }
} .height('100%')
}
} }
\ No newline at end of file
// @ts-nocheck
/** /**
* Copyright (c) 2023 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
...@@ -12,20 +13,33 @@ ...@@ -12,20 +13,33 @@
* 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 TestRunner from '@ohos.application.testRunner'
import TestRunner from '@ohos.application.testRunner'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import AbilityDelegatorRegistry from '@ohos.app.ability.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() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); console.log('onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
JSON.stringify(err) ?? '');
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -33,35 +47,32 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -33,35 +47,32 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare'); console.info('OpenHarmonyTestRunner OnPrepare')
} }
onRun() { onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); console.log('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
var debug = abilityDelegatorArguments.parameters['-D'] cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
if (debug == 'true') console.info('cmd : '+cmd)
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', console.info('executeShellCommand : err : ' + JSON.stringify(err));
JSON.stringify(err) ?? ''); console.info('executeShellCommand : data : ' + d.stdResult);
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', console.info('executeShellCommand : data : ' + d.exitCode);
d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s',
d.exitCode ?? '');
}) })
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
} }
}; };
\ No newline at end of file
/** /*
* Copyright (c) 2023 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": [ "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
{
"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
/**
* Copyright (c) 2023 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.
*/
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}
此差异已折叠。
/**
* Copyright (c) 2023 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.
*/
// 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
# Copyright (c) 2023 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.
#!/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}" "$@"
@rem Copyright (C) 2023 Huawei Device Co., Ltd.
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@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
/**
* Copyright (c) 2023 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.
*/
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "myapplication454434",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册