@midscene/android 1.3.10 → 1.3.11-beta-20260210062109.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/dist/es/index.mjs CHANGED
@@ -4,7 +4,7 @@ import * as __rspack_external_node_module_ab9f2194 from "node:module";
4
4
  import * as __rspack_external_node_path_c5b9b54f from "node:path";
5
5
  import node_assert from "node:assert";
6
6
  import { getMidsceneLocationSchema, z } from "@midscene/core";
7
- import { defineAction, defineActionClearInput, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionScroll, defineActionTap } from "@midscene/core/device";
7
+ import { defineAction, defineActionClearInput, defineActionCursorMove, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionScroll, defineActionSwipe, defineActionTap, normalizeMobileSwipeParam } from "@midscene/core/device";
8
8
  import { getTmpFile, sleep } from "@midscene/core/utils";
9
9
  import { MIDSCENE_ADB_PATH, MIDSCENE_ADB_REMOTE_HOST, MIDSCENE_ADB_REMOTE_PORT, MIDSCENE_ANDROID_IME_STRATEGY, globalConfigManager, overrideAIConfig } from "@midscene/shared/env";
10
10
  import { createImgBase64ByFormat, isValidPNGImageBuffer } from "@midscene/shared/img";
@@ -646,9 +646,21 @@ class AndroidDevice {
646
646
  y: to.center[1]
647
647
  });
648
648
  }),
649
+ defineActionSwipe(async (param)=>{
650
+ const { startPoint, endPoint, duration, repeatCount } = normalizeMobileSwipeParam(param, await this.size());
651
+ for(let i = 0; i < repeatCount; i++)await this.mouseDrag(startPoint, endPoint, duration);
652
+ }),
649
653
  defineActionKeyboardPress(async (param)=>{
650
654
  await this.keyboardPress(param.keyName);
651
655
  }),
656
+ defineActionCursorMove(async (param)=>{
657
+ const arrowKey = 'left' === param.direction ? 'ArrowLeft' : 'ArrowRight';
658
+ const times = param.times ?? 1;
659
+ for(let i = 0; i < times; i++){
660
+ await this.keyboardPress(arrowKey);
661
+ await sleep(100);
662
+ }
663
+ }),
652
664
  defineAction({
653
665
  name: 'LongPress',
654
666
  description: 'Trigger a long press on the screen at specified element',
@@ -7,7 +7,7 @@ import { Agent } from "@midscene/core/agent";
7
7
  import { mergeAndNormalizeAppNameMapping, normalizeForComparison, repeat } from "@midscene/shared/utils";
8
8
  import node_assert from "node:assert";
9
9
  import { getMidsceneLocationSchema, z } from "@midscene/core";
10
- import { defineAction, defineActionClearInput, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionScroll, defineActionTap } from "@midscene/core/device";
10
+ import { defineAction, defineActionClearInput, defineActionCursorMove, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionScroll, defineActionSwipe, defineActionTap, normalizeMobileSwipeParam } from "@midscene/core/device";
11
11
  import { getTmpFile, sleep } from "@midscene/core/utils";
12
12
  import { MIDSCENE_ADB_PATH, MIDSCENE_ADB_REMOTE_HOST, MIDSCENE_ADB_REMOTE_PORT, MIDSCENE_ANDROID_IME_STRATEGY, globalConfigManager } from "@midscene/shared/env";
13
13
  import { createImgBase64ByFormat, isValidPNGImageBuffer } from "@midscene/shared/img";
@@ -743,9 +743,21 @@ class AndroidDevice {
743
743
  y: to.center[1]
744
744
  });
745
745
  }),
746
+ defineActionSwipe(async (param)=>{
747
+ const { startPoint, endPoint, duration, repeatCount } = normalizeMobileSwipeParam(param, await this.size());
748
+ for(let i = 0; i < repeatCount; i++)await this.mouseDrag(startPoint, endPoint, duration);
749
+ }),
746
750
  defineActionKeyboardPress(async (param)=>{
747
751
  await this.keyboardPress(param.keyName);
748
752
  }),
753
+ defineActionCursorMove(async (param)=>{
754
+ const arrowKey = 'left' === param.direction ? 'ArrowLeft' : 'ArrowRight';
755
+ const times = param.times ?? 1;
756
+ for(let i = 0; i < times; i++){
757
+ await this.keyboardPress(arrowKey);
758
+ await sleep(100);
759
+ }
760
+ }),
749
761
  defineAction({
750
762
  name: 'LongPress',
751
763
  description: 'Trigger a long press on the screen at specified element',
package/dist/lib/index.js CHANGED
@@ -678,9 +678,21 @@ var __webpack_exports__ = {};
678
678
  y: to.center[1]
679
679
  });
680
680
  }),
681
+ (0, device_namespaceObject.defineActionSwipe)(async (param)=>{
682
+ const { startPoint, endPoint, duration, repeatCount } = (0, device_namespaceObject.normalizeMobileSwipeParam)(param, await this.size());
683
+ for(let i = 0; i < repeatCount; i++)await this.mouseDrag(startPoint, endPoint, duration);
684
+ }),
681
685
  (0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
682
686
  await this.keyboardPress(param.keyName);
683
687
  }),
688
+ (0, device_namespaceObject.defineActionCursorMove)(async (param)=>{
689
+ const arrowKey = 'left' === param.direction ? 'ArrowLeft' : 'ArrowRight';
690
+ const times = param.times ?? 1;
691
+ for(let i = 0; i < times; i++){
692
+ await this.keyboardPress(arrowKey);
693
+ await (0, utils_namespaceObject.sleep)(100);
694
+ }
695
+ }),
684
696
  (0, device_namespaceObject.defineAction)({
685
697
  name: 'LongPress',
686
698
  description: 'Trigger a long press on the screen at specified element',
@@ -774,9 +774,21 @@ var __webpack_exports__ = {};
774
774
  y: to.center[1]
775
775
  });
776
776
  }),
777
+ (0, device_namespaceObject.defineActionSwipe)(async (param)=>{
778
+ const { startPoint, endPoint, duration, repeatCount } = (0, device_namespaceObject.normalizeMobileSwipeParam)(param, await this.size());
779
+ for(let i = 0; i < repeatCount; i++)await this.mouseDrag(startPoint, endPoint, duration);
780
+ }),
777
781
  (0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
778
782
  await this.keyboardPress(param.keyName);
779
783
  }),
784
+ (0, device_namespaceObject.defineActionCursorMove)(async (param)=>{
785
+ const arrowKey = 'left' === param.direction ? 'ArrowLeft' : 'ArrowRight';
786
+ const times = param.times ?? 1;
787
+ for(let i = 0; i < times; i++){
788
+ await this.keyboardPress(arrowKey);
789
+ await (0, core_utils_namespaceObject.sleep)(100);
790
+ }
791
+ }),
780
792
  (0, device_namespaceObject.defineAction)({
781
793
  name: 'LongPress',
782
794
  description: 'Trigger a long press on the screen at specified element',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android",
3
- "version": "1.3.10",
3
+ "version": "1.3.11-beta-20260210062109.0",
4
4
  "description": "Android automation library for Midscene",
5
5
  "keywords": [
6
6
  "Android UI automation",
@@ -38,8 +38,8 @@
38
38
  "@yume-chan/stream-extra": "^1.0.0",
39
39
  "appium-adb": "12.12.1",
40
40
  "sharp": "^0.34.3",
41
- "@midscene/core": "1.3.10",
42
- "@midscene/shared": "1.3.10"
41
+ "@midscene/core": "1.3.11-beta-20260210062109.0",
42
+ "@midscene/shared": "1.3.11-beta-20260210062109.0"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "@ffmpeg-installer/ffmpeg": "^1.1.0"
@@ -53,7 +53,7 @@
53
53
  "tsx": "^4.19.2",
54
54
  "vitest": "3.0.5",
55
55
  "zod": "3.24.3",
56
- "@midscene/playground": "1.3.10"
56
+ "@midscene/playground": "1.3.11-beta-20260210062109.0"
57
57
  },
58
58
  "license": "MIT",
59
59
  "scripts": {