提交 452ea817 编写于 作者: X xinking129

Merge remote-tracking branch 'upstream/master'

......@@ -53,7 +53,9 @@ group("ability_runtime") {
"freeinstalltest:freeinstalltest",
"newwant:newwant",
"non_concurrent:non_concurrent",
"registerjserror:registerjserror",
"stage:stage",
"stopserviceextension:stopserviceextension",
"want:want",
"workercontextcover:workercontextcover",
]
......
......@@ -16,10 +16,6 @@ import("//test/xts/tools/build/suite.gni")
group("serviceability") {
testonly = true
if (is_standard_system) {
deps = [
"actsserviceabilityclienttest:ActsServiceAbilityClientTest",
"actsserviceabilityserverrelyhap:ActsServiceAbilityServerRelyHap",
"actsserviceabilityserversecondrelyhap:ActsServiceAbilityServerSecondRelyHap",
]
deps = [ "actsserviceabilityclienttest:ActsServiceAbilityClientTest" ]
}
}
......@@ -11,9 +11,7 @@
"kits": [
{
"test-file-name": [
"ActsServiceAbilityClientTest.hap",
"ActsServiceAbilityServerRelyHap.hap",
"ActsServiceAbilityServerSecondRelyHap.hap"
"ActsServiceAbilityClientTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -63,6 +63,24 @@
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"srcPath": "ServiceAbility1",
"name": ".ServiceAbility1",
"icon": "$media:icon",
"srcLanguage": "js",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
},
{
"srcPath": "ServiceAbility2",
"name": ".ServiceAbility2",
"icon": "$media:icon",
"srcLanguage": "js",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
}
],
"js": [
......
......@@ -15,8 +15,8 @@
import rpc from "@ohos.rpc";
import particleAbility from '@ohos.ability.particleAbility'
import commonEvent from '@ohos.commonEvent'
var serversecond_bundleName = "com.amsst.stserviceabilityserversecond";
var serversecond_abilityName = "com.amsst.stserviceabilityserversecond.ServiceAbility";
var serversecond_bundleName = "com.amsst.stserviceabilityclient";
var serversecond_abilityName = "com.amsst.stserviceabilityclient.ServiceAbility2";
var mConnIdJs;
class StubTest extends rpc.RemoteObject {
constructor(des) {
......
......@@ -15,8 +15,8 @@
import rpc from "@ohos.rpc";
import particleAbility from '@ohos.ability.particleAbility'
import commonEvent from '@ohos.commonEvent'
var server_bundleName = "com.amsst.stserviceabilityserver";
var server_abilityName = "com.amsst.stserviceabilityserver.ServiceAbility";
var server_bundleName = "com.amsst.stserviceabilityclient";
var server_abilityName = "com.amsst.stserviceabilityclient.ServiceAbility1";
var mConnIdJs;
class StubTest extends rpc.RemoteObject {
constructor(des) {
......
......@@ -19,8 +19,8 @@ import rpc from "@ohos.rpc";
import { describe, afterEach, it, expect } from '@ohos/hypium'
export default function ActsStServiceAbilityTest() {
describe('ActsStServiceAbilityTest', function () {
let bundleName = "com.amsst.stserviceabilityserver";
let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility";
let bundleName = "com.amsst.stserviceabilityclient";
let abilityName = "com.amsst.stserviceabilityclient.ServiceAbility1";
let subscriber0100;
let CommonEventSubscribeInfo0100 = {
......
......@@ -23,6 +23,10 @@
{
"name": "TestAbility_label",
"value": "label"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.amsst.stserviceabilityserver",
"vendor": "test",
"version": {
"code": 1000110,
"name": "1.1.1"
},
"apiVersion": {
"compatible": 8,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.stserviceabilityserver",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"default",
"tablet"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"srcPath": "ServiceAbility",
"name": ".ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"defPermissions": [
{
"name": "com.ohos.screenlock.DataAbilityShellProvider.PROVIDER"
}
]
}
}
/*
* 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 Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("jws onCreate");
}
onDestroy() {
console.log("jws onDestroy");
}
onWindowStageCreate(windowStage) {
console.log("jws onWindowStageCreate");
}
onWindowStageDestroy() {
console.log("jws onWindowStageDestroy");
}
onForeground() {
console.log("jws onForeground");
}
onBackground() {
console.log("jws onBackground");
}
call(){
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "ServiceExtAbility"
},
{
"name": "description_mainability",
"value": "eTS_Empty Ability"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
},
{
"name": "description_dataability",
"value": "hap sample empty provider"
},
{
"name": "description_mainability2",
"value": "eTS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
},
{
"name": "description_testdataability",
"value": "hap sample empty provider"
},
{
"name": "permreason_dataability",
"value": "request dataability premission"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.amsst.stserviceabilityserversecond",
"vendor": "test",
"version": {
"code": 1000110,
"name": "1.1.1"
},
"apiVersion": {
"compatible": 8,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.stserviceabilityserversecond",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"default",
"tablet"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"srcPath": "ServiceAbility",
"name": ".ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"defPermissions": [
{
"name": "com.ohos.screenlock.DataAbilityShellProvider.PROVIDER"
}
]
}
}
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("jws onCreate");
}
onDestroy() {
console.log("jws onDestroy");
}
onWindowStageCreate(windowStage) {
console.log("jws onWindowStageCreate");
}
onWindowStageDestroy() {
console.log("jws onWindowStageDestroy");
}
onForeground() {
console.log("jws onForeground");
}
onBackground() {
console.log("jws onBackground");
}
call(){
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "ServiceExtAbility"
},
{
"name": "description_mainability",
"value": "eTS_Empty Ability"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
},
{
"name": "description_dataability",
"value": "hap sample empty provider"
},
{
"name": "description_mainability2",
"value": "eTS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
},
{
"name": "description_testdataability",
"value": "hap sample empty provider"
},
{
"name": "permreason_dataability",
"value": "request dataability premission"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsregisterjserrorrely",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "ActsRegisterJsErrorRely"
}
]
}
# 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.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsRegisterJsErrorRely") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsregisterjserrorrely_js_assets",
":actsregisterjserrorrely_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsRegisterJsErrorRely"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsregisterjserrorrely_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsregisterjserrorrely_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsregisterjserrorrely_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsregisterjserrorrely_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* 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.
*/
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import Window from '@ohos.window'
import commonEvent from '@ohos.commonEvent'
import ErrorManager from "@ohos.app.ability.errorManager"
let message;
let commonEventData={
parameters:{
message:message,
}
}
export default class EntryAbility extends Ability {
onCreate(want, launchParam) {
globalThis.want = want;
globalThis.context = this.context;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
// Main window is created, set main page for this ability
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
let observer = undefined;
if (globalThis.want.action == "Acts_RegisterJsErrorCallback_0100") {
observer = {
onUnhandledException(strMsg){
commonEventData.parameters.message = strMsg;
console.info("====>Acts_RegisterJsErrorCallback_0100 onUnhandledException Message: " + strMsg);
commonEvent.publish("ACTS_RegisterEvent_First", commonEventData, (err) => {
console.info("====>Acts_RegisterJsErrorCallback_0100 publish err: " + JSON.stringify(err));
setTimeout(()=>{
globalThis.context.terminateSelf().then(()=>{
console.info("====>Acts_RegisterJsErrorCallback_0100 rely terminateSelf end");
}).catch((err)=>{
console.info("====>Acts_RegisterJsErrorCallback_0100 rely terminateSelf err: " +
JSON.stringify(err));
});
}, 100);
})
}
}
ErrorManager.on("error", observer);
setTimeout(() => {
globalThis.contest.terminateSelf();
}, 300);
} else if (globalThis.want.action == "Acts_RegisterJsErrorCallback_0200") {
observer = {
onUnhandledException(strMsg: String){
commonEventData.parameters.message = strMsg;
console.info("====>Acts_RegisterJsErrorCallback_0200 onUnhandledException Message: " + strMsg);
commonEvent.publish("ACTS_RegisterEvent_First", commonEventData, (err) => {
console.info("====>Acts_RegisterJsErrorCallback_0200 onUnhandledException publish err: " +
JSON.stringify(err));
})
},
onException(errObject: Error){
commonEventData.parameters.message = errObject;
console.info("====>Acts_RegisterJsErrorCallback_0200 onException Message: " + JSON.stringify(errObject));
commonEvent.publish("ACTS_RegisterEvent_Second", commonEventData, (err) => {
console.info("====>Acts_RegisterJsErrorCallback_0200 onException publish err: " +
JSON.stringify(err));
setTimeout(()=>{
globalThis.context.terminateSelf().then(()=>{
console.info("====>Acts_RegisterJsErrorCallback_0200 rely terminateSelf end");
}).catch((err)=>{
console.info("====>Acts_RegisterJsErrorCallback_0200 rely terminateSelf err: " +
JSON.stringify(err));
})
}, 100)
})
}
}
ErrorManager.on("error", observer);
setTimeout(() => {
globalThis.contest.terminateSelf();
}, 300);
} else if (globalThis.want.action == "Acts_UnregisterJsErrorCallback_0800") {
observer = {
onUnhandledException(strMsg: String){
commonEventData.parameters.message = strMsg;
console.info("====>Acts_UnregisterJsErrorCallback_0800 onUnhandledException Message: " + strMsg);
commonEvent.publish("ACTS_RegisterEvent_First", commonEventData, (err) => {
console.info("====>Acts_UnregisterJsErrorCallback_0800 onUnhandledException publish err: " +
JSON.stringify(err));
})
},
onException(errObject: Error){
commonEventData.parameters.message = errObject;
console.info("====>Acts_UnregisterJsErrorCallback_0800 onException Message: " + JSON.stringify(errObject));
commonEvent.publish("ACTS_RegisterEvent_Second", commonEventData, (err) => {
console.info("====>Acts_UnregisterJsErrorCallback_0800 onException publish err: " +
JSON.stringify(err));
setTimeout(()=>{
globalThis.context.terminateSelf().then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely terminateSelf end");
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely terminateSelf err: " +
JSON.stringify(err));
})
}, 100)
})
}
}
ErrorManager.on("error", observer);
let observerId = ErrorManager.on("error", observer);
ErrorManager.off("error", observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely off end");
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely off err: " +
JSON.stringify(err));
})
setTimeout(() => {
globalThis.contest.terminateSelf();
}, 300);
}
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}
/*
* 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 AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate");
}
/*
* 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.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "RegisterJsErrorRely"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "RegisterJsErrorRely"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsregisterjserrortest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "ActsRegisterJsErrorTest"
}
]
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# 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
......@@ -9,32 +9,35 @@
# 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.
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsServiceAbilityServerSecondRelyHap") {
hap_name = "ActsServiceAbilityServerSecondRelyHap"
ohos_js_hap_suite("ActsRegisterJsErrorTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_profile = "entry/src/main/config.json"
testonly = true
deps = [
":serviceability_resources",
":serviceability_ts_assets",
":actsregisterjserrortest_js_assets",
":actsregisterjserrortest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsRegisterJsErrorTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("serviceability_ts_assets") {
ohos_app_scope("actsregisterjserrortest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsregisterjserrortest_js_assets") {
source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
}
ohos_resources("serviceability_resources") {
ohos_resources("actsregisterjserrortest_resources") {
sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json"
deps = [ ":actsregisterjserrortest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.actsregisterjserrortest",
"module-name": "entry_test",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsRegisterJsErrorTest.hap",
"ActsRegisterJsErrorRely.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D",
"setenforce 0"
]
}
]
}
\ 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.
*/
import hilog from '@ohos.hilog';
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters['-D']
if (debug == 'true')
{
cmd += ' -D'
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}
\ 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.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import ErrorManager from "@ohos.app.ability.errorManager"
import commonEvent from '@ohos.commonEvent'
const CASE_TIME_OUT=5000;
var ACTS_Register = {
events: ["ACTS_RegisterEvent_First", "ACTS_RegisterEvent_Second"]
};
export default function abilityTest() {
describe('ActsAbilityTest', function () {
let observer;
beforeAll(function () {
observer = {
onUnhandledException(strMsg){
console.info("====>Acts_RegisterJsErrorCallback onUnhandledException Message: " + strMsg);
},
onException(errObject){
console.info("====>Acts_RegisterJsErrorCallback onException Message: " + errObject);
}
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0100
* @tc.name: JsError callback enhancement
* @tc.desc: Js registers onUnhandledException callback to listen. There is a callback notification when
* JS is abnormal.
*/
it('Acts_RegisterJsErrorCallback_0100',0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_RegisterJsErrorCallback_0100 start");
commonEvent.createSubscriber(ACTS_Register).then(async (data) => {
console.debug("====>Acts_RegisterJsErrorCallback_0100 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.actsregisterjserrorrely",
abilityName: "EntryAbility",
action: "Acts_RegisterJsErrorCallback_0100"
},(err)=>{
console.debug("====>Acts_RegisterJsErrorCallback_0100 startAbility err: "+JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.debug("====>Acts_RegisterJsErrorCallback_0100 subscribeCallBack data: " + JSON.stringify(data));
if(data.event == "ACTS_RegisterEvent_First") {
flag = true;
expect(data.parameters.message).assertContain("Error message:Cannot read property terminateSelf");
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
console.debug("====>Acts_RegisterJsErrorCallback_0100 unSubscribeCallback");
setTimeout(()=>{
done();
}, 800);
}
setTimeout(()=>{
if(flag==false){
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
},CASE_TIME_OUT)
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0200
* @tc.name: JsError callback enhancement
* @tc.desc: Js registers onUnhandledException and onException callback to listen. There is a callback
* notification when JS is abnormal.
*/
it('Acts_RegisterJsErrorCallback_0200',0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_RegisterJsErrorCallback_0200 start")
commonEvent.createSubscriber(ACTS_Register).then(async (data) => {
console.debug("====>Acts_RegisterJsErrorCallback_0200 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.actsregisterjserrorrely",
abilityName: "EntryAbility",
action: "Acts_RegisterJsErrorCallback_0200"
},(err)=>{
console.debug("====>Acts_RegisterJsErrorCallback_0200 startAbility err: "+JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
var msg = {"ACTS_RegisterEvent_First": false, "ACTS_RegisterEvent_Second": false}
function subscribeCallBack(err, data) {
if (data.event === 'ACTS_RegisterEvent_First') {
console.debug("====>Acts_RegisterJsErrorCallback_0200 subscribeCallBack First data: " + JSON.stringify(data));
expect(data.parameters.message).assertContain("Error message:Cannot read property terminateSelf");
msg["ACTS_RegisterEvent_First"] = true;
} else if (data.event === 'ACTS_RegisterEvent_Second') {
console.debug("====>Acts_RegisterJsErrorCallback_0200 subscribeCallBack Second data: " +
JSON.stringify(data));
expect(data.parameters.message.name).assertEqual("TypeError");
expect(data.parameters.message.message).assertEqual("Cannot read property terminateSelf of undefined");
expect(data.parameters.message.stack).assertContain("at anonymous");
msg["ACTS_RegisterEvent_Second"] = true;
}
if (msg["ACTS_RegisterEvent_First"] == true && msg["ACTS_RegisterEvent_Second"] == true) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
setTimeout(()=>{
console.debug("====>Acts_RegisterJsErrorCallback_0200 unSubscribeCallback");
done();
}, 800);
}
setTimeout(()=>{
if(flag==false){
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
},CASE_TIME_OUT)
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0300
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter type is undefined, returns an error.
*/
it('Acts_RegisterJsErrorCallback_0300',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0300 start");
try {
ErrorManager.on(undefined, observer);
expect().assertFail();
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0300 catch " + JSON.stringify(err.code));
expect(err.code).assertEqual(401);
console.info("====>Acts_RegisterJsErrorCallback_0300 end");
done();
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0400
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter type is null, returns an error.
*/
it('Acts_RegisterJsErrorCallback_0400',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0400 start");
try {
ErrorManager.on(null, observer);
expect().assertFail();
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0400 catch " + JSON.stringify(err));
expect(err.code).assertEqual(401);
console.info("====>Acts_RegisterJsErrorCallback_0400 end");
done();
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0500
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter observer is undefined, no abnormal
* error in interface execution.
*/
it('Acts_RegisterJsErrorCallback_0500',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0500 start");
try {
ErrorManager.on("error", undefined);
expect(true).assertTrue();
console.info("====>Acts_RegisterJsErrorCallback_0500 end");
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0500 catch " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0600
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter observer is null, no abnormal
* error in interface execution.
*/
it('Acts_RegisterJsErrorCallback_0600',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0600 start");
try {
ErrorManager.on("error", null);
expect(true).assertTrue();
console.info("====>Acts_RegisterJsErrorCallback_0600 end");
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0600 catch " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0100
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter type is undefined, returns an error.
*/
it('Acts_UnregisterJsErrorCallback_0100',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0100 start");
let observerId = ErrorManager.on("error", observer);
try {
ErrorManager.off(undefined, observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0100 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0100 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
} catch (err) {
console.info("====>Acts_UnregisterJsErrorCallback_0100 catch: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
console.info("====>Acts_UnregisterJsErrorCallback_0100 end");
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0200
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter type is null, returns an error.
*/
it('Acts_UnregisterJsErrorCallback_0200',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0200 start");
let observerId = ErrorManager.on("error", observer);
try {
ErrorManager.off(null, observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0200 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0200 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
} catch (err) {
console.info("====>Acts_UnregisterJsErrorCallback_0200 catch: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
console.info("====>Acts_UnregisterJsErrorCallback_0200 end");
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0300
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is undefined, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0300',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0300 start");
ErrorManager.off("error", undefined).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0300 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0300 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0400
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is null, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0400',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0400 start");
ErrorManager.off("error", null).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0400 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0400 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0500
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is -1, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0500',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0500 start");
ErrorManager.off("error", -1).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0500 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0500 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0600
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is 10000, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0600',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0600 start");
ErrorManager.off("error", 10000).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0600 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0600 err: " + JSON.stringify(err));
expect(err.code).assertEqual(16000003);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0700
* @tc.name: JsError callback enhancement
* @tc.desc: When the parameter objectId of the unregistered JS exception listening interface is the correct
* registered value, the interface executes correctly.
*/
it('Acts_UnregisterJsErrorCallback_0700',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0700 start");
let observerId = ErrorManager.on("error", observer);
try {
ErrorManager.off("error", observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0700 end");
expect(true).assertTrue();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0700 err: " + JSON.stringify(err));
expect().assertFail();
done();
})
} catch (err) {
console.info("====>Acts_UnregisterJsErrorCallback_0700 catch: " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0800
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistered as the correct registered value, the interface executes correctly and the JS
* layer does not trigger an exception error callback.
*/
it('Acts_UnregisterJsErrorCallback_0800',0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_UnregisterJsErrorCallback_0800 start")
commonEvent.createSubscriber(ACTS_Register).then(async (data) => {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.actsregisterjserrorrely",
abilityName: "EntryAbility",
action: "Acts_UnregisterJsErrorCallback_0800"
},(err)=>{
console.debug("====>Acts_UnregisterJsErrorCallback_0800 startAbility err: "+JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
var msg = {"ACTS_RegisterEvent_First": false, "ACTS_RegisterEvent_Second": false}
function subscribeCallBack(err, data) {
if (data.event === 'ACTS_RegisterEvent_First') {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 subscribeCallBack First data: " +
JSON.stringify(data));
expect(data.parameters.message).assertContain("Error message:Cannot read property terminateSelf");
msg["ACTS_RegisterEvent_First"] = true;
} else if (data.event === 'ACTS_RegisterEvent_Second') {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 subscribeCallBack Second data: " +
JSON.stringify(data));
expect(data.parameters.message.name).assertEqual("TypeError");
expect(data.parameters.message.message).assertEqual("Cannot read property terminateSelf of undefined");
expect(data.parameters.message.stack).assertContain("at anonymous");
msg["ACTS_RegisterEvent_Second"] = true;
}
if (msg["ACTS_RegisterEvent_First"] == true && msg["ACTS_RegisterEvent_Second"] == true) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
setTimeout(() => {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 unSubscribeCallback");
done();
}, 800);
}
setTimeout(()=>{
if(flag==false){
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
},CASE_TIME_OUT)
})
})
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
/*
* 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.
*/
import abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ 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.
*/
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Window from '@ohos.window'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
globalThis.abilityContext = this.context;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core} from '@ohos/hypium'
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('onShow finish')
const core = Core.getInstance()
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
core.execute()
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ 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.
*/
import hilog from '@ohos.hilog';
@Entry
@Component
struct Index {
aboutToAppear() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"abilities": [
{
"name": "TestAbility",
"srcEntrance": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"visible": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test 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.
import("//test/xts/tools/build/suite.gni")
group("registerjserror") {
testonly = true
if (is_standard_system) {
deps = [
"ActsRegisterJsErrorRely:ActsRegisterJsErrorRely",
"ActsRegisterJsErrorTest:ActsRegisterJsErrorTest",
]
}
}
{
"app": {
"bundleName": "com.acts.stopserviceextensiontest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
# 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.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsStopServiceExtensionRely") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsstopserviceextensionrely_js_assets",
":actsstopserviceextensionrely_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsStopServiceExtensionRely"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsstopserviceextensionrely_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsstopserviceextensionrely_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsstopserviceextensionrely_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsstopserviceextensionrely_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* 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.
*/
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import Window from '@ohos.window'
export default class EntryAbility extends Ability {
onCreate(want, launchParam) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
// Main window is created, set main page for this ability
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground() {
// Ability has back to background
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}
/*
* 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.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ 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.
*/
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'
import rpc from '@ohos.rpc';
import commonEvent from '@ohos.commonEvent'
let message;
let commonEventData={
parameters:{
message:message,
}
}
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
let strAction = '';
let remoteOBJ = new StubTest("test");
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want){
let disConnect = false;
strAction = want.action;
console.info('ServiceAbility onCreate');
commonEventData.parameters.message = want;
let NewWant = {
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbilitySec",
action: strAction
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info("Acts_StopServiceExtension_0600 service onConnect success!!!")
console.info('Acts_StopServiceExtension_0600 service onConnect element : ' + JSON.stringify(element));
console.info('Acts_StopServiceExtension_0600 service onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
disConnect = true;
console.info("Acts_StopServiceExtension_0600 service onDisconnect success!!!")
console.info('Acts_StopServiceExtension_0600 service onDisconnect ele : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info("Acts_StopServiceExtension_0600 service onFailed!!!")
console.info('Acts_StopServiceExtension_0600 service onFailed errCode : ' + JSON.stringify(code));
},
}
if (strAction == "Acts_StopServiceExtension_0100" || strAction == "Acts_StopServiceExtension_0300" ||
strAction == "Acts_StopServiceExtension_0500" || strAction == "Acts_StopServiceExtension_1700") {
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " publish err: " + JSON.stringify(err));
})
}
if (strAction == "Acts_StopServiceExtension_0200") {
setTimeout(()=>{
this.context.startAbility(NewWant, (err)=>{
console.info("====>" + strAction + " startAbility serviceExtension err: " + JSON.stringify(err));
setTimeout(()=>{
this.context.stopServiceExtensionAbility(NewWant, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " +
JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
})
})
}, 200)
})
}, 100)
}
if (strAction == "Acts_StopServiceExtension_0400") {
setTimeout(()=>{
this.context.startServiceExtensionAbility(NewWant, (err)=>{
console.info("====>" + strAction + " startAbility serviceExtension err: " + JSON.stringify(err));
setTimeout(()=>{
this.context.stopServiceExtensionAbility(NewWant, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " +
JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
})
})
}, 200)
})
}, 100)
}
if (strAction == "Acts_StopServiceExtension_0600") {
setTimeout(()=>{
let data = this.context.connectServiceExtensionAbility(NewWant, options);
console.info("====>" + strAction + " connect ServiceAbilitySec: " + JSON.stringify(data));
setTimeout(() => {
this.context.stopServiceExtensionAbility(NewWant, (err) => {
console.info("====>" + strAction + " stop ServiceAbilitySec err: " +
JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
commonEventData.parameters.message = disConnect;
commonEvent.publish("ACTS_StopEvent_Third", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
})
})
})
}, 200)
}, 100)
}
if (strAction == "Acts_StopServiceExtension_0800") {
setTimeout(()=>{
this.context.stopServiceExtensionAbility({
deviceId: "abcdefg12345678",
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbilitySec",
action: strAction
}, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " + JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " publish err: " + JSON.stringify(err));
})
})
}, 100)
}
if (strAction == "Acts_StopServiceExtension_1800") {
setTimeout(()=>{
this.context.stopServiceExtensionAbility({
deviceId: undefined,
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbilitySec",
action: strAction
}, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " + JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " publish err: " + JSON.stringify(err));
})
})
}, 100)
}
}
onDestroy() {
console.info('ServiceAbility onDestroy');
}
onRequest(want, startId) {
console.info('ServiceAbility onRequest');
}
onConnect(want) {
console.info('ServiceAbility onConnect');
return remoteOBJ;
}
onDisconnect(want) {
console.info('ServiceAbility onDisconnect');
}
onReconnect(want) {
console.info('ServiceAbility onReconnect');
}
onConfigurationUpdate(newConfig) {
console.info('ServiceAbility onConfigurationUpdate');
}
onDump(params) {
console.info('ServiceAbility onDump');
return params;
}
};
\ 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.
*/
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'
import rpc from '@ohos.rpc';
import commonEvent from '@ohos.commonEvent'
let message;
let commonEventData={
parameters:{
message:message,
}
}
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbilitySec onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbilitySec op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
let strAction = '';
let remoteOBJ = new StubTest("test");
export default class ServiceAbilitySec extends ServiceExtensionAbility {
onCreate(want){
strAction = want.action;
console.info('ServiceAbilitySec onCreate');
commonEventData.parameters.message = want;
if (strAction == "Acts_StopServiceExtension_0200" || strAction == "Acts_StopServiceExtension_0400" ||
strAction == "Acts_StopServiceExtension_0600") {
commonEvent.publish("ACTS_StopEvent_Second", commonEventData, (err) => {
console.info("====>" + strAction + " Second publish err: " + JSON.stringify(err));
})
}
}
onDestroy() {
console.info('ServiceAbilitySec onDestroy');
}
onRequest(want, startId) {
console.info('ServiceAbilitySec onRequest');
}
onConnect(want) {
console.info('ServiceAbilitySec onConnect');
return remoteOBJ;
}
onDisconnect(want) {
console.info('ServiceAbilitySec onDisconnect');
}
onReconnect(want) {
console.info('ServiceAbility onReconnect');
}
onConfigurationUpdate(newConfig) {
console.info('ServiceAbility onConfigurationUpdate');
}
onDump(params) {
console.info('ServiceAbility onDump');
return params;
}
};
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/serviceability/ServiceAbility.ts",
"label": "$string:ServiceAbility_label",
"description": "$string:ServiceAbility_desc",
"type": "service"
},
{
"name": "ServiceAbilitySec",
"srcEntrance": "./ets/serviceabilitySec/ServiceAbilitySec.ts",
"label": "$string:ServiceAbilitySec_desc",
"description": "$string:ServiceAbilitySec_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "ServiceAbility_desc",
"value": "service_description"
},
{
"name": "ServiceAbility_label",
"value": "service_label"
},
{
"name": "ServiceAbilitySec_desc",
"value": "service_description"
},
{
"name": "ServiceAbilitySec_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "ActsStopServiceExtensionRely"
},
{
"name": "ServiceAbility_desc",
"value": "service_description"
},
{
"name": "ServiceAbility_label",
"value": "service_label"
},
{
"name": "ServiceAbilitySec_desc",
"value": "service_description"
},
{
"name": "ServiceAbilitySec_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "ActsStopServiceExtensionRely"
},
{
"name": "ServiceAbility_desc",
"value": "service_description"
},
{
"name": "ServiceAbility_label",
"value": "service_label"
},
{
"name": "ServiceAbilitySec_desc",
"value": "service_description"
},
{
"name": "ServiceAbilitySec_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.acts.stopserviceextensiontest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
# 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.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsStopServiceExtensionTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsstopserviceextensiontest_js_assets",
":actsstopserviceextensiontest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsStopServiceExtensionTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsstopserviceextensiontest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsstopserviceextensiontest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsstopserviceextensiontest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsstopserviceextensiontest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.acts.stopserviceextensiontest",
"module-name": "entry_test",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsStopServiceExtensionTest.hap",
"ActsStopServiceExtensionRely.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D",
"setenforce 0"
]
}
]
}
\ 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.
*/
import hilog from '@ohos.hilog';
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters['-D']
if (debug == 'true')
{
cmd += ' -D'
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
/*
* 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.
*/
import abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ 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.
*/
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Window from '@ohos.window'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
this.context.stopServiceExtensionAbility
globalThis.abilityContext = this.context;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core} from '@ohos/hypium'
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('onShow finish')
const core = Core.getInstance()
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
core.execute()
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ 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.
*/
import hilog from '@ohos.hilog';
@Entry
@Component
struct Index {
aboutToAppear() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"abilities": [
{
"name": "TestAbility",
"srcEntrance": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"visible": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test 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.
import("//test/xts/tools/build/suite.gni")
group("stopserviceextension") {
testonly = true
if (is_standard_system) {
deps = [
"ActsStopServiceExtensionRely:ActsStopServiceExtensionRely",
"ActsStopServiceExtensionTest:ActsStopServiceExtensionTest",
]
}
}
......@@ -47,7 +47,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>afterEach start====");
var appAccountManager = account.getAccountManager();
var accounts = await appAccountManager.getAllAccountByOwner(owner)
for (i=0;i<accounts.length;i++){
for (var i=0;i<accounts.length;i++){
var localName = accounts[i].name
if(localName == 'zhangsan'){
await appAccountManager.removeAccount(localName)
......@@ -70,7 +70,8 @@ export default function ActsAccountAppAccess() {
appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data));
console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.removeAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0100 removeAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null);
......@@ -98,7 +99,8 @@ export default function ActsAccountAppAccess() {
appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data));
console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.removeAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0200 removeAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null);
......@@ -125,8 +127,8 @@ export default function ActsAccountAppAccess() {
appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data));
expect(data).assertEqual(false)
console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.removeAccount("CheckAccountLabels_0300", (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0300 removeAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null);
......@@ -152,6 +154,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.removeAccount(name).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success");
done();
......@@ -185,6 +188,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels')
expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult')
appAccountManager.removeAccount(name).then((data) =>{
......@@ -220,6 +224,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data));
appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.removeAccount('CheckAccountLabels_0600').then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success");
done();
......
......@@ -46,7 +46,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>afterEach start====");
var appAccountManager = account.getAccountManager();
var accounts = await appAccountManager.getAllAccountByOwner(owner)
for (i=0;i<accounts.length;i++){
for (var i=0;i<accounts.length;i++){
var localName = accounts[i].name
if(localName == 'zhangsan'){
await appAccountManager.removeAccount(localName)
......@@ -69,7 +69,8 @@ export default function ActsAccountAuthenticator() {
appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data));
console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.deleteAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0100 deleteAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null);
......@@ -97,7 +98,8 @@ export default function ActsAccountAuthenticator() {
appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data));
console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.deleteAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0200 deleteAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null);
......@@ -124,8 +126,8 @@ export default function ActsAccountAuthenticator() {
appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data));
expect(data).assertEqual(false)
console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.deleteAccount("CheckAccountLabels_0300", (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0300 deleteAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null);
......@@ -151,6 +153,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.deleteAccount(name).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success");
}).catch((err) =>{
......@@ -164,7 +167,7 @@ export default function ActsAccountAuthenticator() {
})
}).catch((err) => {
console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_err:" + JSON.stringify(err))
expect(err.code!=0).assertTrue();
expect().assertFail();
done();
})
});
......@@ -182,6 +185,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels')
expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult')
appAccountManager.deleteAccount(name).then((data) =>{
......@@ -215,6 +219,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data));
appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.deleteAccount('CheckAccountLabels_0600').then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success");
}).catch((err) =>{
......
......@@ -22,6 +22,25 @@ const SELFBUNDLE = 'com.example.actsgetaccountsbyowner'
const createAccountOptions = {customData:{age:'12'}}
export default function GetAccountsByOwner() {
describe('GetAccountsByOwner', function () {
beforeAll(async function (done) {
console.debug("====>startAbility start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
await sleep(TIMEOUT);
done();
});
async function sleep(delay) {
let timeoutId = null;
var promise = new Promise((resolve, reject) => {
......@@ -266,20 +285,6 @@ export default function GetAccountsByOwner() {
console.debug("====>creat finish====");
console.debug("====>add account 0900 start====");
await appAccountManager.createAccount("Account_application_callback");
console.debug("====>startAbility 0900 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
function getAllCallback(err, data){
console.debug("====>getAccountsByOwner 0900 err:" + JSON.stringify(err));
console.debug("====>getAccountsByOwner 0900 data:" + JSON.stringify(data));
......@@ -310,21 +315,7 @@ export default function GetAccountsByOwner() {
console.debug("====>creat finish====");
console.debug("====>add account 1000 start====");
await appAccountManager.createAccount("Account_application_promise");
console.debug("====>startAbility 1000 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
sleep(TIMEOUT)
await sleep(TIMEOUT)
console.debug("====>getAccountsByOwner 1000 start====");
try{
var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE);
......@@ -361,20 +352,6 @@ export default function GetAccountsByOwner() {
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
var specifiedBundle = "com.example.actsscenegetallaccounts";
console.debug("====>startAbility 1100 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
function getAllCallback(err, data){
console.debug("====>getAccountsByOwner 1100 err:" + JSON.stringify(err));
console.debug("====>getAccountsByOwner 1100 data:" + JSON.stringify(data));
......@@ -384,7 +361,7 @@ export default function GetAccountsByOwner() {
console.debug("====>GetAccountsByOwner_1100 end====");
done();
}
sleep(TIMEOUT)
await sleep(TIMEOUT)
console.debug("====>getAccountsByOwner 1100 start====");
appAccountManager.getAccountsByOwner(specifiedBundle, getAllCallback);
});
......@@ -400,20 +377,6 @@ export default function GetAccountsByOwner() {
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
var specifiedBundle = "com.example.actsscenegetallaccounts";
console.debug("====>startAbility 1200 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
await sleep(TIMEOUT)
console.debug("====>getAccountsByOwner 1200 start====");
try{
......
......@@ -29,6 +29,7 @@ group("arkui") {
"ace_ets_test:ActsAceEtsTest",
"ace_ets_third_test:ActsAceEtsThirdTest",
"ace_ets_web_dev:ActsAceWebDevTest",
"ace_ets_web_dev_four:ActsAceWebDevFourTest",
"ace_ets_web_dev_three:ActsAceWebDevThreeTest",
"ace_ets_web_dev_two:ActsAceWebDevTwoTest",
"ace_ets_xcomponent:ActsAceXComponentEtsTest",
......
......@@ -397,7 +397,7 @@ export default function textStyleJsunit() {
console.info("[testTextStyle016] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle016] fontWeight: " + obj.$attrs.fontWeight);
expect(obj.$attrs.fontWeight).assertEqual('FontWeight.700');
expect(obj.$attrs.fontWeight).assertEqual('700');
done();
});
......@@ -423,7 +423,7 @@ export default function textStyleJsunit() {
console.info("[testTextStyle017] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle017] fontWeight: " + obj.$attrs.fontWeight);
expect(obj.$attrs.fontWeight).assertEqual('FontWeight.400');
expect(obj.$attrs.fontWeight).assertEqual('400');
done();
});
......
......@@ -70,7 +70,7 @@ struct NavRouterPage {
Flex({ direction: FlexDirection.Row }) {
Row() {
Image($r('app.media.icon')).width(40).height(40).borderRadius(40).margin({ right: 15 })
Text('Hello').fontSize(30).key('textContent' + (item + 1).toString())
Text('Hello').fontSize(30).key('textContent')
}.padding({ left: 15 })
}
}.backgroundColor('#ccc')
......@@ -91,7 +91,7 @@ struct NavRouterPage {
.hideTitleBar(true)
.hideToolBar(true)
.height('80%')
Text(this.stateChange).fontSize(20).margin(10).id('123')
Text(this.stateChange).fontSize(20).margin(10).key('testT')
}.height('100%')
}
}
......
......@@ -26,7 +26,7 @@ struct TextInputPage {
@State maxLength: number = 10
@State copyOption: CopyOptions = CopyOptions.None
@State showPasswordIcon: boolean = false
@State style: TextInputStyle = TextInputStyle.Inline
@State style: TextInputStyle = TextInputStyle.Default
@State textAlign: TextAlign = TextAlign.Center
@State text: string = 'onChange'
@State onSubmit: string = ''
......@@ -163,7 +163,7 @@ struct TextInputPage {
.style(TextInputStyle.Inline)
Text('onSubmit:' + this.onSubmit).fontSize(20).margin(10).key('submit')
Text('onEditChange:' + this.onEditChange).fontSize(20).margin(10).key('editChange')
Text('onCopy:' + this.onCopy).fontSize(20).margin(10).id('copy')
Text('onCopy:' + this.onCopy).fontSize(20).margin(10).key('copy')
Text('onCut:' + this.onCut).fontSize(20).margin(10).key('cut')
Text('onPaste:' + this.onPaste).fontSize(20).margin(10).key('paste')
}.width('100%')
......
......@@ -50,7 +50,7 @@ struct CheckboxExample {
} else {
this.selectedColor = "#000000"
}
}).key("check1").id('chek1')
}).id('chek1')
Checkbox({name: 'checkbox2', group: 'checkboxGroup'})
.select(false)
.selectedColor(0x39a2db)
......
......@@ -44,7 +44,7 @@ struct ImageAnimatorExample {
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'type') {
if (message.name == 'state') {
this.state = message.value
}
if (message.name == 'reverse') {
......@@ -56,24 +56,12 @@ struct ImageAnimatorExample {
if (message.name == 'fixedSize') {
this.fixedSize = message.value
}
if (message.fillMode == 'fillMode') {
if (message.name == 'fillMode') {
this.fillMode = message.value
}
if (message.duration == 'duration') {
if (message.name == 'duration') {
this.duration = message.value
}
if (message.widthT == 'widthT') {
this.widthT = message.value
}
if (message.heightT == 'heighT') {
this.heightT = message.value
}
if (message.top == 'top') {
this.top = message.value
}
if (message.left == 'left') {
this.left = message.value
}
}
this.messageManager.registerCallback(callback)
}
......@@ -111,7 +99,7 @@ struct ImageAnimatorExample {
.margin({ top: 100 })
.key('imageAnimator')
.onStart(() => {
console.info('Start')
console.info('Start123456')
this.message1 = 'start'
})
.onPause(() => {
......
......@@ -24,9 +24,11 @@ struct ImageExample3 {
private on2off: Resource = $rawfile('bm.jpg')
private off2on: Resource = $rawfile('test3.png')
@State src: Resource = this.on
@State m1:string = "xx"
@State m2:string = "x"
@State name:string = "tt3.png"
@State m1:string = "init"
@State m2:string = "init"
@State m3:string = "init"
@State m4:string = "init"
@State imageName:string = "img1.png"
messageManager:MessageManager = new MessageManager()
......@@ -37,8 +39,8 @@ struct ImageExample3 {
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'name') {
this.name = message.value
if (message.name == 'imageName') {
this.imageName = message.value
}
}
this.messageManager.registerCallback(callback)
......@@ -49,9 +51,9 @@ struct ImageExample3 {
Column() {
Row({ space: 20 }) {
Column() {
Image($rawfile(this.name))
Image($rawfile(this.imageName))
.alt($rawfile('img2.png'))
.key('image2')
.key('image1')
.sourceSize({
width: 900,
height: 900
......@@ -66,37 +68,40 @@ struct ImageExample3 {
})
.onError(() => {
console.log('load image fail')
this.m1 = "error"
this.m2 = "error"
})
.overlay('\nwidth: ' + String(this.widthValue) + ' height: ' + String(this.heightValue), {
align: Alignment.Bottom,
offset: { x: 0, y: 20 }
})
Text(this.m1).margin({top:40}).key('text1')
Text(this.m2).margin({top:40}).key('text2')
}
Text(this.m1).margin({top:40}).key('complete')
Text(this.m2).margin({top:40}).key('error')
Text(this.m3).margin({top:40}).key('click')
Text(this.m4).margin({top:40}).key('Finish')
// 为图片添加点击事件,点击完成后加载特定图片。
Image(this.src)
.width(120).height(120)
.onClick(() => {
if (this.src == this.on || this.src == this.off2on) {
this.src = this.on2off
this.m1 = "click"
this.m3 = "click"
} else {
this.src = this.off2on
this.m1 = "click"
this.m3 = "click"
}
}).key('igc')
}).key('image2')
.onFinish(() => {
if (this.src == this.off2on) {
this.src = this.on
this.m2 = "Finish"
this.m4 = "Finish"
} else {
this.src = this.off
this.m2 = "Finish"
this.m4 = "Finish"
}
})
}
}
}.width('100%')
}
......
......@@ -48,8 +48,8 @@ struct SliderExample {
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'outSetValueOne') {
this.outSetValueOne = message.value
if (message.name == 'vInSetValueOne') {
this.vInSetValueOne = message.value
}
if (message.name == 'style') {
this.style = message.value
......
......@@ -106,9 +106,6 @@ struct TextAreaExample {
.textAlign(this.textAlign)
.caretColor(this.caretColor)
.backgroundColor('#FFFFFF')
.inputFilter("shang",err => {
console.info("te")
})
.copyOption(this.copyOption)
.onChange((value: string) => {
this.message1 = value
......
......@@ -67,13 +67,13 @@ export default function blankJsunit() {
console.info('blankJsunitUITest_0200 START');
await CommonFunc.sleep(1000);
// 动态修改Blank组件的minwidth
globalThis.value.message.notify({name:'minWith',value:80})
await CommonFunc.sleep(2000);
globalThis.value.message.notify({name:'minWith',value:'80'})
await CommonFunc.sleep(3000);
// 获取动态修改后的组件的minwidth
let strJson = getInspectorByKey('bl2');
let obj = JSON.parse(strJson);
console.info("[blankJsunit_0200'] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.min).assertEqual('80.00px');
expect(obj.$attrs.min).assertEqual('80.00vp');
done();
});
......
......@@ -109,7 +109,7 @@ export default function checkBoxJsunit() {
let strJson = getInspectorByKey('chek1');
let obj = JSON.parse(strJson);
console.info("[blankJsunit_0400'] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectedColor).assertEqual('#FF000000');
expect(obj.$attrs.selectedColor).assertEqual('#FFFFFF21');
done();
});
......
......@@ -166,14 +166,12 @@ export default function GridItemJsunit() {
it('GridJsunit_0500', 0, async function (done) {
// Verify the columnsTemplate of Grid component
console.info('[GridJsunit_0500] START');
let gridItem1 = CommonFunc.getComponentRect('gridItem1');
let left1 = gridItem1.left
let gridItem2 = CommonFunc.getComponentRect('gridItem1');
let right1 = gridItem2.right
let gridItem1 = CommonFunc.getComponentRect('0');
let right1 = gridItem1.right;
await CommonFunc.sleep(1000);
let gridItem3 = CommonFunc.getComponentRect('3');
let right2 = gridItem3.right
expect(right2 - left1 - 4 * 6).assertEqual((right1 - left1) * 5);
let gridItem3 = CommonFunc.getComponentRect('1');
let left3 = gridItem3.left;
expect(left3 - right1).assertEqual(vp2px(4));
console.info('[GridJsunit_0500] END');
done();
});
......@@ -183,12 +181,10 @@ export default function GridItemJsunit() {
console.info('[GridJsunit_0600] START');
await CommonFunc.sleep(1000);
let gridItem1 = CommonFunc.getComponentRect('0');
let top1 = gridItem1.top
let gridItem2 = CommonFunc.getComponentRect('gridItem3');
let top2 = gridItem2.top
let gridItem3 = CommonFunc.getComponentRect('gridItem3');
let bottom2 = gridItem3.bottom
expect((bottom2 - top2) * 4 + 7.5).assertEqual(bottom2 - top1 - 5 * 3);
let bottom1 = gridItem1.bottom;
let gridItem3 = CommonFunc.getComponentRect('4');
let top3 = gridItem3.top;
expect(top3 - bottom1).assertEqual(vp2px(5));
console.info('[GridJsunit_0600] END');
done();
});
......@@ -199,10 +195,10 @@ export default function GridItemJsunit() {
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
let gridItem1 = CommonFunc.getComponentRect('gridItem1');
let right1 = gridItem1.right
let right1 = gridItem1.right;
let gridItem2 = CommonFunc.getComponentRect('0');
let left1 = gridItem2.left
expect(left1 - right1).assertEqual(6);
let left1 = gridItem2.left;
expect(left1 - right1).assertEqual(vp2px(4));
console.info('[GridJsunit_0700] END');
done();
});
......@@ -216,10 +212,10 @@ export default function GridItemJsunit() {
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
let gridItem1 = CommonFunc.getComponentRect('gridItem1');
let bottom1 = gridItem1.bottom
let bottom1 = gridItem1.bottom;
let gridItem2 = CommonFunc.getComponentRect('gridItem3');
let top1 = gridItem2.top
expect(top1 - bottom1).assertEqual(7.5);
let top1 = gridItem2.top;
expect(top1 - bottom1).assertEqual(vp2px(5));
console.info('[GridJsunit_0800] END');
done();
});
......
......@@ -187,7 +187,7 @@ export default function GridJsunit() {
console.info("[GridJsunit_0500] supportAnimation: " + JSON.stringify(obj.$attrs.supportAnimation));
expect(obj.$attrs.columnsGap).assertEqual('0.00vp');
expect(obj.$attrs.rowsGap).assertEqual('0.00vp');
expect(obj.$attrs.scrollBar).assertEqual('BarState.Off');
expect(obj.$attrs.scrollBar).assertEqual('BarState.Auto');
expect(obj.$attrs.cachedCount).assertEqual(1);
expect(obj.$attrs.supportAnimation).assertEqual('false');
console.info('[GridJsunit_0500] END');
......
......@@ -57,7 +57,11 @@ export default function GridRowJsunit() {
expect(obj.$attrs.columns).assertEqual('4');
expect(obj.$attrs.breakpoints).assertEqual('4');
expect(obj.$attrs.direction).assertEqual('4');
expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000');
// fix the vp2px
let x = vp2px(5).toFixed(6);
let y = vp2px(10).toFixed(6);
let str = '<' + x + ', '+y;
expect(obj.$attrs.gutter).assertEqual(str);
console.info('[GridRowJsunit_0100] END');
done();
});
......@@ -85,9 +89,12 @@ export default function GridRowJsunit() {
console.info("[GridRowJsunit_0200] direction: " + JSON.stringify(obj.$attrs.direction));
console.info("[GridRowJsunit_0200] gutter: " + JSON.stringify(obj.$attrs.gutter));
expect(obj.$attrs.columns).assertEqual('12');
expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000');
expect(obj.$attrs.breakpoints).assertEqual('12');
expect(obj.$attrs.direction).assertEqual('12');
let x = vp2px(5).toFixed(6);
let y = vp2px(10).toFixed(6);
let str = '<' + x + ', '+y;
expect(obj.$attrs.gutter).assertEqual(str);
console.info('[GridRowJsunit_0200] END');
done();
});
......@@ -115,9 +122,12 @@ export default function GridRowJsunit() {
console.info("[GridRowJsunit_0300] direction: " + JSON.stringify(obj.$attrs.direction));
console.info("[GridRowJsunit_0300] gutter: " + JSON.stringify(obj.$attrs.gutter));
expect(obj.$attrs.columns).assertEqual('12');
expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000');
expect(obj.$attrs.breakpoints).assertEqual('12');
expect(obj.$attrs.direction).assertEqual('12');
let x = vp2px(5).toFixed(6);
let y = vp2px(10).toFixed(6);
let str = '<' + x + ', '+y;
expect(obj.$attrs.gutter).assertEqual(str);
console.info('[GridRowJsunit_0300] END');
done();
});
......
......@@ -91,20 +91,20 @@ export default function ListJsunit() {
console.info('[ListJsunit_0200] START');
// Verify onScroll function of List component
let gridTop = CommonFunc.getComponentRect('grid2');
let gridTop = CommonFunc.getComponentRect('list');
let top = gridTop.top
let gridLeft = CommonFunc.getComponentRect('grid2');
let left = gridLeft.left
let gridRight = CommonFunc.getComponentRect('grid2');
let gridBottom = CommonFunc.getComponentRect('list');
let bottom = gridBottom.bottom
let gridRight = CommonFunc.getComponentRect('list');
let right = gridRight.right
let driver = await UiDriver.create()
await driver.swipe(Math.round(left + 50), Math.round(top + 100), Math.round(right - 50), Math.round(top + 100));
await driver.swipe(Math.round(top + 50), Math.round(right - 50), Math.round(bottom - 50), Math.round(right - 50));
await CommonFunc.sleep(1000);
let onScrollText = await driver.findComponent(BY.key('onScrollText'));
let text1 = await onScrollText.getText();
console.info("[ListJsunit_0200] onScrollText: " + text1);
expect(text1).assertEqual('onScroll:succ');
expect(text1).assertEqual('onScroll');
// Verify the functions of onReachStart
await CommonFunc.sleep(200);
......@@ -118,34 +118,34 @@ export default function ListJsunit() {
let onScrollBeginText = await driver.findComponent(BY.key('onScrollBeginText'));
let text3 = await onScrollBeginText.getText();
console.info("[ListJsunit_0200] onScrollBeginText: " + text3);
expect(text3).assertEqual('onScrollBegin:succ');
expect(text3).assertEqual('onScrollBegin');
// Verify the functions of onScrollStart
await CommonFunc.sleep(200);
let onScrollStartText = await driver.findComponent(BY.key('onScrollStartText'));
let text4 = await onScrollStartText.getText();
console.info("[ListJsunit_0200] onScrollStartText: " + text4);
expect(text4).assertEqual('onScrollStart:succ');
expect(text4).assertEqual('onScrollStart');
// Verify the functions of onScrollStop
await CommonFunc.sleep(200);
let onScrollStopText = await driver.findComponent(BY.key('onScrollStopText'));
let text5 = await onScrollStopText.getText();
console.info("[ListJsunit_0200] onScrollStopText: " + text5);
expect(text5).assertEqual('onScrollStop:succ');
expect(text5).assertEqual('onScrollStop');
// Verify the functions of onReachEnd
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100));
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100));
await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await CommonFunc.sleep(1000);
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100));
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100));
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100));
await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await CommonFunc.sleep(1000);
let onReachEndText = await driver.findComponent(BY.key('onReachEndText'));
let text= await onReachEndText.getText();
console.info("[ListJsunit_0200] onReachEndText: " + text);
expect(text).assertEqual('onReachEnd:succ');
expect(text).assertEqual('onReachEnd');
console.info('[ListJsunit_0200] END');
done();
});
......@@ -181,7 +181,7 @@ export default function ListJsunit() {
await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'alignListItem',value:ListItemAlign.Start})
await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'sticky',value:StickyStyle.Header})
globalThis.value.message.notify({name:'sticky',value:StickyStyle.None})
await CommonFunc.sleep(2000);
// Get the propoties value of the List component
......
......@@ -53,25 +53,14 @@ export default function NavRouterJsunit() {
let navRouter2 = await driver.findComponent(BY.key('NavRouter2'));
await navRouter2.click();
await CommonFunc.sleep(1000);
let stateChange = await driver.findComponent(BY.id(123));
await stateChange.click();
await CommonFunc.sleep(1000);
let stateChange = await driver.findComponent(BY.key('testT'));
let text1 = await stateChange.getText();
console.info("[NavRouterJsunit_0100] text1: " + JSON.stringify(text1));
expect(text1 == 'stateChange true').assertTrue();
let textComponent = await driver.findComponent(BY.key('textContent1'));
let textComponent = await driver.findComponent(BY.key('textContent'));
let text2 = await textComponent.getText();
console.info("[NavRouterJsunit_0100] text2: " + JSON.stringify(text2));
expect(text2 == 'Hello').assertTrue();
await CommonFunc.sleep(1000);
let stateChange3 = await driver.findComponent(BY.id(123));
await stateChange3.click();
await CommonFunc.sleep(1000);
let text3 = await stateChange.getText();
console.info("[NavRouterJsunit_0100] text3: " + JSON.stringify(text3));
expect(text3 == 'stateChange false').assertTrue();
console.info('[NavRouterJsunit_0100] END');
done();
});
......
......@@ -137,6 +137,8 @@ export default function RatingJsunit() {
// Modify the indicator value of the Rating component
globalThis.value.message.notify({name:'rating',value:1})
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'text',value:'no change'})
await CommonFunc.sleep(2000);
let driver = await UiDriver.create()
let textComponent1 = await driver.findComponent(BY.key('text'));
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册