@midscene/cli 1.10.4-beta-20260710100314.0 → 1.10.4-beta-20260710115744.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/lib/index.js CHANGED
@@ -3416,9 +3416,10 @@ var __webpack_modules__ = {
3416
3416
  };
3417
3417
  const player = new yaml_.ScriptPlayer(clonedYamlScript, async ()=>{
3418
3418
  const freeFn = [];
3419
- const webTarget = clonedYamlScript.web || clonedYamlScript.target;
3419
+ const resolvedWebTarget = (0, yaml_.resolveWebTarget)(clonedYamlScript);
3420
+ const webTarget = resolvedWebTarget?.target;
3420
3421
  const targetCount = [
3421
- void 0 !== webTarget,
3422
+ void 0 !== resolvedWebTarget,
3422
3423
  void 0 !== clonedYamlScript.android,
3423
3424
  void 0 !== clonedYamlScript.ios,
3424
3425
  void 0 !== clonedYamlScript.harmony,
@@ -3427,17 +3428,17 @@ var __webpack_modules__ = {
3427
3428
  ].filter(Boolean).length;
3428
3429
  if (targetCount > 1) {
3429
3430
  const specifiedTargets = [
3430
- void 0 !== webTarget ? 'web' : null,
3431
+ resolvedWebTarget?.source ?? null,
3431
3432
  void 0 !== clonedYamlScript.android ? 'android' : null,
3432
3433
  void 0 !== clonedYamlScript.ios ? 'ios' : null,
3433
3434
  void 0 !== clonedYamlScript.harmony ? 'harmony' : null,
3434
3435
  void 0 !== clonedYamlScript.computer ? 'computer' : null,
3435
3436
  void 0 !== clonedYamlScript.interface ? 'interface' : null
3436
3437
  ].filter(Boolean);
3437
- throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, harmony, computer, or interface.`);
3438
+ throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: page, browser, web, android, ios, harmony, computer, or interface.`);
3438
3439
  }
3439
3440
  if (void 0 !== webTarget) {
3440
- if (void 0 !== clonedYamlScript.target) console.warn("target is deprecated, please use web instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.");
3441
+ if (resolvedWebTarget?.source === 'target') console.warn("target is deprecated, please use page or browser instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.");
3441
3442
  let localServer;
3442
3443
  let urlToVisit;
3443
3444
  if (webTarget.serve) {
@@ -3452,6 +3453,7 @@ var __webpack_modules__ = {
3452
3453
  webTarget.url = urlToVisit;
3453
3454
  }
3454
3455
  if (webTarget.cdpEndpoint && webTarget.bridgeMode) throw new Error('cdpEndpoint and bridgeMode are mutually exclusive. Please specify only one.');
3456
+ if ('browser' === webTarget.mode && webTarget.bridgeMode) throw new Error('[midscene] browser mode does not support bridgeMode. Use page: or web.mode: page for bridge mode.');
3455
3457
  if (webTarget.cdpEndpoint) {
3456
3458
  const cdpBrowser = options?.browser ?? await external_puppeteer_default().connect({
3457
3459
  browserWSEndpoint: webTarget.cdpEndpoint,
@@ -4096,9 +4098,9 @@ var __webpack_modules__ = {
4096
4098
  setupContext,
4097
4099
  ...fileContextList
4098
4100
  ] : fileContextList;
4099
- const needsBrowser = allContexts.some((ctx)=>Object.keys(ctx.executionConfig.web || ctx.executionConfig.target || {}).length > 0);
4101
+ const needsBrowser = allContexts.some((ctx)=>void 0 !== (0, yaml_.resolveWebTarget)(ctx.executionConfig));
4100
4102
  if (needsBrowser && this.config.shareBrowserContext) {
4101
- const globalWebConfig = this.config.globalConfig?.web;
4103
+ const globalWebConfig = (0, yaml_.resolveWebTarget)(this.config.globalConfig ?? {})?.target;
4102
4104
  if (globalWebConfig?.cdpEndpoint) browser = await external_puppeteer_default().connect({
4103
4105
  browserWSEndpoint: globalWebConfig.cdpEndpoint,
4104
4106
  defaultViewport: null,
@@ -4136,7 +4138,7 @@ var __webpack_modules__ = {
4136
4138
  this.results = await this.processResults(executedResults, notExecutedContexts);
4137
4139
  } finally{
4138
4140
  if (browser && !this.config.keepWindow) {
4139
- const isCdp = !!this.config.globalConfig?.web?.cdpEndpoint;
4141
+ const isCdp = !!(0, yaml_.resolveWebTarget)(this.config.globalConfig ?? {})?.target.cdpEndpoint;
4140
4142
  if (isCdp) browser.disconnect();
4141
4143
  else await browser.close();
4142
4144
  }
@@ -4147,20 +4149,6 @@ var __webpack_modules__ = {
4147
4149
  async createFileContext(file, fileConfig, options) {
4148
4150
  const { globalConfig } = this.config;
4149
4151
  const clonedFileConfig = JSON.parse(JSON.stringify(fileConfig));
4150
- if (clonedFileConfig.target) {
4151
- clonedFileConfig.web = {
4152
- ...clonedFileConfig.target,
4153
- ...clonedFileConfig.web
4154
- };
4155
- delete clonedFileConfig.target;
4156
- }
4157
- if (globalConfig?.target) {
4158
- globalConfig.web = {
4159
- ...globalConfig.target,
4160
- ...globalConfig.web
4161
- };
4162
- delete globalConfig.target;
4163
- }
4164
4152
  const executionConfig = external_lodash_merge_default()(clonedFileConfig, globalConfig);
4165
4153
  return {
4166
4154
  file,
@@ -4708,7 +4696,7 @@ defineYamlBatchTest(test, testOptions);
4708
4696
  "use strict";
4709
4697
  var core_ = __webpack_require__("@midscene/core");
4710
4698
  const cli_namespaceObject = require("@midscene/shared/cli");
4711
- var package_namespaceObject = JSON.parse('{"rE":"1.10.4-beta-20260710100314.0"}');
4699
+ var package_namespaceObject = JSON.parse('{"rE":"1.10.4-beta-20260710115744.0"}');
4712
4700
  var external_node_fs_ = __webpack_require__("node:fs");
4713
4701
  var external_node_fs_namespaceObject = /*#__PURE__*/ __webpack_require__.t(external_node_fs_, 2);
4714
4702
  var external_node_path_ = __webpack_require__("node:path");
@@ -12420,6 +12408,7 @@ defineYamlBatchTest(test, testOptions);
12420
12408
  throw new Error(`Failed to parse config YAML: ${error}`);
12421
12409
  }
12422
12410
  if (!configYaml?.files || !Array.isArray(configYaml?.files)) throw new Error('Config YAML must contain a "files" array');
12411
+ (0, yaml_.resolveWebTarget)(configYaml);
12423
12412
  const files = await expandFilePatterns(configYaml?.files, basePath);
12424
12413
  if (0 === files.length) throw new Error('No YAML files found matching the patterns in "files"');
12425
12414
  const setup = await resolveSetupFile(configYaml.setup, basePath);
@@ -12432,7 +12421,10 @@ defineYamlBatchTest(test, testOptions);
12432
12421
  retry: configYaml.retry ?? config_factory_defaultConfig.retry,
12433
12422
  summary: configYaml.summary ?? defaultSummary,
12434
12423
  shareBrowserContext: configYaml.shareBrowserContext ?? config_factory_defaultConfig.shareBrowserContext,
12424
+ page: configYaml.page,
12425
+ browser: configYaml.browser,
12435
12426
  web: configYaml.web,
12427
+ target: configYaml.target,
12436
12428
  android: configYaml.android,
12437
12429
  ios: configYaml.ios,
12438
12430
  patterns: configYaml.files,
@@ -12448,14 +12440,19 @@ defineYamlBatchTest(test, testOptions);
12448
12440
  async function createConfig(configYamlPath, options) {
12449
12441
  const parsedConfig = await parseConfigYaml(configYamlPath);
12450
12442
  const globalConfig = external_lodash_merge_default()({
12443
+ page: parsedConfig.page,
12444
+ browser: parsedConfig.browser,
12451
12445
  web: parsedConfig.web,
12452
12446
  android: parsedConfig.android,
12453
12447
  ios: parsedConfig.ios,
12454
12448
  target: parsedConfig.target
12455
12449
  }, {
12450
+ page: options?.page,
12451
+ browser: options?.browser,
12456
12452
  web: options?.web,
12457
12453
  android: options?.android,
12458
- ios: options?.ios
12454
+ ios: options?.ios,
12455
+ target: options?.target
12459
12456
  });
12460
12457
  const keepWindow = options?.keepWindow ?? parsedConfig.keepWindow;
12461
12458
  const headed = options?.headed ?? parsedConfig.headed;
@@ -12510,7 +12507,10 @@ defineYamlBatchTest(test, testOptions);
12510
12507
  dotenvOverride: options.dotenvOverride ?? config_factory_defaultConfig.dotenvOverride,
12511
12508
  dotenvDebug: options.dotenvDebug ?? config_factory_defaultConfig.dotenvDebug,
12512
12509
  globalConfig: {
12510
+ page: options.page,
12511
+ browser: options.browser,
12513
12512
  web: options.web,
12513
+ target: options.target,
12514
12514
  android: options.android,
12515
12515
  ios: options.ios
12516
12516
  }
@@ -12583,7 +12583,7 @@ Usage:
12583
12583
  type: 'boolean',
12584
12584
  description: `Turn on logging to help debug why certain keys or values are not being set as you expect, default is ${config_factory_defaultConfig.dotenvDebug}`
12585
12585
  }
12586
- }).version('version', 'Show version number', "1.10.4-beta-20260710100314.0").help().epilogue(`For complete list of configuration options, please visit:
12586
+ }).version('version', 'Show version number', "1.10.4-beta-20260710115744.0").help().epilogue(`For complete list of configuration options, please visit:
12587
12587
  • Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
12588
12588
  • Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
12589
12589
  • iOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-ios-part