diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts index 92341ad1ccf86a4e9cb5ace97ee5af1529467741..41c2c986f8d126bc9fa12b16119184a13fca63d9 100644 --- a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,7 +14,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/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets index 423dd1a68afedf0b7828b744ceb9de129c8aa1b5..4ed5a15c6963c0f443bf6e8d65fb4d177a1aa64d 100644 --- a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * 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 commonEvent from '@ohos.commonEvent' import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' @@ -115,7 +115,8 @@ export default function abilityTest() { console.log('ACTS_AppSelectorTest_1200 cmd = ' + cmdInstall); await abilityDelegator.executeShellCommand(cmdInstall); - await sleep(2000); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); globalThis.abilityContext.startAbility( { action: "ohos.want.action.viewData", @@ -123,21 +124,21 @@ export default function abilityTest() { parameters: { uri: "filePath" } - }, (error, data) => { + }, async(error, data) => { + console.debug("ACTS_AppSelectorTest_1200 startAbility " + JSON.stringify(error) + "," + JSON.stringify(data)); console.debug("ACTS_AppSelectorTest_1200 startAbility end"); - }) - - await sleep(2000); - console.log("ACTS_AppSelectorTest_1200 findComponent"); - let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) - console.log("ACTS_AppSelectorTest_1200 button " + JSON.stringify(button)); - await button.click(); - let subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, SubscribeCallBack) + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(2000); + console.log("ACTS_AppSelectorTest_1200 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1200 button " + JSON.stringify(button)); + await button.click(); + }) + async function SubscribeCallBack(err, data) { console.log('ACTS_AppSelectorTest_1200 bundleName = ' + data.parameters.bundleName); console.log('ACTS_AppSelectorTest_1200 abilityName = ' + data.parameters.abilityName); @@ -258,7 +259,7 @@ export default function abilityTest() { console.log("ACTS_AppSelectorTest_1400 rectAlias " + JSON.stringify(rectAlias)); await driver.swipe(rectSerial.leftX, rectSerial.topY, rectAlias.leftX, rectAlias.topY) - await sleep(2000); + await sleep(3000); console.log("ACTS_AppSelectorTest_1400 findComponent"); let button = await driver.findComponent(BY.text('imagegrelyhap').enabled(true)) console.log("ACTS_AppSelectorTest_1400 button " + JSON.stringify(button)); @@ -310,13 +311,16 @@ export default function abilityTest() { console.debug("ACTS_AppSelectorTest_1500 startAbility " + JSON.stringify(error) + "," + JSON.stringify(data)); console.debug("ACTS_AppSelectorTest_1500 startAbility end"); - await driver.click(400, 400); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(2000); console.log("ACTS_AppSelectorTest_1500 findComponent"); let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + await driver.click(400, 400); + console.log("ACTS_AppSelectorTest_1500 button " + JSON.stringify(button)); await button.click(); - commonEvent.subscribe(subscriber, SubscribeCallBack) + }) async function SubscribeCallBack(err, data) { @@ -371,6 +375,7 @@ export default function abilityTest() { await button.click(); try { + await sleep(2000); let close = await driver.findComponent(BY.text('取消').enabled(true)) console.log("ACTS_AppSelectorTest_1600 close " + JSON.stringify(close)); expect(close == null).assertTrue(); @@ -378,7 +383,7 @@ export default function abilityTest() { } catch (err) { console.debug("ACTS_AppSelectorTest_1600 catch err: " + JSON.stringify(err)); console.debug("ACTS_AppSelectorTest_1600 catch err: " + err); - expect("").assertFail(); + expect(err.code).assertEqual("INTERNAL_ERROR"); done(); } }) @@ -425,7 +430,7 @@ export default function abilityTest() { } catch (err) { console.debug("ACTS_AppSelectorTest_1700 catch err: " + JSON.stringify(err)); console.debug("ACTS_AppSelectorTest_1700 catch err: " + err); - expect("").assertFail(); + expect(err.code).assertEqual("INTERNAL_ERROR"); done(); } }) diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts index d763eaa006c76b7ece6e1758f7090a86d6dcee54..c546e58c88a3a4ba91d9388cce5752a38cc4069b 100644 --- a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,7 +14,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/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets index d4e11bd7373f88b3f8fa4b8d827d27e8c747ac10..da1b5eeba562f98fb3b5e008ad371709bb556a9b 100644 --- a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * 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 commonEvent from '@ohos.commonEvent' import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' @@ -97,7 +97,7 @@ export default function abilityTest() { let button = await component.getBounds() console.log("ACTS_AppSelectorTest_3200 button " + JSON.stringify(button)); - await sleep(2000); + await sleep(1000); globalThis.abilityContext.startAbility( { bundleName: "imagejrelyhap", @@ -107,9 +107,9 @@ export default function abilityTest() { JSON.stringify(error) + "," + JSON.stringify(data)); console.debug("ACTS_AppSelectorTest_3200 startAbility end"); - await sleep(2000); - await driver.click(button.leftX, button.topY); + await sleep(5000); commonEvent.subscribe(subscriber, SubscribeCallBack) + await driver.click(button.leftX, button.topY); }) }) @@ -267,9 +267,9 @@ export default function abilityTest() { console.log("ACTS_AppSelectorTest_0300 findComponent"); let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) console.log("ACTS_AppSelectorTest_0300 button " + JSON.stringify(button)); - await button.click(); subscriber = await commonEvent.createSubscriber(subscriberInfo); commonEvent.subscribe(subscriber, SubscribeCallBack) + await button.click(); async function SubscribeCallBack(err, data) { console.log('ACTS_AppSelectorTest_0300 SubscribeCallBack'); @@ -869,7 +869,7 @@ export default function abilityTest() { }, async (error, data) => { console.log("ACTS_AppSelectorTest_2300 startAbility " + JSON.stringify(error) + "," + JSON.stringify(data)); - expect(error.code).assertEqual(2097199); + expect(error.code).assertEqual(1); await sleep(2000); let button = await driver.findComponent(BY.text('知道了').enabled(true)) console.debug("ACTS_AppSelectorTest_2300 button: " + JSON.stringify(button)) @@ -902,7 +902,7 @@ export default function abilityTest() { }, async (error, data) => { console.log("ACTS_AppSelectorTest_2400 startAbility " + JSON.stringify(error) + "," + JSON.stringify(data)); - expect(error.code).assertEqual(2097199); + expect(error.code).assertEqual(1); await sleep(2000); let button = await driver.findComponent(BY.text('知道了').enabled(true)) console.debug("ACTS_AppSelectorTest_2400 button: " + JSON.stringify(button)) @@ -935,7 +935,7 @@ export default function abilityTest() { }, async (error, data) => { console.log("ACTS_AppSelectorTest_2500 startAbility " + JSON.stringify(error) + "," + JSON.stringify(data)); - expect(error.code).assertEqual(2097199); + expect(error.code).assertEqual(1); await sleep(2000); let button = await driver.findComponent(BY.text('知道了').enabled(true)) console.debug("ACTS_AppSelectorTest_2500 button: " + JSON.stringify(button)) @@ -1243,8 +1243,6 @@ export default function abilityTest() { } }) - - /* * @tc.number: ACTS_AppSelectorTest_3300 * @tc.name: Multi-hap application with action and type configured in feature diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 4aef7ab902d2045efa5ce25e83cf4974e57b42d0..5eccf4c7828dd8d34e6a327910ee1358a56c5833 100644 --- a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,7 +13,6 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' -import commonEvent from '@ohos.commonEvent' export default class MainAbility extends Ability { onCreate(want, launchParam) { @@ -28,7 +27,7 @@ export default class MainAbility extends Ability { // Main window is created, set main page for this ability console.log("[Demo] MainAbility onWindowStageCreate") - windowStage.setUIContent(this.context, "pages/index", null) + // windowStage.setUIContent(this.context, "pages/index", null) } onWindowStageDestroy() { diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,51 @@ +/* + * 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 '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json index f08f3b35c07f15c7d6358b1d25082ae58bb8bdba..d5ff071453789a78c54e1b90a1d323294996502b 100644 --- a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json @@ -38,7 +38,7 @@ "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", "label": "$string:service_ServiceAbility_desc", "description": "$string:service_ServiceAbility_desc", - "type": "service", + "type": "service|dataShare", "visible": true } ] diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json index 3b776341fa178ff77a1cf67cca433a684db62c1e..96165322cba1e22a7cff03ceee3c96d83099f0c4 100644 --- a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json @@ -38,7 +38,7 @@ "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", "label": "$string:service_ServiceAbility_label", "description": "$string:service_ServiceAbility_desc", - "type": "service", + "type": "service|dataShare", "visible": true, "skills": [ {