diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets index abffb3cd4b12b60fa3ee250f17184058f335f4c6..4990eed57086feb078faf401f22eb146aeb15919 100644 --- a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import commonEvent from "@ohos.commonEvent" diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets index 6a265d6a44464b67efb39d07dd3810c44688b164..028497857559803a1f0e4f98f9c8ba97d103f86c 100644 --- a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import commonEvent from "@ohos.commonEvent" diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts index 4568e9a3c429f9ff6befb5d0949a8deadcd773fe..13f0e00fbd3bcc02a9280ec5c4c7b5902cefde18 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts @@ -15,7 +15,7 @@ import Ability from '@ohos.application.Ability' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' +import { Hypium } from '@ohos/hypium' import testsuite from '../test/List.test' export default class MainAbility extends Ability { diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets index 10980c8f8de9f345cfdc88247bc43ffa9f3a486a..4950eba792171c8d879f85bfc141e4b7953d470d 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets @@ -13,39 +13,39 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { /** - * @tc.number: ACTS_AACommand_printSync_0100 + * @tc.number: ACTS_AACommand_printSync_01_0100 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, * The printSync information includes Chinese, special characters, etc. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_printSync_0100', 0, async function (done) { - console.log("ACTS_AACommand_printSync_0100 start ====> " ) + it('ACTS_AACommand_printSync_01_0100', 0, async function (done) { + console.log("ACTS_AACommand_printSync_01_0100 start ====> " ) var msg = '测试日志!@#$%^&*()_+QWE{}|?> " ) - var finishmsg = 'ACTS_AACommand_printSync_0100 end' + console.log("ACTS_AACommand_printSync_01_0100 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_01_0100 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ - console.log("ACTS_AACommand_printSync_0100 finishTest test end ========> callback " ) - console.log("ACTS_AACommand_printSync_0100 finishTest test end " + + console.log("ACTS_AACommand_printSync_01_0100 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_printSync_01_0100 finishTest test end " + "========> callback data: "+JSON.stringify(data)) done() }) }) /** - * @tc.number: ACTS_AACommand_printSync_0200 + * @tc.number: ACTS_AACommand_printSync_01_0200 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, * The length of the printSync message is 1000 characters. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_printSync_0200', 0, async function (done) { + it('ACTS_AACommand_printSync_01_0200', 0, async function (done) { var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'aaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @@ -58,22 +58,22 @@ export default function abilityTest() { '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' globalThis.abilityDelegator.printSync(msg); - console.log("ACTS_AACommand_printSync_0200 printSync end ====> " ) - var finishmsg = 'ACTS_AACommand_printSync_0200 end' + console.log("ACTS_AACommand_printSync_01_0200 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_01_0200 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_printSync_0200 print test end ========> callback " ) + console.log("ACTS_AACommand_printSync_01_0200 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_printSync_0300 + * @tc.number: ACTS_AACommand_printSync_01_0300 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid * The length of the printSync message is greater than 1000 characters. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_printSync_0300', 0, async function (done) { + it('ACTS_AACommand_printSync_01_0300', 0, async function (done) { var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'aaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @@ -87,27 +87,27 @@ export default function abilityTest() { '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + 'fffffffffff' globalThis.abilityDelegator.printSync(msg); - console.log("ACTS_AACommand_printSync_0300 printSync end ====> " ) - var finishmsg = 'ACTS_AACommand_printSync_0300 end' + console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_01_0300 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_printSync_0300 print test end ========> callback " ) + console.log("ACTS_AACommand_printSync_01_0300 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_printSync_0400 + * @tc.number: ACTS_AACommand_printSync_01_0400 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, * printSync information is null. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_printSync_0400', 0, async function (done) { + it('ACTS_AACommand_printSync_01_0400', 0, async function (done) { globalThis.abilityDelegator.printSync(null); - console.log("ACTS_AACommand_printSync_0300 printSync end ====> " ) - var finishmsg = 'ACTS_AACommand_printSync_0400 end' + console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_01_0400 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_printSync_0400 print test end ========> callback " ) + console.log("ACTS_AACommand_printSync_01_0400 print test end ========> callback " ) done() }) }) diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts index 5372e63b8688f4a5749d3c39918e1eba1c513ce4..10cd64e804e29c1fdbc116ec5a9adb511a7c9bf2 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,20 +14,11 @@ */ import Ability from '@ohos.application.Ability' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' export default class MainAbility extends Ability { onCreate(want, launchParam) { globalThis.abilityContext = this.context; console.log('MainAbility onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -36,7 +27,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { console.log('MainAbility onWindowStageCreate') - windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + windowStage.setUIContent(this.context, 'pages/index', null) } diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 9d55879f3923d5f6a95525162dc5ebb865d7aa28..0000000000000000000000000000000000000000 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2022 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 router from '@ohos.router'; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('MainAbility index aboutToAppear') - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets index 3bb1376bf16a11bb8882e58381c6f1499069e0bd..e49699bde347b8ad3fbcd279d57f4f0eeadbba52 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets @@ -13,17 +13,103 @@ * limitations under the License. */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + @Entry @Component struct Index { - @State message: string = 'Hello World' + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + let cmd: any + let abilityDelegatorArguments: any + let abilityDelegator: any + + function sleep(delay) { + let start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } + } + function test(time) { + sleep(time); + } + + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + + cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0100 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult1 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0100 - executeShellCommand: end ') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0200 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_01_0200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0200 stdResult = ' + data.stdResult) + globalThis.stdResult2 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0200 - executeShellCommand: end ') + }) + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0300 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0300 stdResult = ' + data.stdResult) + globalThis.stdResult3 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0300 - executeShellCommand: end ') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0400 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult4 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0400 - executeShellCommand: end ') + }) + + test(3000) + + setTimeout(() => { + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + + }, 15000) + + } + @State message: string = 'Hello World' build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) } .width('100%') } diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets index b4f121d4d105e2609e85c7aff635beeae9a804fa..94d2b11c1bc35f7490503e08a69ac3e83c8787ed 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets @@ -14,21 +14,10 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import appManager from '@ohos.application.appManager'; -const DELAY = 3000 -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +let msg: any export default function abilityTest() { describe('ActsAbilityTest', function () { - var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - function checkRunningProcess(name, dataInfo) { - for (let i = 0, len = dataInfo.length; i < len; i++) { - if (dataInfo[i].processName == name) { - return true; - } - } - return false; - } - /** * @tc.number: ACTS_AACommand_printSync_0100 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid @@ -37,27 +26,10 @@ export default function abilityTest() { * the test command. */ it('ACTS_AACommand_printSync_0100', 0, async function (done) { - console.log("ACTS_AACommand_printSync_0100 --- start") - var cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0100 -s unittest OpenHarmonyTestRunner' - var msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_printSync_0100 - executeShellCommand: start ') - console.log('ACTS_AACommand_printSync_0100 stdResult = ' + data.stdResult) - var i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_printSync_0100 query string i = ' + i); - expect(i == -1).assertEqual(false); - console.log('ACTS_AACommand_printSync_0100 - executeShellCommand: end') - }) - setTimeout(async() => { - var procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_printSync_0100 getProcessRunningInfos ======> ' - + JSON.stringify(procrssinfo)); - var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) - console.log("====>ACTS_AACommand_printSync_0100====>infores = " + infores) - expect(infores==false).assertEqual(true); - done(); - }, DELAY ) + console.log('ACTS_AACommand_printSync_0100 --- start') + msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_printSync_0200 - executeShellCommand: start ') - console.log('ACTS_AACommand_printSync_0200 stdResult = ' + data.stdResult) - var i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_printSync_0200 query string i = ' + i); - expect(i == -1).assertEqual(false); - console.log('ACTS_AACommand_printSync_0200 - executeShellCommand: end') - }) - setTimeout(async() => { - var procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_printSync_0200 getProcessRunningInfos ======> ' + - '' + JSON.stringify(procrssinfo)); - var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) - console.log("====>ACTS_AACommand_printSync_0200====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + console.log('ACTS_AACommand_printSync_0200 --- start') + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + expect(globalThis.stdResult2).assertContain(msg); + done(); }) /** @@ -109,41 +64,21 @@ export default function abilityTest() { * the test command. */ it('ACTS_AACommand_printSync_0300', 0, async function (done) { - console.log("ACTS_AACommand_printSync_0300 --- start") - var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0300 -s unittest OpenHarmonyTestRunner' - var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaa' + - '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' - var msgcopy = 'fffffffffff' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_printSync_0300 - executeShellCommand: start ') - console.log('ACTS_AACommand_printSync_0300 stdResult = ' + data.stdResult) - var i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_printSync_0300 query string i = ' + i); - expect(i == -1).assertEqual(false); - var j = data.stdResult.indexOf(msgcopy); - console.log('ACTS_AACommand_printSync_0300 === query string j = ' + j); - expect(j == -1).assertEqual(true); - console.log('ACTS_AACommand_printSync_0300 - executeShellCommand: end') - }) - setTimeout(async() => { - var procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_printSync_0300 getProcessRunningInfos ======> ' - + JSON.stringify(procrssinfo)); - var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) - console.log("====>ACTS_AACommand_printSync_0300====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + console.log('ACTS_AACommand_printSync_0300 --- start') + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + expect(globalThis.stdResult3).assertContain(msg); + done() + }) /** @@ -154,24 +89,10 @@ export default function abilityTest() { * the test command. */ it('ACTS_AACommand_printSync_0400', 0, async function (done) { - console.log("ACTS_AACommand_printSync_0400 --- start") - var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0400 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_printSync_0400 - executeShellCommand: start ') - console.log('ACTS_AACommand_printSync_0400 stdResult = ' + data.stdResult) - expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false); - console.log('ACTS_AACommand_printSync_0400 - executeShellCommand: end') - }) - setTimeout(async() => { - var procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_printSync_0400 getProcessRunningInfos ======> ' - + JSON.stringify(procrssinfo)); - var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) - console.log("====>ACTS_AACommand_printSync_0400====>infores = ") - expect(infores).assertEqual(false); - done(); - }, DELAY ) + console.log('ACTS_AACommand_printSync_0400 --- start') + msg = 'start ability successfully'; + expect(globalThis.stdResult4).assertContain(msg); + done(); }) }) } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts index b64cffca2792e1099a325ac31f3528c9179de75c..880ca3fa4d033a8cd47c260912eebe0c467c6941 100644 --- a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -15,7 +15,7 @@ import Ability from '@ohos.application.Ability' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' +import { Hypium } from '@ohos/hypium' import testsuite from '../test/List.test' export default class MainAbility extends Ability { diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets index 4a9a4565339f6306241487e351ad83d52f2c54c0..584d97bdba4d6a8e11e02f6a39c82851444b414e 100644 --- a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets @@ -14,40 +14,40 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { /** - * @tc.number: ACTS_AACommand_print_0100 + * @tc.number: ACTS_AACommand_print_01_0100 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_print_0100', 0, async function (done) { - console.log("ACTS_AACommand_print_0100 start ====> " ) + it('ACTS_AACommand_print_01_0100', 0, async function (done) { + console.log("ACTS_AACommand_print_01_0100 start ====> " ) var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_print_0100 print test end ========> callback " ) - console.log("ACTS_AACommand_print_0100 print test end ========> callback err: "+JSON.stringify(err) ) - console.log("ACTS_AACommand_print_0100 print test end ========> callback data: "+JSON.stringify(data)) + console.log("ACTS_AACommand_print_01_0100 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0100 print test end ========> callback err: "+JSON.stringify(err) ) + console.log("ACTS_AACommand_print_01_0100 print test end ========> callback data: "+JSON.stringify(data)) }) - var finishmsg = 'ACTS_AACommand_print_0100 end' + var finishmsg = 'ACTS_AACommand_print_01_0100 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ - console.log("ACTS_AACommand_print_0100 finishTest test end ========> callback " ) - console.log("ACTS_AACommand_print_0100 finishTest test end ========> callback data: "+JSON.stringify(data)) + console.log("ACTS_AACommand_print_01_0100 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0100 finishTest test end ========> callback data: "+JSON.stringify(data)) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0200 + * @tc.number: ACTS_AACommand_print_01_0200 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in AsyncCallback mode. The length of the print message is 1000 characters. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_print_0200', 0, async function (done) { + it('ACTS_AACommand_print_01_0200', 0, async function (done) { var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'aaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @@ -62,21 +62,21 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg,()=>{ console.log("print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0200 end' + var finishmsg = 'ACTS_AACommand_print_01_0200 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0200 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0200 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0300 + * @tc.number: ACTS_AACommand_print_01_0300 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in AsyncCallback mode. The length of the print message is greater than 1000 characters. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_print_0300', 0, async function (done) { + it('ACTS_AACommand_print_01_0300', 0, async function (done) { var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @@ -91,58 +91,58 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg,()=>{ console.log("print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0300 end' + var finishmsg = 'ACTS_AACommand_print_01_0300 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0300 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0300 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0400 + * @tc.number: ACTS_AACommand_print_01_0400 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in AsyncCallback mode. print information is null. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_print_0400', 0, async function (done) { + it('ACTS_AACommand_print_01_0400', 0, async function (done) { globalThis.abilityDelegator.print(null,()=>{ console.log("print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0400 end' + var finishmsg = 'ACTS_AACommand_print_01_0400 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0400 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0400 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0500 + * @tc.number: ACTS_AACommand_print_01_0500 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in Promise mode. The print information includes Chinese, special characters, etc. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_print_0500', 0, async function (done) { + it('ACTS_AACommand_print_01_0500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_print_0500 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0500 end' + var finishmsg = 'ACTS_AACommand_print_01_0500 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0500 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0600 + * @tc.number: ACTS_AACommand_print_01_0600 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in Promise mode. The length of the print message is 1000 characters. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally * through the test command. */ - it('ACTS_AACommand_print_0600', 0, async function (done) { + it('ACTS_AACommand_print_01_0600', 0, async function (done) { var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @@ -154,23 +154,23 @@ export default function abilityTest() { '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' globalThis.abilityDelegator.print(msg).then(()=>{ - console.log("ACTS_AACommand_print_0600 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0600 print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0600 end' + var finishmsg = 'ACTS_AACommand_print_01_0600 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0600 2 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0600 2 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0700 + * @tc.number: ACTS_AACommand_print_01_0700 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in Promise mode. The length of the print message is greater than 1000 characters. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * the test command. */ - it('ACTS_AACommand_print_0700', 0, async function (done) { + it('ACTS_AACommand_print_01_0700', 0, async function (done) { var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @@ -183,197 +183,197 @@ export default function abilityTest() { '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + 'fffffffffff' globalThis.abilityDelegator.print(msg).then(()=>{ - console.log("ACTS_AACommand_print_0700 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0700 print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0700 end' + var finishmsg = 'ACTS_AACommand_print_01_0700 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0700 2 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0700 2 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_print_0800 + * @tc.number: ACTS_AACommand_print_01_0800 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is * called in Promise mode. print information is null. * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally * through the test command. */ - it('ACTS_AACommand_print_0800', 0, async function (done) { + it('ACTS_AACommand_print_01_0800', 0, async function (done) { globalThis.abilityDelegator.print("").then(()=>{ - console.log("ACTS_AACommand_print_0800 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0800 print test end ========> callback " ) }) - var finishmsg = 'ACTS_AACommand_print_0800 end' + var finishmsg = 'ACTS_AACommand_print_01_0800 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ - console.log("ACTS_AACommand_print_0800 2 print test end ========> callback " ) + console.log("ACTS_AACommand_print_01_0800 2 print test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0100 + * @tc.number: ACTS_AACommand_finishTest_01_0100 * @tc.name: Each parameter of the test command is valid, and the finishTest interface is called * in AsyncCallback mode. * The msg parameter is valid (including Chinese and special characters) and the code parameter * is valid (1). * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0100', 0, async function (done) { - var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_0100 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_0100 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0200 + * @tc.number: ACTS_AACommand_finishTest_01_0200 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid (null) and the code parameter is valid (1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0200', 0, async function (done) { + it('ACTS_AACommand_finish_01_0200', 0, async function (done) { setTimeout(() => { - console.log('ACTS_AACommand_finish_0200 code:'+JSON.stringify(code)) + console.log('ACTS_AACommand_finish_01_0200 code:'+JSON.stringify(code)) if(code!=undefined){ expect().assertFail(); } done(); }, 3000) var code = globalThis.abilityDelegator.finishTest(null, 1,()=>{ - console.log(" ACTS_AACommand_finish_0200 finishTest test end ========> callback " ) + console.log(" ACTS_AACommand_finish_01_0200 finishTest test end ========> callback " ) expect().assertFail(); }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0300 + * @tc.number: ACTS_AACommand_finishTest_01_0300 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid (Undefined) and the code parameter is valid (1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0300', 0, async function (done) { + it('ACTS_AACommand_finish_01_0300', 0, async function (done) { setTimeout(() => { - console.log('ACTS_AACommand_finish_0300 code:'+JSON.stringify(code)) + console.log('ACTS_AACommand_finish_01_0300 code:'+JSON.stringify(code)) if(code!=undefined){ expect().assertFail(); } done(); }, 3000) var code = globalThis.abilityDelegator.finishTest(undefined, 1,()=>{ - console.log(" ACTS_AACommand_finish_0300 finishTest test end ========> callback " ) + console.log(" ACTS_AACommand_finish_01_0300 finishTest test end ========> callback " ) expect().assertFail(); }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0400 + * @tc.number: ACTS_AACommand_finishTest_01_0400 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter * is valid (Number.MAX_VALUE) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0400', 0, async function (done) { + it('ACTS_AACommand_finish_01_0400', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_0400 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_0400 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0500 + * @tc.number: ACTS_AACommand_finishTest_01_0500 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter * is valid (Number.MIN_VALUE) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0500', 0, async function (done) { + it('ACTS_AACommand_finish_01_0500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_0500 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_0500 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0600 + * @tc.number: ACTS_AACommand_finishTest_01_0600 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter * is valid (Number.MAX_VALUE+1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0600', 0, async function (done) { + it('ACTS_AACommand_finish_01_0600', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_0600 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_0600 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0700 + * @tc.number: ACTS_AACommand_finishTest_01_0700 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter * is valid (Number.MIN_VALUE-1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0700', 0, async function (done) { + it('ACTS_AACommand_finish_01_0700', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_0700 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_0700 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0800 + * @tc.number: ACTS_AACommand_finishTest_01_0800 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback * mode. The msg parameter is invalid(including Chinese and special characters) and the * code parameter is valid (“ABCD”) * @tc.desc: Verify that the process of the test framework is not stopped by calling this interface. */ - it('ACTS_AACommand_finish_0800', 0, async function (done) { + it('ACTS_AACommand_finish_01_0800', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finish_0800 code:'+JSON.stringify(code)) + console.log('ACTS_AACommand_finish_01_0800 code:'+JSON.stringify(code)) if(code!=undefined){ expect().assertFail(); } done(); }, 3000) var code = globalThis.abilityDelegator.finishTest(msg, 'ABCD',()=>{ - console.log(" ACTS_AACommand_finish_0800 finishTest test end ========> callback " ) + console.log(" ACTS_AACommand_finish_01_0800 finishTest test end ========> callback " ) expect().assertFail(); }) }) /** - * @tc.number: ACTS_AACommand_finishTest_0900 + * @tc.number: ACTS_AACommand_finishTest_01_0900 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter * is valid (1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_0900', 0, async function (done) { + it('ACTS_AACommand_finish_01_0900', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log("ACTS_AACommand_finish_0900 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_0900 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_1000 + * @tc.number: ACTS_AACommand_finishTest_01_1000 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is invalid(null) and the code parameter is valid (1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1000', 0, async function (done) { + it('ACTS_AACommand_finish_01_1000', 0, async function (done) { var code = null setTimeout(() => { - console.log('ACTS_AACommand_finish_1000 code:'+JSON.stringify(code)) + console.log('ACTS_AACommand_finish_01_1000 code:'+JSON.stringify(code)) if(code!=undefined){ expect().assertFail(); } @@ -383,15 +383,15 @@ export default function abilityTest() { }) /** - * @tc.number: ACTS_AACommand_finishTest_1100 + * @tc.number: ACTS_AACommand_finishTest_01_1100 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is invalid(undefined) and the code parameter is valid (1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1100', 0, async function (done) { + it('ACTS_AACommand_finish_01_1100', 0, async function (done) { var code=null setTimeout(() => { - console.log('ACTS_AACommand_finish_1100 code:'+JSON.stringify(code)) + console.log('ACTS_AACommand_finish_01_1100 code:'+JSON.stringify(code)) if(code!=undefined){ expect().assertFail(); } @@ -401,77 +401,77 @@ export default function abilityTest() { }) /** - * @tc.number: ACTS_AACommand_finishTest_1200 + * @tc.number: ACTS_AACommand_finishTest_01_1200 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter * is valid (Number.MAX_VALUE) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1200', 0, async function (done) { + it('ACTS_AACommand_finish_01_1200', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_1200 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_1200 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_1300 + * @tc.number: ACTS_AACommand_finishTest_01_1300 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter * is valid (Number.MIN_VALUE) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1300', 0, async function (done) { + it('ACTS_AACommand_finish_01_1300', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_1300 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_1300 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_1400 + * @tc.number: ACTS_AACommand_finishTest_01_1400 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter * is valid (Number.MAX_VALUE+1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1400', 0, async function (done) { + it('ACTS_AACommand_finish_01_1400', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_1400 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_1400 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_1500 + * @tc.number: ACTS_AACommand_finishTest_01_1500 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter * is valid (Number.MIN_VALUE-1) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1500', 0, async function (done) { + it('ACTS_AACommand_finish_01_1500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ - console.log("ACTS_AACommand_finish_1500 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_finish_01_1500 finishTest test end ========> callback " ) done() }) }) /** - * @tc.number: ACTS_AACommand_finishTest_1600 + * @tc.number: ACTS_AACommand_finishTest_01_1600 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter * is valid (ABCD) * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ - it('ACTS_AACommand_finish_1600', 0, async function (done) { + it('ACTS_AACommand_finish_01_1600', 0, async function (done) { var code = null var msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finish_1600 code:'+JSON.stringify(code)) + console.log('ACTS_AACommand_finish_01_1600 code:'+JSON.stringify(code)) if(code!=undefined){ expect().assertFail(); } diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts index b64cffca2792e1099a325ac31f3528c9179de75c..880ca3fa4d033a8cd47c260912eebe0c467c6941 100644 --- a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts @@ -15,7 +15,7 @@ import Ability from '@ohos.application.Ability' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' +import { Hypium } from '@ohos/hypium' import testsuite from '../test/List.test' export default class MainAbility extends Ability { diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets index f440c983b756e22b09e2a84224bad95eb3c9b657..132551b2e4af630cd7b1bae517403a80146373d7 100644 --- a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts index b64cffca2792e1099a325ac31f3528c9179de75c..1e26ef72ee86e631df14c0d6b46b7e5b49e63c84 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,19 +14,10 @@ */ import Ability from '@ohos.application.Ability' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' export default class MainAbility extends Ability { onCreate(want, launchParam) { console.log('MainAbility onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -35,7 +26,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { console.log('MainAbility onWindowStageCreate') - windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + windowStage.setUIContent(this.context, 'pages/index', null) globalThis.abilityContext = this.context; } diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 9d55879f3923d5f6a95525162dc5ebb865d7aa28..0000000000000000000000000000000000000000 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2022 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 router from '@ohos.router'; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('MainAbility index aboutToAppear') - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets index 3bb1376bf16a11bb8882e58381c6f1499069e0bd..c8afef08de7b17c8d0c0c0eb46cdfb0fa0dc6e1e 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets @@ -13,17 +13,513 @@ * limitations under the License. */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + @Entry @Component struct Index { - @State message: string = 'Hello World' + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + let cmd: any + let abilityDelegatorArguments: any + let abilityDelegator: any + + function sleep(delay) { + let start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } + } + function test(time) { + sleep(time); + } + + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0700 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0700 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0700 stdResult = ' + data.stdResult) + globalThis.stdResult1 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0700 - executeShellCommand: end ') + }) + + test(3000) + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); + globalThis.stdResult2 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0700 end'); + }) + + test(3000) + + cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' + + 'mmand_print_01_0100 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult3 = data.stdResult; + console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + + 'and_print_01_0200 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0200 stdResult = ' + data.stdResult) + globalThis.stdResult4 = data.stdResult; + console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_' + + 'AACommand_print_01_0300 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0300 stdResult = ' + data.stdResult) + globalThis.stdResult5 = data.stdResult; + console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma' + + 'nd_print_01_0400 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult6 = data.stdResult; + console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + + 'and_print_01_0500 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0500 stdResult = ' + data.stdResult) + globalThis.stdResult7 = data.stdResult; + console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' + + 'Command_print_01_0600 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0600 stdResult = ' + data.stdResult) + globalThis.stdResult8 = data.stdResult; + console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_print_01_0700 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0700 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0700 stdResult = ' + data.stdResult) + globalThis.stdResult9 = data.stdResult; + console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_print_01_0800 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0800 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0800 stdResult = ' + data.stdResult) + globalThis.stdResult10 = data.stdResult; + console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0400 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult11 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); + globalThis.stdResult12 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0700 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0100 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult13 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); + globalThis.stdResult14 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0700 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0500 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0500 stdResult = ' + data.stdResult) + globalThis.stdResult15 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0500 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0500 : data : ' + JSON.stringify(data)); + globalThis.stdResult16 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0500 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0600 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0600 stdResult = ' + data.stdResult) + globalThis.stdResult17 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: end') + }) + + test(3000) + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0600 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0600 : data : ' + JSON.stringify(data)); + globalThis.stdResult18 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0600 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0900 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0900 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0900 stdResult = ' + data.stdResult) + globalThis.stdResult19 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: end') + }) + + + test(3000) + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0900 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0900 : data : ' + JSON.stringify(data)); + globalThis.stdResult20 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0900 end'); + }) + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + + ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1200 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1200 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1200 stdResult = ' + data.stdResult) + globalThis.stdResult21 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1200 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1200 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1200 : data : ' + JSON.stringify(data)); + globalThis.stdResult22 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1200 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1300 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1300 stdResult = ' + data.stdResult) + globalThis.stdResult23 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1300 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1300 : data : ' + JSON.stringify(data)); + globalThis.stdResult24 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1300 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1400 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1400 stdResult = ' + data.stdResult) + globalThis.stdResult25 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1400 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1400 : data : ' + JSON.stringify(data)); + globalThis.stdResult26 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1400 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1500 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1500 stdResult = ' + data.stdResult) + globalThis.stdResult27 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1500 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1500 : data : ' + JSON.stringify(data)); + globalThis.stdResult28 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1500 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0200 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0200 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_0200 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0200 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0200 : data : ' + JSON.stringify(data)); + globalThis.stdResult29 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0200 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0300 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0300 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0300 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0300 : data : ' + JSON.stringify(data)); + globalThis.stdResult30 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0300 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0800 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_0800 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0800 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0800 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_0800 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_0800 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0800 : data : ' + JSON.stringify(data)); + globalThis.stdResult31 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0800 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1000 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1000 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1000 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1000 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_1000 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1000 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1000 : data : ' + JSON.stringify(data)); + globalThis.stdResult32 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1000 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1100 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1100 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1100 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_1100 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1100 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1100 : data : ' + JSON.stringify(data)); + globalThis.stdResult33 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1100 end'); + }) + + test(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + + ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1600 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1600 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: end') + }) + + test(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err, data) => { + console.info('ACTS_AACommand_finish_01_1600 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1600 : data : ' + JSON.stringify(data)); + globalThis.stdResult34 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1600 end'); + }) + + test(3000) + + setTimeout(() => { + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, 12000) + + } + @State message: string = 'Hello World' build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) } .width('100%') } diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets index 073cc4f70061ae0adc2779029396f8157c061457..126f4f69765a423d326c7727f42e3c0505653482 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets @@ -14,20 +14,13 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import appManager from '@ohos.application.appManager'; -const DELAY = 3000 -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +let msg: any +let msgcopy: any +let finishmsg: any +let finishmsg1: any export default function abilityTest() { describe('ACTS_AACommand_Test', function () { - let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - function checkRunningProcess(name, dataInfo) { - for (let i = 0, len = dataInfo.length; i < len; i++) { - if (dataInfo[i].processName == name) { - return true; - } - } - return false; - } /** * @tc.number: ACTS_AACommand_0100 @@ -39,10 +32,10 @@ export default function abilityTest() { it('ACTS_AACommand_0100', 0, async function (done) { console.log("ACTS_AACommand_0100 --- start") let cmd = 'aa test -b com.example.actsaacommandtesta' + - 'test -m entry_test ' + - '-s unittest OpenHarmonyTestRunner ' + - '-w 40 -s class ACTS_AACommand_01_3 -s level 1 -s size 0 -s testType aaa -s '+ - 'timeout 5 -s 1 3 -D' + 'test -m entry_test ' + + '-s unittest OpenHarmonyTestRunner ' + + '-w 40 -s class ACTS_AACommand_01_3 -s level 1 -s size 0 -s testType aaa -s ' + + 'timeout 5 -s 1 3 -D' let delay = 3000 globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { console.log('ACTS_AACommand_0100 - executeShellCommand: start ') @@ -109,8 +102,8 @@ export default function abilityTest() { it('ACTS_AACommand_0400', 0, async function (done) { console.log("ACTS_AACommand_0400 --- start") let cmd = 'aa test -b com.example.actsaacommandtestatest -m entry_test ' + - '-s unittest OpenHarmonyTestRunner ' + - '-w 无效值' + '-s unittest OpenHarmonyTestRunner ' + + '-w 无效值' globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { console.log('ACTS_AACommand_0400 - executeShellCommand: start ') console.log('ACTS_AACommand_0400 stdResult = ' + data.stdResult) @@ -134,7 +127,7 @@ export default function abilityTest() { it('ACTS_AACommand_0500', 0, async function (done) { console.log("ACTS_AACommand_0500 --- start") let cmd = 'aa test -b aa test -b com.example.actsaacommandtestatest -m entry_test' + - '-s unittest OpenHarmonyTestRunner -z invalid' + '-s unittest OpenHarmonyTestRunner -z invalid' globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { console.log('ACTS_AACommand_0500 - executeShellCommand: start ') console.log('ACTS_AACommand_0500 stdResult = ' + data.stdResult) @@ -181,33 +174,12 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_0700', 0, async function (done) { console.log("ACTS_AACommand_finishTest_0700 --- start") - var cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0700 -s unittest OpenHarmonyTestRunner' - var finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0700 stdResult = ' + data.stdResult) - var i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0700 query string i = ' + i); - expect(i == -1).assertEqual(false); - var j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); - console.log('ACTS_AACommand_finishTest_0700 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: end') - }) - setTimeout(async() => { - var temp - var cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_print_0100 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0100 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_print_0100 query string i = ' + i); - expect(i == -1).assertEqual(false); - console.log('ACTS_AACommand_print_0100 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0100 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print01', procrssinfo) - console.log("====>ACTS_AACommand_print_0100====>infores = " + infores) - expect(infores==false).assertEqual(true); - done(); - }, DELAY ) + msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_print_0200 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0200 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_print_0200 query string i = ' + i); - expect(i == -1).assertEqual(false); - console.log('ACTS_AACommand_print_0200 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0200 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print02', procrssinfo) - console.log("====>ACTS_AACommand_print_0200====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + expect(globalThis.stdResult4).assertContain(msg); + done() }) /** @@ -309,39 +250,21 @@ export default function abilityTest() { */ it('ACTS_AACommand_print_0300', 0, async function (done) { console.log("ACTS_AACommand_print_0300 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_'+ - 'AACommand_print_0300 -s unittest OpenHarmonyTestRunner' - let msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaa' + - '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' let msgcopy = 'fffffffffff' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_0300 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0300 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_print_0300 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf(msgcopy); - console.log('ACTS_AACommand_print_0300 === query string j = ' + j); - expect(j == -1).assertEqual(true); - console.log('ACTS_AACommand_print_0300 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0300 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print03', procrssinfo) - console.log("====>ACTS_AACommand_print_0300====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + expect(globalThis.stdResult5).assertContain(msg); + expect(globalThis.stdResult5.indexOf(msgcopy) == -1).assertEqual(true); + done() }) /** @@ -353,22 +276,9 @@ export default function abilityTest() { */ it('ACTS_AACommand_print_0400', 0, async function (done) { console.log("ACTS_AACommand_print_0400 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma'+ - 'nd_print_0400 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_0400 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0400 stdResult = ' + data.stdResult) - expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false); - console.log('ACTS_AACommand_print_0400 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0400 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print04', procrssinfo) - console.log("====>ACTS_AACommand_print_0400====>infores = ") - expect(infores).assertEqual(false); - done(); - }, DELAY ) + msg = 'start ability successfully' + expect(globalThis.stdResult6).assertContain(msg); + done() }) /** @@ -380,25 +290,9 @@ export default function abilityTest() { */ it('ACTS_AACommand_print_0500', 0, async function (done) { console.log("ACTS_AACommand_print_0500 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm'+ - 'and_print_0500 -s unittest OpenHarmonyTestRunner' - let msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_print_0500 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0500 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_print_0500 query string i = ' + i); - expect(i == -1).assertEqual(false); - console.log('ACTS_AACommand_print_0500 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0500 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print05', procrssinfo) - console.log("====>ACTS_AACommand_print_0500====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_print_0600 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0600 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_print_0600 query string i = ' + i); - expect(i == -1).assertEqual(false); - console.log('ACTS_AACommand_print_0600 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0600 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print06', procrssinfo) - console.log("====>ACTS_AACommand_print_0600====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + expect(globalThis.stdResult8).assertContain(msg); + done() }) /** @@ -450,39 +328,21 @@ export default function abilityTest() { */ it('ACTS_AACommand_print_0700', 0, async function (done) { console.log("ACTS_AACommand_print_0700 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_print_0700 -s unittest OpenHarmonyTestRunner ' - let msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaa' + - '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - '9aaaaaaaaa' - let msgcopy = 'fffffffffff' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_0700 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_0700 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(msg); - console.log('ACTS_AACommand_print_0700 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf(msgcopy); - console.log('ACTS_AACommand_print_0700 === query string j = ' + j); - expect(j == -1).assertEqual(true); - console.log('ACTS_AACommand_print_0700 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0700 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print07', procrssinfo) - console.log("====>ACTS_AACommand_print_0700====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaa' + msgcopy = 'fffffffffff' + expect(globalThis.stdResult9).assertContain(msg); + expect(globalThis.stdResult9.indexOf(msgcopy) == -1).assertEqual(true); + done() }) /** @@ -494,22 +354,9 @@ export default function abilityTest() { */ it('ACTS_AACommand_print_0800', 0, async function (done) { console.log("ACTS_AACommand_print_0800 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_print_0800 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_0800 - executeShellCommand: start ') - console.log("ACTS_AACommand_print_0800 print test end ========> callback " ) - expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false); - console.log('ACTS_AACommand_print_0800 - executeShellCommand: end') - }) - setTimeout(async() => { - let procrssinfo = await appManager.getProcessRunningInfos() - console.log('ACTS_AACommand_print_0800 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); - let infores = checkRunningProcess('com.example.print08', procrssinfo) - console.log("====>ACTS_AACommand_print_0800====>infores = " + infores) - expect(infores).assertEqual(false); - done(); - }, DELAY ) + msg = 'start ability successfully' + expect(globalThis.stdResult10).assertContain(msg); + done() }) @@ -525,33 +372,11 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_0400', 0, async function (done) { console.log("ACTS_AACommand_finishTest_0400 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_finish_0400 -s unittest OpenHarmonyTestRunner' - let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0400 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0400 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0400 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); - console.log('ACTS_AACommand_finishTest_0400 query string j = ' + j); - expect(j == -1).assertEqual(true); - console.log('ACTS_AACommand_finishTest_0400 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0100 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0100 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0100 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); - console.log('ACTS_AACommand_finishTest_0100 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0100 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0500 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0500 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0500 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: 0'); - console.log('ACTS_AACommand_finishTest_0500 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0500 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0600 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0600 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0600 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); - console.log('ACTS_AACommand_finishTest_0600 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0600 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0700 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0700 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); - console.log('ACTS_AACommand_finishTest_0700 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) - }) /** @@ -725,33 +448,12 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_0900', 0, async function (done) { console.log("ACTS_AACommand_finishTest_0900 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0900 -s unittest OpenHarmonyTestRunner' - let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0900 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0900 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0900 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); - console.log('ACTS_AACommand_finishTest_0900 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0900 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_1200 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_1200 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_1200 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); - console.log('ACTS_AACommand_finishTest_1200 query string j = ' + j); - expect(j == -1).assertEqual(true); - console.log('ACTS_AACommand_finishTest_1200 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + let + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_1300 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_1300 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_1300 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: 0'); - console.log('ACTS_AACommand_finishTest_1300 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_1300 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_1400 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_1400 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_1400 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); - console.log('ACTS_AACommand_finishTest_1400 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_1400 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_1500 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_1500 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_1500 query string i = ' + i); - expect(i == -1).assertEqual(false); - let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); - console.log('ACTS_AACommand_finishTest_1500 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_1500 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0200 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + expect(globalThis.stdResult29.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + done() }) /** @@ -944,24 +547,8 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_0300', 0, async function (done) { console.log("ACTS_AACommand_finishTest_0300 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_0300 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, () => { - console.log('ACTS_AACommand_finishTest_0300 - executeShellCommand: start ') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + expect(globalThis.stdResult30.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + done() }) /** @@ -974,35 +561,8 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_0800', 0, async function (done) { console.log("ACTS_AACommand_finishTest_0800 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0800 -s unittest OpenHarmonyTestRunner' - let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_0800 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_0800 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_0800 query string i = ' + i); - expect(i == -1).assertEqual(true); - let j = data.stdResult.indexOf('TestFinished-ResultCode:'); - console.log('ACTS_AACommand_finishTest_0800 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_0800 exitCode = ' + data.exitCode) - expect(data.exitCode).assertEqual(0); - console.log('ACTS_AACommand_finishTest_0800 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + expect(globalThis.stdResult31.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + done() }) /** @@ -1013,24 +573,8 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_1000', 0, async function (done) { console.log("ACTS_AACommand_finishTest_1000 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_1000 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd).then((data) => { - console.log('ACTS_AACommand_finishTest_1000 - executeShellCommand: start ') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") >=0).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + expect(globalThis.stdResult32.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + done() }) /** @@ -1041,24 +585,8 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_1100', 0, async function (done) { console.log("ACTS_AACommand_finishTest_1100 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1100 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd).then((data) => { - console.log('ACTS_AACommand_finishTest_1100 - executeShellCommand: start ') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + expect(globalThis.stdResult33.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + done() }) /** * @tc.number: ACTS_AACommand_finishTest_1600 @@ -1070,35 +598,8 @@ export default function abilityTest() { */ it('ACTS_AACommand_finishTest_1600', 0, async function (done) { console.log("ACTS_AACommand_finishTest_1600 --- start") - let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + - ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1600 -s unittest OpenHarmonyTestRunner' - let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finishTest_1600 - executeShellCommand: start ') - console.log('ACTS_AACommand_finishTest_1600 stdResult = ' + data.stdResult) - let i = data.stdResult.indexOf(finishmsg); - console.log('ACTS_AACommand_finishTest_1600 query string i = ' + i); - expect(i == -1).assertEqual(true); - let j = data.stdResult.indexOf('TestFinished-ResultCode:'); - console.log('ACTS_AACommand_finishTest_1600 query string j = ' + j); - expect(j == -1).assertEqual(false); - console.log('ACTS_AACommand_finishTest_1600 exitCode = ' + data.exitCode) - expect(data.exitCode).assertEqual(0); - console.log('ACTS_AACommand_finishTest_1600 - executeShellCommand: end') - }) - setTimeout(async() => { - let temp - let cmd ='aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + JSON.stringify(d)); - temp = d["stdResult"]; - expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - console.info('executeShellCommand end'); - }) - done(); - }, DELAY ) + expect(globalThis.stdResult34.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + done() }) }) -}; +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js index 748877217560592fb5bb32eedb9a3937d77b4e33..b814a3c48f1fbb89d334e63fb426017b1ea77f25 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -35,6 +35,7 @@ export default function ActsAmsCallBackFirstScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js index 5e71586a799730bb64528b6d1def624ca8636485..233c0b837a9e4880b907a3f2c44e8ba1338d2cce 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -86,6 +86,7 @@ export default function ActsAmsCallBackFourthScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js index 6080fed293892ae69748f515f217c1b61e9fea95..62d7cf423e47430eb466c0ef988b3d38aa8f7e72 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -52,6 +52,7 @@ export default function ActsAmsCallBackSecondScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js index 4b642e9ef4da6fc68f45291b8e583d6dc246a9b4..bac786495b7ebd19092a4fba1662ffe91cb1780b 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -52,6 +52,7 @@ export default function ActsAmsCallBackThirdScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js index a7c742da9e01284faf958a25d6c7368e9b8756b1..cd2c8ac41c0d679330dd64880fa495a0ebd88e3a 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -106,6 +106,7 @@ export default function ActsAmsTestFifthScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js index 2b105766e4898cff986987abc760a17b43b1422b..b5e048c7bb701440d937285437e27c94876013a7 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -40,6 +40,7 @@ export default function ActsAmsTestFirstScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js index 9417fe93f1b1430d4440ba8a03269b4eb2bfa759..9798b69468e54beb678d552dd17d17a592d7a943 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -106,6 +106,7 @@ export default function ActsAmsTestFourthScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js index 5ff92b663c942f72845a1e3bad60da82ba4678ac..269eef31564c74029663c2d168a33315e6663f80 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -62,6 +62,7 @@ export default function ActsAmsTestSecondScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js index 43010250798084c322da8b728638a6ceeca0c69b..cb06a6e770b862da2a1d832425f4e18079524a9a 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -63,6 +63,7 @@ export default function ActsAmsTestThirdScene() { ' + error.code + ', data length [' + data.length + ']'); } ); + sleep(500); done(); }); diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b and b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actscalltest/systemcallfeature/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalltest/systemcallfeature/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/actscalltest/systemcallfeature/signature/openharmony_sx.p7b and b/ability/ability_runtime/actscalltest/systemcallfeature/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts index 18a480f20d7c4dbac48ace298cc2713946da095c..819778e4a382140881d768693896cdd98f927b70 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -16,7 +16,7 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' function PublishCallBackOne() { console.debug("====>Publish CallBack ACTS_StartAbility_0100_CommonEvent====>"); - globalThis.abilityContext.terminateSelf().then(()=>{ + globalThis.abilityContext2.terminateSelf().then(()=>{ commonEvent.publish("ACTS_TerminateSelf_CommonEvent", PublishCallBackTwo); console.debug("====>publish ACTS_TerminateSelf_CommonEvent finish====>") }); @@ -40,7 +40,7 @@ export default class MainAbility2 extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility2 onWindowStageCreate") - globalThis.abilityContext = this.context + globalThis.abilityContext2 = this.context windowStage.setUIContent(this.context, "MainAbility/pages/index/second", null) commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", PublishCallBackOne); } diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts index 901087341aa196125ecf69cd1b61963ec6d09489..7d1f0f3d280bcb813d90bbe85a15a06296cd54e3 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -28,9 +28,9 @@ export default class MainAbility3 extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility3 onWindowStageCreate") - globalThis.abilityContext = this.context + globalThis.abilityContext3 = this.context windowStage.setUIContent(this.context, "MainAbility/pages/index/second", null) - globalThis.abilityContext.terminateSelfWithResult( + globalThis.abilityContext3.terminateSelfWithResult( { resultCode:1, want:{ diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index 66b4457a8a81fb8d3356cf46d67226c850944858..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b and b/ability/ability_runtime/featureability/actsfeatureabilitytest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets index 46d99db918d22083aeb81000ad5b9d751d9dcfa0..fdfab03ef658f7c572dd10cf99bc13cbb716b05f 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets @@ -44,35 +44,33 @@ export default function killProcessWithAccountTest() { beforeEach(async (done) => { - console.log('======>beforeEach killProcessWithAccountTest<======='); + console.log('======>beforeEach killProcessWithAccountTest<=======' + flag); if(flag == false){ - setTimeout(()=>{ - globalThis.abilityContext.startAbilityWithAccount( + setTimeout(async ()=>{ + await globalThis.abilityContext.startAbilityWithAccount( { bundleName: 'com.acts.killprocesswithaccountpackage', abilityName: 'com.acts.killprocesswithaccountpackage.MainAbility' - }, ACCOUNT_ID, - { - windowMode: 2, - displayId: 1 - }).then(() => { + }, ACCOUNT_ID).then(() => { console.log(" ====>ACTS_KillProcessWithAccount startability ====> success! ") - done(); + }).catch((error) => { + console.log(" ====>ACTS_KillProcessWithAccount startability ====> error: " + JSON.stringify(error)) }) + sleep(500); + done(); },1000) }else{ - globalThis.abilityContext.startAbilityWithAccount( + await globalThis.abilityContext.startAbilityWithAccount( { bundleName: 'com.acts.killprocesswithaccountpackage', abilityName: 'com.acts.killprocesswithaccountpackage.MainAbility' - }, ACCOUNT_ID, - { - windowMode: 2, - displayId: 1 - }).then(() => { + }, ACCOUNT_ID).then(() => { console.log(" ====>ACTS_KillProcessWithAccount startability ====> success! ") - done(); + }).catch((error) => { + console.log(" ====>ACTS_KillProcessWithAccount startability ====> error: " + JSON.stringify(error)) }) + sleep(500); + done(); } }) diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b and b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b and b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b and b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b and b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b and b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b b/ability/ability_runtime/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b old mode 100644 new mode 100755 index 66b4457a8a81fb8d3356cf46d67226c850944858..dcec6c9615032c1b48bf185e839d9720dd68aab0 Binary files a/ability/ability_runtime/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b and b/ability/ability_runtime/stage/actslifecyclemultihaptest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets index 94e818a3d2ba4eda16b7660bf3252d7cf01a70bb..d1dd39f8f60df31efc4ffa1995941c7bb984cd0e 100644 --- a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets @@ -494,12 +494,12 @@ export default function lifecycleTest() { expect(exlist[0]).assertEqual("MainAbility5 onAbilityCreate"); expect(exlist[1]).assertEqual("MainAbility5 onWindowStageCreate"); expect(exlist[2]).assertEqual("MainAbility5 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[4]).assertEqual("MainAbility2 onWindowStageCreate"); - expect(exlist[5]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[6]).assertEqual("MainAbility5 onAbilityBackground"); - expect(exlist[7]).assertEqual("MainAbility5 onWindowStageDestroy"); - expect(exlist[8]).assertEqual("MainAbility5 onAbilityDestroy"); + expect(exlist[3]).assertEqual("MainAbility5 onAbilityBackground"); + expect(exlist[4]).assertEqual("MainAbility5 onWindowStageDestroy"); + expect(exlist[5]).assertEqual("MainAbility5 onAbilityDestroy"); + expect(exlist[6]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[7]).assertEqual("MainAbility2 onWindowStageCreate"); + expect(exlist[8]).assertEqual("MainAbility2 onAbilityForeground"); expect(exlist[9]).assertEqual("MainAbility2 onAbilityBackground"); expect(exlist[10]).assertEqual("MainAbility2 onWindowStageDestroy"); expect(exlist[11]).assertEqual("MainAbility2 onAbilityDestroy"); diff --git a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/signature/openharmony_sx.p7b b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/signature/openharmony_sx.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..dcec6c9615032c1b48bf185e839d9720dd68aab0 100755 Binary files a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/signature/openharmony_sx.p7b and b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/signature/openharmony_sx.p7b differ diff --git a/arkXtest/uitest/src/main/ets/test/uitest.test.ets b/arkXtest/uitest/src/main/ets/test/uitest.test.ets index 2ba44c28268baf64b4dc08df9475a1c5849a1487..6520fcc95ab41cb12afd39265aae1639c3cb418a 100644 --- a/arkXtest/uitest/src/main/ets/test/uitest.test.ets +++ b/arkXtest/uitest/src/main/ets/test/uitest.test.ets @@ -730,12 +730,20 @@ export default function UiTest() { let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) let mode1 = await window1.getWindowMode() expect(mode1 == WindowMode.FULLSCREEN).assertTrue() - await window1.resume() - let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let mode2 = await window2.getWindowMode() - expect(mode2 == WindowMode.FLOATING).assertTrue() - await window2.resume() - await stopApplication('com.uitestScene.acts') + try { + await window1.resume() + let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let mode2 = await window2.getWindowMode() + expect(mode2 == WindowMode.FLOATING).assertTrue() + await stopApplication('com.uitestScene.acts') + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window1 != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) /* @@ -778,16 +786,25 @@ export default function UiTest() { let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) let window = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - await window.resume() - await driver.delayMs(waitUiReadyMs) - let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds1 = await window1.getBounds() - await window1.moveTo(100,100) - await driver.delayMs(waitUiReadyMs) - let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds2 = await window2.getBounds() - expect(bounds1 != bounds2).assertTrue() - await stopApplication('com.uitestScene.acts') + try{ + await window.resume() + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds1 = await window1.getBounds() + await window1.moveTo(100,100) + await driver.delayMs(waitUiReadyMs) + let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds2 = await window2.getBounds() + expect(bounds1 != bounds2).assertTrue() + await stopApplication('com.uitestScene.acts') + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) /* @@ -800,31 +817,40 @@ export default function UiTest() { let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) let window = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - await window.resume() - await driver.delayMs(waitUiReadyMs) - - let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds1 = await window1.getBounds() - await window1.resize(600,600,ResizeDirection.RIGHT_DOWN) - await driver.delayMs(waitUiReadyMs) - let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds2 = await window2.getBounds() - expect(bounds2 != bounds1).assertTrue() - - await window2.resize(400,400,ResizeDirection.RIGHT_UP) - let window3 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds3= await window3.getBounds() - expect(bounds3 != bounds2).assertTrue() - await window3.resize(300,300,ResizeDirection.LEFT_DOWN) - let window4 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds4= await window4.getBounds() - expect(bounds4 != bounds3).assertTrue() - - await window4.resize(500,500,ResizeDirection.LEFT_UP) - let window5 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds5= await window5.getBounds() - expect(bounds5 != bounds4).assertTrue() - await stopApplication('com.uitestScene.acts') + try{ + await window.resume() + await driver.delayMs(waitUiReadyMs) + + let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds1 = await window1.getBounds() + await window1.resize(600,600,ResizeDirection.RIGHT_DOWN) + await driver.delayMs(waitUiReadyMs) + let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds2 = await window2.getBounds() + expect(bounds2 != bounds1).assertTrue() + + await window2.resize(400,400,ResizeDirection.RIGHT_UP) + let window3 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds3= await window3.getBounds() + expect(bounds3 != bounds2).assertTrue() + await window3.resize(300,300,ResizeDirection.LEFT_DOWN) + let window4 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds4= await window4.getBounds() + expect(bounds4 != bounds3).assertTrue() + + await window4.resize(500,500,ResizeDirection.LEFT_UP) + let window5 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds5= await window5.getBounds() + expect(bounds5 != bounds4).assertTrue() + await stopApplication('com.uitestScene.acts') + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) it('testWindowResizeB', 0, async function () { @@ -832,32 +858,41 @@ export default function UiTest() { let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) let window = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - await window.resume() - await driver.delayMs(waitUiReadyMs) - - let window5 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds5= await window5.getBounds() - await window5.resize(bounds5.rightX - bounds5.leftX,300,ResizeDirection.DOWN) - let window6 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds6= await window6.getBounds() - expect(bounds6 != bounds5).assertTrue() - - await window6.resize(bounds6.rightX - bounds6.leftX,500,ResizeDirection.UP) - let window7 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds7 = await window7.getBounds() - expect(bounds7 != bounds6).assertTrue() - - await window7.resize(300,bounds7.bottomY - bounds7.topY,ResizeDirection.LEFT) - let window8 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds8 = await window8.getBounds() - expect(bounds8 != bounds7).assertTrue() - - await window8.resize(500,bounds8.bottomY - bounds8.topY,ResizeDirection.RIGHT) - let window9 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let bounds9 = await window9.getBounds() - expect(bounds9 != bounds8).assertTrue() - - await stopApplication('com.uitestScene.acts') + try{ + await window.resume() + await driver.delayMs(waitUiReadyMs) + + let window5 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds5= await window5.getBounds() + await window5.resize(bounds5.rightX - bounds5.leftX,300,ResizeDirection.DOWN) + let window6 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds6= await window6.getBounds() + expect(bounds6 != bounds5).assertTrue() + + await window6.resize(bounds6.rightX - bounds6.leftX,500,ResizeDirection.UP) + let window7 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds7 = await window7.getBounds() + expect(bounds7 != bounds6).assertTrue() + + await window7.resize(300,bounds7.bottomY - bounds7.topY,ResizeDirection.LEFT) + let window8 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds8 = await window8.getBounds() + expect(bounds8 != bounds7).assertTrue() + + await window8.resize(500,bounds8.bottomY - bounds8.topY,ResizeDirection.RIGHT) + let window9 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let bounds9 = await window9.getBounds() + expect(bounds9 != bounds8).assertTrue() + + await stopApplication('com.uitestScene.acts') + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) /* @@ -886,14 +921,23 @@ export default function UiTest() { let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) let window = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - await window.resume() - let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - await window2.maximize() - await driver.delayMs(waitUiReadyMs) - let window3 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - let mode = await window3.getWindowMode() - expect(mode == WindowMode.FULLSCREEN).assertTrue() - await stopApplication('com.uitestScene.acts') + try{ + await window.resume() + let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + await window2.maximize() + await driver.delayMs(waitUiReadyMs) + let window3 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + let mode = await window3.getWindowMode() + expect(mode == WindowMode.FULLSCREEN).assertTrue() + await stopApplication('com.uitestScene.acts') + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) /* @@ -906,11 +950,20 @@ export default function UiTest() { let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) let window = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + try{ await window.minimize() - await driver.delayMs(waitUiReadyMs) - let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - expect(window1 == null).assertTrue() - await stopApplication('com.uitestScene.acts') + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + expect(window1 == null).assertTrue() + await stopApplication('com.uitestScene.acts') + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) /* @@ -923,11 +976,19 @@ export default function UiTest() { let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) let window = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - await window.close() - await driver.delayMs(waitUiReadyMs) - let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) - expect(window1 == null).assertTrue() - await stopApplication('com.uitestScene.acts') + try{ + await window.close() + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + expect(window1 == null).assertTrue() + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window != null).assertTrue() + } else { + expect(false).assertTrue() + } + } }) /* diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets index 19e639635ba87115f015e4e291aa865485994153..358d696e5b761a3f05d51bb6036dcbc3f0838a39 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets @@ -23,7 +23,7 @@ export default function inputMethodJSUnit() { let inputMethodSetting = inputMethod.getInputMethodSetting(); console.info("inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting)); inputMethodSetting.listInputMethod((arr) => { - console.info("inputmethoh_test_001 listInputMethod result---" + JSON.stringify(arr)); + console.info("appInfoTest_input_2 listInputMethod result---" + JSON.stringify(arr)); expect(1==1).assertTrue(); }); done(); @@ -32,17 +32,19 @@ export default function inputMethodJSUnit() { it('inputmethoh_test_002', 0, async function (done) { let inputMethodSetting = inputMethod.getInputMethodSetting(); console.info("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting)); - let promise = inputMethodSetting.listInputMethod(); - console.info("inputmethoh_test_002 listInputMethod result---" + JSON.stringify(promise)); - if (promise.length > 0){ - let obj = promise[0] - console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj)); - expect(obj.packageName != null).assertTrue(); - expect(obj.methodId != null).assertTrue(); - }else{ - console.info("inputmethoh_test_002 listInputMethod is null"); - except().assertFail() - } + inputMethodSetting.listInputMethod().then(inputMethodProperty => { + if (inputMethodProperty.length > 0){ + let obj = inputMethodProperty[0] + console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj)); + expect(obj.packageName != null).assertTrue(); + expect(obj.methodId != null).assertTrue(); + }else{ + console.info("inputmethoh_test_002 listInputMethod is null"); + expect().assertFail() + } + }).catch(err => { + console.info("inputmethoh_test_002 listInputMethod is err: " + JSON.stringify(err)); + }); done(); }); @@ -58,9 +60,13 @@ export default function inputMethodJSUnit() { it('inputmethoh_test_004', 0, async function (done) { let inputMethodSetting = inputMethod.getInputMethodSetting(); console.info("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting)); - let promise = inputMethodSetting.displayOptionalInputMethod(); - console.info("inputmethoh_test_004 displayOptionalInputMethod result---" + JSON.stringify(promise)); - expect(promise).assertEqual(undefined) + inputMethodSetting.displayOptionalInputMethod().then(() => { + console.info("inputmethoh_test_004 displayOptionalInputMethod is called"); + expect(true).assertTrue() + }).catch(err => { + console.info("inputmethoh_test_004 displayOptionalInputMethod is err: " + JSON.stringify(err)); + expect().assertFail() + }); done(); }); @@ -76,9 +82,13 @@ export default function inputMethodJSUnit() { it('inputmethoh_test_006', 0, async function (done) { let inputMethodCtrl = inputMethod.getInputMethodController(); console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl)); - let promise = inputMethodCtrl.stopInput(); - console.info("inputmethoh_test_006 inputMethodCtrl stopInput result---" + JSON.stringify(promise)); - expect(promise).assertEqual(true) + inputMethodCtrl.stopInput().then(data => { + console.info("inputmethoh_test_006 stopInput result----" + data); + expect(data == true).assertTrue() + }).catch(err => { + console.info("inputmethoh_test_006 stopInput is err: " + JSON.stringify(err)); + expect().assertFail() + }); done(); }); @@ -96,6 +106,29 @@ export default function inputMethodJSUnit() { done(); }); + /* + * @tc.number inputmethod_test_switchInputMethod_001 + * @tc.name Test Indicates the input method which will replace the current one. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_switchInputMethod_001', 0, async function (done) { + console.info("************* inputmethod_test_switchInputMethod_001 Test start*************"); + let inputMethodProperty = { + packageName:"com.example.kikakeyboard", + methodId:"ServiceExtAbility" + } + + inputMethod.switchInputMethod(inputMethodProperty).then(data => { + console.info("inputmethod_test_switchInputMethod_001 data:" + data) + expect(data == true).assertTrue(); + }).catch( err=> { + console.info("inputmethod_test_switchInputMethod_001 err:" + err) + }) + console.info("************* inputmethod_test_switchInputMethod_001 Test end*************"); + done(); + }); + /* * @tc.number inputmethod_test_switchInputMethod_002 * @tc.name Test Indicates the input method which will replace the current one. @@ -119,5 +152,77 @@ export default function inputMethodJSUnit() { console.info("************* inputmethod_test_switchInputMethod_002 Test end*************"); done(); }); + + /* + * @tc.number inputmethod_test_showSoftKeyboard_001 + * @tc.name Test Indicates the input method which will show softboard with calback. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_showSoftKeyboard_001', 0, async function (done) { + let inputMethodCtrl = inputMethod.getInputMethodController() + inputMethodCtrl.showSoftKeyboard((data)=>{ + if(data == undefined){ + console.info("showSoftKeyboard callbace success" ); + }else{ + console.info('showSoftKeyboard callbace failed : ' + JSON.stringify(err)) + } + }); + console.info("************* inputmethod_test_showSoftKeyboard_001 Test end*************"); + done(); + }); + + /* + * @tc.number inputmethod_test_showSoftKeyboard_001 + * @tc.name Test Indicates the input method which will show softboard with Promise. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_showSoftKeyboard_002', 0, async function (done) { + let inputMethodCtrl = inputMethod.getInputMethodController() + inputMethodCtrl.showSoftKeyboard().then((data) =>{ + console.info("showSoftKeyboard promise success" ); + }).catch((err) => { + console.info('showSoftKeyboard promise failed : ' + JSON.stringify(err)) + }) + console.info("************* inputmethod_test_showSoftKeyboard_002 Test end*************"); + done(); + }); + + /* + * @tc.number inputmethod_test_showSoftKeyboard_001 + * @tc.name Test Indicates the input method which will hide softboard with calback. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_hideSoftKeyboard_001', 0, async function (done) { + let inputMethodCtrl = inputMethod.getInputMethodController() + inputMethodCtrl.hideSoftKeyboard((data)=>{ + if(data == undefined){ + console.info("hideSoftKeyboard callbace success" ); + }else{ + console.info('hideSoftKeyboard callbace failed : ' + JSON.stringify(err)) + } + }); + console.info("************* inputmethod_test_hideSoftKeyboard_001 Test end*************"); + done(); + }); + + /* + * @tc.number inputmethod_test_showSoftKeyboard_001 + * @tc.name Test Indicates the input method which will hide softboard with Promise. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_hideSoftKeyboard_002', 0, async function (done) { + let inputMethodCtrl = inputMethod.getInputMethodController() + inputMethodCtrl.hideSoftKeyboard().then((data) =>{ + console.info("hideSoftKeyboard promise success" ); + }).catch((err) => { + console.info('hideSoftKeyboard promise failed : ' + JSON.stringify(err)) + }) + console.info("************* inputmethod_test_hideSoftKeyboard_002 Test end*************"); + done(); + }); }) } diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index 50dc7474811ad8a43d362d188a9da332198ebdb6..50ae5c0130e5152c97765fcbe49d9ddb2a432ef3 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -32,6 +32,7 @@ group("multimedia") { "image/image_js_standard/imageModifyProperty:image_modifyProperty_js_hap", "image/image_js_standard/imagePacking:image_packing_js_hap", "image/image_js_standard/imagePixelMapFramework:image_pixelmapframework_js_hap", + "image/image_js_standard/imageRGBA:image_rgba_js_hap", "image/image_js_standard/imageReceiver:image_receiver_js_hap", "image/image_js_standard/imageWebp:image_webp_js_hap", "image/image_js_standard/imageYUV:image_yuv_js_hap", diff --git a/multimedia/image/image_js_standard/imageRGBA/BUILD.gn b/multimedia/image/image_js_standard/imageRGBA/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2a0a35be6d8cea5d36e2f70bb4993ef4223856d9 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/BUILD.gn @@ -0,0 +1,31 @@ +# 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("image_rgba_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":image_rgba_js_assets", + ":image_rgba_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsImageRGBAJsTest" +} +ohos_js_assets("image_rgba_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("image_rgba_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/image/image_js_standard/imageRGBA/Test.json b/multimedia/image/image_js_standard/imageRGBA/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..eea7b947b1fe52d951e4fb072320031ae2706b2d --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/Test.json @@ -0,0 +1,41 @@ +{ + "description": "Configuration for Image Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.image.RGBA", + "shell-timeout": "120000" + }, + "kits": [ + { + "test-file-name": [ + "ActsImageRGBAJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + ] + }, + + { + "type": "ShellKit", + "run-command": [ + "hilog -Q pidoff", + "hilog -b D" + ], + "teardown-command":[ + ] + } + ] + +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/signature/openharmony_sx.p7b b/multimedia/image/image_js_standard/imageRGBA/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..d9fe0c1edd5ef09a357ed0bf05ed915a72278cca Binary files /dev/null and b/multimedia/image/image_js_standard/imageRGBA/signature/openharmony_sx.p7b differ diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/config.json b/multimedia/image/image_js_standard/imageRGBA/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..29aafe990cec42fb8f8ef0f0fd7d831eb27385c3 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/config.json @@ -0,0 +1,104 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.image.RGBA", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.image.RGBA.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.image.RGBA.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + "reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MEDIA_LOCATION", + "reason":"use ohos.permission.MEDIA_LOCATION" + }, + { + "name": "ohos.permission.READ_MEDIA", + "reason":"use ohos.permission.READ_MEDIA" + }, + { + "name": "ohos.permission.WRITE_MEDIA", + "reason":"use ohos.permission.WRITE_MEDIA" + } + ], + "package": "ohos.acts.multimedia.image.RGBA", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } + } \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/app.js b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8b3c3b3cb7930c465567b386bf230cb38a0d128e --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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'); + } +}; \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/i18n/en-US.json b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/i18n/zh-CN.json b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..b1c02368f72f929e4375a43170444de95dcc5984 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.css b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..53b12aeee6149cbc85a51a69bdadb6a06c635dd3 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.hml b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..e7b706af9e044f0ef934e80c6c23ddabf25e2f7d --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
\ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.js b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a2a05dae07aa3d9a816c0729268ce2ab139cd50c --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * 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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/List.test.js b/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2b11d9442f715daeee9cbe94faae0071426659ee --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * 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('./RGBA.test.js') \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js b/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js new file mode 100644 index 0000000000000000000000000000000000000000..708a60f85c944d72a3c6b37ae10aa545979db618 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js @@ -0,0 +1,481 @@ +/* + * 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 image from '@ohos.multimedia.image' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('Image', function () { + + beforeAll(function () { + console.info('beforeAll case'); + }) + + beforeEach(function () { + console.info('beforeEach case'); + }) + + afterEach(function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + /** + * @tc.number : RGBA_001 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_F16, + * size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_001', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 7, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then(pixelmap => { + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + .catch(error => { + console.log('RGBA_001 err' + error); + expect(false).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_002 + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_F16, + * size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_002', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 7, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err != undefined) { + console.info('RGBA_002 err: ' + err); + expect(false).assertTrue(); + done(); + return; + } + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_003 + * @tc.name : create pixelmap-promise (editable: false, pixelFormat: RGBA_F16, + * size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_003', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 7, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then(pixelmap => { + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + .catch(error => { + console.log('RGBA_003 err' + error); + expect(false).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_004 + * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_F16, + * size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_004', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 7, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err != undefined) { + console.info('RGBA_002 err: ' + err); + expect(false).assertTrue(); + done(); + return; + } + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + + }) + + /** + * @tc.number : RGBA_005 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: ALPHA_8, + * size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_005', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 6, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then(pixelmap => { + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + .catch(error => { + console.log('RGBA_005 err' + error); + expect(false).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_006 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGB_565, + * size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_006', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then(pixelmap => { + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + .catch(error => { + console.log('RGBA_006 err' + error); + expect(false).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_007 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: ARGB_8888, + * size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_007', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 1, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then(pixelmap => { + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + .catch(error => { + console.log('RGBA_007 err' + error); + expect(false).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_008 + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ALPHA_8, + * size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_008', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 6, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err != undefined) { + console.info('RGBA_008 err: ' + err); + expect(false).assertTrue(); + done(); + return; + } + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + + }) + + /** + * @tc.number : RGBA_009 + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGB_565, + * size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_009', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err != undefined) { + console.info('RGBA_009 err: ' + err); + expect(false).assertTrue(); + done(); + return; + } + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + + }) + + /** + * @tc.number : RGBA_010 + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ARGB_8888, + * size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_010', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 1, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err != undefined) { + console.info('RGBA_010 err: ' + err); + expect(false).assertTrue(); + done(); + return; + } + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_011 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_011', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err) { + console.info('RGBA_011 err: ' + err); + expect(pixelmap == undefined).assertTrue(); + console.info('RGBA_011 pass'); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }) + }) + + /** + * @tc.number : RGBA_012 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: ARGB_8888, size: { height: 6, width: -1 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_012', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: -1 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err) { + console.info('RGBA_012 err: ' + err); + expect(pixelmap == undefined).assertTrue(); + console.info('RGBA_012 pass'); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }) + }) + + /** + * @tc.number : RGBA_013 + * @tc.name : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: -1, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_013', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: 8 } } + image.createPixelMap(Color, opts).then(pixelmap => { + expect(false).assertTrue(); + console.info('RGBA_013 failed'); + done(); + }).catch(error => { + console.log('RGBA_013 err: ' + error); + expect(true).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_014 + * @tc.name : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: -1 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_014', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: -1 } } + image.createPixelMap(Color, opts).then(pixelmap => { + expect(false).assertTrue(); + console.info('RGBA_014 failed'); + done(); + }).catch(error => { + console.log('RGBA_014 error: ' + error); + expect(true).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_015 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: BGRA8888, + * size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_015', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 4, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then(pixelmap => { + console.log('RGBA_015 pixelFormat: 4'); + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + .catch(error => { + console.log('RGBA_015 err: ' + error); + expect(false).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : RGBA_016 + * @tc.name : create pixelmap-callback (editable: true, pixelFormat: BGRA8888, + * size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('RGBA_016', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 4, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + if (err != undefined) { + console.log('RGBA_016 err: ' + err); + expect(false).assertTrue(); + done(); + return; + } + console.log('RGBA_016 pixelFormat: image.PixelMapFormat.BGRA_8888'); + expect(pixelmap != undefined).assertTrue(); + expect(pixelmap.isEditable == opts.editable).assertTrue(); + done(); + }) + }) +}) \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/resources/base/element/string.json b/multimedia/image/image_js_standard/imageRGBA/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..eed70c6527b594a191b279111f5ad25a3155a1b6 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ImageJSTestMain" + }, + { + "name": "mainability_description", + "value": "ImageJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/resources/base/media/icon.png b/multimedia/image/image_js_standard/imageRGBA/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/image/image_js_standard/imageRGBA/src/main/resources/base/media/icon.png differ diff --git a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/AudioPlayerHLSTest.test.js b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/AudioPlayerHLSTest.test.js index c4d5d0d71724befce9b86b18f58bcb8dc1552af9..0203d819f7339d36d4b363e9026bccdbbb72ab06 100644 --- a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/AudioPlayerHLSTest.test.js +++ b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/AudioPlayerHLSTest.test.js @@ -38,7 +38,7 @@ describe('AudioPlayerHLSTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HLS + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HLS_0100 * @tc.name : 001.test hls audio only * @tc.desc : HLS Video playback control test * @tc.size : MediumTest @@ -50,14 +50,14 @@ describe('AudioPlayerHLSTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HLS_VARIANT + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HLS_VARIANT_0100 * @tc.name : 001.test hls audio variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HLS_0100Variant', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HLS_VARIANT_0100', 0, async function (done) { playAudioSource(HTTP_PATH + '05.hls/hls_variant_audio/index.m3u8', 219600, PLAY_TIME, false, done); }) }) diff --git a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js index 8e9078f9b278afc3d0b6f5d94a1db6f96d624d95..dc97230a663ae2c0468f7122c983358ce722b2a7 100644 --- a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js +++ b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js @@ -60,66 +60,66 @@ describe('VideoPlayerHLSTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_SEPARATE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_Separate_0100 * @tc.name : 001.test hls audio video separate * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_0100Separate', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_Separate_0100', 0, async function (done) { await testVideoSeek(HTTP_PATH + '05.hls/2/index.m3u8', 10033, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_AUDIOONLY + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_AudioOnly_0100 * @tc.name : 001.test hls audio only * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_0100AudioOnly', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_AudioOnly_0100', 0, async function (done) { await testVideoSeek(HTTP_PATH + '05.hls/audio_only/index.m3u8', 10033, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_VARIANT + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_Variant_0100 * @tc.name : 001.test hls variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_0100Variant', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_Variant_0100', 0, async function (done) { await testVideoSeek(HTTP_PATH + '05.hls/hls_variant/index.m3u8', 10033, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_AUDIOOFF + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_AudioOff_0100 * @tc.name : 001.test hls variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_0100VariantAudioOff', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_AudioOff_0100', 0, async function (done) { await testVideoSeek(HTTP_PATH + '05.hls/hls_variant2/index.m3u8', 10080, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_CODEC_CHAGNGE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_CodecChange_0100 * @tc.name : 001.test hls variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_0100CodecChange', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_CodecChange_0100', 0, async function (done) { await testVideoSeek(HTTP_PATH + '05.hls/hls_variant3/index.m3u8', 10080, PLAY_TIME, done); done(); }) diff --git a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js index fac7a58606c0a46eae370de15d65736f058b4393..285f025b582bfdeddc1b65ba947c6624e89ddd0b 100644 --- a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js +++ b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js @@ -60,66 +60,66 @@ describe('VideoPlayerHLSTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEPARATE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_Separate_0100 * @tc.name : 001.test hls audio video separate * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_0100Separate', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_Separate_0100', 0, async function (done) { await playVideoSource(HTTP_PATH + '05.hls/2/index.m3u8', 640, 320, 10033, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_AUDIOONLY + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_AudioOnly_0100 * @tc.name : 001.test hls audio only * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_0100AudioOnly', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_AudioOnly_0100', 0, async function (done) { await playVideoSource(HTTP_PATH + '05.hls/audio_only/index.m3u8', 0, 0, 10033, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_VARIANT + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_Variant_0100 * @tc.name : 001.test hls variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_0100Variant', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_Variant_0100', 0, async function (done) { await playVideoSource(HTTP_PATH + '05.hls/hls_variant/index.m3u8', null, null, 10033, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_AUDIOOFF + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_AudioOff_0100 * @tc.name : 001.test hls variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_0100VariantAudioOff', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_AudioOff_0100', 0, async function (done) { await playVideoSource(HTTP_PATH + '05.hls/hls_variant2/index.m3u8', null, null, 10080, PLAY_TIME, done); done(); }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_CODEC_CHAGNGE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_CodecChange_0100 * @tc.name : 001.test hls variant * @tc.desc : HLS Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_0100CodecChange', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_CodecChange_0100', 0, async function (done) { await playVideoSource(HTTP_PATH + '05.hls/hls_variant3/index.m3u8', null, null, 10080, PLAY_TIME, done); done(); }) diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js index 554eda40f30a510ab236596853c472e941010119..d923ec6a83bd6671b2ebe715415c5519ccb53a59 100755 --- a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js +++ b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js @@ -102,17 +102,17 @@ describe('MultimodalInput_test', function () { inputDevice.getDevice(data[i], (res, err) => { console.info(`getDevice:data ${JSON.stringify(data)}`); arr = Object.keys(res); - expect(res.id).assertInstanceOf('number'); - expect(res.name).assertInstanceOf('string'); + expect(res.id).assertInstanceOf('Number'); + expect(res.name).assertInstanceOf('String'); expect(res.sources).assertInstanceOf('Array'); expect(res.axisRanges).assertInstanceOf('Array'); - expect(res.bus).assertInstanceOf('number'); - expect(res.product).assertInstanceOf('number'); - expect(res.vendor).assertInstanceOf('number'); - expect(res.version).assertInstanceOf('number'); - expect(res.phys).assertInstanceOf('string'); - expect(res.uniq).assertInstanceOf('string'); - expect(res).assertInstanceOf('InputDeviceData'); + expect(res.bus).assertInstanceOf('Number'); + expect(res.product).assertInstanceOf('Number'); + expect(res.vendor).assertInstanceOf('Number'); + expect(res.version).assertInstanceOf('Number'); + expect(res.phys).assertInstanceOf('String'); + expect(res.uniq).assertInstanceOf('String'); + expect(res).assertInstanceOf('Object'); for(let j = 0;j < res.axisRanges.length; j++ ){ expect(res.axisRanges[j].source == 'keyboard' || res.axisRanges[j].source == 'mouse' || res.axisRanges[j].source == 'touchpad' || res.axisRanges[j].source == 'touchscreen' @@ -122,15 +122,14 @@ describe('MultimodalInput_test', function () { || res.axisRanges[j].axis == 'y' || res.axisRanges[j].axis == 'pressure' || res.axisRanges[j].axis == 'toolMinor' || res.axisRanges[j].axis == 'touchMajor' || res.axisRanges[j].axis == 'NULL').assertTrue(); - expect(res.axisRanges[j].max).assertInstanceOf('number'); + expect(res.axisRanges[j].max).assertInstanceOf('Number'); expect(res.axisRanges[j]).assertInstanceOf('AxisRange'); - expect(res.axisRanges[j].min).assertInstanceOf('number'); - expect(res.axisRanges[j].fuzz).assertInstanceOf('number'); - expect(res.axisRanges[j].flat).assertInstanceOf('number'); - expect(res.axisRanges[j].resolution).assertInstanceOf('number'); + expect(res.axisRanges[j].min).assertInstanceOf('Number'); + expect(res.axisRanges[j].fuzz).assertInstanceOf('Number'); + expect(res.axisRanges[j].flat).assertInstanceOf('Number'); + expect(res.axisRanges[j].resolution).assertInstanceOf('Number'); } }) - expect(arr.length > 0).assertTrue(); } } console.info(`inputDevice::getDevice_test-02 exit`); @@ -176,7 +175,7 @@ describe('MultimodalInput_test', function () { } else { for (let i = 0; i < data.length; ++i) { inputDevice.getKeyboardType(data[i], (res, err) => { - expect(res).assertInstanceOf('number'); + expect(res).assertInstanceOf('Number'); }); } } @@ -204,8 +203,7 @@ describe('MultimodalInput_test', function () { } else { for (let i = 0; i < data.length; ++i) { inputDevice.getKeyboardType(data[i]).then((res) => { - expect(res).assertInstanceOf('number'); - done(); + expect(res).assertInstanceOf('Number'); }); } } @@ -282,13 +280,15 @@ describe('MultimodalInput_test', function () { * @tc.name MultimodalInputDevice_getDeviceIds_Promise_test * @tc.desc inputdevice interface getDeviceIds & supportKeys test */ - it("MultimodalInputDevice_getDeviceIds_Promise_test", 0, async function () { - console.info(`inputDevice::supportKeys_test-01 enter`); - await inputDevice.getDeviceIds().then((data, err) => { + it("MultimodalInputDevice_getDeviceIds_Promise_test", 0, async function (done) { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test enter`); + inputDevice.getDeviceIds().then((data, err) => { if (err) { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test err`); expect(false).assertTrue(); done(); } else { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test data`); for (let i = 0; i < data.length; ++i) { inputDevice.supportKeys(data[i], [17, 22, 2055]).then((res, err) => { expect(res).assertInstanceOf('Array'); @@ -296,7 +296,7 @@ describe('MultimodalInput_test', function () { } done(); } - console.info(`inputDevice::supportKeys_test-01 exit`); + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test exit`); }); }) @@ -305,18 +305,20 @@ describe('MultimodalInput_test', function () { * @tc.name MultimodalInputDevice_getDevice_Promise_test * @tc.desc inputdevice interface getDevice test */ - it("MultimodalInputDevice_getDevice_Promise_test", 0, async function () { - console.info(`inputDevice::getDevice_test-01 enter`); - await inputDevice.getDevice(-1).then((data, err) => { + it("MultimodalInputDevice_getDevice_Promise_test", 0, async function (done) { + console.info(`MultimodalInputDevice_getDevice_Promise_test enter`); + inputDevice.getDevice(-1).then((data, err) => { if (err) { + console.info(`MultimodalInputDevice_getDevice_Promise_test err`); expect(false).assertTrue(); - console.info(`inputDevice::getDevice_test-01 ${JSON.stringify(err)}`); + console.info(`MultimodalInputDevice_getDevice_Promise_test ${JSON.stringify(err)}`); done(); } else { + console.info(`MultimodalInputDevice_getDevice_Promise_test data`); expect(JSON.stringify(data) !== "{}").assertTrue(); done(); } - console.info(`inputDevice::getDevice_test-01 exit`); + console.info(`MultimodalInputDevice_getDevice_Promise_test exit`); }); }) diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js index 6ad015b7403825375f6b76e1b6335fdccb2eaef8..7f9923fb5cb89d9cd8caffba8502bb0a948ae0e1 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js @@ -26,6 +26,7 @@ var time = 1000 export default function ActsAnsGetWantAgentInfoTest() { describe('ActsAnsGetWantAgentInfoTest', function () { console.info('----ActsGetWantAgentInfoTest----'); + /* * @tc.number: ACTS_SetWantInfo_0100 * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() @@ -107,6 +108,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }, time); console.info('----getWantAgenta after----'); }) + /* * @tc.number: ACTS_SetWantInfo_0200 * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() @@ -170,6 +172,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_0200====>"); }, time) }) + /* * @tc.number: ACTS_SetWantInfo_0300 * @tc.name: equal(normal) @@ -372,6 +375,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); }, 1000); }) + /* * @tc.number: ACTS_SetWantInfo_0500 * @tc.name: equal(),cancel() @@ -472,6 +476,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); }, 1000); }) + /* * @tc.number: ACTS_SetWantInfo_0600 * @tc.name: equal() @@ -494,20 +499,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_0600====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_0700 * @tc.name: equal() * @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")promise */ it('ACTS_SetWantInfo_0700', 0, async function (done) { - var promise = await wantAgent.equal("$%$%^$%^","$%$%^$%^") - console.info('----equali success!----'+promise) - expect(promise).assertEqual(undefined); + wantAgent.equal("$%$%^$%^","$%$%^$%^").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_0700====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_0800 * @tc.name: equal() @@ -525,20 +534,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_0800====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_0900 * @tc.name: equal() * @tc.desc: verify the function of equal({},{})promise */ it('ACTS_SetWantInfo_0900', 0, async function (done) { - var promise = wantAgent.equal({},{}) - console.info('----equalk success!----'+promise) - expect(promise).assertEqual(null); + wantAgent.equal({},{}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_0900====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_1000 * @tc.name: equal() @@ -556,20 +569,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1000====>"); }, time); }); + /* - * @tc.number: ACTS_SetWantInfo_2200 + * @tc.number: ACTS_SetWantInfo_1100 * @tc.name: equal() * @tc.desc: verify the function of equal(100,100)promise */ it('ACTS_SetWantInfo_1100', 0, async function (done) { - var promise = await wantAgent.equal(100,100) - console.info('----equaln success!----'+promise) - expect(promise).assertEqual(undefined); + wantAgent.equal(100,100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1100====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_1200 * @tc.name: getWantAgent() @@ -584,6 +601,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1200====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1300 * @tc.name: getWantAgent() @@ -591,14 +609,17 @@ describe('ActsAnsGetWantAgentInfoTest', function () { */ it('ACTS_SetWantInfo_1300', 0, async function (done) { console.info('----ACTS_SetWantInfo_0300 begin----'); - var promise = wantAgent.getWantAgent("") - console.log("===getWantAgentb==="+promise) - expect(promise).assertEqual(null); + wantAgent.getWantAgent("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1300====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1400 * @tc.name: getBundleName() @@ -613,20 +634,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1400====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1500 * @tc.name: getBundleName() * @tc.desc: verify the function of getBundleName("")promise */ it('ACTS_SetWantInfo_1500', 0, async function (done) { - var promise = await wantAgent.getBundleName("") - console.info('----getBundleNameb success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getBundleName("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1500====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1600 * @tc.name: getUid() @@ -641,20 +666,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1600====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1700 * @tc.name: getUid() * @tc.desc: verify the function of getUid("")promise */ it('ACTS_SetWantInfo_1700', 0, async function (done) { - var promise =await wantAgent.getUid("") - console.info('----getUidb success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getUid("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1700====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1800 * @tc.name: getWant() @@ -670,20 +699,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1800====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1900 * @tc.name: getWant() * @tc.desc: verify the function of getWant("")promise */ it('ACTS_SetWantInfo_1900', 0, async function (done) { - var promise = await wantAgent.getWant("") - console.info('----getWantb success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getWant("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1900====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2000 * @tc.name: getWantAgent() @@ -699,20 +732,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2000====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2100 * @tc.name: getWantAgent() * @tc.desc: verify the function of getWantAgent(100)promises */ it('ACTS_SetWantInfo_2100', 0, async function (done) { - var promise = wantAgent.getWantAgent(100) - console.log("----getWantAgentb success!----"+promise) - expect(promise).assertEqual(null) + wantAgent.getWantAgent(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2100====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2200 * @tc.name: getBundleName() @@ -728,20 +765,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2200====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2300 * @tc.name: getBundleName() * @tc.desc: verify the function of getBundleName(100)promise */ it('ACTS_SetWantInfo_2300', 0, async function (done) { - var promise =await wantAgent.getBundleName(100) - console.info('----getBundleNamed success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getBundleName(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2300====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2400 * @tc.name: getUid() @@ -756,20 +797,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2400====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2500 * @tc.name: getUid() * @tc.desc: verify the function of getUid(100)promise */ it('ACTS_SetWantInfo_2500', 0, async function (done) { - var promise =await wantAgent.getUid(100) - console.info('----getUidd success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getUid(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2500====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2600 * @tc.name: getWant() @@ -785,20 +830,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2600====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2700 * @tc.name: getWant() * @tc.desc: verify the function of getWant(100)promise */ it('ACTS_SetWantInfo_2700', 0, async function (done) { - var promise = await wantAgent.getWant(100) - console.info('----getWantd success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getWant(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2700====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2800 * @tc.name: getWantAgent() @@ -811,6 +860,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }) done(); }) + /* * @tc.number: ACTS_SetWantInfo_2900 * @tc.name: getWantAgent() @@ -824,6 +874,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }) done(); }) + /* * @tc.number: ACTS_SetWantInfo_3000 * @tc.name: getBundleName() @@ -836,17 +887,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3100 * @tc.name: getBundleName() * @tc.desc: verify the function of getBundleName({})promise */ it('ACTS_SetWantInfo_3100', 0, async function (done) { - var promise = wantAgent.getBundleName({}) - console.info('----getBundleNamef success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.getBundleName({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3200 * @tc.name: getUid() @@ -858,17 +913,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3300 * @tc.name: getUid() * @tc.desc: verify the function of getUid({})promise */ it('ACTS_SetWantInfo_3300', 0, async function (done) { - var promise = wantAgent.getUid({}) - console.info('----getUidf success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.getUid({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3400 * @tc.name: getWant() @@ -880,17 +939,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3500 * @tc.name: getWant() * @tc.desc: verify the function of getWant({})promise */ it('ACTS_SetWantInfo_3500', 0, async function (done) { - var promise = wantAgent.getWant({}) - console.info('----getWantf success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.getWant({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3600 * @tc.name: cancel() @@ -902,17 +965,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3700 * @tc.name: cancel() * @tc.desc: verify the function of cancel({})promise */ it('ACTS_SetWantInfo_3700', 0, async function (done) { - var promise = await wantAgent.cancel({}) - console.info('----cancelb success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.cancel({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3800 * @tc.name: cancel() @@ -924,17 +991,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3900 * @tc.name: cancel() * @tc.desc: verify the function of cancel(100)promise */ it('ACTS_SetWantInfo_3900', 0, async function (done) { - var promise =await wantAgent.cancel(100) - console.info('----canceld success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.cancel(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() }) + /* * @tc.number: ACTS_SetWantInfo_4000 * @tc.name: getWant() @@ -946,17 +1017,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_4100 * @tc.name: cancel() * @tc.desc: verify the function of cancel("")promise */ it('ACTS_SetWantInfo_4100', 0, async function (done) { - var promise = await wantAgent.cancel("") - console.info('----cancelf success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.cancel("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() }) + /* * @tc.number: ACTS_SetWantInfo_4200 * @tc.name: cancel() @@ -968,15 +1043,18 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_4300 * @tc.name: cancel() * @tc.desc: verify the function of cancel("%^%^%^")promise */ it('ACTS_SetWantInfo_4300', 0, async function (done) { - var promise =await wantAgent.cancel("%^%^%^") - console.info('----cancelh success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.cancel("%^%^%^").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() }) }) diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js index c1e67bba1272adae3de9acdc7cf584e5383bdd06..81edb327766c9cb77e987aa0ac578d2247855d9d 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js @@ -47,7 +47,7 @@ describe('ActsAnsWantAgentFiveTest', function () { } }, ], -// operationType: wantAgent.OperationType.START_ABILITY, + operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] } @@ -75,9 +75,7 @@ describe('ActsAnsWantAgentFiveTest', function () { } ); } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); + expect(err.code).assertEqual(-1) } done(); diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js index 9e2155943184f01794032c7c32971e33a75a3ab4..be7898790bac53eaaeeb927fc149b8cce4900754 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js @@ -67,15 +67,17 @@ describe('ActsAnsWantAgentFiveProTest', function () { console.info('----trigger success!----'); console.info('== trigger data ' + JSON.stringify(data) ); } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); + expect(err.code).assertEqual(-1) } done(); } ); done(); } - ); + ).catch((err)=>{ + expect(err.code).assertEqual(-1) + done() + }) setTimeout(function(){ console.debug("====>time out ACTS_SetWant_1000====>"); }, time); diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js b/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js index 5f969d4c6ceed8b47ac6a8c1d68be77f493f77cd..ffdd1180ec644f4be201fac3143d49173e983676 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/js/test/ActsSubscriber_test_ordered.js @@ -477,9 +477,14 @@ describe('ActsSubscriberTestOrder', function () { expect(data.event).assertEqual('publish_event0500'); expect(data.code).assertEqual(10); expect(data.data).assertEqual('publish_event0500_init'); - commonEventSubscriber0500.finishCommonEvent().then(() => { - console.info('===============>subscriberCallBack0500 finishCommonEvent promise'); - }); + commonEventSubscriber0500.finishCommonEvent((err) => { + if (err.code) { + console.info("===============>finishCommonEvent AsyncCallback failed " + JSON.stringify(err)); + } else { + console.info("===============>FinishCommonEvent AsyncCallback success"); + } + done() + }) } async function subscriberCallBack0501(err, data) { @@ -489,10 +494,14 @@ describe('ActsSubscriberTestOrder', function () { expect(data.event).assertEqual('publish_event0500'); expect(data.code).assertEqual(10); expect(data.data).assertEqual('publish_event0500_init'); - commonEventSubscriber0501.finishCommonEvent().then(() => { - console.info('===============>subscriberCallBack0501 finishCommonEvent promise'); - done(); - }); + commonEventSubscriber0501.finishCommonEvent((err) => { + if (err.code) { + console.info("===============>finishCommonEvent AsyncCallback failed " + JSON.stringify(err)); + } else { + console.info("===============>FinishCommonEvent AsyncCallback success"); + } + done() + }) } Subscriber.createSubscriber( diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js index 96c4cf46a0751ad3e87af3368639e1219c215a1b..b842606ad5d4f6d054bda508023d9df2a0247f8f 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js @@ -455,5 +455,62 @@ export default function ActsSubscriberTestUnorder() { await sleep(500) }) + + /* + * @tc.number : ActsSubscriberTestUnorder_0900 + * @tc.name : check properties + * @tc.desc : CommonEventPublishData + */ + it('ActsSubscriberTestUnorder_0900', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0900 START ') + CommonEventSubscriberInfo.events[0] = 'publish_event_0900' + CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0900' + CommonEventSubscriberInfo.priority = 10 + + let CommonEventPublishData = { + code: 0, + data: "initial_data", + subscriberPermissions:['publish_event_0900_subscriberPermissions'], + isOrdered:false, + isSticky:false, + parameters:{ + key1:'parameters_0100' + } + } + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => { + if (err.code) { + console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData)) + expect(true).assertTrue() + } + }) + + await commonEvent.publish('publish_event_0900', CommonEventPublishData, (err) => { + if (err.code) { + console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventPublishData)) + expect(true).assertTrue() + done() + } + }) + + await sleep(5000) + }) }) } diff --git a/startup/startup_standard/deviceinfo/src/main/js/test/List.test.js b/startup/startup_standard/deviceinfo/src/main/js/test/List.test.js index 82d3def74c845b98c5f2bbcde8d3f8101645b24e..fb74897985b845135f35bceb4be4fc5044f4ebaf 100644 --- a/startup/startup_standard/deviceinfo/src/main/js/test/List.test.js +++ b/startup/startup_standard/deviceinfo/src/main/js/test/List.test.js @@ -13,11 +13,9 @@ * limitations under the License. */ import DeviceInfoTest from './DeviceInfoJsUnit.test.js' -import SystemParameterTest from './ParametersJsUnit.test.js' import SystemDeviceTest from './SystemDeviceApi.test.js' export default function testsuite() { DeviceInfoTest() -SystemParameterTest() -SystemDeviceTest() + SystemDeviceTest() } diff --git a/startup/startup_standard/deviceinfo/src/main/js/test/ParametersJsUnit.test.js b/startup/startup_standard/deviceinfo/src/main/js/test/ParametersJsUnit.test.js deleted file mode 100644 index ca7d36697e3768980d8610126e660aea086759fe..0000000000000000000000000000000000000000 --- a/startup/startup_standard/deviceinfo/src/main/js/test/ParametersJsUnit.test.js +++ /dev/null @@ -1,803 +0,0 @@ -/* - * 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. - */ - -// @ts-nocheck - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import systemparameter from '@ohos.systemparameter' - -export default function SystemParameterTest() { -describe('SystemParameterTest', function () { - - console.info('SystemParameterTest start################################start'); - let PROPERTY_MAX_VALUE = 'a'; - for (let i = 0; i < 127; i++) { - PROPERTY_MAX_VALUE = 'a' + PROPERTY_MAX_VALUE; - } - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0100 - * @tc.name testSet0100 - * @tc.desc Set the value for the given key with parameter callback. - */ - it('testSet0100', 0, async function (done) { - console.info('testSet0100 start'); - let ret = false; - try { - systemparameter.set('hw_sc.build.os.version', '10.20.30.4', function (err) { - if (err == undefined) { - ret = true; - console.info('testSet0100 set callback hw_sc.build.os.version value success '); - expect(ret).assertTrue(); - } else { - console.info('testSet0100 set callback hw_sc.build.os.version value err:' - + err.code); - } - }); - done(); - } catch (err) { - console.info('testSet0100 set callback hw_sc.build.os.version unexpect err:' + err); - } - console.info('testSet0100 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0110 - * @tc.name testSet0110 - * @tc.desc Set a value that is not a string to the property value - */ - it('testSet0110', 0, async function (done) { - console.info('testSet0110 start'); - let ret = false; - try { - systemparameter.set('hw_sc.build.os.version', 111, function (err) { - if (err == undefined) { - console.info('testSet0110 set callback hw_sc.build.os.version value success'); - } else { - console.info('testSet0110 set callback hw_sc.build.os.version value err:' - + err.code) - } - }); - - } catch (err) { - ret = true; - console.info('testSet0110 set callback hw_sc.build.os.version unexpect err:' + err); - expect(ret).assertTrue(); - done(); - } - console.info('testSet0110 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0120 - * @tc.name testSet0120 - * @tc.desc Set the property value to an extra long string - */ - it('testSet0120', 0, async function (done) { - console.info('testSet0120 start'); - let ret = false; - try { - systemparameter.set('hw_sc.build.os.version', PROPERTY_MAX_VALUE, function (err) { - if (err == undefined) { - console.info('testSet0120 set callback hw_sc.build.os.version value success'); - } else { - ret = true; - console.info('testSet0120 set callback hw_sc.build.os.version value err:' + - err.code); - expect(ret).assertTrue(); - done(); - } - }); - - } catch (err) { - console.info('testSet0120 set callback hw_sc.build.os.version unexpect err:' + err); - } - console.info('testSet0120 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0200 - * @tc.name testSet0200 - * @tc.desc Set the value for the given key. - */ - it('testSet0200', 0, async function (done) { - console.info('testSet0200 start'); - let parameterInfo = systemparameter.set('hw_sc.build.os.version', '1.5.3.6'); - let ret = false; - try { - parameterInfo.then(function (value) { - console.info('testSet0200 promise set hw_sc.build.os.version success: ' + value); - ret = true; - expect(ret).assertTrue(); - done(); - }).catch(function (err) { - console.info('testSet0200 promise set hw_sc.build.os.version error: ' + err.code); - }); - } catch (err) { - console.info('testSet0200 set callback hw_sc.build.os.version unexpect err:' + err) - } - console.info('testSet0200 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0220 - * @tc.name testSet0220 - * @tc.desc Set the property value to an extra long string - */ - it('testSet0220', 0, async function (done) { - console.info('testSet0220 start'); - let ret = false; - try { - let parameterInfo = systemparameter.set('hw_sc.build.os.version', PROPERTY_MAX_VALUE); - parameterInfo.then(function (value) { - console.info('testSet0220 promise set hw_sc.build.os.version success: ' + value); - }).catch(function (err) { - ret = true; - console.info('testSet0220 promise set hw_sc.build.os.version error: ' + err.code); - expect(ret).assertTrue(); - done(); - }); - } catch (err) { - console.info('testSet0220 set callback hw_sc.build.os.version unexpect err:' + err); - } - console.info('testSet0220 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0230 - * @tc.name testSet0230 - * @tc.desc Set a value that is not a string to the property value - */ - it('testSet0230', 0, async function (done) { - console.info('testSet0230 start'); - let ret = false; - try { - let parameterInfo = systemparameter.set('hw_sc.build.os.version', 111); - parameterInfo.then(function (value) { - console.info('testSet0230 promise set hw_sc.build.os.version success: ' + value); - }).catch(function (err) { - console.info('testSet0230 promise set hw_sc.build.os.version error: ' + err.code); - }); - } catch (err) { - ret = true; - console.info('testSet0230 set callback hw_sc.build.os.version unexpect err:' + err); - expect(ret).assertTrue(); - done(); - } - console.info('testSet0230 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0300 - * @tc.name testSetSync0300 - * @tc.desc Set the value for the given key. - */ - it('testSetSync0300', 0, function () { - console.info('testSetSync0300 start'); - let ret = false; - try { - systemparameter.setSync('hw_sc.build.os.version', '2.5.3.10'); - console.info('testSetSync0300 promise setSync hw_sc.build.os.version success'); - ret = true; - } catch (err) { - console.info('testSetSync0300 promise setSync hw_sc.build.os.version: ' + err); - } - expect(ret).assertTrue(); - console.info('testSetSync0300 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0310 - * @tc.name testSetSync0310 - * @tc.desc Set the property value to an extra long string - */ - it('testSetSync0310', 0, async function (done) { - console.info('testSetSync0310 start'); - let ret = false; - let sysValue = null; - try { - systemparameter.setSync('hw_sc.build.os.version', PROPERTY_MAX_VALUE); - let parameterInfo = systemparameter.get('hw_sc.build.os.version'); - parameterInfo.then(function (value) { - ret = true; - console.info(' get testcast0310 system version : ' + value); - sysValue = value; - if (sysValue === PROPERTY_MAX_VALUE) { - console.info('testSetSync0310 promise setSynchw_sc.build.os.version failed :' - + sysValue); - } else { - console.info('testSetSync0310 promise setSync hw_sc.build.os.version: ' + sysValue); - ret = true; - expect(ret).assertTrue(); - done(); - } - }) - } catch (err) { - console.info('testSetSync0310 promise setSync hw_sc.build.os.version: ' + err); - } - console.info('testSetSync0310 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0320 - * @tc.name testSetSync0320 - * @tc.desc Set a value that is not a string to the property value - */ - it('testSetSync0320', 0, function () { - console.info('testSetSync0320 start'); - let ret = false; - try { - systemparameter.setSync('hw_sc.build.os.version', 111); - console.info('testSetSync0320 promise setSync hw_sc.build.os.version success: '); - - } catch (err) { - console.info('testSetSync0320 promise setSync hw_sc.build.os.version error: ' + err); - ret = true; - } - expect(ret).assertTrue(); - console.info('testSetSync0320 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0340 - * @tc.name testSetSync0340 - * @tc.desc Set parameter value ' ' - */ - it('testSetSync0340', 0, async function (done) { - console.info('testSetSync0340 start'); - let ret = false; - let sysValue = 0; - try { - systemparameter.setSync('hw_sc.build.os.version', ' '); - let parameterInfo = systemparameter.get('hw_sc.build.os.version'); - parameterInfo.then(function (value) { - ret = true; - console.info(' get testSetSync0340 system version : ' + value); - sysValue = value; - if (sysValue === ' ') { - console.info('testSetSync0340 promise get rhw_sc.build.os.version :' + sysValue); - ret = true; - expect(ret).assertTrue(); - done(); - } else { - console.info('testSetSync0340 promise get hw_sc.build.os.version: ' + sysValue); - } - }) - } catch (err) { - ret = true; - console.info('promise get hw_sc.build.os.version: ' + err); - } - console.info('testSetSync0340 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0400 - * @tc.name testGet0400 - * @tc.desc get systemparameter value - */ - it('testGet0400', 0, async function (done) { - console.info('testGet0400 start'); - let ret = false; - try { - let parameterInfo = systemparameter.get('hw_sc.build.os.version'); - parameterInfo.then(function (value) { - ret = true; - console.info(' testGet0400 promise get hw_sc.build.os.version success: ' + value); - expect(ret).assertTrue(); - done(); - }).catch(function (err) { - console.info(' testGet0400 promise get hw_sc.build.os.version error: ' + err.code); - }); - } catch (err) { - console.info('testGet0400 promise setSync hw_sc.build.os.version error: ' + err); - } - - console.info('testGet0400 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0410 - * @tc.name testGet0410 - * @tc.desc Get an attribute key that successfully sets value - */ - it('testGet0410', 0, async function (done) { - console.info('testGet0410 start'); - let ret = false; - try { - systemparameter.set('hw_sc.build.os.version', '1.1.1.1').then((data, err) => { - if (err == undefined) { - console.info('testGet0410 set sucess :' + data); - } else { - console.info('testGet0410 set failed :' + err.code()); - } - }) - setTimeout(function () { - let parameterInfo = systemparameter.get('hw_sc.build.os.version'); - parameterInfo.then(function (value) { - if (value === '1.1.1.1') { - console.info('promise get hw_sc.build.os.version success: ' + value); - ret = true; - expect(ret).assertTrue(); - done(); - } - }).catch(function (err) { - console.info('promise get hw_sc.build.os.version error: ' + err.code); - }); - }, '1000'); - } catch (err) { - console.info('testGet0410 promise get shw_sc.build.os.version error: ' + err); - } - console.info('testGet0410 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0420 - * @tc.name testGet0420 - * @tc.desc Get an attribute key value that sets the qualified value - */ - it('testGet0420', 0, async function (done) { - console.info('testGet0420 start'); - let ret = false; - let sysValue = 0; - try { - systemparameter.set('hw_sc.build.os.version', '1.1.1.1').then((data, err) => { - if (err == undefined) { - console.info('testGet0420 set sucess :' + data); - } else { - console.info('testGet0420 set failed :' + err.code()); - } - }) - let parameter = systemparameter.get('hw_sc.build.os.version', '10.3.4.5.63'); - parameter.then(function (value) { - sysValue = value; - if (sysValue === '1.1.1.1') { - ret = true; - console.info(' testGet0420 promise get hw_sc.build.os.version success: ' + value); - expect(ret).assertTrue(); - done(); - } else { - console.info(' testGet0420 promise get hw_sc.build.os.version faile ' + value); - } - }).catch(function (err) { - console.info(' testGet0420 promise get hw_sc.build.os.version error: ' + err.code); - }); - } catch (err) { - console.info('testGet0420 promise get hw_sc.build.os.version error: ' + err); - } - console.info('testGet0420 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0430 - * @tc.name testGet0430 - * @tc.desc Get a value without attribute key - */ - it('testGet0430', 0, async function (done) { - console.info('testGet0430 start'); - let ret = false; - try { - systemparameter.get(' ', '0.0.0.0').then((data, err) => { - if (err == undefined) { - console.info('testGet0430 promise success: ' + data); - ret = true; - expect(ret).assertTrue(); - } else { - console.info(' testGet0430 promise get faile ' + err); - } - }) - - } catch (err) { - console.info('testGet0430 promise catch get failed ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0430 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0440 - * @tc.name testGet0440 - * @tc.desc Directly obtain the key value of a normal setting attribute - */ - it('testGet0440', 0, async function (done) { - console.info('testGet0440 start'); - let ret = false; - try { - let parameter = systemparameter.get('c.c.c.c', '10.3.4.5.63'); - parameter.then(function (value) { - ret = true; - console.info(' testGet0440 promise get hw_sc.build.os.version success: ' + value); - expect(ret).assertTrue(); - }).catch(function (err) { - console.info(' testGet0440 promise get hw_sc.build.os.version error: ' + err.code); - }); - } catch (err) { - console.info('testGet0440 promise setSync hw_sc.build.os.version: ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0440 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0450 - * @tc.name testGet0450 - * @tc.desc Set the property value to an extra long string - */ - it('testGet0450', 0, async function (done) { - console.info('testGet0450 start'); - let ret = false; - try { - let parameter = systemparameter.get('a.b.b.c', PROPERTY_MAX_VALUE); - parameter.then(function (value) { - console.info(' testGet0450 promise get a.b.b.c success: ' + value); - }).catch(function (err) { - ret = true; - console.info(' testGet0450 promise get a.b.b.c error: ' + err.code); - expect(ret).assertTrue(); - }); - } catch (err) { - console.info('testGet0450 promise setSync a.b.b.c error: ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0450 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0500 - * @tc.name testGet0500 - * @tc.desc Get a property key value - */ - it('testGet0500', 0, async function (done) { - console.info('testGet0500 start'); - let ret = false; - try { - systemparameter.get('hw_sc.build.os.version', (err, data) => { - if (err == undefined) { - console.log('testGet0500 get test.parameter.key value success:' + data); - ret = true; - expect(ret).assertTrue(); - } else { - console.log('testGet0500 get test.parameter.key value err:' + err.code) - } - }); - } catch (err) { - console.log('testGet0500 get unexpected error: ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0500 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0510 - * @tc.name testGet0510 - * @tc.desc Get a set successful attribute key value - */ - it('testGet0510', 0, async function (done) { - let ret = false; - try { - systemparameter.set('aaaaaa', '2.2.2.2').then((data, err) => { - if (err == undefined) { - console.info('testGet0510 set aaaaa sucess :' + data); - } else { - console.info('testGet0510 set aaaaa failed :' + err); - } - }) - systemparameter.get('aaaaaa', (err, data) => { - if (err == undefined) { - console.info('testGet0510 get aaaaa sucess :' + data); - ret = true; - expect(ret).assertTrue(); - } else { - console.info('testGet0510 get aaaaa failed :' + err.code); - } - }) - } catch (err) { - console.info('testGet0510 promise get input error: ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0510 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0520 - * @tc.name testGet0520 - * @tc.desc Get a property key value directly - */ - it('testGet0520', 0, async function (done) { - console.info('testGet0520 start'); - let ret = false; - try { - systemparameter.get('a.a.a.a ', (err, data) => { - if (err == undefined) { - console.info('testGet0520 get systemparameter sucess: ' + data); - ret = true; - expect(ret).assertTrue(); - } else { - console.info('testGet0520 get systemparameter sucess: ' + err.code); - } - }) - } catch (err) { - console.info('testGet0520 promise get input error: ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0520 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0530 - * @tc.name testGet0530 - * @tc.desc Gets the value of an empty string - */ - it('testGet0530', 0, async function (done) { - console.info('testGet0530 start'); - let ret = false; - try { - systemparameter.get(' ', (err, data) => { - if (err == undefined) { - console.info('testGet0530 get systemparameter sucess: ' + data); - ret = true; - expect(ret).assertTrue(); - } else { - console.info('testGet0530 get systemparameter sucess: ' + err.code); - } - }) - } catch (err) { - console.info('testGet0530 promise get input error: ' + err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0530 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0600 - * @tc.name testGet0600 - * @tc.desc Set the value for the given key. - */ - it('testGet0600', 0, function (done) { - console.info('testGet0600 start'); - let ret = false; - try { - systemparameter.get('hw_sc.build.os.version', '1.1.1.1', async (err, data) => { - if (err == undefined && data === '1.1.1.1') { - ret = true; - console.info('testGet0600 get systemparameter hw_sc.build.os.version sucess: ' - + data); - expect(ret).assertTrue(); - } else { - console.info('testGet0600 get systemparameter hw_sc.build.os.version failed: ' - + err.code); - } - }) - } catch (err) { - console.info('testGet0600 get systemparameter hw_sc.build.os.version abnormal: ', err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0600 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0610 - * @tc.name testGet0610 - * @tc.desc Gets an attribute key value whose value is not a string - */ - it('testGet0610', 0, async function (done) { - console.info('testGet0610 start'); - let ret = false; - try { - systemparameter.get('hw_sc.build.os.version', 111, (err, data) => { - if (err == undefined && data === 111) { - console.info('testGet0610 get systemparameter hw_sc.build.os.version sucess: ' - + data); - } else { - console.info('testGet0610 get systemparameter hw_sc.build.os.version failed: ' - + err.code); - } - }) - } catch (err) { - ret = true; - console.info('testGet0610 get systemparameter hw_sc.build.os.version abnormal: ', err); - done(); - setTimeout(function () { - expect(ret).assertTrue(); - }, '1000'); - } - console.info('testGet0610 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0620 - * @tc.name testGet0620 - * @tc.desc Get an attribute key value whose value is empty - */ - it('testGet0620', 0, async function (done) { - console.info('testGet0620 start'); - let ret = false; - try { - systemparameter.get('hw_sc.build.os.version', ' ', (err, data) => { - if (err == undefined) { - ret = true; - console.info('testGet0620 get systemparameter hw_sc.build.os.version sucess: ' - + data); - } else { - console.info('testGet0620 get systemparameter hw_sc.build.os.version failed: ' - + err.code); - } - }) - } catch (err) { - console.info('testGet0620 get systemparameter hw_sc.build.os.version abnormal: ', err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0620 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0640 - * @tc.name testGet0640 - * @tc.desc Set the property value to an extra long string - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('testGet0640', 0, async function (done) { - console.info('testGet0640 start'); - let ret = false; - try { - systemparameter.get('b.b.b.b.b', PROPERTY_MAX_VALUE, (err, data) => { - if (err == undefined) { - console.info('testGet0640 get systemparameter b.b.b.b.b sucess: ' - + data); - } else { - ret = true; - console.info('testGet0640 get systemparameter b.b.b.b.b failed: ' + err.code); - } - }) - } catch (err) { - console.info('testGet0640 get systemparameter b.b.b.b.b abnormal: ', err); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testGet0640 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0700 - * @tc.name testGetSync0700 - * @tc.desc Gets an attribute key value whose attribute value is not a string - */ - it('testGetSync0700', 0, function (done) { - console.info('testGetSync0700 start'); - let ret = false; - try { - let parameterInfo = systemparameter.getSync('hw_sc.build.os.version', 496); - console.info(JSON.stringify(parameterInfo)); - } catch (err) { - ret = true; - console.info('testGetSync0700 promise get input error: ' + err); - done(); - } - expect(ret).assertTrue(); - console.info('testGetSync0700 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0710 - * @tc.name testGetSync0710 - * @tc.desc Get a property key value that sets the correct value - */ - it('testGetSync0710', 0, function (done) { - console.info('testGetSync0710 start'); - let ret = false; - try { - let parameterInfo = systemparameter.getSync('hw_sc.build.os.version', '0.0.0.0'); - ret = true; - console.info('testGetSync0710 promise get input sucess: ', parameterInfo); - done(); - } catch (err) { - console.info('testGetSync0710 promise get input error: ' + err); - } - expect(ret).assertTrue(); - console.info('testGetSync0710 : end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0720 - * @tc.name testGetSync0720 - * @tc.desc Get the value of the attribute key directly - */ - it('testGetSync0720', 0, function (done) { - console.info('testGetSync0720 start'); - let ret = false; - try { - let parameterInfo = systemparameter.getSync('hw_sc.build.os.version'); - ret = true; - console.info('testGetSync0720 promise get input sucess: ', parameterInfo); - done(); - } catch (err) { - console.info('testGetSync0720 promise get input error: ' + err); - } - expect(ret).assertTrue(); - console.info('testGetSync0720: end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0730 - * @tc.name testGetSync0730 - * @tc.desc Get the value of the attribute key directly - */ - it('testGetSync0730', 0, function (done) { - console.info('testGetSync0730 start'); - let ret = false; - try { - let parameterInfo = systemparameter.getSync('a.b.c.d.1.2.3.4', '1.2.3.4'); - console.info('testGetSync0730 get parameter = ', parameterInfo); - ret = true; - console.info('testGetSync0730 promise get input sucess: ', parameterInfo); - done(); - } catch (err) { - console.info('testGetSync0730 promise get input error: ' + err); - } - expect(ret).assertTrue(); - console.info('testGetSync0730: end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0740 - * @tc.name testGetSync0740 - * @tc.desc Gets the value of the attribute with the specified key. - */ - it('testGetSync0740', 0, function (done) { - console.info('testGetSync0740 start'); - let ret = false; - try { - systemparameter.setSync('hw_sc.build.os.version', '9.8.7.6'); - let parameterInfo = systemparameter.getSync('hw_sc.build.os.version', '0.0.0.0'); - ret = true; - console.info('testGetSync0740 promise get input sucess: ', parameterInfo); - done(); - } catch (err) { - console.info('testGetSync0740 promise get input error: ' + err); - } - expect(ret).assertTrue(); - console.info('testGetSync0740 : end'); - }) -})} diff --git a/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets b/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets index 12120ba7921e1f1f6a9a41f363705c28b30e4a6b..a7a0faa44b1c0363159128a7f7e96de5eca7623e 100755 --- a/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets +++ b/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets @@ -73,15 +73,20 @@ export default function wallpaperJSUnit() { * @tc.level 0 */ it('testGetColorsCallbackSystem101', 0, async function (done) { + await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data) { + let RgbaColor = { + red:data[0][0], + green:data[0][1], + blue:data[0][2], + alpha:data[0][3] + } console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err)); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data)); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]); console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]); - - if (err) { expect(null).assertFail(); } @@ -610,5 +615,45 @@ export default function wallpaperJSUnit() { }) done(); }) + + /* + * @tc.number testGetFileCallback101 + * @tc.name Obtains a file of the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetFileCallback101', 0, async function (done) { + wallpaper.getFile(WALLPAPER_SYSTEM, (error, data) => { + if (error) { + console.error("callback failed to getFile because: " + JSON.stringify(error)); + expect().assertFail() + }else{ + expect(typeof data == "number").assertTrue(); + expect(!isNaN(data)).assertTrue(); + console.info("callback success to getFile: " + JSON.stringify(data)); + done() + } + }); + done(); + }) + + /* + * @tc.number testGetFilePromise101 + * @tc.name Obtains a file of the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetFilePromise101', 0, async function (done) { + wallpaper.getFile(WALLPAPER_SYSTEM).then((data) => { + expect(typeof data == "number").assertTrue(); + expect(!isNaN(data)).assertTrue(); + console.info("promise success to getFile: " + JSON.stringify(data)); + done() + }).catch((error) => { + console.error("promise failed to getFile because: " + JSON.stringify(error)); + expect().assertFail() + }); + done(); + }) }) }