@validate.qa/runner 1.0.8 → 1.0.9

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 (3) hide show
  1. package/dist/cli.js +43 -12
  2. package/dist/cli.mjs +43 -12
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -12038,7 +12038,7 @@ var require_kill_tree = __commonJS({
12038
12038
  var node_child_process_1 = require("child_process");
12039
12039
  var node_util_1 = require("util");
12040
12040
  var node_fs_1 = require("fs");
12041
- var execFileAsync2 = (0, node_util_1.promisify)(node_child_process_1.execFile);
12041
+ var execFileAsync3 = (0, node_util_1.promisify)(node_child_process_1.execFile);
12042
12042
  var PS_TIMEOUT_MS = 2e3;
12043
12043
  var PS_BUFFER = 1024 * 1024;
12044
12044
  async function gracefulCloseWithTreeKill(options) {
@@ -12092,7 +12092,7 @@ var require_kill_tree = __commonJS({
12092
12092
  timer.unref?.();
12093
12093
  let stdout;
12094
12094
  try {
12095
- const result = await execFileAsync2("ps", ["-A", "-o", "pid=,ppid=,command="], {
12095
+ const result = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid=,command="], {
12096
12096
  maxBuffer: PS_BUFFER,
12097
12097
  signal: controller.signal
12098
12098
  });
@@ -12130,7 +12130,7 @@ var require_kill_tree = __commonJS({
12130
12130
  timer.unref?.();
12131
12131
  let stdout;
12132
12132
  try {
12133
- const result = await execFileAsync2("ps", ["-A", "-o", "pid=,ppid=,command="], {
12133
+ const result = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid=,command="], {
12134
12134
  maxBuffer: PS_BUFFER,
12135
12135
  signal: controller.signal
12136
12136
  });
@@ -12207,7 +12207,7 @@ var require_kill_tree = __commonJS({
12207
12207
  timer.unref?.();
12208
12208
  let stdout;
12209
12209
  try {
12210
- const result = await execFileAsync2("ps", ["-A", "-o", "pid=,ppid="], {
12210
+ const result = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid="], {
12211
12211
  maxBuffer: PS_BUFFER,
12212
12212
  signal: controller.signal
12213
12213
  });
@@ -321095,7 +321095,7 @@ var require_update = __commonJS({
321095
321095
  var require_opts_arg = __commonJS({
321096
321096
  "../../node_modules/tar/node_modules/mkdirp/lib/opts-arg.js"(exports2, module2) {
321097
321097
  "use strict";
321098
- var { promisify: promisify2 } = require("util");
321098
+ var { promisify: promisify3 } = require("util");
321099
321099
  var fs = require("fs");
321100
321100
  var optsArg = (opts) => {
321101
321101
  if (!opts)
@@ -321109,9 +321109,9 @@ var require_opts_arg = __commonJS({
321109
321109
  else
321110
321110
  throw new TypeError("invalid options argument");
321111
321111
  opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir;
321112
- opts.mkdirAsync = promisify2(opts.mkdir);
321112
+ opts.mkdirAsync = promisify3(opts.mkdir);
321113
321113
  opts.stat = opts.stat || opts.fs.stat || fs.stat;
321114
- opts.statAsync = promisify2(opts.stat);
321114
+ opts.statAsync = promisify3(opts.stat);
321115
321115
  opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync;
321116
321116
  opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync;
321117
321117
  return opts;
@@ -325204,7 +325204,7 @@ var require_process_inventory = __commonJS({
325204
325204
  var node_child_process_1 = require("child_process");
325205
325205
  var node_os_1 = __importDefault(require("os"));
325206
325206
  var node_util_1 = require("util");
325207
- var execFileAsync2 = (0, node_util_1.promisify)(node_child_process_1.execFile);
325207
+ var execFileAsync3 = (0, node_util_1.promisify)(node_child_process_1.execFile);
325208
325208
  var DEFAULT_LIMIT = 60;
325209
325209
  var DEFAULT_TIMEOUT_MS = 800;
325210
325210
  var MAX_COMMAND_LENGTH = 320;
@@ -325266,7 +325266,7 @@ var require_process_inventory = __commonJS({
325266
325266
  const timer = setTimeout(() => controller.abort(), timeoutMs);
325267
325267
  timer.unref?.();
325268
325268
  try {
325269
- const { stdout } = await execFileAsync2(command, args, {
325269
+ const { stdout } = await execFileAsync3(command, args, {
325270
325270
  maxBuffer: 1024 * 1024,
325271
325271
  signal: controller.signal
325272
325272
  });
@@ -326288,7 +326288,7 @@ var require_package4 = __commonJS({
326288
326288
  "package.json"(exports2, module2) {
326289
326289
  module2.exports = {
326290
326290
  name: "@validate.qa/runner",
326291
- version: "1.0.8",
326291
+ version: "1.0.9",
326292
326292
  description: "validate local test runner - execute Playwright tests on your machine, connected to validate.qa cloud.",
326293
326293
  bin: {
326294
326294
  "validate-runner": "dist/cli.js"
@@ -326421,6 +326421,8 @@ function shouldUseAuthState(tags, playwrightCode) {
326421
326421
 
326422
326422
  // src/services/appium-executor.ts
326423
326423
  init_dist();
326424
+ var import_node_child_process2 = require("child_process");
326425
+ var import_node_util2 = require("util");
326424
326426
  var import_runner_core8 = __toESM(require_dist2());
326425
326427
 
326426
326428
  // src/services/appium-lifecycle.ts
@@ -327601,6 +327603,7 @@ async function startMobileNetworkCapture(options) {
327601
327603
 
327602
327604
  // src/services/appium-executor.ts
327603
327605
  var DEFAULT_STEP_TIMEOUT_MS = 1e4;
327606
+ var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
327604
327607
  var WebDriverTransportError = class extends Error {
327605
327608
  isTransport = true;
327606
327609
  constructor(message) {
@@ -327922,6 +327925,18 @@ async function sendKeysToFocusedInput(sessionId, value) {
327922
327925
  body: JSON.stringify({ text: value, value: Array.from(value) })
327923
327926
  });
327924
327927
  }
327928
+ function encodeAndroidInputText(value) {
327929
+ return value.replace(/%/g, "%25").replace(/\s/g, "%s");
327930
+ }
327931
+ async function sendAndroidTextToFocusedInput(deviceId, value) {
327932
+ if (!deviceId) {
327933
+ throw new Error("Android keyboard fallback requires a device id");
327934
+ }
327935
+ await execFileAsync2("adb", ["-s", deviceId, "shell", "input", "text", encodeAndroidInputText(value)], {
327936
+ timeout: 1e4,
327937
+ windowsHide: true
327938
+ });
327939
+ }
327925
327940
  async function trySendElementValue(sessionId, elementId, value) {
327926
327941
  try {
327927
327942
  await wdRequest(`/session/${sessionId}/element/${elementId}/value`, {
@@ -327970,7 +327985,7 @@ async function executeTap(sessionId, step) {
327970
327985
  }
327971
327986
  await tapCoordinates(sessionId, bounds);
327972
327987
  }
327973
- async function executeType(sessionId, step) {
327988
+ async function executeType(sessionId, step, context) {
327974
327989
  if (step.value === void 0 || step.value === null || step.value === "") return;
327975
327990
  const value = String(step.value);
327976
327991
  const bounds = boundsFromStep(step);
@@ -328019,6 +328034,7 @@ async function executeType(sessionId, step) {
328019
328034
  if (bounds) {
328020
328035
  if (!tappedBounds) {
328021
328036
  await tapCoordinates(sessionId, bounds);
328037
+ tappedBounds = true;
328022
328038
  await new Promise((resolve) => setTimeout(resolve, MOBILE_FOCUS_SETTLE_MS));
328023
328039
  }
328024
328040
  try {
@@ -328029,6 +328045,17 @@ async function executeType(sessionId, step) {
328029
328045
  lastInputError = error2;
328030
328046
  }
328031
328047
  }
328048
+ if (context.platform === "ANDROID" && tappedBounds) {
328049
+ try {
328050
+ context.log?.(" Appium active-element send failed; using Android focused-keyboard input fallback");
328051
+ await sendAndroidTextToFocusedInput(context.deviceId, value);
328052
+ await new Promise((resolve) => setTimeout(resolve, MOBILE_FOCUS_SETTLE_MS));
328053
+ return;
328054
+ } catch (error2) {
328055
+ if (isTransportError(error2)) throw error2;
328056
+ lastInputError = error2;
328057
+ }
328058
+ }
328032
328059
  throw new Error(`TYPE step could not send text to the focused target${lastInputError instanceof Error ? `: ${lastInputError.message}` : ""}`);
328033
328060
  }
328034
328061
  async function executeClear(sessionId, step) {
@@ -328250,7 +328277,11 @@ async function executeMobileTest(options) {
328250
328277
  await executeTap(sessionId, step);
328251
328278
  break;
328252
328279
  case "type":
328253
- await executeType(sessionId, step);
328280
+ await executeType(sessionId, step, {
328281
+ platform: options.target.platform,
328282
+ deviceId: selectedDevice.id,
328283
+ log: log2
328284
+ });
328254
328285
  break;
328255
328286
  case "clear":
328256
328287
  await executeClear(sessionId, step);
package/dist/cli.mjs CHANGED
@@ -12043,7 +12043,7 @@ var require_kill_tree = __commonJS({
12043
12043
  var node_child_process_1 = __require("child_process");
12044
12044
  var node_util_1 = __require("util");
12045
12045
  var node_fs_1 = __require("fs");
12046
- var execFileAsync2 = (0, node_util_1.promisify)(node_child_process_1.execFile);
12046
+ var execFileAsync3 = (0, node_util_1.promisify)(node_child_process_1.execFile);
12047
12047
  var PS_TIMEOUT_MS = 2e3;
12048
12048
  var PS_BUFFER = 1024 * 1024;
12049
12049
  async function gracefulCloseWithTreeKill(options) {
@@ -12097,7 +12097,7 @@ var require_kill_tree = __commonJS({
12097
12097
  timer.unref?.();
12098
12098
  let stdout;
12099
12099
  try {
12100
- const result = await execFileAsync2("ps", ["-A", "-o", "pid=,ppid=,command="], {
12100
+ const result = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid=,command="], {
12101
12101
  maxBuffer: PS_BUFFER,
12102
12102
  signal: controller.signal
12103
12103
  });
@@ -12135,7 +12135,7 @@ var require_kill_tree = __commonJS({
12135
12135
  timer.unref?.();
12136
12136
  let stdout;
12137
12137
  try {
12138
- const result = await execFileAsync2("ps", ["-A", "-o", "pid=,ppid=,command="], {
12138
+ const result = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid=,command="], {
12139
12139
  maxBuffer: PS_BUFFER,
12140
12140
  signal: controller.signal
12141
12141
  });
@@ -12212,7 +12212,7 @@ var require_kill_tree = __commonJS({
12212
12212
  timer.unref?.();
12213
12213
  let stdout;
12214
12214
  try {
12215
- const result = await execFileAsync2("ps", ["-A", "-o", "pid=,ppid="], {
12215
+ const result = await execFileAsync3("ps", ["-A", "-o", "pid=,ppid="], {
12216
12216
  maxBuffer: PS_BUFFER,
12217
12217
  signal: controller.signal
12218
12218
  });
@@ -321100,7 +321100,7 @@ var require_update = __commonJS({
321100
321100
  var require_opts_arg = __commonJS({
321101
321101
  "../../node_modules/tar/node_modules/mkdirp/lib/opts-arg.js"(exports, module) {
321102
321102
  "use strict";
321103
- var { promisify: promisify2 } = __require("util");
321103
+ var { promisify: promisify3 } = __require("util");
321104
321104
  var fs = __require("fs");
321105
321105
  var optsArg = (opts) => {
321106
321106
  if (!opts)
@@ -321114,9 +321114,9 @@ var require_opts_arg = __commonJS({
321114
321114
  else
321115
321115
  throw new TypeError("invalid options argument");
321116
321116
  opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir;
321117
- opts.mkdirAsync = promisify2(opts.mkdir);
321117
+ opts.mkdirAsync = promisify3(opts.mkdir);
321118
321118
  opts.stat = opts.stat || opts.fs.stat || fs.stat;
321119
- opts.statAsync = promisify2(opts.stat);
321119
+ opts.statAsync = promisify3(opts.stat);
321120
321120
  opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync;
321121
321121
  opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync;
321122
321122
  return opts;
@@ -325209,7 +325209,7 @@ var require_process_inventory = __commonJS({
325209
325209
  var node_child_process_1 = __require("child_process");
325210
325210
  var node_os_1 = __importDefault(__require("os"));
325211
325211
  var node_util_1 = __require("util");
325212
- var execFileAsync2 = (0, node_util_1.promisify)(node_child_process_1.execFile);
325212
+ var execFileAsync3 = (0, node_util_1.promisify)(node_child_process_1.execFile);
325213
325213
  var DEFAULT_LIMIT = 60;
325214
325214
  var DEFAULT_TIMEOUT_MS = 800;
325215
325215
  var MAX_COMMAND_LENGTH = 320;
@@ -325271,7 +325271,7 @@ var require_process_inventory = __commonJS({
325271
325271
  const timer = setTimeout(() => controller.abort(), timeoutMs);
325272
325272
  timer.unref?.();
325273
325273
  try {
325274
- const { stdout } = await execFileAsync2(command, args, {
325274
+ const { stdout } = await execFileAsync3(command, args, {
325275
325275
  maxBuffer: 1024 * 1024,
325276
325276
  signal: controller.signal
325277
325277
  });
@@ -326293,7 +326293,7 @@ var require_package4 = __commonJS({
326293
326293
  "package.json"(exports, module) {
326294
326294
  module.exports = {
326295
326295
  name: "@validate.qa/runner",
326296
- version: "1.0.8",
326296
+ version: "1.0.9",
326297
326297
  description: "validate local test runner - execute Playwright tests on your machine, connected to validate.qa cloud.",
326298
326298
  bin: {
326299
326299
  "validate-runner": "dist/cli.js"
@@ -326427,6 +326427,8 @@ function shouldUseAuthState(tags, playwrightCode) {
326427
326427
  // src/services/appium-executor.ts
326428
326428
  init_dist();
326429
326429
  var import_runner_core8 = __toESM(require_dist2());
326430
+ import { execFile as execFile2 } from "child_process";
326431
+ import { promisify as promisify2 } from "util";
326430
326432
 
326431
326433
  // src/services/appium-lifecycle.ts
326432
326434
  import { spawn, execFileSync } from "child_process";
@@ -327609,6 +327611,7 @@ async function startMobileNetworkCapture(options) {
327609
327611
 
327610
327612
  // src/services/appium-executor.ts
327611
327613
  var DEFAULT_STEP_TIMEOUT_MS = 1e4;
327614
+ var execFileAsync2 = promisify2(execFile2);
327612
327615
  var WebDriverTransportError = class extends Error {
327613
327616
  isTransport = true;
327614
327617
  constructor(message) {
@@ -327930,6 +327933,18 @@ async function sendKeysToFocusedInput(sessionId, value) {
327930
327933
  body: JSON.stringify({ text: value, value: Array.from(value) })
327931
327934
  });
327932
327935
  }
327936
+ function encodeAndroidInputText(value) {
327937
+ return value.replace(/%/g, "%25").replace(/\s/g, "%s");
327938
+ }
327939
+ async function sendAndroidTextToFocusedInput(deviceId, value) {
327940
+ if (!deviceId) {
327941
+ throw new Error("Android keyboard fallback requires a device id");
327942
+ }
327943
+ await execFileAsync2("adb", ["-s", deviceId, "shell", "input", "text", encodeAndroidInputText(value)], {
327944
+ timeout: 1e4,
327945
+ windowsHide: true
327946
+ });
327947
+ }
327933
327948
  async function trySendElementValue(sessionId, elementId, value) {
327934
327949
  try {
327935
327950
  await wdRequest(`/session/${sessionId}/element/${elementId}/value`, {
@@ -327978,7 +327993,7 @@ async function executeTap(sessionId, step) {
327978
327993
  }
327979
327994
  await tapCoordinates(sessionId, bounds);
327980
327995
  }
327981
- async function executeType(sessionId, step) {
327996
+ async function executeType(sessionId, step, context) {
327982
327997
  if (step.value === void 0 || step.value === null || step.value === "") return;
327983
327998
  const value = String(step.value);
327984
327999
  const bounds = boundsFromStep(step);
@@ -328027,6 +328042,7 @@ async function executeType(sessionId, step) {
328027
328042
  if (bounds) {
328028
328043
  if (!tappedBounds) {
328029
328044
  await tapCoordinates(sessionId, bounds);
328045
+ tappedBounds = true;
328030
328046
  await new Promise((resolve) => setTimeout(resolve, MOBILE_FOCUS_SETTLE_MS));
328031
328047
  }
328032
328048
  try {
@@ -328037,6 +328053,17 @@ async function executeType(sessionId, step) {
328037
328053
  lastInputError = error2;
328038
328054
  }
328039
328055
  }
328056
+ if (context.platform === "ANDROID" && tappedBounds) {
328057
+ try {
328058
+ context.log?.(" Appium active-element send failed; using Android focused-keyboard input fallback");
328059
+ await sendAndroidTextToFocusedInput(context.deviceId, value);
328060
+ await new Promise((resolve) => setTimeout(resolve, MOBILE_FOCUS_SETTLE_MS));
328061
+ return;
328062
+ } catch (error2) {
328063
+ if (isTransportError(error2)) throw error2;
328064
+ lastInputError = error2;
328065
+ }
328066
+ }
328040
328067
  throw new Error(`TYPE step could not send text to the focused target${lastInputError instanceof Error ? `: ${lastInputError.message}` : ""}`);
328041
328068
  }
328042
328069
  async function executeClear(sessionId, step) {
@@ -328258,7 +328285,11 @@ async function executeMobileTest(options) {
328258
328285
  await executeTap(sessionId, step);
328259
328286
  break;
328260
328287
  case "type":
328261
- await executeType(sessionId, step);
328288
+ await executeType(sessionId, step, {
328289
+ platform: options.target.platform,
328290
+ deviceId: selectedDevice.id,
328291
+ log: log2
328292
+ });
328262
328293
  break;
328263
328294
  case "clear":
328264
328295
  await executeClear(sessionId, step);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@validate.qa/runner",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "validate local test runner - execute Playwright tests on your machine, connected to validate.qa cloud.",
5
5
  "bin": {
6
6
  "validate-runner": "dist/cli.js"