提交 953cee65 编写于 作者: Z zhaoyuan17

update xts ans test

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 b37a615e
......@@ -2,9 +2,9 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "60000",
"package": "com.example.actsansnotificationcancel",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
......@@ -15,4 +15,4 @@
"cleanup-apps": true
}
]
}
\ No newline at end of file
}
......@@ -2,9 +2,9 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "60000",
"package": "com.example.actsansnotificationremove",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
......@@ -15,4 +15,4 @@
"cleanup-apps": true
}
]
}
\ No newline at end of file
}
......@@ -20,6 +20,8 @@ group("ActsAnsSlotTest") {
"actsansgetslottestcallback:ActsAnsGetSlotTestCallback",
"actsansgetslottestpromise:ActsAnsGetSlotTestPromise",
"actsansremoveslottest:ActsAnsRemoveSlotTest",
"actsansslotsystemcallback:ActsAnsSlotSystemCallback",
"actsansslotsystempromise:ActsAnsSlotSystemPromise",
]
}
}
# 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("ActsAnsSlotSystemCallback") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsSlotSystemCallback"
}
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": "21600000",
"package": "com.example.actsansslotsystemcallback",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAnsSlotSystemCallback.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansslotsystemcallback",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansslotsystemcallback",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansslotsystemcallback.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"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: "测试slot接口callback形式:系统应用"
},
onInit() {
this.title = this.data.title;
},
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
{
"string": [
{
"name": "app_name",
"value": "ActsAnsSlotSystemCallback"
},
{
"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 notification from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAnsSlotSystemCallback', function () {
/*
* @tc.number : ActsAnsSlotSystemCallback_0100
* @tc.name : Verify getSlots after adding slots and removeSlot
* @tc.desc : getSlots after adding all type slots and removing slot
*/
it('ActsAnsSlotSystemCallback_0100', 0, async function (done) {
console.debug("====>ActsAnsSlotSystemCallback_0100 start====>");
function timeOut(){
console.debug("====>time out enter ActsAnsSlotSystemCallback_0100====>");
}
console.debug("====>addSlot SOCIAL_COMMUNICATION====>");
await notification.addSlot(
{
type: notification.SlotType.SOCIAL_COMMUNICATION,
level: notification.SlotLevel.LEVEL_NONE,
desc: "slot_SOCIAL_COMMUNICATION_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SOCIAL_COMMUNICATION_sound",
lightEnabled: true,
lightColor: 1
},
(err)=>{
console.debug("====>addSlot SOCIAL_COMMUNICATION callback====>");
expect(err.code).assertEqual(0);
})
console.debug("====>addSlot SERVICE_INFORMATION====>");
await notification.addSlot(
{
type: notification.SlotType.SERVICE_INFORMATION,
level: notification.SlotLevel.LEVEL_MIN,
desc: "slot_SERVICE_INFORMATION_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SERVICE_INFORMATION_sound",
lightEnabled: true,
lightColor: 2
},
(err)=>{
console.debug("====>addSlot SERVICE_INFORMATION callback====>");
expect(err.code).assertEqual(0);
})
console.debug("====>addSlot CONTENT_INFORMATION====>");
await notification.addSlot(
{
type: notification.SlotType.CONTENT_INFORMATION,
level: notification.SlotLevel.LEVEL_LOW,
desc: "slot_CONTENT_INFORMATION_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_CONTENT_INFORMATION_sound",
lightEnabled: true,
lightColor: 3
},
(err)=>{
console.debug("====>addSlot CONTENT_INFORMATION callback====>");
expect(err.code).assertEqual(0);
})
console.debug("====>addSlot OTHER_TYPES====>");
await notification.addSlot(
{
type: notification.SlotType.OTHER_TYPES,
level: notification.SlotLevel.LEVEL_DEFAULT,
desc: "slot_OTHER_TYPES_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_OTHER_TYPES_sound",
lightEnabled: true,
lightColor: 4
},
(err)=>{
console.debug("====>addSlot OTHER_TYPES callback====>");
expect(err.code).assertEqual(0);
})
console.debug("====>addSlot UNKNOWN_TYPE====>");
await notification.addSlot(
{
type: notification.SlotType.UNKNOWN_TYPE,
level: notification.SlotLevel.LEVEL_HIGH,
desc: "slot_UNKNOWN_TYPE_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_UNKNOWN_TYPE_sound",
lightEnabled: true,
lightColor: 5
},
(err)=>{
console.debug("====>addSlot UNKNOWN_TYPE callback====>");
expect(err.code).assertEqual(0);
})
await notification.getSlots((err, data)=>{
console.debug("====>getSlots enter====>");
console.debug("====>getSlots data====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>getSlots data====>" + JSON.stringify(data));
try{
expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE);
expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc");
expect(data[0].badgeFlag).assertEqual(false);
expect(data[0].bypassDnd).assertEqual(true);
expect(data[0].vibrationEnabled).assertEqual(true);
expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound");
expect(data[0].lightEnabled).assertEqual(true);
expect(data[0].lightColor).assertEqual(1);
expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION);
expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN);
expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc");
expect(data[1].badgeFlag).assertEqual(false);
expect(data[1].bypassDnd).assertEqual(true);
expect(data[1].vibrationEnabled).assertEqual(true);
expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound");
expect(data[1].lightEnabled).assertEqual(true);
expect(data[1].lightColor).assertEqual(2);
expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION);
expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW);
expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc");
expect(data[2].badgeFlag).assertEqual(false);
expect(data[2].bypassDnd).assertEqual(true);
expect(data[2].vibrationEnabled).assertEqual(true);
expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound");
expect(data[2].lightEnabled).assertEqual(true);
expect(data[2].lightColor).assertEqual(3);
expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT);
expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc");
expect(data[3].badgeFlag).assertEqual(false);
expect(data[3].bypassDnd).assertEqual(true);
expect(data[3].vibrationEnabled).assertEqual(true);
expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound");
expect(data[3].lightEnabled).assertEqual(true);
expect(data[3].lightColor).assertEqual(4);
console.debug("====>getSlots end====>");
console.debug("====>ActsAnsSlotSystemCallback_0100 end====>");
notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{
console.debug("====>removeSlot ActsAnsSlotSystemCallback_0100 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
done();
})
}catch(err){
console.error("====>getSlots catch err====>" + JSON.stringify(err));
expect().assertFail();
}
})
setTimeout(timeOut, 10000);
})
/*
* @tc.number : ActsAnsSlotSystemPromise_0200
* @tc.name : Verify that the same type of slot is added repeatedly
* @tc.desc : the same type of slot is added repeatedly, and the obtained slot is added for the first time
*/
it('ActsAnsSlotSystemCallback_0200', 0, async function (done) {
console.debug("====>ActsAnsSlotSystemCallback_0200 start====>");
async function timeOutTwo(){
console.debug("====>time out enter ActsAnsSlotSystemCallback_0200====>");
}
console.debug("====>addSlot SOCIAL_COMMUNICATION====>");
notification.addSlot(
{
type: notification.SlotType.SOCIAL_COMMUNICATION,
level: notification.SlotLevel.LEVEL_NONE,
desc: "slot_SOCIAL_COMMUNICATION_Desc_First",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SOCIAL_COMMUNICATION_Sound_First",
lightEnabled: true,
lightColor: 1
}
).then(()=>{
console.debug("====>addSlot SOCIAL_COMMUNICATION callback====>");
})
notification.addSlot(
{
type: notification.SlotType.SOCIAL_COMMUNICATION,
level: notification.SlotLevel.LEVEL_DEFAULT,
desc: "slot_SOCIAL_COMMUNICATION_Desc_Second",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SOCIAL_COMMUNICATION_Sound_Second",
lightEnabled: true,
lightColor: 1
}
).then(()=>{
console.debug("====>addSlot SOCIAL_COMMUNICATION callback====>");
})
console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION: ====>");
await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, data) => {
console.debug("====>getSlotActsAnsSlotSystemCallback_0200 enter====>");
console.debug("====>getSlotActsAnsSlotSystemCallback_0200 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>getSlotActsAnsSlotSystemCallback_0200 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE);
expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_Desc_First");
expect(data.badgeFlag).assertEqual(false);
expect(data.bypassDnd).assertEqual(true);
expect(data.vibrationEnabled).assertEqual(true);
expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_Sound_First");
expect(data.lightEnabled).assertEqual(true);
expect(data.lightColor).assertEqual(1);
console.debug("====>getSlotActsAnsSlotSystemCallback_0200 finish====>");
console.debug("====>ActsAnsSlotSystemCallback_0200 end====>");
done();
})
setTimeout(timeOutTwo, 10000);
})
})
\ 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('./ExampleJsunit.test.js')
\ 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("ActsAnsSlotSystemPromise") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsSlotSystemPromise"
}
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": "21600000",
"package": "com.example.actsansslotsystempromise",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAnsSlotSystemPromise.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansslotsystempromise",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansslotsystempromise",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansslotsystempromise.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"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: "测试slot接口promise形式:系统应用"
},
onInit() {
this.title = this.data.title;
},
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
{
"string": [
{
"name": "app_name",
"value": "ActsAnsSlotSystemPromise"
},
{
"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 notification from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAnsSlotSystemPromise', function () {
/*
* @tc.number : ActsAnsSlotSystemPromise_0100
* @tc.name : Verify getSlots after adding slots and removeSlot
* @tc.desc : getSlots after adding all type slots and adding again after removing slot
*/
it('ActsAnsSlotSystemPromise_0100', 0, async function (done) {
console.debug("====>ActsAnsSlotTestSystem_0100 start====>");
console.debug("====>addSlot SOCIAL_COMMUNICATION====>");
notification.addSlot(
{
type: notification.SlotType.SOCIAL_COMMUNICATION,
level: notification.SlotLevel.LEVEL_NONE,
desc: "slot_SOCIAL_COMMUNICATION_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SOCIAL_COMMUNICATION_sound",
lightEnabled: true,
lightColor: 1
}
).then(()=>{
console.debug("====>addSlot SOCIAL_COMMUNICATION promise====>");
})
console.debug("====>addSlot SERVICE_INFORMATION====>");
notification.addSlot(
{
type: notification.SlotType.SERVICE_INFORMATION,
level: notification.SlotLevel.LEVEL_MIN,
desc: "slot_SERVICE_INFORMATION_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SERVICE_INFORMATION_sound",
lightEnabled: true,
lightColor: 2
}
).then(()=>{
console.debug("====>addSlot SERVICE_INFORMATION promise====>");
})
console.debug("====>addSlot CONTENT_INFORMATION====>");
notification.addSlot(
{
type: notification.SlotType.CONTENT_INFORMATION,
level: notification.SlotLevel.LEVEL_LOW,
desc: "slot_CONTENT_INFORMATION_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_CONTENT_INFORMATION_sound",
lightEnabled: true,
lightColor: 3
}
).then(()=>{
console.debug("====>addSlot CONTENT_INFORMATION promise====>");
})
console.debug("====>addSlot OTHER_TYPES====>");
notification.addSlot(
{
type: notification.SlotType.OTHER_TYPES,
level: notification.SlotLevel.LEVEL_DEFAULT,
desc: "slot_OTHER_TYPES_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_OTHER_TYPES_sound",
lightEnabled: true,
lightColor: 4
}
).then(()=>{
console.debug("====>addSlot OTHER_TYPES promise====>");
})
console.debug("====>addSlot UNKNOWN_TYPE====>");
notification.addSlot(
{
type: notification.SlotType.UNKNOWN_TYPE,
level: notification.SlotLevel.LEVEL_HIGH,
desc: "slot_UNKNOWN_TYPE_desc",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_UNKNOWN_TYPE_sound",
lightEnabled: true,
lightColor: 5
}
).then(()=>{
console.debug("====>addSlot UNKNOWN_TYPE promise====>");
})
notification.getSlots().then((data)=>{
console.debug("====>getSlots enter====>");
console.debug("====>getSlots data====>" + JSON.stringify(data));
try{
expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE);
expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc");
expect(data[0].badgeFlag).assertEqual(false);
expect(data[0].bypassDnd).assertEqual(true);
expect(data[0].vibrationEnabled).assertEqual(true);
expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound");
expect(data[0].lightEnabled).assertEqual(true);
expect(data[0].lightColor).assertEqual(1);
expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION);
expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN);
expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc");
expect(data[1].badgeFlag).assertEqual(false);
expect(data[1].bypassDnd).assertEqual(true);
expect(data[1].vibrationEnabled).assertEqual(true);
expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound");
expect(data[1].lightEnabled).assertEqual(true);
expect(data[1].lightColor).assertEqual(2);
expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION);
expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW);
expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc");
expect(data[2].badgeFlag).assertEqual(false);
expect(data[2].bypassDnd).assertEqual(true);
expect(data[2].vibrationEnabled).assertEqual(true);
expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound");
expect(data[2].lightEnabled).assertEqual(true);
expect(data[2].lightColor).assertEqual(3);
expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT);
expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc");
expect(data[3].badgeFlag).assertEqual(false);
expect(data[3].bypassDnd).assertEqual(true);
expect(data[3].vibrationEnabled).assertEqual(true);
expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound");
expect(data[3].lightEnabled).assertEqual(true);
expect(data[3].lightColor).assertEqual(4);
console.debug("====>getSlots end====>");
}catch(err){
console.error("====>getSlots catch err====>" + JSON.stringify(err));
expect().assertFail();
}
})
notification.removeAllSlots().then(()=>{
console.debug("====>removeAllSlots ActsAnsSlotSystemPromise_0100====>");
})
notification.getSlots().then((data)=>{
console.debug("====>getSlots enter====>");
console.debug("====>getSlots data====>" + JSON.stringify(data));
})
console.debug("====>addSlot SERVICE_INFORMATION second====>");
notification.addSlot(
{
type: notification.SlotType.SERVICE_INFORMATION,
level: notification.SlotLevel.LEVEL_DEFAULT,
desc: "slot_SERVICE_INFORMATION_Desc_Second",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SERVICE_INFORMATION_Sound_Second",
lightEnabled: true,
lightColor: 2
}
).then(()=>{
console.debug("====>addSlot SERVICE_INFORMATION second====>");
})
notification.getSlot(notification.SlotType.SERVICE_INFORMATION).then((data) => {
console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsSlotSystemPromise_0100 enter====>");
console.debug("====>getSlotPromise ActsAnsSlotSystemPromise_0100 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION);
expect(data.level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT);
expect(data.desc).assertEqual("slot_SERVICE_INFORMATION_Desc_Second");
expect(data.badgeFlag).assertEqual(false);
expect(data.bypassDnd).assertEqual(true);
expect(data.vibrationEnabled).assertEqual(true);
expect(data.sound).assertEqual("slot_SERVICE_INFORMATION_Sound_Second");
expect(data.lightEnabled).assertEqual(true);
expect(data.lightColor).assertEqual(2);
console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsSlotSystemPromise_0100 finish====>");
done();
})
console.debug("====>ActsAnsSlotTestSystem_0100 end====>");
setTimeout(function (){
console.debug("====>time out ActsAnsSlotTestSystem_0100====>");
}, 10000);
})
/*
* @tc.number : ActsAnsSlotSystemPromise_0200
* @tc.name : Verify that the same type of slot is added repeatedly
* @tc.desc : the same type of slot is added repeatedly, and the obtained slot is added for the first time
*/
it('ActsAnsSlotSystemPromise_0200', 0, async function (done) {
console.debug("====>ActsAnsSlotSystemPromise_0200 start====>");
console.debug("====>addSlot SOCIAL_COMMUNICATION====>");
notification.addSlot(
{
type: notification.SlotType.SOCIAL_COMMUNICATION,
level: notification.SlotLevel.LEVEL_NONE,
desc: "slot_SOCIAL_COMMUNICATION_Desc_First",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SOCIAL_COMMUNICATION_Sound_First",
lightEnabled: true,
lightColor: 1
}
).then(()=>{
console.debug("====>addSlot SOCIAL_COMMUNICATION promise====>");
})
notification.addSlot(
{
type: notification.SlotType.SOCIAL_COMMUNICATION,
level: notification.SlotLevel.LEVEL_DEFAULT,
desc: "slot_SOCIAL_COMMUNICATION_Desc_Second",
badgeFlag: false,
bypassDnd: true,
vibrationEnabled: true,
sound: "slot_SOCIAL_COMMUNICATION_Sound_Second",
lightEnabled: true,
lightColor: 1
}
).then(()=>{
console.debug("====>addSlot SOCIAL_COMMUNICATION promise====>");
})
console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION: ====>");
notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION).then((data) => {
console.debug("====>getSlotActsAnsSlotSystemPromise_0200 enter====>");
console.debug("====>getSlotActsAnsSlotSystemPromise_0200 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE);
expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_Desc_First");
expect(data.badgeFlag).assertEqual(false);
expect(data.bypassDnd).assertEqual(true);
expect(data.vibrationEnabled).assertEqual(true);
expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_Sound_First");
expect(data.lightEnabled).assertEqual(true);
expect(data.lightColor).assertEqual(1);
console.debug("====>getSlotActsAnsSlotSystemPromise_0200 finish====>");
done();
})
console.debug("====>ActsAnsSlotSystemPromise_0200 end====>");
setTimeout(function (){
console.debug("====>time out ActsAnsSlotSystemPromise_0200====>");
}, 10000);
})
})
\ 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('./ExampleJsunit.test.js')
\ No newline at end of file
......@@ -21,7 +21,11 @@ group("publish_test") {
"badgedisplayedset:badgedisplayedset",
"enablenotification:enablenotification",
"enablenotificationset:enablenotificationset",
"getactive:getactive",
"getwantagentinfo:getwantagentinfo",
"publishcontentype:ActsAnsNotificationTest",
"subscribe:subscribe",
"unsubscribe:ActsAnsUnSubscriberTest",
"wantagent:wantagent",
]
}
......
# 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("getactive") {
testonly = true
if (is_standard_system) {
deps = [
"getactivenormal:getactivenormal",
"getcancelactivenum:ActsAnsGetCancelActiveNumTest",
]
}
}
# 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("getactivenormal") {
testonly = true
if (is_standard_system) {
deps = [
"active:ActsAnsGetActiveTest",
# "sub:ActsAnsActiveSubscriberTest",
"publish:ActsAnsActivePublishTest",
]
}
}
# 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("ActsAnsGetActiveTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetActiveTest"
}
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": "21600000",
"package": "com.example.actsansgetactivetest",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetActiveTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.neu.actsansgetactivetest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetactivetest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansgetactivetest.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": "Active"
},
{
"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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
describe('ActsAnsGetActiveTest', function () {
console.info("===========ActsSubscriberTest start====================>");
/*
* @tc.number: ActsActive_test_0100
* @tc.name: getAllActiveNotifications()
* @tc.desc: verify the function of getAllActiveNotifications
*/
it('ActsActive_test_0100', 0, async function (done) {
await notify.getAllActiveNotifications((error, data) => {
console.log("==========================>getAllActiveNotifications1=======================>" + data)
expect(typeof(data)).assertEqual('object')
for (let i = 0; i < data.length; i++) {
console.log("==========================>getAllActiveNotificationshashCode1=======================>" + data[i].hashCode)
console.log("==========================>getAllActiveNotificationsid1=======================>" + data[i].id)
console.log("==========================>getAllActiveNotificationslotType1=======================>" + data[i].slotType)
console.log("==========================>getAllActiveNotificationclassification1=======================>" + data[i].classification)
console.log("==========================>getAllActiveNotificationsortingKey1=======================>" + data[i].sortingKey)
console.log("==========================>getAllActiveNotificationscontentType1=======================>" + data[i].content.contentType)
console.log("==========================>getAllActiveNotificationstitle1=======================>" + data[i].content.normal.title)
console.log("==========================>getAllActiveNotificationstext1=======================>" + data[i].content.normal.text)
console.log("==========================>getAllActiveNotificationsadditionalText1=======================>" + data[i].content.normal.additionalText)
}
})
var promise = await notify.getAllActiveNotifications()
expect(typeof(promise)).assertEqual('object')
for (let i = 0; i < promise.length; i++) {
console.log("==========================>getAllActiveNotificationsPromisehashCode1=======================>" + promise[i].hashCode)
console.log("==========================>getAllActiveNotificationsPromiseid1=======================>" + promise[i].id)
console.log("==========================>getAllActiveNotificationsPromiseslotType1=======================>" + promise[i].slotType)
console.log("==========================>getAllActiveNotificationsPromiseclassification1=======================>" + promise[i].classification)
console.log("==========================>getAllActiveNotificationsPromisesortingKey1=======================>" + promise[i].sortingKey)
console.log("==========================>getAllActiveNotificationsPromisecontentType1=======================>" + promise[i].content.contentType)
console.log("==========================>getAllActiveNotificationsPromisetitle1=======================>" + promise[i].content.normal.title)
console.log("==========================>getAllActiveNotificationsPromisetext1=======================>" + promise[i].content.normal.text)
console.log("==========================>getAllActiveNotificationsPromiseadditionalText1=======================>" + promise[i].content.normal.additionalText)
}
done();
setTimeout(function(){
console.debug("====>time out ActsActive_test_0100====>");
}, time);
})
})
/*
* 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('./GetActiveInfo.test.js')
\ 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("ActsAnsActivePublishTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsActivePublishTest"
}
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": "21600000",
"package": "com.example.actsansactivepublishtest",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAnsActivePublishTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.neu.actsansactivepublishtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansactivepublishtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansactivepublishtest.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": "publish1"
},
{
"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 notification from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
describe('ActsAnsActivePublishTest', function () {
function publishCallback001(){
console.log('ActsNotificationTest ACTS_Publish_0100 asyncCallback')
}
/*
* @tc.number: ACTS_GetActiveNumTest_0100
* @tc.name: getActiveNotifications(),getActiveNotificationNums()
* @tc.desc: verify the function of getActiveNotifications,getActiveNotificationNums
*/
it('ACTS_GetActiveNumTest_0100', 0,async function (done) {
await notification.publish({
id: 1,
content: {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test1_title",
text: "test1_text",
additionalText: "test1_additionalText"
},
},
slotType:notification.SlotType.SOCIAL_COMMUNICATION,
classification:"classification1",
sortingKey:"sortingKey1",
},publishCallback001);
await notification.publish({
id: 2,
content: {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test2_title",
text: "test2_text",
additionalText: "test2_additionalText"
},
},
slotType:notification.SlotType.SOCIAL_COMMUNICATION,
classification:"classification2",
sortingKey:"sortingKey2",
},publishCallback001);
await notification.getActiveNotifications(
(error,data) => {
console.log("============PublishgetActiveNotificationsTest1============"+data)
expect(typeof(data)).assertEqual('object')
for (let i = 0; i < data.length; i++) {
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].hashCode)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].id)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].classification)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].sortingKey)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].slotType)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.contentType)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.normal.title)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.normal.text)
console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.normal.additionalText)
}
})
var promise = await notification.getActiveNotifications();
expect(typeof(promise)).assertEqual('object')
for (let i = 0; i < promise.length; i++) {
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].hashCode)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].id)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].slotType)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].classification)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].sortingKey)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.contentType)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.title)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.text)
console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.additionalText)
}
await notification.getActiveNotificationCount((error,data) => {
console.log("============getActiveNotificationNumsTest1============"+JSON.stringify(data))
expect(typeof(data)).assertEqual('number')
})
var promise = await notification.getActiveNotificationCount();
console.log("============getActiveNotificationNumsTest1Promise============"+JSON.stringify(promise))
console.log("============ACTS_PublishTest1_0100 finished============")
expect(typeof(promise)).assertEqual('number')
done();
setTimeout(function(){
console.debug("====>time out ACTS_GetActiveNumTest_0100====>");
}, time);
})
})
\ 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('./ExampleJsunit.test.js')
\ 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("ActsAnsActiveSubscriberTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsActiveSubscriberTest"
}
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": "21600000",
"package": "com.example.actsansactivesubscribertest",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAnsActiveSubscriberTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.neu.actsansactivesubscribertest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansactivesubscribertest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansactivesubscribertest.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": "Sub1"
},
{
"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.
*/
require('./Subscriber.js')
\ 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
describe('ActsAnsActiveSubscriberTest', function () {
console.info("===========ActsSubscriberTest start====================>");
//consume
function consumeCallback(err, data) {
console.debug("==========================>consumeCallback data : =======================>" + JSON.stringify(data));
}
//subscribeOn
function subscribeOnCallback(err) {
console.debug("==========================>subscribeOnCallback=======================>");
}
//subscribe
function subscribeCallback(err) {
console.debug("==========================>subscribeCallback=======================>");
}
/*
* @tc.number: ActsWantAgent_test_0100
* @tc.name: createSubscriber(),subscribe()
* @tc.desc: verify the function of createSubscriber,subscribe
*/
it('ActsActiveSubscriber_test_0100', 0, async function (done) {
console.debug("===============ActsWantAgent_test_0100======begin====================>");
var subInfo ={
onConsume:consumeCallback,
onConnect:subscribeOnCallback,
}
try{
await notify.subscribe(subInfo,subscribeCallback);
}catch(err) {
console.error('=ActsActiveSubscriber_test_0100 订阅 subscribeCallback err:'+err);
}
console.debug("===============ActsActiveSubscriber_test_0100=======end===================>");
done();
setTimeout(function(){
console.debug("====>time out ActsActiveSubscriber_test_0100====>");
}, time);
})
})
# 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("ActsAnsGetCancelActiveNumTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetCancelActiveNumTest"
}
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": "21600000",
"package": "com.example.actsansgetcancelactivenumtest",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetCancelActiveNumTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.neu.actsansgetcancelactivenumtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetcancelactivenumtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansgetcancelactivenumtest.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;
}
<div class="container">
<text class="title">
GetCancelActiveNum启动
</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 {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": "CancelActiveNum"
},
{
"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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
describe('ActsAnsGetCancelActiveNumTest', function () {
console.info("===========ActsGetCancelActiveNumTest start====================>");
//consume
function consumeCallback(err, data) {
console.debug("==========================>consumeCallback data : =======================>" + JSON.stringify(data));
console.debug("==========================>consumeCallback===notificationId:====================>" + data.request.id);
console.debug("==========================>consumeCallback===sortingMap.sortedHashCode.length:====================>" + data.sortingMap.sortedHashCode.length);
}
function cancelAllCallBack(){
console.info("==========================>cancelAllCallBack start=======================>");
}
//subscribeOn
function subscribeOnCallback(err) {
console.debug("==========================>subscribeOnCallback=======================>");
}
//subscribe
function subscribeCallback(err) {
console.debug("==========================>subscribeCallback=======================>");
}
//publish
function publishCallback001(){
console.log('ActsAnsGetCancelActiveNumTest ActsGetCancelActiveNum_test_0200 publish asyncCallback')
}
/*
* @tc.number: ActsGetCancelActiveNum_test_0100
* @tc.name: createSubscriber(),subscriber()
* @tc.desc: verify the function of createSubscriber,subscriber
*/
it('ActsGetCancelActiveNum_test_0100', 0, async function (done) {
console.debug("===============ActsGetCancelActiveNum_test_0100======begin====================>");
var subInfo ={
onConsume:consumeCallback,
onConnecte:subscribeOnCallback,
}
try{
await notify.subscribe(subInfo,subscribeCallback);
}catch(err) {
console.error('=ActsWantAgent_test_0100 订阅 subscribeCallback err:'+err);
}
console.debug("===============ActsGetCancelActiveNum_test_0100=======end===================>");
done();
setTimeout(function(){
console.debug("====>time out ActsGetCancelActiveNum_test_0100====>");
}, time);
})
/*
* @tc.number: ActsGetCancelActiveNum_test_0200
* @tc.name: getActiveNotifications(),getActiveNotificationNums()
* @tc.desc: verify the function of getActiveNotifications,getActiveNotificationNums
*/
it('ActsGetCancelActiveNum_test_0200', 0,async function (done) {
await notify.publish({
id: 1,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test1_title",
text: "test1_text",
additionalText: "test1_additionalText"
},
}
},publishCallback001);
await notify.publish({
id: 2,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test2_title",
text: "test2_text",
additionalText: "test2_additionalText"
},
}
},publishCallback001);
await notify.publish({
id: 3,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test3_title",
text: "test3_text",
additionalText: "test3_additionalText"
},
}
},publishCallback001);
await notify.getActiveNotifications(
(error,data) => {
console.log("============PublishGetActiveNotificationsTest1============"+data)
expect(typeof(data)).assertEqual('object')
for (let i = 0; i < data.length; i++) {
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].hashCode)
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].Id)
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].slotType)
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].content.contentType)
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].content.normal.title)
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].content.normal.text)
console.log("==========================>PublishGetActiveNotificationsTest1=======================>" + data[i].content.normal.additionalText)
}
})
var promise = await notify.getActiveNotifications();
expect(typeof(promise)).assertEqual('object')
for (let i = 0; i < promise.length; i++) {
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].hashCode)
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].Id)
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].slotType)
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.contentType)
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.title)
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.text)
console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.additionalText)
}
await notify.getActiveNotificationCount((error,data) => {
console.log("============getActiveNotificationNumsTest1============"+JSON.stringify(data))
expect(typeof(data)).assertEqual('number')
})
var promise = await notify.getActiveNotificationCount();
expect(typeof(promise)).assertEqual('number')
console.log("============getActiveNotificationNumsTest1Promise============"+JSON.stringify(promise))
console.log("============ActsGetCancelActiveNum_test_0200 finished============")
done();
setTimeout(function(){
console.debug("====>time out ActsGetCancelActiveNum_test_0200====>");
}, time);
})
/*
* @tc.number: ActsGetCancelActiveNum_test_0300
* @tc.name: cancel(),getActiveNotificationNums()
* @tc.desc: verify the function of cancel,getActiveNotificationNums
*/
it('ActsGetCancelActiveNum_test_0300', 0,async function (done) {
await notify.cancel(1,cancelAllCallBack);
await notify.getActiveNotificationCount((error,data) => {
expect(typeof(data)).assertEqual('number')
console.log("============getActiveNotificationCancelNums============"+data)
})
var promise = await notify.getActiveNotificationCount();
expect(typeof(promise)).assertEqual('number')
console.log("============getActiveNotificationCancelNumsPromise============"+JSON.stringify(promise))
console.log("============ActsGetCancelActiveNum_test_0300 finished============")
done();
setTimeout(function(){
console.debug("====>time out ActsGetCancelActiveNum_test_0300====>");
}, time);
})
})
/*
* 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('./GetCancelActiveNum.test.js')
\ No newline at end of file
......@@ -42,7 +42,8 @@
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard"
"launchType": "standard",
"visible": true
}
],
"js": [
......
......@@ -42,7 +42,8 @@
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard"
"launchType": "standard",
"visible": true
}
],
"js": [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册