提交 7f36a04c 编写于 作者: Z zhijianwen

show

Signed-off-by: Nzhijianwen <zhijianwen@huawei.com>
上级 5fd1c9d3
...@@ -12,31 +12,31 @@ ...@@ -12,31 +12,31 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import notification from '@system.notification' import notification from '@system.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ActsNotificationShowTest() { export default function ActsNotificationShowTest() {
describe('ActsNotificationShowTest', function () { describe('ActsNotificationShowTest', function () {
console.info("ActsNotificationShowTest start"); const TAG = 'ActsNotificationShowTest ===> '
console.info(TAG + "ActsNotificationShowTest START")
/* /*
* @tc.number: ActsNotificationShowTest_0100 * @tc.number: ActsNotificationShowTest_0100
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0100', 0, async function (done) { it('ActsNotificationShowTest_0100', 0, async function (done) {
let ShowNotificationOptions = { console.info(TAG + 'ActsNotificationShowTest_0100 START ')
contentTitle: 'Title1', let ShowNotificationOptions = {
contentText: 'This is a notification 001' contentTitle: 'Title1',
} contentText: 'This is a notification 001'
notification.show(ShowNotificationOptions); }
expect(ShowNotificationOptions.contentTitle).assertEqual('Title1'); notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 001'); console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
console.log('ActsNotificationShowTest_0100 success' console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
+ ShowNotificationOptions.contentTitle expect(ShowNotificationOptions.contentTitle).assertEqual('Title1')
+ ShowNotificationOptions.contentText); expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 001')
done(); done()
}) })
/* /*
...@@ -45,19 +45,16 @@ describe('ActsNotificationShowTest', function () { ...@@ -45,19 +45,16 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0200', 0, async function (done) { it('ActsNotificationShowTest_0200', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0200 START ')
contentTitle: 123, let ShowNotificationOptions = {
contentText: 'This is a notification 002' contentTitle: 123,
} contentText: 'This is a notification 002'
notification.show(ShowNotificationOptions); }
if(ShowNotificationOptions.contentTitle == 123){ notification.show(ShowNotificationOptions)
console.log('ActsNotificationShowTest_0200 conteneTitle is number:' console.info(TAG + ' conteneTitle is number:' + ShowNotificationOptions.contentTitle)
+ ShowNotificationOptions.contentTitle); console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
} expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 002')
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 002'); done()
console.log(' ActsNotificationShowTest_0200 success'
+ ShowNotificationOptions.contentText);
done();
}) })
/* /*
...@@ -66,11 +63,11 @@ describe('ActsNotificationShowTest', function () { ...@@ -66,11 +63,11 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0300', 0, async function (done) { it('ActsNotificationShowTest_0300', 0, async function (done) {
let ShowNotificationOptions ={} console.info(TAG + 'ActsNotificationShowTest_0300 START ')
notification.show(ShowNotificationOptions); let ShowNotificationOptions = {}
expect(ShowNotificationOptions.contentTitle).assertEqual(undefined); notification.show(ShowNotificationOptions)
console.log(' ActsNotificationShowTest_0300 success '); expect(ShowNotificationOptions.contentTitle).assertEqual(undefined)
done(); done()
}) })
/* /*
...@@ -79,28 +76,28 @@ describe('ActsNotificationShowTest', function () { ...@@ -79,28 +76,28 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0400', 0, async function (done) { it('ActsNotificationShowTest_0400', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0400 START ')
contentTitle: 'Title4', let ShowNotificationOptions = {
contentText: 'This is a notification 004', contentTitle: 'Title4',
ActionResult: { contentText: 'This is a notification 004',
bundleName: 'com.example.notification', ActionResult: {
abilityName: 'com.example.notification.MainAbility', bundleName: 'com.example.notification',
uri: '/', abilityName: 'com.example.notification.MainAbility',
} uri: '/',
} }
notification.show(ShowNotificationOptions); }
expect(ShowNotificationOptions.contentTitle).assertEqual('Title4'); notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 004'); console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification'); console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility'); console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/'); console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
console.log('ActsNotificationShowTest_0400 success' console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
+ ShowNotificationOptions.contentTitle expect(ShowNotificationOptions.contentTitle).assertEqual('Title4')
+ ShowNotificationOptions.contentText expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 004')
+ ShowNotificationOptions.ActionResult.bundleName expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification')
+ ShowNotificationOptions.ActionResult.abilityName expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility')
+ ShowNotificationOptions.ActionResult.uri); expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/')
done(); done()
}) })
/* /*
...@@ -109,28 +106,28 @@ describe('ActsNotificationShowTest', function () { ...@@ -109,28 +106,28 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0500', 0, async function (done) { it('ActsNotificationShowTest_0500', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0500 START ')
contentTitle: 'Title5', let ShowNotificationOptions = {
contentText: 'This is a notification 005', contentTitle: 'Title5',
ActionResult: { contentText: 'This is a notification 005',
bundleName: 'com.example.notification', ActionResult: {
abilityName: 'com.example.notification.MainAbility', bundleName: 'com.example.notification',
uri: 'pages/index/index', abilityName: 'com.example.notification.MainAbility',
} uri: 'pages/index/index',
} }
notification.show(ShowNotificationOptions); }
expect(ShowNotificationOptions.contentTitle).assertEqual('Title5'); notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 005'); console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification'); console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility'); console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('pages/index/index'); console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
console.log('ActsNotificationShowTest_0500 success' console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
+ ShowNotificationOptions.contentTitle expect(ShowNotificationOptions.contentTitle).assertEqual('Title5')
+ ShowNotificationOptions.contentText expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 005')
+ ShowNotificationOptions.ActionResult.bundleName expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification')
+ ShowNotificationOptions.ActionResult.abilityName expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility')
+ ShowNotificationOptions.ActionResult.uri); expect(ShowNotificationOptions.ActionResult.uri).assertEqual('pages/index/index')
done(); done()
}) })
/* /*
...@@ -139,30 +136,27 @@ describe('ActsNotificationShowTest', function () { ...@@ -139,30 +136,27 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0600', 0, async function (done) { it('ActsNotificationShowTest_0600', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0600 START ')
contentTitle: 'Title6', let ShowNotificationOptions = {
contentText: 'This is a notification 006', contentTitle: 'Title6',
ActionResult: { contentText: 'This is a notification 006',
bundleName: '', ActionResult: {
abilityName: 'com.example.notification.MainAbility', bundleName: '',
uri: '/', abilityName: 'com.example.notification.MainAbility',
} uri: '/',
} }
notification.show(ShowNotificationOptions); }
if(ShowNotificationOptions.ActionResult.bundleName == ''){ notification.show(ShowNotificationOptions)
console.log('ActsNotificationShowTest_0200 bundleName is null:' console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
+ ShowNotificationOptions.ActionResult.bundleName); console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
} console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
expect(ShowNotificationOptions.contentTitle).assertEqual('Title6'); console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 006'); console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility'); expect(ShowNotificationOptions.contentTitle).assertEqual('Title6')
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/'); expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 006')
console.log(' ActsNotificationShowTest_0600 success' expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility')
+ ShowNotificationOptions.contentTitle expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/')
+ ShowNotificationOptions.contentText done()
+ ShowNotificationOptions.ActionResult.abilityName
+ ShowNotificationOptions.ActionResult.uri);
done();
}) })
/* /*
...@@ -171,30 +165,27 @@ describe('ActsNotificationShowTest', function () { ...@@ -171,30 +165,27 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0700', 0, async function (done) { it('ActsNotificationShowTest_0700', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0700 START ')
contentTitle: 'Title7', let ShowNotificationOptions = {
contentText: 'This is a notification 007', contentTitle: 'Title7',
ActionResult: { contentText: 'This is a notification 007',
bundleName: 'com.example.notification', ActionResult: {
abilityName: '', bundleName: 'com.example.notification',
uri: '/', abilityName: '',
} uri: '/',
}
notification.show(ShowNotificationOptions);
if(ShowNotificationOptions.ActionResult.abilityName == ''){
console.log('ActsNotificationShowTest_0200 abilityName is null:'
+ ShowNotificationOptions.ActionResult.abilityName);
} }
expect(ShowNotificationOptions.contentTitle).assertEqual('Title7'); }
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 007'); notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification'); console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/'); console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
console.log('ActsNotificationShowTest_0700 success' console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
+ ShowNotificationOptions.contentTitle console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
+ ShowNotificationOptions.contentText console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
+ ShowNotificationOptions.ActionResult.bundleName expect(ShowNotificationOptions.contentTitle).assertEqual('Title7')
+ ShowNotificationOptions.ActionResult.uri); expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 007')
done(); expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification')
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/')
done()
}) })
/* /*
...@@ -203,29 +194,27 @@ describe('ActsNotificationShowTest', function () { ...@@ -203,29 +194,27 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0800', 0, async function (done) { it('ActsNotificationShowTest_0800', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0800 START ')
contentTitle: 'Title8', let ShowNotificationOptions = {
contentText: 'This is a notification 008', contentTitle: 'Title8',
ActionResult: { contentText: 'This is a notification 008',
bundleName: 'com.example.notification', ActionResult: {
abilityName: 'com.example.notification.MainAbility', bundleName: 'com.example.notification',
uri: '', abilityName: 'com.example.notification.MainAbility',
} uri: '',
} }
notification.show(ShowNotificationOptions); }
if(ShowNotificationOptions.ActionResult.uri == ''){ notification.show(ShowNotificationOptions)
console.log('ActsNotificationShowTest_0200 uri is null: ' + ShowNotificationOptions.ActionResult.uri); console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
} console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
expect(ShowNotificationOptions.contentTitle).assertEqual('Title8'); console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 008'); console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification'); console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility'); expect(ShowNotificationOptions.contentTitle).assertEqual('Title8')
console.log('ActsNotificationShowTest_0800 success' expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 008')
+ ShowNotificationOptions.contentTitle expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification')
+ ShowNotificationOptions.contentText expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility')
+ ShowNotificationOptions.ActionResult.bundleName done()
+ ShowNotificationOptions.ActionResult.abilityName);
done();
}) })
/* /*
...@@ -234,25 +223,25 @@ describe('ActsNotificationShowTest', function () { ...@@ -234,25 +223,25 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0900', 0, async function (done) { it('ActsNotificationShowTest_0900', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_0900 START ')
contentText: 'This is a notification 009', let ShowNotificationOptions = {
ActionResult: { contentText: 'This is a notification 009',
bundleName: 'com.example.notification', ActionResult: {
abilityName: 'com.example.notification.MainAbility', bundleName: 'com.example.notification',
uri: '/', abilityName: 'com.example.notification.MainAbility',
} uri: '/',
} }
notification.show(ShowNotificationOptions); }
expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 009'); notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification'); console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText)
expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility'); console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/'); console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
console.log('ActsNotificationShowTest_0900 success' console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
+ ShowNotificationOptions.contentText expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 009')
+ ShowNotificationOptions.ActionResult.bundleName expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification')
+ ShowNotificationOptions.ActionResult.abilityName expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility')
+ ShowNotificationOptions.ActionResult.uri); expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/')
done(); done()
}) })
/* /*
...@@ -261,26 +250,30 @@ describe('ActsNotificationShowTest', function () { ...@@ -261,26 +250,30 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_1000', 0, async function (done) { it('ActsNotificationShowTest_1000', 0, async function (done) {
let ShowNotificationOptions ={ console.info(TAG + 'ActsNotificationShowTest_1000 START ')
contentTitle: 'Title10', let ShowNotificationOptions = {
ActionResult: { contentTitle: 'Title10',
bundleName: 'com.example.notification', ActionResult: {
abilityName: 'com.example.notification.MainAbility', bundleName: 'com.example.notification',
uri: '/', abilityName: 'com.example.notification.MainAbility',
} uri: '/',
} }
notification.show(ShowNotificationOptions); }
expect(ShowNotificationOptions.contentTitle).assertEqual('Title10'); notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification'); console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle)
expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility'); console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName)
expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/'); console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName)
console.log('ActsNotificationShowTest_1000 success ' console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri)
+ ShowNotificationOptions.contentTitle expect(ShowNotificationOptions.contentTitle).assertEqual('Title10')
+ ShowNotificationOptions.ActionResult.bundleName expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification')
+ ShowNotificationOptions.ActionResult.abilityName expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility')
+ ShowNotificationOptions.ActionResult.uri); expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/')
done(); done()
}) })
}) console.info(TAG + "ActsNotificationShowTest END");
})
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册