@midscene/cli 1.12.9 → 1.12.10-beta-20260918062325.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/framework/index.mjs +20 -5
- package/dist/es/framework/index.mjs.map +1 -1
- package/dist/es/index.mjs +33 -9
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/framework/index.js +20 -5
- package/dist/lib/framework/index.js.map +1 -1
- package/dist/lib/index.js +33 -9
- package/dist/lib/index.js.map +1 -1
- package/dist/types/framework/index.d.ts +2 -0
- package/package.json +8 -8
package/dist/es/index.mjs
CHANGED
|
@@ -3025,9 +3025,7 @@ var __webpack_modules__ = {
|
|
|
3025
3025
|
module.exports = (string, columns, options)=>String(string).normalize().replace(/\r\n/g, '\n').split('\n').map((line)=>exec(line, columns, options)).join('\n');
|
|
3026
3026
|
},
|
|
3027
3027
|
"./src/index.ts" (__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
3028
|
-
var package_namespaceObject = {
|
|
3029
|
-
rE: "1.12.9"
|
|
3030
|
-
};
|
|
3028
|
+
var package_namespaceObject = JSON.parse('{"rE":"1.12.10-beta-20260918062325.0"}');
|
|
3031
3029
|
var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
|
|
3032
3030
|
const MAX_PATTERN_LENGTH = 65536;
|
|
3033
3031
|
const assertValidPattern = (pattern)=>{
|
|
@@ -8607,6 +8605,7 @@ var __webpack_modules__ = {
|
|
|
8607
8605
|
continueOnError: false,
|
|
8608
8606
|
retry: 0,
|
|
8609
8607
|
shareBrowserContext: false,
|
|
8608
|
+
reusePage: false,
|
|
8610
8609
|
headed: false,
|
|
8611
8610
|
keepWindow: false,
|
|
8612
8611
|
dotenvOverride: false,
|
|
@@ -8681,6 +8680,10 @@ Usage:
|
|
|
8681
8680
|
type: 'boolean',
|
|
8682
8681
|
description: `Share a Puppeteer Web browser context across multiple yaml files, default is ${config_options_defaultConfig.shareBrowserContext}`
|
|
8683
8682
|
},
|
|
8683
|
+
'reuse-page': {
|
|
8684
|
+
type: 'boolean',
|
|
8685
|
+
description: `Reuse one Puppeteer Web page across sequential yaml files; requires --share-browser-context and --concurrent 1, default is ${config_options_defaultConfig.reusePage}`
|
|
8686
|
+
},
|
|
8684
8687
|
'dotenv-override': {
|
|
8685
8688
|
type: 'boolean',
|
|
8686
8689
|
description: `Whether the variables in the .env file override the global variables, the default is ${config_options_defaultConfig.dotenvOverride}`
|
|
@@ -8693,7 +8696,7 @@ Usage:
|
|
|
8693
8696
|
type: 'boolean',
|
|
8694
8697
|
description: 'Whether to dismiss the HarmonyOS keyboard after text input'
|
|
8695
8698
|
}
|
|
8696
|
-
}).version('version', 'Show version number', "1.12.
|
|
8699
|
+
}).version('version', 'Show version number', "1.12.10-beta-20260918062325.0").help().epilogue(`For complete list of configuration options, please visit:
|
|
8697
8700
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
8698
8701
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
8699
8702
|
• HarmonyOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-harmony-part
|
|
@@ -10866,6 +10869,7 @@ Examples:
|
|
|
10866
10869
|
retry: configYaml.retry ?? config_options_defaultConfig.retry,
|
|
10867
10870
|
summary: configYaml.summary ?? defaultSummary,
|
|
10868
10871
|
shareBrowserContext: configYaml.shareBrowserContext ?? config_options_defaultConfig.shareBrowserContext,
|
|
10872
|
+
reusePage: configYaml.reusePage ?? config_options_defaultConfig.reusePage,
|
|
10869
10873
|
patterns: configYaml.files,
|
|
10870
10874
|
files,
|
|
10871
10875
|
setup,
|
|
@@ -10893,6 +10897,7 @@ Examples:
|
|
|
10893
10897
|
setup = await resolveSetupFile(options.setup, basePath);
|
|
10894
10898
|
}
|
|
10895
10899
|
const shareBrowserContext = options?.shareBrowserContext ?? parsedConfig.shareBrowserContext;
|
|
10900
|
+
const reusePage = options?.reusePage ?? parsedConfig.reusePage;
|
|
10896
10901
|
return {
|
|
10897
10902
|
files,
|
|
10898
10903
|
setup,
|
|
@@ -10901,6 +10906,7 @@ Examples:
|
|
|
10901
10906
|
retry: options?.retry ?? parsedConfig.retry,
|
|
10902
10907
|
summary: options?.summary ?? parsedConfig.summary,
|
|
10903
10908
|
shareBrowserContext,
|
|
10909
|
+
reusePage,
|
|
10904
10910
|
headed: finalHeaded,
|
|
10905
10911
|
keepWindow: keepWindow,
|
|
10906
10912
|
dotenvOverride: options?.dotenvOverride ?? parsedConfig.dotenvOverride,
|
|
@@ -10917,6 +10923,7 @@ Examples:
|
|
|
10917
10923
|
const headed = options.headed ?? config_options_defaultConfig.headed;
|
|
10918
10924
|
const finalHeaded = keepWindow || headed;
|
|
10919
10925
|
const shareBrowserContext = options.shareBrowserContext ?? config_options_defaultConfig.shareBrowserContext;
|
|
10926
|
+
const reusePage = options.reusePage ?? config_options_defaultConfig.reusePage;
|
|
10920
10927
|
return {
|
|
10921
10928
|
files,
|
|
10922
10929
|
setup,
|
|
@@ -10925,6 +10932,7 @@ Examples:
|
|
|
10925
10932
|
retry: options.retry ?? config_options_defaultConfig.retry,
|
|
10926
10933
|
summary: options.summary ?? defaultSummary,
|
|
10927
10934
|
shareBrowserContext,
|
|
10935
|
+
reusePage,
|
|
10928
10936
|
headed: finalHeaded,
|
|
10929
10937
|
keepWindow: keepWindow,
|
|
10930
10938
|
dotenvOverride: options.dotenvOverride ?? config_options_defaultConfig.dotenvOverride,
|
|
@@ -11196,6 +11204,7 @@ Examples:
|
|
|
11196
11204
|
console.log(` Continue on error: ${config.continueOnError}`);
|
|
11197
11205
|
console.log(` Retry: ${config.retry ?? 0}`);
|
|
11198
11206
|
console.log(` Share browser context: ${config.shareBrowserContext ?? false}`);
|
|
11207
|
+
console.log(` Reuse browser page: ${config.reusePage ?? false}`);
|
|
11199
11208
|
console.log(` Summary output: ${config.summary}`);
|
|
11200
11209
|
}
|
|
11201
11210
|
function printExecutionFinished() {
|
|
@@ -12160,11 +12169,22 @@ Examples:
|
|
|
12160
12169
|
}
|
|
12161
12170
|
if (setupContext && !shareBrowserContext && 'puppeteer-web' === resolveBatchRuntimeTarget(setupContext.executionConfig)) throw new Error(`Puppeteer Web setup "${setupContext.file}" requires shareBrowserContext: true so its browser state can be shared with the main files.`);
|
|
12162
12171
|
};
|
|
12163
|
-
const createSharedBrowserRuntime = async (browser, browserContextOptions)=>{
|
|
12172
|
+
const createSharedBrowserRuntime = async (browser, browserContextOptions, reusePage = false)=>{
|
|
12164
12173
|
const browserContext = await browser.createBrowserContext(browserContextOptions);
|
|
12165
|
-
|
|
12166
|
-
browserContext
|
|
12167
|
-
|
|
12174
|
+
try {
|
|
12175
|
+
const page = reusePage ? await browserContext.newPage() : void 0;
|
|
12176
|
+
return {
|
|
12177
|
+
browserContext,
|
|
12178
|
+
page
|
|
12179
|
+
};
|
|
12180
|
+
} catch (error) {
|
|
12181
|
+
try {
|
|
12182
|
+
await browserContext.close();
|
|
12183
|
+
} catch (cleanupError) {
|
|
12184
|
+
batchWarning('failed to close the shared browser context after page creation failed; preserving the original error', cleanupError);
|
|
12185
|
+
}
|
|
12186
|
+
throw error;
|
|
12187
|
+
}
|
|
12168
12188
|
};
|
|
12169
12189
|
class YamlBatchExecutor {
|
|
12170
12190
|
async run(options = {}) {
|
|
@@ -12249,10 +12269,11 @@ Examples:
|
|
|
12249
12269
|
sharedRuntime.current = null;
|
|
12250
12270
|
await staleRuntime.browserContext.close();
|
|
12251
12271
|
}
|
|
12252
|
-
sharedRuntime.current = await createSharedBrowserRuntime(browser, browserContextOptions);
|
|
12272
|
+
sharedRuntime.current = await createSharedBrowserRuntime(browser, browserContextOptions, this.config.reusePage);
|
|
12253
12273
|
for (const context of allContexts){
|
|
12254
12274
|
context.options.browser = browser;
|
|
12255
12275
|
context.options.browserContext = sharedRuntime.current.browserContext;
|
|
12276
|
+
if (sharedRuntime.current.page) context.options.page = sharedRuntime.current.page;
|
|
12256
12277
|
}
|
|
12257
12278
|
};
|
|
12258
12279
|
await resetSetupRuntime();
|
|
@@ -12532,6 +12553,8 @@ Examples:
|
|
|
12532
12553
|
}, (_, index)=>`batch-occurrence-${index + 1}`);
|
|
12533
12554
|
if (this.caseIds.length !== occurrenceCount) throw new Error(`Batch occurrence identity mismatch: expected ${occurrenceCount} case ID(s), received ${this.caseIds.length}`);
|
|
12534
12555
|
if (new Set(this.caseIds).size !== this.caseIds.length) throw new Error('Batch occurrence case IDs must be unique');
|
|
12556
|
+
if (config.reusePage && !config.shareBrowserContext) throw new Error('reusePage requires shareBrowserContext: true');
|
|
12557
|
+
if (config.reusePage && 1 !== config.concurrent) throw new Error('reusePage requires concurrent: 1');
|
|
12535
12558
|
}
|
|
12536
12559
|
}
|
|
12537
12560
|
async function runYamlBatch(config, options = {}) {
|
|
@@ -13165,6 +13188,7 @@ defineYamlBatchTest(test, testOptions);
|
|
|
13165
13188
|
retry: options.retry,
|
|
13166
13189
|
summary: options.summary,
|
|
13167
13190
|
shareBrowserContext: options['share-browser-context'],
|
|
13191
|
+
reusePage: options['reuse-page'],
|
|
13168
13192
|
headed: options.headed,
|
|
13169
13193
|
keepWindow: options['keep-window'],
|
|
13170
13194
|
dotenvOverride: options['dotenv-override'],
|