@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
|
@@ -2720,6 +2720,7 @@ var __webpack_exports__ = {};
|
|
|
2720
2720
|
console.log(` Continue on error: ${config.continueOnError}`);
|
|
2721
2721
|
console.log(` Retry: ${config.retry ?? 0}`);
|
|
2722
2722
|
console.log(` Share browser context: ${config.shareBrowserContext ?? false}`);
|
|
2723
|
+
console.log(` Reuse browser page: ${config.reusePage ?? false}`);
|
|
2723
2724
|
console.log(` Summary output: ${config.summary}`);
|
|
2724
2725
|
}
|
|
2725
2726
|
function printExecutionFinished() {
|
|
@@ -3698,11 +3699,22 @@ var __webpack_exports__ = {};
|
|
|
3698
3699
|
}
|
|
3699
3700
|
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.`);
|
|
3700
3701
|
};
|
|
3701
|
-
const createSharedBrowserRuntime = async (browser, browserContextOptions)=>{
|
|
3702
|
+
const createSharedBrowserRuntime = async (browser, browserContextOptions, reusePage = false)=>{
|
|
3702
3703
|
const browserContext = await browser.createBrowserContext(browserContextOptions);
|
|
3703
|
-
|
|
3704
|
-
browserContext
|
|
3705
|
-
|
|
3704
|
+
try {
|
|
3705
|
+
const page = reusePage ? await browserContext.newPage() : void 0;
|
|
3706
|
+
return {
|
|
3707
|
+
browserContext,
|
|
3708
|
+
page
|
|
3709
|
+
};
|
|
3710
|
+
} catch (error) {
|
|
3711
|
+
try {
|
|
3712
|
+
await browserContext.close();
|
|
3713
|
+
} catch (cleanupError) {
|
|
3714
|
+
batchWarning('failed to close the shared browser context after page creation failed; preserving the original error', cleanupError);
|
|
3715
|
+
}
|
|
3716
|
+
throw error;
|
|
3717
|
+
}
|
|
3706
3718
|
};
|
|
3707
3719
|
class YamlBatchExecutor {
|
|
3708
3720
|
async run(options = {}) {
|
|
@@ -3787,10 +3799,11 @@ var __webpack_exports__ = {};
|
|
|
3787
3799
|
sharedRuntime.current = null;
|
|
3788
3800
|
await staleRuntime.browserContext.close();
|
|
3789
3801
|
}
|
|
3790
|
-
sharedRuntime.current = await createSharedBrowserRuntime(browser, browserContextOptions);
|
|
3802
|
+
sharedRuntime.current = await createSharedBrowserRuntime(browser, browserContextOptions, this.config.reusePage);
|
|
3791
3803
|
for (const context of allContexts){
|
|
3792
3804
|
context.options.browser = browser;
|
|
3793
3805
|
context.options.browserContext = sharedRuntime.current.browserContext;
|
|
3806
|
+
if (sharedRuntime.current.page) context.options.page = sharedRuntime.current.page;
|
|
3794
3807
|
}
|
|
3795
3808
|
};
|
|
3796
3809
|
await resetSetupRuntime();
|
|
@@ -4070,6 +4083,8 @@ var __webpack_exports__ = {};
|
|
|
4070
4083
|
}, (_, index)=>`batch-occurrence-${index + 1}`);
|
|
4071
4084
|
if (this.caseIds.length !== occurrenceCount) throw new Error(`Batch occurrence identity mismatch: expected ${occurrenceCount} case ID(s), received ${this.caseIds.length}`);
|
|
4072
4085
|
if (new Set(this.caseIds).size !== this.caseIds.length) throw new Error('Batch occurrence case IDs must be unique');
|
|
4086
|
+
if (config.reusePage && !config.shareBrowserContext) throw new Error('reusePage requires shareBrowserContext: true');
|
|
4087
|
+
if (config.reusePage && 1 !== config.concurrent) throw new Error('reusePage requires concurrent: 1');
|
|
4073
4088
|
}
|
|
4074
4089
|
}
|
|
4075
4090
|
async function runYamlBatch(config, options = {}) {
|