@midscene/ios 1.10.11 → 1.10.12-beta-20260812055946.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/bin.mjs CHANGED
@@ -256,11 +256,17 @@ class IOSWebDriverClient extends WebDriverClient {
256
256
  this.ensureSession();
257
257
  try {
258
258
  const windowSize = await this.getWindowSize();
259
- debugIOS('Triggering app switcher with slow swipe up gesture');
260
- const centerX = windowSize.width / 2;
261
- const startY = windowSize.height - 5;
262
- const endY = 0.5 * windowSize.height;
263
- await this.swipe(centerX, startY, centerX, endY, 1500);
259
+ const centerX = Math.round(windowSize.width / 2);
260
+ const startY = Math.max(0, windowSize.height - 1);
261
+ const endY = Math.round(0.5 * windowSize.height);
262
+ debugIOS('Triggering app switcher with native WDA drag gesture');
263
+ await this.makeRequest('POST', `/session/${this.sessionId}/wda/dragfromtoforduration`, {
264
+ fromX: centerX,
265
+ fromY: startY,
266
+ toX: centerX,
267
+ toY: endY,
268
+ duration: 1
269
+ });
264
270
  await new Promise((resolve)=>setTimeout(resolve, 800));
265
271
  } catch (error) {
266
272
  debugIOS(`App switcher failed: ${error}`);
@@ -270,6 +276,7 @@ class IOSWebDriverClient extends WebDriverClient {
270
276
  async pressKey(key) {
271
277
  this.ensureSession();
272
278
  debugIOS(`Attempting to press key: ${key}`);
279
+ if ('+' !== key.trim() && key.includes('+')) throw new Error(`iOS keyboardPress does not support key combinations: ${JSON.stringify(key)}`);
273
280
  if ('Enter' === key || 'Return' === key || 'return' === key) {
274
281
  debugIOS('Handling Enter/Return key for iOS');
275
282
  await this.makeRequest('POST', `/session/${this.sessionId}/wda/keys`, {
@@ -1220,18 +1227,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
1220
1227
  await this.wdaBackend.pressHomeButton();
1221
1228
  }
1222
1229
  async appSwitcher() {
1223
- try {
1224
- debugDevice('Triggering app switcher with slow swipe up gesture');
1225
- const { width, height } = await this.size();
1226
- const centerX = Math.round(width / 2);
1227
- const startY = Math.round(height - 5);
1228
- const endY = Math.round(0.5 * height);
1229
- await this.wdaBackend.swipe(centerX, startY, centerX, endY, 1500);
1230
- await sleep(800);
1231
- } catch (error) {
1232
- debugDevice(`App switcher failed: ${error}`);
1233
- throw new Error(`Failed to trigger app switcher: ${error}`);
1234
- }
1230
+ await this.wdaBackend.appSwitcher();
1235
1231
  }
1236
1232
  async hideKeyboard(keyNames) {
1237
1233
  try {
package/dist/es/cli.mjs CHANGED
@@ -256,11 +256,17 @@ class IOSWebDriverClient extends WebDriverClient {
256
256
  this.ensureSession();
257
257
  try {
258
258
  const windowSize = await this.getWindowSize();
259
- debugIOS('Triggering app switcher with slow swipe up gesture');
260
- const centerX = windowSize.width / 2;
261
- const startY = windowSize.height - 5;
262
- const endY = 0.5 * windowSize.height;
263
- await this.swipe(centerX, startY, centerX, endY, 1500);
259
+ const centerX = Math.round(windowSize.width / 2);
260
+ const startY = Math.max(0, windowSize.height - 1);
261
+ const endY = Math.round(0.5 * windowSize.height);
262
+ debugIOS('Triggering app switcher with native WDA drag gesture');
263
+ await this.makeRequest('POST', `/session/${this.sessionId}/wda/dragfromtoforduration`, {
264
+ fromX: centerX,
265
+ fromY: startY,
266
+ toX: centerX,
267
+ toY: endY,
268
+ duration: 1
269
+ });
264
270
  await new Promise((resolve)=>setTimeout(resolve, 800));
265
271
  } catch (error) {
266
272
  debugIOS(`App switcher failed: ${error}`);
@@ -270,6 +276,7 @@ class IOSWebDriverClient extends WebDriverClient {
270
276
  async pressKey(key) {
271
277
  this.ensureSession();
272
278
  debugIOS(`Attempting to press key: ${key}`);
279
+ if ('+' !== key.trim() && key.includes('+')) throw new Error(`iOS keyboardPress does not support key combinations: ${JSON.stringify(key)}`);
273
280
  if ('Enter' === key || 'Return' === key || 'return' === key) {
274
281
  debugIOS('Handling Enter/Return key for iOS');
275
282
  await this.makeRequest('POST', `/session/${this.sessionId}/wda/keys`, {
@@ -1220,18 +1227,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
1220
1227
  await this.wdaBackend.pressHomeButton();
1221
1228
  }
1222
1229
  async appSwitcher() {
1223
- try {
1224
- debugDevice('Triggering app switcher with slow swipe up gesture');
1225
- const { width, height } = await this.size();
1226
- const centerX = Math.round(width / 2);
1227
- const startY = Math.round(height - 5);
1228
- const endY = Math.round(0.5 * height);
1229
- await this.wdaBackend.swipe(centerX, startY, centerX, endY, 1500);
1230
- await sleep(800);
1231
- } catch (error) {
1232
- debugDevice(`App switcher failed: ${error}`);
1233
- throw new Error(`Failed to trigger app switcher: ${error}`);
1234
- }
1230
+ await this.wdaBackend.appSwitcher();
1235
1231
  }
1236
1232
  async hideKeyboard(keyNames) {
1237
1233
  try {
@@ -1626,7 +1622,7 @@ class IOSMidsceneTools extends BaseMidsceneTools {
1626
1622
  const tools = new IOSMidsceneTools();
1627
1623
  runToolsCLI(tools, 'midscene-ios', {
1628
1624
  stripPrefix: 'ios_',
1629
- version: "1.10.11",
1625
+ version: "1.10.12-beta-20260812055946.0",
1630
1626
  extraCommands: createReportCliCommands()
1631
1627
  }).catch((e)=>{
1632
1628
  process.exit(reportCLIError(e));
package/dist/es/index.mjs CHANGED
@@ -77,11 +77,17 @@ class IOSWebDriverClient extends WebDriverClient {
77
77
  this.ensureSession();
78
78
  try {
79
79
  const windowSize = await this.getWindowSize();
80
- debugIOS('Triggering app switcher with slow swipe up gesture');
81
- const centerX = windowSize.width / 2;
82
- const startY = windowSize.height - 5;
83
- const endY = 0.5 * windowSize.height;
84
- await this.swipe(centerX, startY, centerX, endY, 1500);
80
+ const centerX = Math.round(windowSize.width / 2);
81
+ const startY = Math.max(0, windowSize.height - 1);
82
+ const endY = Math.round(0.5 * windowSize.height);
83
+ debugIOS('Triggering app switcher with native WDA drag gesture');
84
+ await this.makeRequest('POST', `/session/${this.sessionId}/wda/dragfromtoforduration`, {
85
+ fromX: centerX,
86
+ fromY: startY,
87
+ toX: centerX,
88
+ toY: endY,
89
+ duration: 1
90
+ });
85
91
  await new Promise((resolve)=>setTimeout(resolve, 800));
86
92
  } catch (error) {
87
93
  debugIOS(`App switcher failed: ${error}`);
@@ -91,6 +97,7 @@ class IOSWebDriverClient extends WebDriverClient {
91
97
  async pressKey(key) {
92
98
  this.ensureSession();
93
99
  debugIOS(`Attempting to press key: ${key}`);
100
+ if ('+' !== key.trim() && key.includes('+')) throw new Error(`iOS keyboardPress does not support key combinations: ${JSON.stringify(key)}`);
94
101
  if ('Enter' === key || 'Return' === key || 'return' === key) {
95
102
  debugIOS('Handling Enter/Return key for iOS');
96
103
  await this.makeRequest('POST', `/session/${this.sessionId}/wda/keys`, {
@@ -1041,18 +1048,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
1041
1048
  await this.wdaBackend.pressHomeButton();
1042
1049
  }
1043
1050
  async appSwitcher() {
1044
- try {
1045
- debugDevice('Triggering app switcher with slow swipe up gesture');
1046
- const { width, height } = await this.size();
1047
- const centerX = Math.round(width / 2);
1048
- const startY = Math.round(height - 5);
1049
- const endY = Math.round(0.5 * height);
1050
- await this.wdaBackend.swipe(centerX, startY, centerX, endY, 1500);
1051
- await sleep(800);
1052
- } catch (error) {
1053
- debugDevice(`App switcher failed: ${error}`);
1054
- throw new Error(`Failed to trigger app switcher: ${error}`);
1055
- }
1051
+ await this.wdaBackend.appSwitcher();
1056
1052
  }
1057
1053
  async hideKeyboard(keyNames) {
1058
1054
  try {
package/dist/lib/bin.js CHANGED
@@ -281,11 +281,17 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
281
281
  this.ensureSession();
282
282
  try {
283
283
  const windowSize = await this.getWindowSize();
284
- debugIOS('Triggering app switcher with slow swipe up gesture');
285
- const centerX = windowSize.width / 2;
286
- const startY = windowSize.height - 5;
287
- const endY = 0.5 * windowSize.height;
288
- await this.swipe(centerX, startY, centerX, endY, 1500);
284
+ const centerX = Math.round(windowSize.width / 2);
285
+ const startY = Math.max(0, windowSize.height - 1);
286
+ const endY = Math.round(0.5 * windowSize.height);
287
+ debugIOS('Triggering app switcher with native WDA drag gesture');
288
+ await this.makeRequest('POST', `/session/${this.sessionId}/wda/dragfromtoforduration`, {
289
+ fromX: centerX,
290
+ fromY: startY,
291
+ toX: centerX,
292
+ toY: endY,
293
+ duration: 1
294
+ });
289
295
  await new Promise((resolve)=>setTimeout(resolve, 800));
290
296
  } catch (error) {
291
297
  debugIOS(`App switcher failed: ${error}`);
@@ -295,6 +301,7 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
295
301
  async pressKey(key) {
296
302
  this.ensureSession();
297
303
  debugIOS(`Attempting to press key: ${key}`);
304
+ if ('+' !== key.trim() && key.includes('+')) throw new Error(`iOS keyboardPress does not support key combinations: ${JSON.stringify(key)}`);
298
305
  if ('Enter' === key || 'Return' === key || 'return' === key) {
299
306
  debugIOS('Handling Enter/Return key for iOS');
300
307
  await this.makeRequest('POST', `/session/${this.sessionId}/wda/keys`, {
@@ -1245,18 +1252,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
1245
1252
  await this.wdaBackend.pressHomeButton();
1246
1253
  }
1247
1254
  async appSwitcher() {
1248
- try {
1249
- debugDevice('Triggering app switcher with slow swipe up gesture');
1250
- const { width, height } = await this.size();
1251
- const centerX = Math.round(width / 2);
1252
- const startY = Math.round(height - 5);
1253
- const endY = Math.round(0.5 * height);
1254
- await this.wdaBackend.swipe(centerX, startY, centerX, endY, 1500);
1255
- await (0, core_utils_namespaceObject.sleep)(800);
1256
- } catch (error) {
1257
- debugDevice(`App switcher failed: ${error}`);
1258
- throw new Error(`Failed to trigger app switcher: ${error}`);
1259
- }
1255
+ await this.wdaBackend.appSwitcher();
1260
1256
  }
1261
1257
  async hideKeyboard(keyNames) {
1262
1258
  try {
package/dist/lib/cli.js CHANGED
@@ -280,11 +280,17 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
280
280
  this.ensureSession();
281
281
  try {
282
282
  const windowSize = await this.getWindowSize();
283
- debugIOS('Triggering app switcher with slow swipe up gesture');
284
- const centerX = windowSize.width / 2;
285
- const startY = windowSize.height - 5;
286
- const endY = 0.5 * windowSize.height;
287
- await this.swipe(centerX, startY, centerX, endY, 1500);
283
+ const centerX = Math.round(windowSize.width / 2);
284
+ const startY = Math.max(0, windowSize.height - 1);
285
+ const endY = Math.round(0.5 * windowSize.height);
286
+ debugIOS('Triggering app switcher with native WDA drag gesture');
287
+ await this.makeRequest('POST', `/session/${this.sessionId}/wda/dragfromtoforduration`, {
288
+ fromX: centerX,
289
+ fromY: startY,
290
+ toX: centerX,
291
+ toY: endY,
292
+ duration: 1
293
+ });
288
294
  await new Promise((resolve)=>setTimeout(resolve, 800));
289
295
  } catch (error) {
290
296
  debugIOS(`App switcher failed: ${error}`);
@@ -294,6 +300,7 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
294
300
  async pressKey(key) {
295
301
  this.ensureSession();
296
302
  debugIOS(`Attempting to press key: ${key}`);
303
+ if ('+' !== key.trim() && key.includes('+')) throw new Error(`iOS keyboardPress does not support key combinations: ${JSON.stringify(key)}`);
297
304
  if ('Enter' === key || 'Return' === key || 'return' === key) {
298
305
  debugIOS('Handling Enter/Return key for iOS');
299
306
  await this.makeRequest('POST', `/session/${this.sessionId}/wda/keys`, {
@@ -1244,18 +1251,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
1244
1251
  await this.wdaBackend.pressHomeButton();
1245
1252
  }
1246
1253
  async appSwitcher() {
1247
- try {
1248
- debugDevice('Triggering app switcher with slow swipe up gesture');
1249
- const { width, height } = await this.size();
1250
- const centerX = Math.round(width / 2);
1251
- const startY = Math.round(height - 5);
1252
- const endY = Math.round(0.5 * height);
1253
- await this.wdaBackend.swipe(centerX, startY, centerX, endY, 1500);
1254
- await (0, core_utils_namespaceObject.sleep)(800);
1255
- } catch (error) {
1256
- debugDevice(`App switcher failed: ${error}`);
1257
- throw new Error(`Failed to trigger app switcher: ${error}`);
1258
- }
1254
+ await this.wdaBackend.appSwitcher();
1259
1255
  }
1260
1256
  async hideKeyboard(keyNames) {
1261
1257
  try {
@@ -1650,7 +1646,7 @@ class IOSMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools {
1650
1646
  const tools = new IOSMidsceneTools();
1651
1647
  (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-ios', {
1652
1648
  stripPrefix: 'ios_',
1653
- version: "1.10.11",
1649
+ version: "1.10.12-beta-20260812055946.0",
1654
1650
  extraCommands: (0, core_namespaceObject.createReportCliCommands)()
1655
1651
  }).catch((e)=>{
1656
1652
  process.exit((0, cli_namespaceObject.reportCLIError)(e));
package/dist/lib/index.js CHANGED
@@ -112,11 +112,17 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
112
112
  this.ensureSession();
113
113
  try {
114
114
  const windowSize = await this.getWindowSize();
115
- debugIOS('Triggering app switcher with slow swipe up gesture');
116
- const centerX = windowSize.width / 2;
117
- const startY = windowSize.height - 5;
118
- const endY = 0.5 * windowSize.height;
119
- await this.swipe(centerX, startY, centerX, endY, 1500);
115
+ const centerX = Math.round(windowSize.width / 2);
116
+ const startY = Math.max(0, windowSize.height - 1);
117
+ const endY = Math.round(0.5 * windowSize.height);
118
+ debugIOS('Triggering app switcher with native WDA drag gesture');
119
+ await this.makeRequest('POST', `/session/${this.sessionId}/wda/dragfromtoforduration`, {
120
+ fromX: centerX,
121
+ fromY: startY,
122
+ toX: centerX,
123
+ toY: endY,
124
+ duration: 1
125
+ });
120
126
  await new Promise((resolve)=>setTimeout(resolve, 800));
121
127
  } catch (error) {
122
128
  debugIOS(`App switcher failed: ${error}`);
@@ -126,6 +132,7 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
126
132
  async pressKey(key) {
127
133
  this.ensureSession();
128
134
  debugIOS(`Attempting to press key: ${key}`);
135
+ if ('+' !== key.trim() && key.includes('+')) throw new Error(`iOS keyboardPress does not support key combinations: ${JSON.stringify(key)}`);
129
136
  if ('Enter' === key || 'Return' === key || 'return' === key) {
130
137
  debugIOS('Handling Enter/Return key for iOS');
131
138
  await this.makeRequest('POST', `/session/${this.sessionId}/wda/keys`, {
@@ -1076,18 +1083,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
1076
1083
  await this.wdaBackend.pressHomeButton();
1077
1084
  }
1078
1085
  async appSwitcher() {
1079
- try {
1080
- debugDevice('Triggering app switcher with slow swipe up gesture');
1081
- const { width, height } = await this.size();
1082
- const centerX = Math.round(width / 2);
1083
- const startY = Math.round(height - 5);
1084
- const endY = Math.round(0.5 * height);
1085
- await this.wdaBackend.swipe(centerX, startY, centerX, endY, 1500);
1086
- await (0, utils_namespaceObject.sleep)(800);
1087
- } catch (error) {
1088
- debugDevice(`App switcher failed: ${error}`);
1089
- throw new Error(`Failed to trigger app switcher: ${error}`);
1090
- }
1086
+ await this.wdaBackend.appSwitcher();
1091
1087
  }
1092
1088
  async hideKeyboard(keyNames) {
1093
1089
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/ios",
3
- "version": "1.10.11",
3
+ "version": "1.10.12-beta-20260812055946.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -43,10 +43,10 @@
43
43
  "dependencies": {
44
44
  "@inquirer/prompts": "^7.8.6",
45
45
  "open": "10.1.0",
46
- "@midscene/core": "1.10.11",
47
- "@midscene/shared": "1.10.11",
48
- "@midscene/playground": "1.10.11",
49
- "@midscene/webdriver": "1.10.11"
46
+ "@midscene/core": "1.10.12-beta-20260812055946.0",
47
+ "@midscene/webdriver": "1.10.12-beta-20260812055946.0",
48
+ "@midscene/shared": "1.10.12-beta-20260812055946.0",
49
+ "@midscene/playground": "1.10.12-beta-20260812055946.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@rslib/core": "^0.18.3",
package/static/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.8bb5dc6e.js"></script><script defer src="/static/js/226.e0976a0a.js"></script><script defer src="/static/js/index.277018ac.js"></script><link href="/static/css/index.1e8e86da.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.8bb5dc6e.js"></script><script defer src="/static/js/226.e0976a0a.js"></script><script defer src="/static/js/index.fbf1ef67.js"></script><link href="/static/css/index.1e8e86da.css" rel="stylesheet"></head><body><div id="root"></div></body></html>