提交 9c89e346 编写于 作者: O openharmony_ci 提交者: Gitee

!684 更新xts测试用例

Merge pull request !684 from blackleon/master_0923
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "120000",
"package": "com.example.actsbmsallshortcutinfotest",
"shell-timeout": "60000"
},
......
......@@ -16,7 +16,11 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 1000;
const NAMECOUNT = 10000;
describe('ActsBmsAllShortcutInfoTest', function () {
/*
* @tc.number: bms_getAllShortcutInfo_0100
* @tc.name: test getAllShortcutInfo with promise
......@@ -33,7 +37,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.third1', 'third1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0100==================end');
}, TIMEOUT)
});
/*
* @tc.number: bms_getAllShortcutInfo_0200
* @tc.name: test getAllShortcutInfo with callback
......@@ -48,7 +56,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.third1', 'third1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0200==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_0300
* @tc.name: test getAllShortcutInfo with promise
......@@ -66,6 +78,9 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.third1', 'third1');
checkShortcutIsExist(data, 'id.third3', 'third3');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0300==================end');
}, TIMEOUT)
})
/*
......@@ -84,7 +99,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
await uninstall(bundleName);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0400==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_0500
* @tc.name: test getAllShortcutInfo with promise
......@@ -96,7 +115,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0500==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_0600
* @tc.name: test getAllShortcutInfo with callback
......@@ -110,7 +133,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0600==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_0700
* @tc.name: test getAllShortcutInfo with promise
......@@ -146,7 +173,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
}
}
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0700==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_0800
* @tc.name: test getAllShortcutInfo with callback
......@@ -178,7 +209,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
await uninstall(bundleName);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0800==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_0900
* @tc.name: test getAllShortcutInfo with promise
......@@ -193,7 +228,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_0900==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1000
* @tc.name: test getAllShortcutInfo with callback
......@@ -208,7 +247,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
await uninstall(bundleName);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1000==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1100
* @tc.name: test getAllShortcutInfo with promise
......@@ -222,7 +265,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.system1', 'system1');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1100==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1200
* @tc.name: test getAllShortcutInfo with callback
......@@ -237,7 +284,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.system1', 'system1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1200==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1300
* @tc.name: test getAllShortcutInfo with promise
......@@ -251,7 +302,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(1);
checkShortcutIsExist(data, 'id.vendor1', 'vendor1');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1300==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1400
* @tc.name: test getAllShortcutInfo with callback
......@@ -266,7 +321,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.vendor1', 'vendor1');
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1400==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1500
* @tc.name: test getAllShortcutInfo with promise
......@@ -287,7 +346,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
var info = await bundle.getAllShortcutInfo(bundleName);
expect(info.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1500==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1600
* @tc.name: test getAllShortcutInfo with callback
......@@ -301,6 +364,9 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1600==================end');
}, TIMEOUT)
})
/*
......@@ -319,7 +385,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
checkShortcutIsExist(data, 'id.third4A', 'third4A');
checkShortcutIsExist(data, 'id.third4B', 'third4B');
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1700==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1800
* @tc.name: test getAllShortcutInfo with callback
......@@ -336,7 +406,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
await uninstall(bundleName);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1800==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_1900
* @tc.name: test getAllShortcutInfo with promise
......@@ -349,7 +423,11 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_1900==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getAllShortcutInfo_2000
* @tc.name: test getAllShortcutInfo with promise
......@@ -363,6 +441,9 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_2000==================end');
}, TIMEOUT)
})
/*
......@@ -373,13 +454,16 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_2100', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_2100==================');
var bundleName = 'test';
for(var i = 0; i < 10000; i++){
for (var i = 0; i < NAMECOUNT; i++) {
bundleName += 'test';
}
var data = await bundle.getAllShortcutInfo(bundleName);
expect(typeof data).assertEqual('object');
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_2100==================end');
}, TIMEOUT)
})
/*
......@@ -390,7 +474,7 @@ describe('ActsBmsAllShortcutInfoTest', function () {
it('bms_getAllShortcutInfo_2200', 0, async function (done) {
console.info('=====================bms_getAllShortcutInfo_2200==================');
var bundleName = 'test';
for(var i = 0; i < 10000; i++){
for (var i = 0; i < NAMECOUNT; i++) {
bundleName += 'test';
}
bundle.getAllShortcutInfo(bundleName, async (result, data) => {
......@@ -398,6 +482,9 @@ describe('ActsBmsAllShortcutInfoTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.info('=====================bms_getAllShortcutInfo_2200==================end');
}, TIMEOUT)
})
function checkShortcutInfo(dataInfo, name) {
......@@ -416,9 +503,9 @@ describe('ActsBmsAllShortcutInfoTest', function () {
if (typeof dataInfo.wants != 'undefined' && Object.keys(dataInfo.wants).length != 0) {
expect(dataInfo.wants.length).assertLarger(0);
for (var j = 0; j < dataInfo.wants.length; j++) {
console.info('=============targetClass==============' + JSON.stringify(dataInfo.wants[j].targetClass));
console.info('========targetClass=========' + JSON.stringify(dataInfo.wants[j].targetClass));
expect(dataInfo.wants[j].targetClass).assertEqual('com.example.' + name + '.MainAbility');
console.info('=============targetBundle==============' + JSON.stringify(dataInfo.wants[j].targetBundle));
console.info('========targetBundle=========' + JSON.stringify(dataInfo.wants[j].targetBundle));
expect(dataInfo.wants[j].targetBundle).assertEqual('com.example.' + name);
}
}
......@@ -426,7 +513,7 @@ describe('ActsBmsAllShortcutInfoTest', function () {
async function install(bundlePath) {
let result = await bundle.getBundleInstaller();
await result.install(bundlePath, {
result.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
......@@ -441,7 +528,7 @@ describe('ActsBmsAllShortcutInfoTest', function () {
}
async function uninstall(bundleName) {
let result = await bundle.getBundleInstaller();
await result.uninstall(bundleName, {
result.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
......
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsbmscheckpermissiontest",
"shell-timeout": "60000"
},
......
......@@ -76,7 +76,7 @@
"reason": "Need open camera",
"usedScene": {
"ability": [
"com.example.permissionchange.MainAbility"
"com.example.actsbmscheckpermissiontest.MainAbility"
],
"when": "always"
}
......@@ -86,7 +86,7 @@
"reason": "Need PERMISSION_A",
"usedScene": {
"ability": [
"com.example.permissionchange.MainAbility"
"com.example.actsbmscheckpermissiontest.MainAbility"
],
"when": "always"
}
......
......@@ -19,8 +19,11 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
const BUNDLE_NAME = 'com.example.actsbmscheckpermissiontest';
const PERMISSION_ONE = 'com.permission.CAMERA';
const PERMISSION_TWO = 'com.permission.PERMISSION_A';
const TIMEOUT = 1000;
const NAMECOUNT = 10000;
describe('ActsBmsCheckPermissionTest', function () {
/*
* @tc.number: bms_checkPermission_0100
* @tc.name: check whether the permission is granted
......@@ -31,7 +34,11 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO)
expect(data).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0100==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0200
* @tc.name: check whether the permission is granted
......@@ -44,7 +51,11 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(0);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0200==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0300
* @tc.name: check whether the permission is granted
......@@ -56,7 +67,11 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission('', PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0300==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0400
* @tc.name: check whether the permission is granted
......@@ -70,7 +85,11 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0400==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0500
* @tc.name: check whether the permission is granted
......@@ -82,7 +101,11 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, '')
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0500==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0600
* @tc.name: check whether the permission is granted
......@@ -96,7 +119,11 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0600==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0700
* @tc.name: check whether the permission is granted
......@@ -108,6 +135,9 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, '@\n,. 。测试@abc1^%12345')
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0700==================end');
}, TIMEOUT)
})
/*
......@@ -123,7 +153,11 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0800==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_0900
* @tc.name: check whether the permission is granted
......@@ -135,7 +169,11 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission('@\n,. 。测试@abc1^%12345', PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0900==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_1000
* @tc.name: check whether the permission is granted
......@@ -149,7 +187,11 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1000==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_1100
* @tc.name: check whether the permission is granted
......@@ -159,12 +201,15 @@ describe('ActsBmsCheckPermissionTest', function () {
it('bms_checkPermission_1100', 0, async function (done) {
console.info('=====================bms_checkPermission_1100==================');
var permissionName = 'test';
for (var i = 0; i < 10000; i++) {
for (var i = 0; i < NAMECOUNT; i++) {
permissionName += 'test';
}
var data = await bundle.checkPermission(BUNDLE_NAME, permissionName)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1100==================end');
}, TIMEOUT)
})
/*
......@@ -176,7 +221,7 @@ describe('ActsBmsCheckPermissionTest', function () {
it('bms_checkPermission_1200', 0, async function (done) {
console.info('=====================bms_checkPermission_1200==================');
var permissionName = 'test';
for (var i = 0; i < 10000; i++) {
for (var i = 0; i < NAMECOUNT; i++) {
permissionName += 'test';
}
await bundle.checkPermission(BUNDLE_NAME, permissionName, (err, data) => {
......@@ -184,7 +229,11 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1200==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_1300
* @tc.name: check whether the permission is granted
......@@ -194,13 +243,17 @@ describe('ActsBmsCheckPermissionTest', function () {
it('bms_checkPermission_1300', 0, async function (done) {
console.info('=====================bms_checkPermission_1300==================');
var bundleName = 'test';
for (var i = 0; i < 10000; i++) {
for (var i = 0; i < NAMECOUNT; i++) {
bundleName += 'test';
}
var data = await bundle.checkPermission(bundleName, PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1300==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_checkPermission_1400
* @tc.name: check whether the permission is granted
......@@ -210,7 +263,7 @@ describe('ActsBmsCheckPermissionTest', function () {
it('bms_checkPermission_1400', 0, async function (done) {
console.info('=====================bms_checkPermission_1400==================');
var bundleName = 'test';
for (var i = 0; i < 10000; i++) {
for (var i = 0; i < NAMECOUNT; i++) {
bundleName += 'test';
}
await bundle.checkPermission(bundleName, PERMISSION_ONE, (err, data) => {
......@@ -218,5 +271,8 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1400==================end');
}, TIMEOUT)
})
})
\ No newline at end of file
......@@ -2,9 +2,9 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsbmshapmoduletest",
"shell-timeout": "300000"
"shell-timeout": "60000"
},
"kits": [
{
......@@ -24,7 +24,7 @@
{
"type": "PushKit",
"push": [
"bmsMainAbilityFirstScene.hap.hap->/data/test/bmsMainAbilityFirstScene.hap",
"bmsMainAbilityFirstScene.hap->/data/test/bmsMainAbilityFirstScene.hap",
"bmsMainAbilitySecondScene.hap->/data/test/bmsMainAbilitySecondScene.hap",
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap"
]
......
......@@ -14,9 +14,12 @@
*/
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 1000;
describe('ActsBmsHapModuleTest', function () {
/*
* @tc.number: bms_getHapModuleInfo_0100
* @tc.name: get hapModuleInfo from one app by getBundleInfo
......@@ -26,8 +29,8 @@ describe('ActsBmsHapModuleTest', function () {
console.debug('===========begin bms_getHapModuleInfo_0100===========')
await install(['/data/test/bmsMainAbilityFirstScene.hap']);
let bundleName = 'com.example.bmsmainabilityfirstscene';
let ret = false
bundle.getBundleInfo(bundleName, 1, callback);
function callback(err, data) {
console.debug('=======get bundle========' + JSON.stringify(data));
let hapModuleInfo = data.hapModuleInfo[0];
......@@ -36,11 +39,14 @@ describe('ActsBmsHapModuleTest', function () {
expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
checkHapModuleInfo(hapModuleInfo);
ret = true;
done();
}
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
});
/*
* @tc.number: bms_getHapModuleInfo_0200
* @tc.name: get hapModuleInfo from two modules by getBundleInfo
......@@ -49,6 +55,7 @@ describe('ActsBmsHapModuleTest', function () {
it('bms_getHapModuleInfo_0200', 0, async function (done) {
console.debug('===========begin bms_getHapModuleInfo_0200===========')
await install(['/data/test/bmsMainAbilitySecondScene.hap']);
let ret = false
let bundleName = 'com.example.bmsmainabilityfirstscene';
let firstMainAbility = 'com.example.bmsmainabilityfirstscene.MainAbility';
let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility';
......@@ -56,7 +63,7 @@ describe('ActsBmsHapModuleTest', function () {
bundle.getBundleInfo(bundleName, 1, async (err, data) => {
console.debug('=======hapModule length========' + data.hapModuleInfo.length);
expect(data.hapModuleInfo.length).assertEqual(2);
for (let i = 0, len = data.hapModuleInfo.length;i < len; i++) {
for (let i = 0, len = data.hapModuleInfo.length; i < len; i++) {
console.debug('=======get hapModule========' + JSON.stringify(data.hapModuleInfo[i]))
console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[i].mainAbilityName);
checkHapModuleInfo(data.hapModuleInfo[i]);
......@@ -67,8 +74,12 @@ describe('ActsBmsHapModuleTest', function () {
expect(result.get(firstMainAbility).moduleName).assertEqual('entry');
expect(result.get(secondMainAbility).moduleName).assertEqual('bmsmainabilitysecondscene');
await uninstall(bundleName);
ret = true;
done();
})
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
})
/*
......@@ -80,6 +91,7 @@ describe('ActsBmsHapModuleTest', function () {
console.debug('===========begin bms_getHapModuleInfo_0300===========')
await install(['/data/test/bmsThirdBundleTest2.hap']);
let bundleName = 'com.example.third2';
let ret = false;
bundle.getBundleInfo(bundleName, 1).then(async (data) => {
console.debug('=======get hapModule========' + JSON.stringify(data))
expect(data.hapModuleInfo.length).assertEqual(1);
......@@ -88,8 +100,12 @@ describe('ActsBmsHapModuleTest', function () {
expect(data.hapModuleInfo[0].moduleName).assertEqual('entry');
checkHapModuleInfo(data.hapModuleInfo[0]);
await uninstall(bundleName);
ret = true;
done();
})
setTimeout(function () {
expect(ret).assertTrue();
}, TIMEOUT);
})
function checkHapModuleInfo(dataInfo) {
......@@ -111,17 +127,16 @@ describe('ActsBmsHapModuleTest', function () {
expect(typeof dataInfo.installationFree).assertEqual('boolean');
}
async function install(bundlePath)
{
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
await installer.install(bundlePath, {
console.log('========install========' + typeof installer);
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) {
console.info('========install Finish========');
expect(typeof err).assertEqual('object');
......@@ -132,10 +147,9 @@ describe('ActsBmsHapModuleTest', function () {
}
}
async function uninstall(bundleName)
{
async function uninstall(bundleName) {
var installer = await bundle.getBundleInstaller();
await installer.uninstall(bundleName, {
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
......@@ -152,5 +166,4 @@ describe('ActsBmsHapModuleTest', function () {
expect(data.statusMessage).assertEqual('SUCCESS');
}
}
})
\ No newline at end of file
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsbmsjstest",
"shell-timeout": "60000"
},
......
......@@ -13,9 +13,12 @@
* limitations under the License.
*/
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 3000;
describe('ActsBmsJsTest', function () {
/*
* @tc.number: bms_getJsAbility_0100
* @tc.name: test the multi js ability
......@@ -27,13 +30,16 @@ describe('ActsBmsJsTest', function () {
let bundleName = 'com.example.third2';
let abilityName = 'com.example.third2.MainAbility';
await install(['/data/test/bmsThirdBundleTest2.hap']);
bundle.getBundleInfo(bundleName,1).then((data)=>{
expect(data.abilityInfo.length).assertEqual(1);
checkIsExist(abilityName, data);
uninstall(bundleName);
done();
});
let data = await bundle.getBundleInfo(bundleName, 1);
expect(data.abilityInfo.length).assertEqual(1);
checkIsExist(abilityName, data);
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0100==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getJsAbility_0200
* @tc.name: test the multi js ability
......@@ -46,15 +52,18 @@ describe('ActsBmsJsTest', function () {
let abilityName1 = 'com.example.third5.AMainAbility';
let abilityName2 = 'com.example.third5.BMainAbility';
await install(['/data/test/bmsThirdBundleTest5.hap']);
bundle.getBundleInfo(bundleName,1).then((data)=>{
console.debug('==========bundleInfo==========' + JSON.stringify(data))
expect(data.abilityInfo.length).assertLarger(1);
checkIsExist(abilityName1, data);
checkIsExist(abilityName2, data);
uninstall(bundleName);
done();
});
let data = await bundle.getBundleInfo(bundleName, 1)
console.debug('==========bundleInfo==========' + JSON.stringify(data))
expect(data.abilityInfo.length).assertLarger(1);
checkIsExist(abilityName1, data);
checkIsExist(abilityName2, data);
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0200==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getJsAbility_0300
* @tc.name: test the multi js ability
......@@ -66,17 +75,18 @@ describe('ActsBmsJsTest', function () {
let bundleName = 'com.example.js';
let abilityName = 'com.example.js.MainAbility';
await install(['/data/test/bmsThirdBundleJs.hap']);
bundle.getBundleInfo(bundleName,1).then((data)=>{
expect(data.abilityInfo.length).assertEqual(1);
checkIsExist(abilityName, data);
uninstall(bundleName);
done();
});
let data = await bundle.getBundleInfo(bundleName, 1);
expect(data.abilityInfo.length).assertEqual(1);
checkIsExist(abilityName, data);
await uninstall(bundleName);
done();
setTimeout(function () {
console.info('=====================bms_getJsAbility_0300==================end');
}, TIMEOUT)
})
async function install(bundlePath)
{
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
await installer.install(bundlePath, {
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
......@@ -96,7 +106,7 @@ describe('ActsBmsJsTest', function () {
async function uninstall(bundleName)
{
var installer = await bundle.getBundleInstaller();
await installer.uninstall(bundleName, {
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
......@@ -118,8 +128,7 @@ describe('ActsBmsJsTest', function () {
console.debug('==========bundleInfo==========' + JSON.stringify(data))
console.debug('==========AbilityInfo===========' + JSON.stringify(data.abilityInfo))
let abilityNames = new Map();
for (var i = 0; i < data.abilityInfo.length; i++)
{
for (var i = 0; i < data.abilityInfo.length; i++) {
console.debug('==========abilityName==========' + data.abilityInfo[i].name);
abilityNames.set(data.abilityInfo[i].name, data.abilityInfo[i]);
}
......
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsbmsmetadatatest",
"shell-timeout": "60000"
},
......
......@@ -16,7 +16,10 @@
import bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 1000;
describe('ActsBmsMetaDataTest', function () {
/*
* @tc.number: bms_getMetaData_0100
* @tc.name: test to get meta data for an application.
......@@ -51,7 +54,11 @@ describe('ActsBmsMetaDataTest', function () {
}, 0, 0)
checkMetaData(datainfo.metaData);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0100===========')
}, TIMEOUT);
})
/*
* @tc.number: bms_getMetaData_0200
* @tc.name: test to get meta data for an update application.
......@@ -73,7 +80,11 @@ describe('ActsBmsMetaDataTest', function () {
}, 0, 0)
checkMetaData(datainfo.metaData);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0200===========')
}, TIMEOUT);
})
/*
* @tc.number: bms_getMetaData_0300
* @tc.name: test to get meta data for an uninstalled application.
......@@ -97,7 +108,11 @@ describe('ActsBmsMetaDataTest', function () {
console.info('==========abilityInfo is ==========' + JSON.stringify(datainfo));
checkMetaDataNoExit(datainfo.metaData);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0300===========')
}, TIMEOUT);
})
/*
* @tc.number: bms_getMetaData_0400
* @tc.name: test to get meta data for an application.
......@@ -132,9 +147,13 @@ describe('ActsBmsMetaDataTest', function () {
}, 0, 0)
console.info('==========abilityInfo is ==========' + JSON.stringify(datainfo2));
checkMetaData(datainfo2.metaData);
uninstall('com.example.third5');
await uninstall('com.example.third5');
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0400===========')
}, TIMEOUT);
})
/*
* @tc.number: bms_getMetaData_0500
* @tc.name: test to get meta data for an application that does not exist.
......@@ -157,7 +176,11 @@ describe('ActsBmsMetaDataTest', function () {
console.info('==========abilityInfo is ==========' + JSON.stringify(datainfo));
checkMetaDataNoExit(datainfo.metaData);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0500===========')
}, TIMEOUT);
})
/*
* @tc.number: bms_getMetaData_0600
* @tc.name: test to get meta data for a system application.
......@@ -178,7 +201,11 @@ describe('ActsBmsMetaDataTest', function () {
}, 0, 0)
checkMetaData(datainfo.metaData);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0600===========')
}, TIMEOUT);
})
/*
* @tc.number: bms_getMetaData_0700
* @tc.name: test to get meta data for a vendor application.
......@@ -199,6 +226,9 @@ describe('ActsBmsMetaDataTest', function () {
}, 0, 0)
checkMetaData(datainfo.metaData);
done();
setTimeout(function () {
console.debug('============bms_getMetaData_0700===========')
}, TIMEOUT);
})
function checkMetaData(data) {
......@@ -254,7 +284,7 @@ describe('ActsBmsMetaDataTest', function () {
}
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
await installer.install(bundlePath, {
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
......@@ -273,7 +303,7 @@ describe('ActsBmsMetaDataTest', function () {
async function uninstall(bundleName) {
var installer = await bundle.getBundleInstaller();
await installer.uninstall(bundleName, {
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
......
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "120000",
"package": "com.example.actsbmsmoduleusagerecordtest",
"shell-timeout": "60000"
},
......
......@@ -18,32 +18,25 @@ import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
const START_ABILITY_TIMEOUT = 5000;
const MIN_NUM = 2;
const MAX_NUM = 10;
const NUM_TWO = 2;
const NUM_TEN = 10;
const INVALID_NUM = -1;
var SubscriberInfo_bms_getModuleUsageRecordTest_0100 = {
const TIMEOUT = 1000;
const EVENTTIMEOUT = 2000;
var subscriberInfoGetModuleUsageRecordTest_0100 = {
events: ['ACTS_Third1_Publish_CommonEvent'],
};
describe('ActsBmsModuleUsageRecordTest', function () {
beforeAll(async (done) => {
console.debug('=======before all install========');
bundle.getBundleInstaller().then((data) => {
data.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, onReceiveinstallEvent);
})
function onReceiveinstallEvent(err, data) {
console.info('========install finish========' + JSON.stringify(err));
console.info('========install finish========' + JSON.stringify(data));
console.info('========install finish========' + data.status);
console.info('========install finish========' + data.statusMessage);
done()
}
await install(['/data/test/bmsThirdBundleTest1.hap'])
done();
setTimeout(function () {
console.debug('=======before all install finish========');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0100
* @tc.name: getModuleUsageRecord(maxNum)
......@@ -59,17 +52,17 @@ describe('ActsBmsModuleUsageRecordTest', function () {
clearTimeout(id);
expect(data.event).assertEqual('ACTS_Third1_Publish_CommonEvent');
console.debug('====>Subscribe CallBack data:====>' + JSON.stringify(data));
let records = await bundle.getModuleUsageRecords(MIN_NUM);
let records = await bundle.getModuleUsageRecords(NUM_TWO);
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0100');
var result = checkIsExist(records, bundleName);
expect(result).assertEqual(true);
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
done();
}
await commonEvent.createSubscriber(SubscriberInfo_bms_getModuleUsageRecordTest_0100).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoGetModuleUsageRecordTest_0100).then((data) => {
console.debug('====>Create Subscriber====>');
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
function UnSubscribeCallback() {
console.debug('====>UnSubscribe CallBack====>');
......@@ -93,7 +86,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
}
)
expect(result).assertEqual(0);
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0100==================end');
}, EVENTTIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0200
* @tc.name: getModuleUsageRecord(maxNum)
......@@ -102,14 +99,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_0200', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0200==================');
var bundleName = 'com.example.third1';
bundle.getModuleUsageRecords(MIN_NUM, (err, data) => {
bundle.getModuleUsageRecords(NUM_TWO, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0200');
var result = checkIsExist(data, bundleName);
expect(result).assertEqual(true);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0200==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0300
* @tc.name: getModuleUsageRecord(maxNum)
......@@ -118,14 +119,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_0300', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0300==================');
var bundleName = 'com.example.third1';
bundle.getModuleUsageRecords(MAX_NUM, (err, data) => {
bundle.getModuleUsageRecords(NUM_TEN, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0300');
var result = checkIsExist(data, bundleName);
expect(result).assertEqual(true);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0300==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0400
* @tc.name: getModuleUsageRecord(maxNum)
......@@ -134,12 +139,16 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_0400', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0400==================');
var bundleName = 'com.example.third1';
var records = await bundle.getModuleUsageRecords(MAX_NUM);
var records = await bundle.getModuleUsageRecords(NUM_TEN);
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0400');
var result = checkIsExist(records, bundleName);
expect(result).assertEqual(true);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0400==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0500
* @tc.name: getModuleUsageRecord(maxNum) by promise
......@@ -151,12 +160,16 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var bundleName = 'com.example.third1'
await uninstall(bundleName);
console.debug('===================uninstall third1====================');
var records = await bundle.getModuleUsageRecords(MAX_NUM)
var records = await bundle.getModuleUsageRecords(NUM_TEN)
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0500');
var result = checkIsExist(records, bundleName);
expect(result).assertEqual(false);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0500==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0600
* @tc.name: getModuleUsageRecord(maxNum,callback: AsyncCallback<Array<ModuleUsageRecord>>)
......@@ -166,14 +179,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_0600', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0600==================');
var bundleName = 'com.example.third1'
await bundle.getModuleUsageRecords(MAX_NUM, (err, data) => {
await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0600');
var result = checkIsExist(data, bundleName);
expect(result).assertEqual(false);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0600==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0700
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
......@@ -187,7 +204,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0700==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0800
* @tc.name: getModuleUsageRecord(maxNum) by promise
......@@ -198,7 +219,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var data = await bundle.getModuleUsageRecords(INVALID_NUM);
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0800==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_0900
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
......@@ -212,7 +237,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
expect(data.length).assertEqual(0);
done();
});
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_0900==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1000
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
......@@ -223,7 +252,11 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var data = await bundle.getModuleUsageRecords(0);
expect(data.length).assertEqual(0);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1000==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1100
* @tc.name: getModuleUsageRecord(maxNum) by promise
......@@ -236,12 +269,16 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
await install(bundlePath);
console.debug('===================install third1====================');
var records = await bundle.getModuleUsageRecords(MAX_NUM)
var records = await bundle.getModuleUsageRecords(NUM_TEN)
checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_1100');
var result = checkIsExist(records, bundleName);
expect(result).assertEqual(true);
done();
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1100==================end');
}, TIMEOUT)
})
/*
* @tc.number: bms_getModuleUsageRecordTest_1200
* @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback<Array<ModuleUsageRecord>>)
......@@ -251,13 +288,16 @@ describe('ActsBmsModuleUsageRecordTest', function () {
it('bms_getModuleUsageRecordTest_1200', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_1200==================');
var bundleName = 'com.example.third1'
await bundle.getModuleUsageRecords(MAX_NUM, (err, data) => {
await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => {
expect(err.code).assertEqual(0);
checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_1200');
var result = checkIsExist(data, bundleName);
expect(result).assertEqual(true);
done();
})
setTimeout(function () {
console.debug('=====================bms_getModuleUsageRecordTest_1200==================end');
}, TIMEOUT)
})
function checkModuleUsageRecord(data, caseName) {
......@@ -310,7 +350,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
}
async function install(bundlePath) {
var installer = await bundle.getBundleInstaller();
await installer.install(bundlePath, {
installer.install(bundlePath, {
param: {
userId: 0,
installFlag: 1,
......@@ -329,7 +369,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
}
async function uninstall(bundleName) {
var installer = await bundle.getBundleInstaller();
await installer.uninstall(bundleName, {
installer.uninstall(bundleName, {
param: {
userId: 0,
installFlag: 1,
......
......@@ -2,9 +2,9 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "21600000",
"package": "com.example.actsansnotificationcancel",
"shell-timeout": "60000"
"shell-timeout": "21600000"
},
"kits": [
{
......
......@@ -2,9 +2,9 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "21600000",
"package": "com.example.actsansnotificationremove",
"shell-timeout": "60000"
"shell-timeout": "21600000"
},
"kits": [
{
......
......@@ -19,10 +19,7 @@ group("ActsAnsSlotTest") {
deps = [
"actsansgetslottestcallback:ActsAnsGetSlotTestCallback",
"actsansgetslottestpromise:ActsAnsGetSlotTestPromise",
"actsanslotbybundle:ActsAnsSlotByBundle",
"actsansremoveslottest:ActsAnsRemoveSlotTest",
"actsansslotsystemcallback:ActsAnsSlotSystemCallback",
"actsansslotsystempromise:ActsAnsSlotSystemPromise",
]
}
}
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsansgetslottestcallback",
"shell-timeout": "60000"
},
......
......@@ -17,31 +17,31 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe('ActsAnsGetSlotTestCallback', function () {
function addSlotActsAnsGetSlotTestCallback_0100(err){
function addSlotActsAnsGetSlotTestCallbackFirst(err){
console.debug("====>addSlotActsAnsGetSlotTestCallback_0100 enter====>");
console.debug("====>addSlotActsAnsGetSlotTestCallback_0100 err: ====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>addSlotActsAnsGetSlotTestCallback_0100 finish====>");
}
function addSlotActsAnsGetSlotTestCallback_0200(err, data){
function addSlotActsAnsGetSlotTestCallbackSecond(err, data){
console.debug("====>addSlotActsAnsGetSlotTestCallback_0200 enter====>");
console.debug("====>addSlotActsAnsGetSlotTestCallback_0200 err: ====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>addSlotActsAnsGetSlotTestCallback_0200 finish====>");
}
function addSlotActsAnsGetSlotTestCallback_0300(err){
function addSlotActsAnsGetSlotTestCallbackThird(err){
console.debug("====>addSlotActsAnsGetSlotTestCallback_0300 enter====>");
console.debug("====>addSlotActsAnsGetSlotTestCallback_0300 err: ====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>addSlotActsAnsGetSlotTestCallback_0300 finish====>");
}
function addSlotActsAnsGetSlotTestCallback_0400(err){
function addSlotActsAnsGetSlotTestCallbackFourth(err){
console.debug("====>addSlotActsAnsGetSlotTestCallback_0400 enter====>");
console.debug("====>addSlotActsAnsGetSlotTestCallback_0400 err: ====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>addSlotActsAnsGetSlotTestCallback_0400 finish====>");
}
function addSlotActsAnsGetSlotTestCallback_0500(err){
function addSlotActsAnsGetSlotTestCallbackFifth(err){
console.debug("====>addSlotActsAnsGetSlotTestCallback_0500 enter====>");
console.debug("====>addSlotActsAnsGetSlotTestCallback_0500 err: ====>" + JSON.stringify(err));
console.debug("====>addSlotActsAnsGetSlotTestCallback_0500 finish====>");
......@@ -55,9 +55,9 @@ describe('ActsAnsGetSlotTestCallback', function () {
it('ActsAnsGetSlotTestCallback_0100', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestCallback_0100 start====>");
console.debug("====>addSlot SlotType.SOCIAL_COMMUNICATION: ====>");
await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION, addSlotActsAnsGetSlotTestCallback_0100);
await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION, addSlotActsAnsGetSlotTestCallbackFirst);
console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION: ====>");
await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, data)=> {
await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, function (err, data){
console.debug("====>getSlotActsAnsGetSlotTestCallback_0100 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestCallback_0100 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
......@@ -75,6 +75,9 @@ describe('ActsAnsGetSlotTestCallback', function () {
console.debug("====>getSlotActsAnsGetSlotTestCallback_0100 finish====>");
done();
});
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestCallback_0100====>");
}, 1000);
})
/*
......@@ -84,7 +87,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
*/
it('ActsAnsGetSlotTestCallback_0200', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestCallback_0200 start====>");
function getSlotActsAnsGetSlotTestCallback_0200(err, data) {
function getSlotActsAnsGetSlotTestCallbackSecond(err, data) {
console.debug("====>getSlotActsAnsGetSlotTestCallback_0200 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestCallback_0200 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
......@@ -103,9 +106,12 @@ describe('ActsAnsGetSlotTestCallback', function () {
done();
}
console.debug("====>addSlot SlotType.SERVICE_INFORMATION: ====>");
await notification.addSlot(notification.SlotType.SERVICE_INFORMATION, addSlotActsAnsGetSlotTestCallback_0200);
await notification.addSlot(notification.SlotType.SERVICE_INFORMATION, addSlotActsAnsGetSlotTestCallbackSecond);
console.debug("====>getSlot SlotType.SERVICE_INFORMATION: ====>");
await notification.getSlot(notification.SlotType.SERVICE_INFORMATION, getSlotActsAnsGetSlotTestCallback_0200);
await notification.getSlot(notification.SlotType.SERVICE_INFORMATION, getSlotActsAnsGetSlotTestCallbackSecond);
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestCallback_0200====>");
}, 1000);
})
/*
......@@ -115,7 +121,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
*/
it('ActsAnsGetSlotTestCallback_0300', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestCallback_0300 start====>");
function getSlotActsAnsGetSlotTestCallback_0300(err, data) {
function getSlotActsAnsGetSlotTestCallbackThird(err, data) {
console.debug("====>getSlotActsAnsGetSlotTestCallback_0300 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestCallback_0300 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
......@@ -134,9 +140,12 @@ describe('ActsAnsGetSlotTestCallback', function () {
done();
}
console.debug("====>addSlot SlotType.CONTENT_INFORMATION: ====>");
await notification.addSlot(notification.SlotType.CONTENT_INFORMATION, addSlotActsAnsGetSlotTestCallback_0300);
await notification.addSlot(notification.SlotType.CONTENT_INFORMATION, addSlotActsAnsGetSlotTestCallbackThird);
console.debug("====>getSlot SlotType.CONTENT_INFORMATION: ====>");
await notification.getSlot(notification.SlotType.CONTENT_INFORMATION, getSlotActsAnsGetSlotTestCallback_0300);
await notification.getSlot(notification.SlotType.CONTENT_INFORMATION, getSlotActsAnsGetSlotTestCallbackThird);
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestCallback_0300====>");
}, 1000);
})
/*
......@@ -146,7 +155,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
*/
it('ActsAnsGetSlotTestCallback_0400', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestCallback_0400 start====>");
function getSlotActsAnsGetSlotTestCallback_0400(err, data) {
function getSlotActsAnsGetSlotTestCallbackFourth(err, data) {
console.debug("====>getSlotActsAnsGetSlotTestCallback_0400 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestCallback_0400 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
......@@ -165,9 +174,12 @@ describe('ActsAnsGetSlotTestCallback', function () {
done();
}
console.debug("====>addSlot SlotType.OTHER_TYPES: ====>");
await notification.addSlot(notification.SlotType.OTHER_TYPES, addSlotActsAnsGetSlotTestCallback_0400);
await notification.addSlot(notification.SlotType.OTHER_TYPES, addSlotActsAnsGetSlotTestCallbackFourth);
console.debug("====>getSlot SlotType.OTHER_TYPES: ====>");
await notification.getSlot(notification.SlotType.OTHER_TYPES, getSlotActsAnsGetSlotTestCallback_0400);
await notification.getSlot(notification.SlotType.OTHER_TYPES, getSlotActsAnsGetSlotTestCallbackFourth);
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestCallback_0400====>");
}, 1000);
})
/*
......@@ -177,7 +189,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
*/
it('ActsAnsGetSlotTestCallback_0500', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestCallback_0500 start====>");
function getSlotActsAnsGetSlotTestCallback_0500(err, data) {
function getSlotActsAnsGetSlotTestCallbackFifth(err, data) {
console.debug("====>getSlotActsAnsGetSlotTestCallback_0500 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestCallback_0500 err====>" + JSON.stringify(err));
expect(err.code).assertEqual(0);
......@@ -196,8 +208,11 @@ describe('ActsAnsGetSlotTestCallback', function () {
done();
}
console.debug("====>addSlot SlotType.UNKNOWN_TYPE: ====>");
await notification.addSlot(notification.SlotType.UNKNOWN_TYPE, addSlotActsAnsGetSlotTestCallback_0500);
await notification.addSlot(notification.SlotType.UNKNOWN_TYPE, addSlotActsAnsGetSlotTestCallbackFifth);
console.debug("====>getSlot SlotType.UNKNOWN_TYPE: ====>");
await notification.getSlot(notification.SlotType.UNKNOWN_TYPE, getSlotActsAnsGetSlotTestCallback_0500);
await notification.getSlot(notification.SlotType.UNKNOWN_TYPE, getSlotActsAnsGetSlotTestCallbackFifth);
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestCallback_0500====>");
}, 1000);
})
})
\ No newline at end of file
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsansgetslottestpromise",
"shell-timeout": "60000"
},
......
......@@ -24,11 +24,11 @@ describe('ActsAnsGetSlotTestPromise', function () {
*/
it('ActsAnsGetSlotTestPromise_0100', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestPromise_0100 start====>");
await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION).then(() => {
notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION).then(() => {
console.debug("====>addSlotActsAnsGetSlotTestPromise_0100 enter====>");
})
console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION: ====>");
await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION).then((data) => {
notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION).then((data) => {
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
......@@ -42,9 +42,12 @@ describe('ActsAnsGetSlotTestPromise', function () {
expect(data.lightEnabled).assertEqual(false);
expect(data.lightColor).assertEqual(0);
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 finish====>");
done();
})
console.debug("====>ActsAnsGetSlotTestPromise_0100 end====>");
done();
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestPromise_0100====>");
}, 1000);
})
/*
......@@ -54,13 +57,13 @@ describe('ActsAnsGetSlotTestPromise', function () {
*/
it('ActsAnsGetSlotTestPromise_0200', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestPromise_0200 start====>");
await notification.addSlot(notification.SlotType.SERVICE_INFORMATION).then(() => {
console.debug("====>addSlotByTypePromise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 enter====>");
notification.addSlot(notification.SlotType.SERVICE_INFORMATION).then(() => {
console.debug("====>addSlotByTypePromise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 enter");
})
console.debug("====>getSlot SlotType.SERVICE_INFORMATION: ====>");
await notification.getSlot(notification.SlotType.SERVICE_INFORMATION).then((data) => {
notification.getSlot(notification.SlotType.SERVICE_INFORMATION).then((data) => {
console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 enter====>");
console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 data====>" + JSON.stringify(data));
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0200 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION);
expect(data.level).assertEqual(3);
expect(data.desc).assertEqual("");
......@@ -72,9 +75,12 @@ describe('ActsAnsGetSlotTestPromise', function () {
expect(data.lightEnabled).assertEqual(false);
expect(data.lightColor).assertEqual(0);
console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 finish====>");
done();
})
console.debug("====>ActsAnsGetSlotTestPromise_0200 end====>");
done();
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestPromise_0200====>");
}, 1000);
})
/*
......@@ -85,13 +91,13 @@ describe('ActsAnsGetSlotTestPromise', function () {
it('ActsAnsGetSlotTestPromise_0300', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestPromise_0300 Promise start====>");
console.debug("====>addSlot SlotType.CONTENT_INFORMATION: ====>");
await notification.addSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
console.debug("====>addSlotByTypePromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 enter====>");
notification.addSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
console.debug("====>addSlotByTypePromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 enter");
})
console.debug("====>getSlot SlotType.CONTENT_INFORMATION: ====>");
await notification.getSlot(notification.SlotType.CONTENT_INFORMATION).then((data) => {
notification.getSlot(notification.SlotType.CONTENT_INFORMATION).then((data) => {
console.debug("====>getSlotPromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 enter====>");
console.debug("====>getSlotPromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 data====>" + JSON.stringify(data));
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0300 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION);
expect(data.level).assertEqual(3);
expect(data.desc).assertEqual("");
......@@ -103,9 +109,12 @@ describe('ActsAnsGetSlotTestPromise', function () {
expect(data.lightEnabled).assertEqual(false);
expect(data.lightColor).assertEqual(0);
console.debug("====>getSlotPromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 finish====>");
done();
})
console.info("====>ActsAnsGetSlotTestPromise_0300 end====>");
done();
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestPromise_0300====>");
}, 1000);
})
/*
......@@ -116,13 +125,13 @@ describe('ActsAnsGetSlotTestPromise', function () {
it('ActsAnsGetSlotTestPromise_0400', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestPromise_0400 start====>");
console.debug("====>addSlot SlotType.OTHER_TYPES: ====>");
await notification.addSlot(notification.SlotType.OTHER_TYPES).then(() => {
console.debug("====>addSlotByTypePromise OTHER_TYPES AnsGetSlotByTypeAfterAddPromiseTest_0400 enter====>");
notification.addSlot(notification.SlotType.OTHER_TYPES).then(() => {
console.debug("====>addSlotByTypePromise AnsGetSlotByTypeAfterAddPromiseTest_0400 enter====>");
})
console.debug("====>getSlot SlotType.OTHER_TYPES: ====>");
await notification.getSlot(notification.SlotType.OTHER_TYPES).then((data) => {
notification.getSlot(notification.SlotType.OTHER_TYPES).then((data) => {
console.debug("====>getSlotPromise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 enter====>");
console.debug("====>getSlotPromise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 data====>" + JSON.stringify(data));
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0400 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data.level).assertEqual(3);
expect(data.desc).assertEqual("");
......@@ -134,9 +143,12 @@ describe('ActsAnsGetSlotTestPromise', function () {
expect(data.lightEnabled).assertEqual(false);
expect(data.lightColor).assertEqual(0);
console.debug("====>getSlotPromise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 finish====>");
done();
})
console.debug("====>ActsAnsGetSlotTestPromise_0400 end====>");
done();
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestPromise_0400====>");
}, 1000);
})
/*
......@@ -147,13 +159,13 @@ describe('ActsAnsGetSlotTestPromise', function () {
it('ActsAnsGetSlotTestPromise_0500', 0, async function (done) {
console.debug("====>ActsAnsGetSlotTestPromise_0500 start====>");
console.debug("====>addSlot SlotType.UNKNOWN_TYPE: ====>");
await notification.addSlot(notification.SlotType.UNKNOWN_TYPE).then(() => {
notification.addSlot(notification.SlotType.UNKNOWN_TYPE).then(() => {
console.debug("====>addSlotByTypePromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 enter====>");
})
console.debug("====>getSlot SlotType.UNKNOWN_TYPE: ====>");
await notification.getSlot(notification.SlotType.UNKNOWN_TYPE).then((data) => {
notification.getSlot(notification.SlotType.UNKNOWN_TYPE).then((data) => {
console.debug("====>getSlotPromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 enter====>");
console.debug("====>getSlotPromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 data====>" + JSON.stringify(data));
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0500 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data.level).assertEqual(3);
expect(data.desc).assertEqual("");
......@@ -165,8 +177,11 @@ describe('ActsAnsGetSlotTestPromise', function () {
expect(data.lightEnabled).assertEqual(false);
expect(data.lightColor).assertEqual(0);
console.debug("====>getSlotPromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 finish====>");
done();
})
console.debug("====>ActsAnsGetSlotTestPromise_0500 end====>");
done();
setTimeout(function(){
console.debug("====>time out ActsAnsGetSlotTestPromise_0500====>");
}, 1000);
})
})
\ 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("ActsAnsSlotByBundle") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsSlotByBundle"
}
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": "300000",
"package": "com.example.actsansslotbybundle",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsSlotByBundle.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansslotbybundle",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansslotbybundle",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansslotbybundle.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.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": "ActsAnsSlotByBundle"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
/*
* 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('ActsAnsSlotByBundle', function () {
/*
* @tc.number : ActsAnsSlotByBundle_0100
* @tc.name : Verify getSlot SOCIAL_COMMUNICATION
* @tc.desc : After setSlot, call the getSlotsByBundle interface to
* check whether the information is consistent.(promise)
*/
it('ActsAnsSlotByBundle_0100', 0, async function (done) {
console.debug("====>ActsAnsSlotByBundle_0100 start====>");
var bundleoption = {
bundle: "com.example.actsansgettest"
}
var notificationslot = {
type: notification.SlotType.SERVICE_INFORMATION,
level:4
}
notification.addSlot(notification.SlotType.SERVICE_INFORMATION).then(() => {
console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>");
console.debug("====>getSlotsByBundle1 start====>");
notification.getSlotsByBundle(bundleoption).then((data)=>{
console.debug("====>getSlotsByBundle1====>" + JSON.stringify(data));
expect(data[0].type).assertEqual(2)
expect(data[0].level).assertEqual(3)
expect(data[0].badgeFlag).assertEqual(true)
expect(data[0].bypassDnd).assertEqual(false)
expect(data[0].lockscreenVisibility).assertEqual(2)
expect(data[0].vibrationEnabled).assertEqual(true)
expect(data[0].lightEnabled).assertEqual(false)
expect(data[0].lightColor).assertEqual(0)
console.debug("====>getSlotsByBundle1 finish====>");
console.debug("====>setSlotByBundle start====>");
notification.setSlotByBundle(bundleoption,notificationslot).then(()=>{
console.debug("====>setSlotsByBundle====>")
console.debug("====>getSlotsByBundle1.1 start====>");
notification.getSlotsByBundle(bundleoption).then((data)=>{
console.debug("====>getSlotsByBundle1.1====>" + JSON.stringify(data));
expect(data[0].type).assertEqual(2)
expect(data[0].level).assertEqual(4)
expect(data[0].badgeFlag).assertEqual(true)
expect(data[0].bypassDnd).assertEqual(false)
expect(data[0].lockscreenVisibility).assertEqual(2)
expect(data[0].vibrationEnabled).assertEqual(true)
expect(data[0].lightEnabled).assertEqual(false)
expect(data[0].lightColor).assertEqual(0)
console.debug("====>getSlotsByBundle1.1 finish====>");
notification.getSlotNumByBundle(bundleoption).then((data)=>{
console.debug("====>getSlotNumAsBundle1====>" + JSON.stringify(data));
expect(data).assertEqual(1)
done();
})
})
})
})
})
})
/*
* @tc.number : ActsAnsSlotByBundle_0100
* @tc.name : Verify getSlot SOCIAL_COMMUNICATION
* @tc.desc : After setSlot, call the getSlotsByBundle interface to
* check whether the information is consistent.(callback)
*/
it('ActsAnsSetSlotByBundle_0200', 0, async function (done) {
console.debug("====>ActsAnsSlotByBundle_0200 start====>");
var bundleoption = {
bundle: "com.example.actsansgettest"
}
var notificationslot = {
type: notification.SlotType.SERVICE_INFORMATION,
level:4
}
notification.addSlot(notification.SlotType.SERVICE_INFORMATION).then(() => {
console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>");
console.debug("====>getSlotsByBundle2 start====>");
notification.getSlotsByBundle(bundleoption,(err,data)=>{
console.debug("====>getSlotsByBundle2====>" + JSON.stringify(data));
expect(data[0].type).assertEqual(2)
expect(data[0].level).assertEqual(3)
expect(data[0].badgeFlag).assertEqual(true)
expect(data[0].bypassDnd).assertEqual(false)
expect(data[0].lockscreenVisibility).assertEqual(2)
expect(data[0].vibrationEnabled).assertEqual(true)
expect(data[0].lightEnabled).assertEqual(false)
expect(data[0].lightColor).assertEqual(0)
console.debug("====>getSlotsByBundle2 finish====>");
console.debug("====>setSlotByBundle start====>");
notification.setSlotByBundle(bundleoption,notificationslot,()=>{
console.debug("====>setSlotsByBundle====>")
console.debug("====>getSlotsByBundle2.1 start====>");
notification.getSlotsByBundle(bundleoption,(err,data)=>{
console.debug("====>getSlotsByBundle2.1====>" + JSON.stringify(data));
expect(data[0].type).assertEqual(2)
expect(data[0].level).assertEqual(4)
expect(data[0].badgeFlag).assertEqual(true)
expect(data[0].bypassDnd).assertEqual(false)
expect(data[0].lockscreenVisibility).assertEqual(2)
expect(data[0].vibrationEnabled).assertEqual(true)
expect(data[0].lightEnabled).assertEqual(false)
expect(data[0].lightColor).assertEqual(0)
console.debug("====>getSlotsByBundle2.1 finish====>");
notification.getSlotNumByBundle(bundleoption,(err,data)=>{
console.debug("====>getSlotNumAsBundle2====>" + JSON.stringify(data));
expect(data).assertEqual(1)
done();
})
})
})
})
})
})
})
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"test-timeout": "60000",
"package": "com.example.actsansremoveslottest",
"shell-timeout": "60000"
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册