@yoqa/runner 0.3.25 → 0.3.26

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.
Files changed (2) hide show
  1. package/dist/index.js +34 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16816,7 +16816,7 @@ function getCatalogDb() {
16816
16816
  // package.json
16817
16817
  var package_default = {
16818
16818
  name: "@yoqa/runner",
16819
- version: "0.3.25",
16819
+ version: "0.3.26",
16820
16820
  description: "Yoqa local runner \u2014 Appium + catalog HTTP API (Bun). Start with yoqa serve or the yoqa-runner bin.",
16821
16821
  license: "UNLICENSED",
16822
16822
  type: "module",
@@ -17591,6 +17591,38 @@ async function listDevices(platform, options = {}) {
17591
17591
  return listAndroidDevices(options);
17592
17592
  }
17593
17593
 
17594
+ // src/domains/devices/keyboard.ts
17595
+ function isUnsupportedCommandError(error) {
17596
+ const message = error instanceof Error ? error.message : String(error);
17597
+ return /unknown command|unknown method|not (yet )?(been )?implemented|not (yet )?supported|does not support/i.test(message);
17598
+ }
17599
+ function w3cKeyActions(text2) {
17600
+ const actions = [];
17601
+ for (const ch of text2) {
17602
+ actions.push({ type: "keyDown", value: ch }, { type: "keyUp", value: ch });
17603
+ }
17604
+ return [{ type: "key", id: "keyboard", actions }];
17605
+ }
17606
+ async function w3cType(browser, text2) {
17607
+ await browser.performActions(w3cKeyActions(text2));
17608
+ try {
17609
+ await browser.releaseActions();
17610
+ } catch {}
17611
+ }
17612
+ async function typeText(browser, text2) {
17613
+ if (text2.length === 0)
17614
+ return "noop";
17615
+ try {
17616
+ await browser.execute("mobile: type", { text: text2 });
17617
+ return "mobile";
17618
+ } catch (error) {
17619
+ if (!isUnsupportedCommandError(error))
17620
+ throw error;
17621
+ }
17622
+ await w3cType(browser, text2);
17623
+ return "w3c";
17624
+ }
17625
+
17594
17626
  // src/domains/devices/session.ts
17595
17627
  var YOQA_ROOT4 = join7(homedir6(), ".yoqa");
17596
17628
  var DEFAULT_MJPEG_PORT = Number(process.env.YOQA_MJPEG_PORT ?? "9100");
@@ -18087,7 +18119,7 @@ async function createDeviceSession(options) {
18087
18119
  const type = async (text2) => {
18088
18120
  await gate.withLock(async () => {
18089
18121
  await guard(async () => {
18090
- await browser.keys(text2.split(""));
18122
+ await typeText(browser, text2);
18091
18123
  });
18092
18124
  });
18093
18125
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoqa/runner",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "Yoqa local runner — Appium + catalog HTTP API (Bun). Start with yoqa serve or the yoqa-runner bin.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",