@midscene/cli 1.8.11 → 1.9.1-beta-20260605030300.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 +25 -5
- package/dist/es/framework/index.mjs.map +1 -1
- package/dist/es/index.mjs +5 -6
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/framework/index.js +24 -8
- package/dist/lib/framework/index.js.map +1 -1
- package/dist/lib/index.js +4 -9
- package/dist/lib/index.js.map +1 -1
- package/package.json +8 -7
|
@@ -2660,17 +2660,18 @@ function createRstestYamlProject(options) {
|
|
|
2660
2660
|
bail: options.bail
|
|
2661
2661
|
};
|
|
2662
2662
|
}
|
|
2663
|
-
const
|
|
2663
|
+
const requireFromCliPackage = ()=>{
|
|
2664
|
+
if ('undefined' != typeof __dirname) return createRequire(join(__dirname, 'index.js'));
|
|
2664
2665
|
const entry = process.argv[1] ? external_node_path_resolve(process.argv[1]) : join(process.cwd(), 'midscene-cli.js');
|
|
2665
2666
|
return createRequire(entry);
|
|
2666
2667
|
};
|
|
2667
2668
|
const resolvePackageFromRstestCore = (packageName)=>{
|
|
2668
|
-
const require =
|
|
2669
|
+
const require = requireFromCliPackage();
|
|
2669
2670
|
const rstestPackageJsonPath = require.resolve('@rstest/core/package.json');
|
|
2670
2671
|
return createRequire(rstestPackageJsonPath).resolve(packageName);
|
|
2671
2672
|
};
|
|
2672
2673
|
function resolveRstestCoreImportPath() {
|
|
2673
|
-
const require =
|
|
2674
|
+
const require = requireFromCliPackage();
|
|
2674
2675
|
const packageJsonPath = require.resolve('@rstest/core/package.json');
|
|
2675
2676
|
return join(dirname(packageJsonPath), 'dist', 'index.js');
|
|
2676
2677
|
}
|
|
@@ -2911,6 +2912,7 @@ async function createYamlPlayer(file, script, options) {
|
|
|
2911
2912
|
void 0 !== webTarget,
|
|
2912
2913
|
void 0 !== clonedYamlScript.android,
|
|
2913
2914
|
void 0 !== clonedYamlScript.ios,
|
|
2915
|
+
void 0 !== clonedYamlScript.harmony,
|
|
2914
2916
|
void 0 !== clonedYamlScript.computer,
|
|
2915
2917
|
void 0 !== clonedYamlScript.interface
|
|
2916
2918
|
].filter(Boolean).length;
|
|
@@ -2919,10 +2921,11 @@ async function createYamlPlayer(file, script, options) {
|
|
|
2919
2921
|
void 0 !== webTarget ? 'web' : null,
|
|
2920
2922
|
void 0 !== clonedYamlScript.android ? 'android' : null,
|
|
2921
2923
|
void 0 !== clonedYamlScript.ios ? 'ios' : null,
|
|
2924
|
+
void 0 !== clonedYamlScript.harmony ? 'harmony' : null,
|
|
2922
2925
|
void 0 !== clonedYamlScript.computer ? 'computer' : null,
|
|
2923
2926
|
void 0 !== clonedYamlScript.interface ? 'interface' : null
|
|
2924
2927
|
].filter(Boolean);
|
|
2925
|
-
throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, computer, or interface.`);
|
|
2928
|
+
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.`);
|
|
2926
2929
|
}
|
|
2927
2930
|
if (void 0 !== webTarget) {
|
|
2928
2931
|
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.");
|
|
@@ -3027,6 +3030,23 @@ async function createYamlPlayer(file, script, options) {
|
|
|
3027
3030
|
freeFn
|
|
3028
3031
|
};
|
|
3029
3032
|
}
|
|
3033
|
+
if (void 0 !== clonedYamlScript.harmony) {
|
|
3034
|
+
const harmonyTarget = clonedYamlScript.harmony;
|
|
3035
|
+
const { agentFromHdcDevice } = await import("@midscene/harmony");
|
|
3036
|
+
const agent = await agentFromHdcDevice(harmonyTarget?.deviceId, {
|
|
3037
|
+
...harmonyTarget,
|
|
3038
|
+
...buildAgentOptions(clonedYamlScript.agent, preference.reportFileName, fileName)
|
|
3039
|
+
});
|
|
3040
|
+
if (harmonyTarget?.launch) await agent.launch(harmonyTarget.launch);
|
|
3041
|
+
freeFn.push({
|
|
3042
|
+
name: 'destroy_harmony_agent',
|
|
3043
|
+
fn: ()=>agent.destroy()
|
|
3044
|
+
});
|
|
3045
|
+
return {
|
|
3046
|
+
agent,
|
|
3047
|
+
freeFn
|
|
3048
|
+
};
|
|
3049
|
+
}
|
|
3030
3050
|
if (void 0 !== clonedYamlScript.computer) {
|
|
3031
3051
|
const computerTarget = clonedYamlScript.computer;
|
|
3032
3052
|
const { agentForComputer } = await import("@midscene/computer");
|
|
@@ -3069,7 +3089,7 @@ async function createYamlPlayer(file, script, options) {
|
|
|
3069
3089
|
freeFn
|
|
3070
3090
|
};
|
|
3071
3091
|
}
|
|
3072
|
-
throw new Error('No valid interface configuration found in the yaml script, should be either "web", "android", "ios", "computer", or "interface"');
|
|
3092
|
+
throw new Error('No valid interface configuration found in the yaml script, should be either "web", "android", "ios", "harmony", "computer", or "interface"');
|
|
3073
3093
|
}, void 0, file);
|
|
3074
3094
|
return player;
|
|
3075
3095
|
}
|