@midscene/android 0.24.1 → 0.24.2-beta-20250730123854.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.
@@ -79,7 +79,12 @@ declare class AndroidDevice implements AndroidDevicePage {
79
79
  back(): Promise<void>;
80
80
  home(): Promise<void>;
81
81
  recentApps(): Promise<void>;
82
+ longPress(x: number, y: number, duration?: number): Promise<void>;
83
+ pullDown(startPoint?: Point, distance?: number, duration?: number): Promise<void>;
84
+ private pullDrag;
85
+ pullUp(startPoint?: Point, distance?: number, duration?: number): Promise<void>;
82
86
  getXpathsById(id: string): Promise<string[]>;
87
+ getXpathsByPoint(point: Point, isOrderSensitive: boolean): Promise<string[]>;
83
88
  getElementInfoByXpath(xpath: string): Promise<ElementInfo>;
84
89
  }
85
90
 
package/dist/es/index.js CHANGED
@@ -570,9 +570,41 @@ ${Object.keys(size).filter((key) => size[key]).map(
570
570
  const adb = await this.getAdb();
571
571
  await adb.shell("input keyevent 187");
572
572
  }
573
+ async longPress(x, y, duration = 1e3) {
574
+ const adb = await this.getAdb();
575
+ const { x: adjustedX, y: adjustedY } = this.adjustCoordinates(x, y);
576
+ await adb.shell(
577
+ `input swipe ${adjustedX} ${adjustedY} ${adjustedX} ${adjustedY} ${duration}`
578
+ );
579
+ }
580
+ async pullDown(startPoint, distance, duration = 800) {
581
+ const { width, height } = await this.size();
582
+ const start = startPoint ? { x: startPoint.left, y: startPoint.top } : { x: width / 2, y: height * 0.15 };
583
+ const pullDistance = distance || height * 0.5;
584
+ const end = { x: start.x, y: start.y + pullDistance };
585
+ await this.pullDrag(start, end, duration);
586
+ await sleep(200);
587
+ }
588
+ async pullDrag(from, to, duration) {
589
+ const adb = await this.getAdb();
590
+ const { x: fromX, y: fromY } = this.adjustCoordinates(from.x, from.y);
591
+ const { x: toX, y: toY } = this.adjustCoordinates(to.x, to.y);
592
+ await adb.shell(`input swipe ${fromX} ${fromY} ${toX} ${toY} ${duration}`);
593
+ }
594
+ async pullUp(startPoint, distance, duration = 600) {
595
+ const { width, height } = await this.size();
596
+ const start = startPoint ? { x: startPoint.left, y: startPoint.top } : { x: width / 2, y: height * 0.85 };
597
+ const pullDistance = distance || height * 0.4;
598
+ const end = { x: start.x, y: start.y - pullDistance };
599
+ await this.pullDrag(start, end, duration);
600
+ await sleep(100);
601
+ }
573
602
  async getXpathsById(id) {
574
603
  throw new Error("Not implemented");
575
604
  }
605
+ async getXpathsByPoint(point, isOrderSensitive) {
606
+ throw new Error("Not implemented");
607
+ }
576
608
  async getElementInfoByXpath(xpath) {
577
609
  throw new Error("Not implemented");
578
610
  }
@@ -79,7 +79,12 @@ declare class AndroidDevice implements AndroidDevicePage {
79
79
  back(): Promise<void>;
80
80
  home(): Promise<void>;
81
81
  recentApps(): Promise<void>;
82
+ longPress(x: number, y: number, duration?: number): Promise<void>;
83
+ pullDown(startPoint?: Point, distance?: number, duration?: number): Promise<void>;
84
+ private pullDrag;
85
+ pullUp(startPoint?: Point, distance?: number, duration?: number): Promise<void>;
82
86
  getXpathsById(id: string): Promise<string[]>;
87
+ getXpathsByPoint(point: Point, isOrderSensitive: boolean): Promise<string[]>;
83
88
  getElementInfoByXpath(xpath: string): Promise<ElementInfo>;
84
89
  }
85
90
 
package/dist/lib/index.js CHANGED
@@ -597,9 +597,41 @@ ${Object.keys(size).filter((key) => size[key]).map(
597
597
  const adb = await this.getAdb();
598
598
  await adb.shell("input keyevent 187");
599
599
  }
600
+ async longPress(x, y, duration = 1e3) {
601
+ const adb = await this.getAdb();
602
+ const { x: adjustedX, y: adjustedY } = this.adjustCoordinates(x, y);
603
+ await adb.shell(
604
+ `input swipe ${adjustedX} ${adjustedY} ${adjustedX} ${adjustedY} ${duration}`
605
+ );
606
+ }
607
+ async pullDown(startPoint, distance, duration = 800) {
608
+ const { width, height } = await this.size();
609
+ const start = startPoint ? { x: startPoint.left, y: startPoint.top } : { x: width / 2, y: height * 0.15 };
610
+ const pullDistance = distance || height * 0.5;
611
+ const end = { x: start.x, y: start.y + pullDistance };
612
+ await this.pullDrag(start, end, duration);
613
+ await (0, import_utils.sleep)(200);
614
+ }
615
+ async pullDrag(from, to, duration) {
616
+ const adb = await this.getAdb();
617
+ const { x: fromX, y: fromY } = this.adjustCoordinates(from.x, from.y);
618
+ const { x: toX, y: toY } = this.adjustCoordinates(to.x, to.y);
619
+ await adb.shell(`input swipe ${fromX} ${fromY} ${toX} ${toY} ${duration}`);
620
+ }
621
+ async pullUp(startPoint, distance, duration = 600) {
622
+ const { width, height } = await this.size();
623
+ const start = startPoint ? { x: startPoint.left, y: startPoint.top } : { x: width / 2, y: height * 0.85 };
624
+ const pullDistance = distance || height * 0.4;
625
+ const end = { x: start.x, y: start.y - pullDistance };
626
+ await this.pullDrag(start, end, duration);
627
+ await (0, import_utils.sleep)(100);
628
+ }
600
629
  async getXpathsById(id) {
601
630
  throw new Error("Not implemented");
602
631
  }
632
+ async getXpathsByPoint(point, isOrderSensitive) {
633
+ throw new Error("Not implemented");
634
+ }
603
635
  async getElementInfoByXpath(xpath) {
604
636
  throw new Error("Not implemented");
605
637
  }
@@ -79,7 +79,12 @@ declare class AndroidDevice implements AndroidDevicePage {
79
79
  back(): Promise<void>;
80
80
  home(): Promise<void>;
81
81
  recentApps(): Promise<void>;
82
+ longPress(x: number, y: number, duration?: number): Promise<void>;
83
+ pullDown(startPoint?: Point, distance?: number, duration?: number): Promise<void>;
84
+ private pullDrag;
85
+ pullUp(startPoint?: Point, distance?: number, duration?: number): Promise<void>;
82
86
  getXpathsById(id: string): Promise<string[]>;
87
+ getXpathsByPoint(point: Point, isOrderSensitive: boolean): Promise<string[]>;
83
88
  getElementInfoByXpath(xpath: string): Promise<ElementInfo>;
84
89
  }
85
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android",
3
- "version": "0.24.1",
3
+ "version": "0.24.2-beta-20250730123854.0",
4
4
  "description": "Android automation library for Midscene",
5
5
  "keywords": [
6
6
  "Android UI automation",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "appium-adb": "12.12.1",
28
- "@midscene/shared": "0.24.1",
29
- "@midscene/web": "0.24.1",
30
- "@midscene/core": "0.24.1"
28
+ "@midscene/core": "0.24.2-beta-20250730123854.0",
29
+ "@midscene/web": "0.24.2-beta-20250730123854.0",
30
+ "@midscene/shared": "0.24.2-beta-20250730123854.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@modern-js/module-tools": "2.60.6",