@midscene/cli 1.5.7 → 1.5.8-beta-20260324073120.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/index.mjs +53 -23
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/index.js +53 -23
- package/dist/lib/index.js.map +1 -1
- package/package.json +7 -7
package/dist/es/index.mjs
CHANGED
|
@@ -3022,9 +3022,7 @@ var __webpack_modules__ = {
|
|
|
3022
3022
|
"./src/index.ts" (__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
3023
3023
|
var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
|
|
3024
3024
|
var main_default = /*#__PURE__*/ __webpack_require__.n(main);
|
|
3025
|
-
var package_namespaceObject = {
|
|
3026
|
-
rE: "1.5.7"
|
|
3027
|
-
};
|
|
3025
|
+
var package_namespaceObject = JSON.parse('{"rE":"1.5.8-beta-20260324073120.0"}');
|
|
3028
3026
|
class Node {
|
|
3029
3027
|
value;
|
|
3030
3028
|
next;
|
|
@@ -3205,6 +3203,28 @@ var __webpack_modules__ = {
|
|
|
3205
3203
|
urlToVisit = webTarget.url.startsWith('/') ? `http://${serverAddress?.address}:${serverAddress?.port}${webTarget.url}` : `http://${serverAddress?.address}:${serverAddress?.port}/${webTarget.url}`;
|
|
3206
3204
|
webTarget.url = urlToVisit;
|
|
3207
3205
|
}
|
|
3206
|
+
if (webTarget.cdpEndpoint && webTarget.bridgeMode) throw new Error('cdpEndpoint and bridgeMode are mutually exclusive. Please specify only one.');
|
|
3207
|
+
if (webTarget.cdpEndpoint) {
|
|
3208
|
+
const cdpBrowser = options?.browser ?? await puppeteer.connect({
|
|
3209
|
+
browserWSEndpoint: webTarget.cdpEndpoint,
|
|
3210
|
+
defaultViewport: null
|
|
3211
|
+
});
|
|
3212
|
+
if (webTarget.chromeArgs) console.warn('chromeArgs are not supported in CDP mode (browser is already running). They will be ignored.');
|
|
3213
|
+
const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(webTarget, {
|
|
3214
|
+
...preference,
|
|
3215
|
+
...buildAgentOptions(clonedYamlScript.agent, preference.testId, fileName)
|
|
3216
|
+
}, cdpBrowser, options?.page);
|
|
3217
|
+
const cleanFreeFn = newFreeFn.filter((f)=>'puppeteer_browser' !== f.name);
|
|
3218
|
+
if (!options?.browser) cleanFreeFn.push({
|
|
3219
|
+
name: 'cdp_browser_disconnect',
|
|
3220
|
+
fn: ()=>cdpBrowser.disconnect()
|
|
3221
|
+
});
|
|
3222
|
+
freeFn.push(...cleanFreeFn);
|
|
3223
|
+
return {
|
|
3224
|
+
agent,
|
|
3225
|
+
freeFn
|
|
3226
|
+
};
|
|
3227
|
+
}
|
|
3208
3228
|
if (!webTarget.bridgeMode) {
|
|
3209
3229
|
const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(webTarget, {
|
|
3210
3230
|
...preference,
|
|
@@ -3774,25 +3794,31 @@ var __webpack_modules__ = {
|
|
|
3774
3794
|
const needsBrowser = fileContextList.some((ctx)=>Object.keys(ctx.executionConfig.web || ctx.executionConfig.target || {}).length > 0);
|
|
3775
3795
|
if (needsBrowser && this.config.shareBrowserContext) {
|
|
3776
3796
|
const globalWebConfig = this.config.globalConfig?.web;
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
userAgent: globalWebConfig?.userAgent,
|
|
3781
|
-
windowSize: headed ? {
|
|
3782
|
-
width,
|
|
3783
|
-
height
|
|
3784
|
-
} : void 0,
|
|
3785
|
-
chromeArgs: globalWebConfig?.chromeArgs
|
|
3786
|
-
});
|
|
3787
|
-
browser = await puppeteer.launch({
|
|
3788
|
-
headless: !headed,
|
|
3789
|
-
defaultViewport: headed ? null : {
|
|
3790
|
-
width,
|
|
3791
|
-
height
|
|
3792
|
-
},
|
|
3793
|
-
args,
|
|
3794
|
-
acceptInsecureCerts: globalWebConfig?.acceptInsecureCerts
|
|
3797
|
+
if (globalWebConfig?.cdpEndpoint) browser = await puppeteer.connect({
|
|
3798
|
+
browserWSEndpoint: globalWebConfig.cdpEndpoint,
|
|
3799
|
+
defaultViewport: null
|
|
3795
3800
|
});
|
|
3801
|
+
else {
|
|
3802
|
+
const width = globalWebConfig?.viewportWidth ?? defaultViewportWidth;
|
|
3803
|
+
const height = globalWebConfig?.viewportHeight ?? defaultViewportHeight;
|
|
3804
|
+
const args = buildChromeArgs({
|
|
3805
|
+
userAgent: globalWebConfig?.userAgent,
|
|
3806
|
+
windowSize: headed ? {
|
|
3807
|
+
width,
|
|
3808
|
+
height
|
|
3809
|
+
} : void 0,
|
|
3810
|
+
chromeArgs: globalWebConfig?.chromeArgs
|
|
3811
|
+
});
|
|
3812
|
+
browser = await puppeteer.launch({
|
|
3813
|
+
headless: !headed,
|
|
3814
|
+
defaultViewport: headed ? null : {
|
|
3815
|
+
width,
|
|
3816
|
+
height
|
|
3817
|
+
},
|
|
3818
|
+
args,
|
|
3819
|
+
acceptInsecureCerts: globalWebConfig?.acceptInsecureCerts
|
|
3820
|
+
});
|
|
3821
|
+
}
|
|
3796
3822
|
sharedPage = await browser.newPage();
|
|
3797
3823
|
for (const context of fileContextList){
|
|
3798
3824
|
context.options.browser = browser;
|
|
@@ -3802,7 +3828,11 @@ var __webpack_modules__ = {
|
|
|
3802
3828
|
const { executedResults, notExecutedContexts } = await this.executeFiles(fileContextList);
|
|
3803
3829
|
this.results = await this.processResults(executedResults, notExecutedContexts);
|
|
3804
3830
|
} finally{
|
|
3805
|
-
if (browser && !this.config.keepWindow)
|
|
3831
|
+
if (browser && !this.config.keepWindow) {
|
|
3832
|
+
const isCdp = !!this.config.globalConfig?.web?.cdpEndpoint;
|
|
3833
|
+
if (isCdp) browser.disconnect();
|
|
3834
|
+
else await browser.close();
|
|
3835
|
+
}
|
|
3806
3836
|
await this.generateOutputIndex();
|
|
3807
3837
|
}
|
|
3808
3838
|
return this.results;
|
|
@@ -11925,7 +11955,7 @@ Usage:
|
|
|
11925
11955
|
type: 'boolean',
|
|
11926
11956
|
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}`
|
|
11927
11957
|
}
|
|
11928
|
-
}).version('version', 'Show version number', "1.5.
|
|
11958
|
+
}).version('version', 'Show version number', "1.5.8-beta-20260324073120.0").help().epilogue(`For complete list of configuration options, please visit:
|
|
11929
11959
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
11930
11960
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
11931
11961
|
• iOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-ios-part
|