@oniroproject/oniro-app 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oniroproject/oniro-app",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Cross-platform CLI for Oniro/OpenHarmony application development.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "clean": "rm -rf dist"
25
25
  },
26
26
  "dependencies": {
27
- "@oniroproject/core": "0.16.0",
27
+ "@oniroproject/core": "0.17.0",
28
28
  "commander": "^12.1.0",
29
29
  "sharp": "^0.34.5"
30
30
  },
@@ -0,0 +1,33 @@
1
+ import { UIAbility, Want } from '@kit.AbilityKit';
2
+ import { abilityDelegatorRegistry, Component, Driver, ON } from '@kit.TestKit';
3
+ import { beforeAll, describe, expect, it } from '@ohos/hypium';
4
+
5
+ const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
6
+ const bundleName: string = abilityDelegatorRegistry.getArguments().bundleName;
7
+
8
+ // UI tests for pages/Index: they start the app's EntryAbility, then drive the
9
+ // page through UiTest's Driver.
10
+ export default function indexTest() {
11
+ describe('IndexTest', () => {
12
+ beforeAll(async () => {
13
+ const want: Want = { bundleName: bundleName, abilityName: 'EntryAbility' };
14
+ await delegator.startAbility(want);
15
+ await Driver.create().waitForComponent(ON.id('HelloWorld'), 5000);
16
+ })
17
+
18
+ it('showsEntryAbility', 0, async () => {
19
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
20
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
21
+ })
22
+
23
+ it('tapShowsWelcome', 0, async () => {
24
+ const driver: Driver = Driver.create();
25
+ const greeting: Component = await driver.findComponent(ON.id('HelloWorld'));
26
+ expect(await greeting.getText()).assertEqual('Hello World');
27
+ await greeting.click();
28
+ await driver.delayMs(500);
29
+ const updated: Component = await driver.findComponent(ON.id('HelloWorld'));
30
+ expect(await updated.getText()).assertEqual('Welcome');
31
+ })
32
+ })
33
+ }
@@ -1,5 +1,7 @@
1
1
  import abilityTest from './Ability.test';
2
+ import indexTest from './Index.test';
2
3
 
3
4
  export default function testsuite() {
4
5
  abilityTest();
5
- }
6
+ indexTest();
7
+ }
@@ -3,7 +3,7 @@
3
3
  "name": "entry_test",
4
4
  "type": "feature",
5
5
  "deviceTypes": [
6
- "phone"
6
+ "default"
7
7
  ],
8
8
  "deliveryWithInstall": true,
9
9
  "installationFree": false
@@ -0,0 +1,33 @@
1
+ import { UIAbility, Want } from '@kit.AbilityKit';
2
+ import { abilityDelegatorRegistry, Component, Driver, ON } from '@kit.TestKit';
3
+ import { beforeAll, describe, expect, it } from '@ohos/hypium';
4
+
5
+ const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
6
+ const bundleName: string = abilityDelegatorRegistry.getArguments().bundleName;
7
+
8
+ // UI tests for pages/Index: they start the app's EntryAbility, then drive the
9
+ // page through UiTest's Driver.
10
+ export default function indexTest() {
11
+ describe('IndexTest', () => {
12
+ beforeAll(async () => {
13
+ const want: Want = { bundleName: bundleName, abilityName: 'EntryAbility' };
14
+ await delegator.startAbility(want);
15
+ await Driver.create().waitForComponent(ON.id('HelloWorld'), 5000);
16
+ })
17
+
18
+ it('showsEntryAbility', 0, async () => {
19
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
20
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
21
+ })
22
+
23
+ it('tapShowsWelcome', 0, async () => {
24
+ const driver: Driver = Driver.create();
25
+ const greeting: Component = await driver.findComponent(ON.id('HelloWorld'));
26
+ expect(await greeting.getText()).assertEqual('Hello World');
27
+ await greeting.click();
28
+ await driver.delayMs(500);
29
+ const updated: Component = await driver.findComponent(ON.id('HelloWorld'));
30
+ expect(await updated.getText()).assertEqual('Welcome');
31
+ })
32
+ })
33
+ }
@@ -1,5 +1,7 @@
1
1
  import abilityTest from './Ability.test';
2
+ import indexTest from './Index.test';
2
3
 
3
4
  export default function testsuite() {
4
5
  abilityTest();
5
- }
6
+ indexTest();
7
+ }
@@ -3,7 +3,7 @@
3
3
  "name": "entry_test",
4
4
  "type": "feature",
5
5
  "deviceTypes": [
6
- "phone"
6
+ "default"
7
7
  ],
8
8
  "deliveryWithInstall": true,
9
9
  "installationFree": false
@@ -1,5 +1,7 @@
1
1
  import abilityTest from './Ability.test';
2
+ import napiTest from './Napi.test';
2
3
 
3
4
  export default function testsuite() {
4
5
  abilityTest();
5
- }
6
+ napiTest();
7
+ }
@@ -0,0 +1,15 @@
1
+ import { describe, expect, it } from '@ohos/hypium';
2
+ import testNapi from 'libentry.so';
3
+
4
+ // Unit tests for the native library built from src/main/cpp (napi_init.cpp).
5
+ export default function napiTest() {
6
+ describe('NapiTest', () => {
7
+ it('addsTwoNumbers', 0, () => {
8
+ expect(testNapi.add(2, 3)).assertEqual(5);
9
+ })
10
+
11
+ it('addsNegativeAndFractional', 0, () => {
12
+ expect(testNapi.add(-1.5, 0.5)).assertEqual(-1);
13
+ })
14
+ })
15
+ }
@@ -3,7 +3,7 @@
3
3
  "name": "entry_test",
4
4
  "type": "feature",
5
5
  "deviceTypes": [
6
- "phone"
6
+ "default"
7
7
  ],
8
8
  "deliveryWithInstall": true,
9
9
  "installationFree": false