提交 2bd57b77 编写于 作者: Z zhaoyuan17

Update test code

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 152e4d28
......@@ -16,8 +16,8 @@ group("ans_standard") {
testonly = true
if (is_standard_system) {
deps = [
#"actsansnotificationcancel:ActsAnsNotificationCancel",
#"actsansnotificationremove:ActsAnsNotificationRemove",
"actsansnotificationcancel:ActsAnsNotificationCancel",
"actsansnotificationremove:ActsAnsNotificationRemove",
"actsansslottest:ActsAnsSlotTest",
"publish_test:publish_test",
]
......
# 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("ActsAnsCancelGroup") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsCancelGroup"
}
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.actsansrcancelgroup",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsCancelGroup.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansrcancelgroup",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansrcancelgroup",
"name": ".actsansremovegroup",
"deviceType": [
"phone"
],
"reqPermissions": [{
"name": "ohos.permission.NOTIFICATION_CONTROLLER",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansrcancelgroup.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;
}
<div class="container">
<text class="title">
ActsAnsNotificationCancel
</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 device from '@system.device'
import router from '@system.router'
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()
}
}
{
"string": [
{
"name": "app_name",
"value": "actsansremovegroup"
},
{
"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('./ActsAnsCancelGroup.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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsRemoveGroup") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsRemoveGroup"
}
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.actsansremovegroup",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsRemoveGroup.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansremovegroup",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansremovegroup",
"name": ".actsansremovegroup",
"deviceType": [
"phone"
],
"reqPermissions": [{
"name": "ohos.permission.NOTIFICATION_CONTROLLER",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansremovegroup.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;
}
<div class="container">
<text class="title">
AnsRemoveGroup
</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 device from '@system.device'
import router from '@system.router'
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()
}
}
{
"string": [
{
"name": "app_name",
"value": "actsansremovegroup"
},
{
"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('./ActsAnsRemoveGroup.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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsDoNotDisturbTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsDoNotDisturbTest"
}
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.actsansdonotdisturbtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsDoNotDisturbTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansdonotdisturbtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansdonotdisturbtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansdonotdisturbtest.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": "DoNot"
},
{
"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('./doNotDisturbTest.js')
\ No newline at end of file
......@@ -15,7 +15,7 @@
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
var time = 300
var ERR_ANS_NON_SYSTEM_APP = 67108877
describe('ActsAnsActiveTest', function () {
console.info("===========ActsAnsActiveTest start====================>");
......@@ -79,9 +79,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0100 publish end==================>");
notify.getActiveNotifications(getCallback);
console.debug("===============Ans_GetActive_0100 getActiveNotifications end==================>");
done();
setTimeout(async function(){
console.debug("===============Ans_GetActive_0100 done==================>");
done();
}, time);
})
......@@ -142,9 +142,9 @@ describe('ActsAnsActiveTest', function () {
console.log("=======Ans_GetActive_0200 getCallback badgeIconStyle=====>"+promiseData[i].badgeIconStyle)
}
console.debug("===============Ans_GetActive_0200 getActiveNotifications end==================>");
done();
setTimeout(async function(){
console.debug("===============Ans_GetActive_0200 done==================>");
done();
}, time);
})
......@@ -218,9 +218,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0300 publish2 end==================>");
notify.getActiveNotifications(getCallbackTwo);
console.debug("===============Ans_GetActive_0300 getActiveNotifications end==================>");
done();
setTimeout(async function(){
console.debug("===============Ans_GetActive_0300 done==================>");
done();
}, time);
})
......@@ -289,9 +289,9 @@ describe('ActsAnsActiveTest', function () {
}
}
console.debug("===============Ans_GetActive_0400 getActiveNotifications end==================>");
done();
setTimeout(async function(){
console.debug("===============Ans_GetActive_0400 done==================>");
done();
}, time);
})
......@@ -307,9 +307,9 @@ describe('ActsAnsActiveTest', function () {
console.log("Ans_GetActive_0500 getCallback data.length============>" + data.length);
console.log("Ans_GetActive_0500 getCallback JSON.stringify(data)============>" + JSON.stringify(data));
expect(data.length).assertEqual(0);
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_0500 done==================>");
done();
}, time);
});
})
......@@ -327,9 +327,9 @@ describe('ActsAnsActiveTest', function () {
expect(promiseData.length).assertEqual(0);
console.debug("=========Ans_GetActive_0600 promiseData.length=============>"+promiseData.length);
console.debug("==Ans_GetActivcae_0600 JSON.stringify(promiseData)========>"+JSON.stringify(promiseData));
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_0600 done==================>");
done();
}, time);
})
......@@ -394,9 +394,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0700 cancel end==================>");
notify.getActiveNotifications(getCallbackFour);
console.debug("===============Ans_GetActive_0700 getActiveNotifications end==================>");
done();
setTimeout(async function(){
console.debug("===============Ans_GetActive_0700 done==================>");
done();
}, time);
})
......@@ -454,9 +454,9 @@ describe('ActsAnsActiveTest', function () {
console.log("============Ans_GetActive_0800 getCallback label=====>"+promiseData[i].label)
}
console.debug("===============Ans_GetActive_0800 getActiveNotifications end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_0800 done==================>");
done();
}, time);
})
......@@ -508,9 +508,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0900 cancelAll end==================>");
notify.getActiveNotifications(getCallbackFive);
console.debug("===============Ans_GetActive_0900 getActiveNotifications end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_0900 done==================>");
done();
}, time);
})
......@@ -558,9 +558,9 @@ describe('ActsAnsActiveTest', function () {
console.log("Ans_GetActive_1000 getCallback data============>"+JSON.stringify(promiseData));
expect(promiseData.length).assertEqual(0);
console.debug("===============Ans_GetActive_1000 getActiveNotifications end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1000 done==================>");
done();
}, time);
})
......@@ -599,9 +599,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1100 publish end==================>");
notify.getActiveNotificationCount(getCountCallback);
console.debug("===============Ans_GetActive_1100 getActiveNotificationCount end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1100 done==================>");
done();
}, time);
})
......@@ -636,9 +636,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(1);
console.debug("===============Ans_GetActive_1200 promiseCount==================>"+promiseCount);
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1200 done==================>");
done();
}, time);
})
......@@ -698,9 +698,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1300 publish end==================>");
notify.getActiveNotificationCount(getCountCallbackTwo);
console.debug("===============Ans_GetActive_1300 getActiveNotificationCount end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1300 done==================>");
done();
}, time);
})
......@@ -755,9 +755,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(2);
console.debug("===============Ans_GetActive_1400 promiseCount==================>"+promiseCount);
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1400 done==================>");
done();
}, time);
})
......@@ -776,9 +776,9 @@ describe('ActsAnsActiveTest', function () {
await notify.cancelAll();
notify.getActiveNotificationCount(getCountCallbackThree);
console.debug("===============Ans_GetActive_1500 getActiveNotificationCount end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1500 done==================>");
done();
}, time);
})
......@@ -793,9 +793,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(0);
console.debug("===============Ans_GetActive_1600 promiseCount==================>"+promiseCount);
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1600 done==================>");
done();
}, time);
})
......@@ -846,9 +846,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1700 cancel end==================>");
notify.getActiveNotificationCount(getCountCallbackFour);
console.debug("===============Ans_GetActive_1700 getActiveNotifications end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1700 done==================>");
done();
}, time);
})
......@@ -894,9 +894,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(1);
console.debug("===============Ans_GetActive_1800 promiseCount===========>"+promiseCount);
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1800 done==================>");
done();
}, time);
})
......@@ -946,9 +946,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1900 cancel end==================>");
notify.getActiveNotificationCount(getCountCallbackFive);
console.debug("===============Ans_GetActive_1900 getActiveNotifications end==================>");
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_1900 done==================>");
done();
}, time);
})
......@@ -994,19 +994,17 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(0);
console.debug("===============Ans_GetActive_2000 promiseCount===========>"+promiseCount);
done();
setTimeout(function(){
console.debug("===============Ans_GetActive_2000 done==================>");
done();
}, time);
})
function getAllCallbackNine(err, data){
console.debug("========Ans_GetAllActive_0900 getAllCallbackNine data.length========>"+data.length);
console.debug("========Ans_GetAllActive_0900 getAllCallbackNine err.code========>"+err.code);
expect(err.code).assertEqual(67108877);
expect(data).assertEqual(undefined);
function getAllCallbackNine(err,data){
console.debug("===========Ans_GetAllActive_0900 getAllCallbackNine data.length============>"+data.length);
console.debug("===========Ans_GetAllActive_0900 getAllCallbackNine err.code============>"+err.code);
expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP);
}
/*
* @tc.number: Ans_GetAllActive_0900
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
......@@ -1032,9 +1030,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetAllActive_0900 publish CurrentApp notify end==================>");
notify.getAllActiveNotifications(getAllCallbackNine);
console.debug("===============Ans_GetAllActive_0900 getAllActiveNotifications end==================>");
done();
setTimeout(async function(){
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0900 done==================>");
done();
}, time);
})
......@@ -1061,11 +1059,16 @@ describe('ActsAnsActiveTest', function () {
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_1000 publish CurrentApp notify end==================>");
await notify.getAllActiveNotifications().then().catch((err)=>{
await notify.getAllActiveNotifications().then(()=>{
console.debug("=======Ans_GetAllActive_1000 then========>");
}).catch((err)=>{
expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP);
console.debug("==Ans_GetAllActive_1000 err==>"+err.code);
done();
console.debug("=======Ans_GetAllActive_1000 err==========>"+err.code);
});
setTimeout(function(){
console.debug("===============Ans_GetAllActive_1000 done==================>");
done();
}, 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("ActsAnsPublishSoundTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsPublishSoundTest"
}
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.actsanspublishsoundtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsPublishSoundTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsanspublishsoundtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsanspublishsoundtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"reqPermissions": [{
"name": "ohos.permission.NOTIFICATION_CONTROLLER",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsanspublishsoundtest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "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;
}
<div class="container">
<text class="title">
发布声音通知-normal
</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 device from '@system.device'
import router from '@system.router'
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)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "pubSound"
},
{
"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('./ExampleJsunit.test.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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsPublishVibraTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsPublishVibraTest"
}
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.actsanspublishvibratest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsPublishVibraTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsanspublishvibratest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsanspublishvibratest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"reqPermissions": [
{
"name": "ohos.permission.NOTIFICATION_CONTROLLER",
"reason": "install bundle",
"usedScene": {
"ability": [
"KitFramework"
],
"when": "always"
}
}
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsanspublishvibratest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "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;
}
<div class="container">
<text class="title">
发布震动通知-normal
</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 device from '@system.device'
import router from '@system.router'
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)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "PubVibra"
},
{
"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('./ExampleJsunit.test.js')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册