提交 78bd4843 编写于 作者: O openharmony_ci 提交者: Gitee

!1269 Update ans &bms test code

Merge pull request !1269 from blackleon/update_master_1202
......@@ -17,6 +17,9 @@ group("ams_standard") {
testonly = true
if (is_standard_system) {
deps = [
"amsabilitymanager/amsMissionSnapshotTest:amsMissionSnapshotTest",
"amsabilitymanager/amsMissionSnapshotTestSingleton:amsMissionSnapshotTestSingleton",
"amsabilitymanager/amsMissionSnapshotTestSingletonS:amsMissionSnapshotTestSingletonS",
"amsdatauriutils:amsDataUriUtils",
"amszipfileunzipfilest:amsZipfileUnzipfileST",
"fwkdataaccessor:FWKDataAccessor",
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("amsMissionSnapshotTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMissionSnapshotTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests"
}
{
"app": {
"bundleName": "com.amsst.amsMissionSnapshotTest",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsMissionSnapshotTest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"name": "com.amsst.amsMissionSnapshotTest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STAbilityManagerMissionSnapshot
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('====onShow finish====<')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./amsMissionSnapshotTest.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "MissionSnapshot"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("amsMissionSnapshotTestSingleton") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMissionSnapshotTestSingleton"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"bundleName": "com.amsst.amsMissionSnapshotTestSingleton",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsMissionSnapshotTestSingleton",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"name": "com.amsst.amsMissionSnapshotTestSingleton.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "singleton",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STAbilityManagerMissionSnapshotSingleton
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import commonEvent from '@ohos.commonevent'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
OnActive(){
console.debug('ACTS_MissionSnapshot_OnActive');
commonEvent.publish("ACTS_MissionSnapshot_OnActive", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_OnActive err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
onShow() {
console.debug('ACTS_MissionSnapshot_onShow');
commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_onShow err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StServiceAbilityServer"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("amsMissionSnapshotTestSingletonS") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMissionSnapshotTestSingletonS"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"bundleName": "com.amsst.amsMissionSnapshotTestSingletonS",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsMissionSnapshotTestSingletonS",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"name": "com.amsst.amsMissionSnapshotTestSingletonS.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "singleton",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STAbilityManagerMissionSnapshotSingletonS
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import commonEvent from '@ohos.commonevent'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
OnActive(){
console.debug('ACTS_MissionSnapshot_OnActive');
commonEvent.publish("ACTS_MissionSnapshot_OnActive", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_OnActive err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
onShow() {
console.debug('ACTS_MissionSnapshot_onShow');
commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_onShow err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StServiceAbilityServer"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
......@@ -24,6 +24,7 @@ group("publish_test") {
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
"activebtn:activebtn",
"ansactscancelgroup:ActsAnsCancelGroup",
"ansactsremovegroup:ActsAnsRemoveGroup",
"donotdisturbmode:ActsAnsDoNotDisturbTest",
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("activebtn") {
testonly = true
if (is_standard_system) {
deps = [
"activebutton:ActsAnsActionButtonTest",
"testa:testA",
"testb:testB",
"testc:testC",
]
}
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsActionButtonTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsActionButtonTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsansactionbuttontest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsActionButtonTest.hap",
"testA.hap",
"testB.hap",
"testC.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansactionbuttontest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansactionbuttontest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansactionbuttontest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "ActiveBtn"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import notify from '@ohos.notification';
import { OperationType, WantAgentFlags} from '@ohos.wantagent';
import wantagent from '@ohos.wantAgent'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var timeout = 300;
describe('ActsAnsPublishInput', function () {
console.info("===========ActsAnsPublishInput start====================>");
function onConsumeOne(data) {
console.info("=========Ans_PublishInput_0100 onConsume start==============>");
console.info("=========Ans_PublishInput_0100 onConsume data:==============>" + JSON.stringify(data));
var inputKey = data.request.actionButtons[0].userInput.inputKey
console.info("=========Ans_PublishInput_0100 onConsume inputKey================>"+inputKey);
expect(inputKey).assertEqual("inputKey_0100");
console.info("=========Ans_PublishInput_0100 onConsume end================>");
}
/*
* @tc.number: Ans_PublishInput_0100
* @tc.name: publish(request: NotificationRequest): Promise<void>;
* @tc.desc: Verify that the inputKey information can be received in the received notification.
*/
it('Ans_PublishInput_0100', 0, async function (done) {
console.info("==================Ans_PublishInput_0100 start==================>");
var subscriber = {
onConsume:onConsumeOne,
}
var agentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.actsanspublishinput",
abilityName: "com.example.actsanspublishinput.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentData = await wantagent.getWantAgent(agentInfo);
console.info("===========Ans_PublishInput_0100 getWantAgent promise======>");
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
wantAgent: wantAgentData,
actionButtons: [
{
title:"button1",
wantAgent:wantAgentData,
userInput : {
inputKey: "inputKey_0100",
}
}]
}
await notify.subscribe(subscriber);
console.info("===========Ans_PublishInput_0100 subscribe promise======>");
await notify.publish(notificationRequest);
console.info("===========Ans_PublishInput_0100 publish promise========>");
setTimeout((async function(){
console.info("======Ans_PublishInput_0100 setTimeout==============>");
notify.unsubscribe(subscriber);
console.info("======Ans_PublishInput_0100 setTimeout unsubscribe==>");
done();
}),timeout);
})
function onConsumeTwo(data) {
console.info("=========Ans_PublishInput_0200 onConsume start==============>");
console.info("=========Ans_PublishInput_0200 onConsume data:==============>" + JSON.stringify(data));
var inputKey = data.request.actionButtons[0].userInput.inputKey
console.info("=========Ans_PublishInput_0200 onConsume inputKey================>"+inputKey);
expect(inputKey).assertEqual(" ");
console.info("=========Ans_PublishInput_0200 onConsume end================>");
}
/*
* @tc.number: Ans_PublishInput_0200
* @tc.name: publish(request: NotificationRequest): Promise<void>;
* @tc.desc: Verify that the inputKey information can be received in the received notification.(inputKey = " ")
*/
it('Ans_PublishInput_0200', 0, async function (done) {
console.info("==================Ans_PublishInput_0200 start==================>");
var subscriber = {
onConsume:onConsumeTwo,
}
var agentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.actsanspublishinput",
abilityName: "com.example.actsanspublishinput.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentData = await wantagent.getWantAgent(agentInfo);
console.info("===========Ans_PublishInput_0200 getWantAgent promise======>");
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 2,
slotType : notify.SlotType.SERVICE_INFORMATION,
wantAgent: wantAgentData,
actionButtons: [
{
title:"button2",
wantAgent:wantAgentData,
userInput : {
inputKey: " ",
}
}]
}
await notify.subscribe(subscriber);
console.info("===========Ans_PublishInput_0200 subscribe promise======>");
await notify.publish(notificationRequest);
console.info("===========Ans_PublishInput_0200 publish promise========>");
setTimeout((async function(){
console.info("======Ans_PublishInput_0200 setTimeout==============>");
notify.unsubscribe(subscriber);
console.info("======Ans_PublishInput_0200 setTimeout unsubscribe==>");
done();
}),timeout);
})
})
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./publishIcon.js')
require('./publishImage.js')
require('./ActsAnsPublishInput.js')
require('./ActiveButton.js')
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import notification from '@ohos.notification'
import image from '@ohos.multimedia.image'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var ERR_ANS_ICON_OVER_SIZE = 67108882
var largeIconA
var smallIconA
var largeBufferA
var smallBufferA
var largeOptsA
var smallOptsA
var largeIconB
var smallIconB
var largeBufferB
var smallBufferB
var largeOptsB
var smallOptsB
var largeIconC
var smallIconC
var largeBufferC
var smallBufferC
var largeOptsC
var smallOptsC
var largeIconD
var smallIconD
var largeBufferD
var smallBufferD
var largeOptsD
var smallOptsD
describe('ActsAnsPublishIconTest', function () {
function publishCallbackA(err){
console.log('ActsAnsPublishIconTest publishCallbackA asyncCallback'+err.code)
expect(err.code).assertEqual(0)
}
function publishCallbackB(err){
console.log('ActsAnsPublishIconTest publishCallbackB asyncCallback'+err.code)
expect(err.code).assertEqual(ERR_ANS_ICON_OVER_SIZE)
}
function consumeCallbackA(data) {
console.debug("===consumeCallbackA data : ===>" + JSON.stringify(data));
expect(data.request.id).assertEqual(1)
}
function consumeCallbackB(data) {
console.debug("===consumeCallbackB data : ===>" + JSON.stringify(data));
expect(data.request.id).assertEqual(2)
}
function subscribeCallbackA(err) {
console.info("===subscribeCallbackA err : ===>" + JSON.stringify(err));
expect(err.code).assertEqual(0)
}
function subscribeCallbackB(err) {
console.info("===subscribeCallbackB err : ===>" + JSON.stringify(err));
expect(err.code).assertEqual(0)
}
/*
* @tc.number: ACTS_PublishIconTest_0100
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0100', 0,async function (done) {
var subInfo ={
onConsume:consumeCallbackA,
}
await notification.subscribe(subInfo,subscribeCallbackA);
largeBufferA = new ArrayBuffer(4*100*100);
smallBufferA = new ArrayBuffer(4*2*25);
largeOptsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 100, width: 100}}
smallOptsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferA, largeOptsA);
promise_Large.then((data) => {
largeIconA = data;
console.debug("===createPixelMapA largeIcon===>"+JSON.stringify(largeIconA));
const promise_Small = image.createPixelMap(smallBufferA, smallOptsA);
promise_Small.then((data) => {
smallIconA = data;
console.debug("===createPixelMapA smallIcon===>"+JSON.stringify(smallIconA));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_titleA",
text: "test_textA",
additionalText: "test_additionalTextA"
},
},
id: 1,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconA,
largeIcon:largeIconA,
},publishCallbackA);
setTimeout((async function(){
notification.unsubscribe(subInfo);
console.info("======ActsPublishImage_test_0100 setTimeout unsubscribe===>");
done();
}),300);
})
});
});
/*
* @tc.number: ACTS_PublishTest_0200
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0200', 0,async function (done) {
var subInfo ={
onConsume:consumeCallbackB,
}
await notification.subscribe(subInfo,subscribeCallbackB);
largeBufferB = new ArrayBuffer(4*200*50);
smallBufferB = new ArrayBuffer(4*2*25);
largeOptsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 200}}
smallOptsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferB, largeOptsB);
promise_Large.then((data) => {
largeIconB = data;
console.debug("===createPixelMapB largeIcon===>"+JSON.stringify(largeIconB));
const promise_Small = image.createPixelMap(smallBufferB, smallOptsB);
promise_Small.then((data) => {
smallIconB = data;
console.debug("===createPixelMapB smallIcon===>"+JSON.stringify(smallIconB));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_titleB",
text: "test_textB",
additionalText: "test_additionalTextB"
},
},
id: 2,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconB,
largeIcon:largeIconB,
}).then(()=>{
console.debug("===ACTS_PublishIconTest_0200 promise===>");
});
setTimeout((async function(){
notification.unsubscribe(subInfo);
console.info("======ActsPublishImage_test_0200 setTimeout unsubscribe===>");
done();
}),300);
})
});
});
/*
* @tc.number: ACTS_PublishIconTest_0300
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0300', 0,async function (done) {
largeBufferC = new ArrayBuffer(4*1024*50);
smallBufferC = new ArrayBuffer(4*2*25);
largeOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}}
smallOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferC, largeOptsC);
promise_Large.then((data) => {
largeIconC = data;
console.debug("===createPixelMapC largeIcon===>"+JSON.stringify(largeIconC));
const promise_Small = image.createPixelMap(smallBufferC, smallOptsC);
promise_Small.then((data) => {
smallIconC = data;
console.debug("===createPixelMapC smallIcon===>"+JSON.stringify(smallIconC));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_titleC",
text: "test_textC",
additionalText: "test_additionalTextC"
},
},
id: 3,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconC,
largeIcon:largeIconC,
},publishCallbackB);
done();
})
});
});
/*
* @tc.number: ACTS_PublishTest_0400
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0400', 0,async function (done) {
largeBufferD = new ArrayBuffer(4*1024*50);
smallBufferD = new ArrayBuffer(4*2*25);
largeOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}}
smallOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferD, largeOptsD);
promise_Large.then((data) => {
largeIconD = data;
console.debug("===createPixelMapD largeIcon===>"+JSON.stringify(largeIconD));
const promise_Small = image.createPixelMap(smallBufferD, smallOptsD);
promise_Small.then((data) => {
smallIconD = data;
console.debug("===createPixelMapD smallIcon===>"+JSON.stringify(smallIconD));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test1_title",
text: "test1_text",
additionalText: "test1_additionalText"
},
},
id: 4,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconD,
largeIcon:largeIconD,
}).then().catch((err)=>{
console.debug("===ACTS_PublishIconTest_0400 promise===>"+err.code);
expect(err.code).assertEqual(ERR_ANS_ICON_OVER_SIZE)
done()
});
})
});
});
})
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import notify from '@ohos.notification'
import image from '@ohos.multimedia.image'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var BufferA
var BufferB
var BufferC
var BufferD
var optsA
var optsB
var optsC
var optsD
var pubimageA
var pubimageB
var pubimageC
var pubimageD
var ERR_ANS_PICTURE_OVER_SIZE = 67108883
describe('ActsAnsPublishImageTest', function () {
console.info("===ActsAnsPublishImageTest start===>");
//consume
function consumeCallbackA(data) {
console.debug("===>consumeDoNotCallback1 data : ===>" + JSON.stringify(data));
expect(data.request.id).assertEqual(1)
}
function consumeCallbackB(data) {
console.debug("===>consumeDoNotCallback2 data : ===>" +JSON.stringify(data));
expect(data.request.id).assertEqual(2)
}
//subscribe
function subscribeCallbackA(err) {
console.debug("===>subscribeCallbackA===>"+err.code);
expect(err.code).assertEqual(0)
}
function subscribeCallbackB(err) {
console.debug("===>subscribeCallbackB===>"+err.code);
expect(err.code).assertEqual(0)
}
function publishCallbackA(err){
console.log('ActsAnsPublishImageTest publishCallbackA asyncCallback'+err.code)
expect(err.code).assertEqual(0)
}
function publishCallbackB(err){
console.log('ActsAnsPublishImageTest publishCallbackB asyncCallback'+err.code)
expect(err.code).assertEqual(ERR_ANS_PICTURE_OVER_SIZE)
}
/*
* @tc.number: ActsPublishImage_test_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0100', 0, async function (done) {
console.debug("===ActsDoNotSubscriber_test_0100===begin===>");
var subInfo ={
onConsume:consumeCallbackA,
}
await notify.subscribe(subInfo, subscribeCallbackA);
BufferA = new ArrayBuffer(32);
optsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(BufferA, optsA);
promise_Large.then((data) => {
pubimageA = data;
console.debug("===createPixelMapA image===>"+pubimageA);
notify.publish({
id: 1,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleA",
text: "image_textA",
additionalText: "image_additionalTextA",
briefText:"image_briefA",
expandedTitle:"expandedTitleA",
picture:pubimageA
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationA",
sortingKey:"sortingKeyA",
},publishCallbackA);
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsPublishImage_test_0100 setTimeout unsubscribe===>");
done();
}),300);
})
})
/*
* @tc.number: ActsPublishImage_test_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0200', 0, async function (done) {
console.debug("===ActsPublishImage_test_0200===begin===>");
var subInfo ={
onConsume:consumeCallbackB,
}
await notify.subscribe(subInfo, subscribeCallbackB);
BufferB = new ArrayBuffer(32);
optsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(BufferB, optsB);
promise_Large.then((data) => {
pubimageB = data;
console.debug("===createPixelMapB image===>"+pubimageB);
notify.publish({
id: 2,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleB",
text: "image_textB",
additionalText: "image_additionalTextB",
briefText:"image_briefB",
expandedTitle:"expandedTitleB",
picture:pubimageB
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationB",
sortingKey:"sortingKeyB",
}).then(()=> {
console.debug("===ActsPublishImage_test_0200 promise===>")
})
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("===ActsPublishImage_test_0200 setTimeout unsubscribe===>");
done();
}),300);
})
})
/*
* @tc.number: ActsPublishImage_test_0300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0300', 0, async function (done) {
console.debug("===ActsPublishImage_test_0300===begin===>");
BufferC = new ArrayBuffer( 4*1024* 2048);
optsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}}
const promise_Large = image.createPixelMap(BufferC, optsC);
promise_Large.then((data) => {
pubimageC = data;
console.debug("====createPixelMapC image===>"+pubimageC);
notify.publish({
id: 3,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleC",
text: "image_textC",
additionalText: "image_additionalTextC",
briefText:"image_briefC",
expandedTitle:"expandedTitleC",
picture:pubimageC
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationC",
sortingKey:"sortingKeyC",
},publishCallbackB);
done();
})
})
/*
* @tc.number: ActsPublishImage_test_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0400', 0, async function (done) {
console.debug("===ActsPublishImage_test_0400===begin===>");
BufferD = new ArrayBuffer( 4*1024* 2048);
optsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}}
const promise_Large = image.createPixelMap(BufferD, optsD);
promise_Large.then((data) => {
pubimageD = data;
console.debug("===createPixelMapD image===>"+pubimageD);
notify.publish({
id: 4,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleD",
text: "image_textD",
additionalText: "image_additionalTextD",
briefText:"image_briefD",
expandedTitle:"expandedTitleD",
picture:pubimageD
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationD",
sortingKey:"sortingKeyD",
}).then().catch((err)=>{
console.debug("===ActsPublishImage_test_0400 err===>"+err.code);
expect(err.code).assertEqual(ERR_ANS_PICTURE_OVER_SIZE)
done();
});
})
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("testA") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "testA"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.wantAgentTestA",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.wantAgentTestA",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.wantAgentTestA.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "test1"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("testB") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "testB"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.wantAgentTestB",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.wantAgentTestB",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.wantAgentTestB.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "test2"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("testC") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "testC"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.wantAgentTestC",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.wantAgentTestC",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.wantAgentTestC.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "test3"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -9,7 +9,8 @@
"kits": [
{
"test-file-name": [
"ActsAnsBadgeDisplayTest.hap"
"ActsAnsBadgeDisplayTest.hap",
"localcandisplay.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgenta;
......@@ -55,7 +55,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoa,
(err, data) => {
......@@ -135,7 +135,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfod).then(
(data) => {
......@@ -198,7 +198,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfob,(err,data)=>{
WantAgentb = data
......@@ -227,7 +227,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoc,
(err, data) => {
......@@ -302,7 +302,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoe,(err,data)=>{
console.log("=======agentInfoe======="+err.code+JSON.stringify(data))
......@@ -332,7 +332,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfof,
(err, data) => {
......@@ -394,7 +394,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoe,(err,data)=>{
WantAgentd = data
......@@ -423,7 +423,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfof,
(err, data) => {
......
......@@ -17,7 +17,7 @@ import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAnsPublishSoundTest', function () {
console.info("===========ActsAnsPublishSoundTest start====================>");
var timeout = 300
var timeout = 1000
var bundleoption = {
bundle: "com.example.actsanspublishsoundtest"
}
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -32,8 +32,8 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -52,7 +52,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -73,8 +73,8 @@ describe('ActsAnsWantAgentOneTest', function () {
expect(data.finalCode).assertEqual(0);
expect(data.finalData).assertEqual("");
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.neu.WantAgentTest1");
expect(data.want.abilityName).assertEqual("com.example.test.MainAbility");
expect(data.want.bundleName).assertEqual("com.example.WantAgentTest1");
expect(data.want.abilityName).assertEqual("com.example.WantAgentTest1.MainAbility");
expect(data.want.uri).assertEqual("key={true,true,false}");
expect(JSON.stringify(data.want.entities)).assertEqual(JSON.stringify(["entity1"]));
expect(data.want.action).assertEqual("action1");
......@@ -112,7 +112,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -132,7 +132,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.ONE_TIME_FLAG]
wantAgentFlags:[WantAgentFlags.ONE_TIME_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -165,7 +165,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -185,7 +185,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.NO_BUILD_FLAG]
wantAgentFlags:[WantAgentFlags.NO_BUILD_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -218,7 +218,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -238,7 +238,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.CANCEL_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.CANCEL_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -271,7 +271,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -291,7 +291,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.CONSTANT_FLAG]
wantAgentFlags:[WantAgentFlags.CONSTANT_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -22,7 +22,7 @@ describe('ActsAnsWantAgentOneProTest', function () {
console.info('----ActsWantAgentTest----');
/*
* @tc.number: ACTS_SetWant_0100
* @tc.number: ACTS_SetWant_0200
* @tc.name: getWantAgent(OperationType.START_ABILITY)
* @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)
*/
......@@ -30,9 +30,8 @@ describe('ActsAnsWantAgentOneProTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -51,7 +50,7 @@ describe('ActsAnsWantAgentOneProTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo).then(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册