@mablhq/mabl-cli 2.72.5 → 2.72.15
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/browserEngines/chromiumBrowserEngine.js +17 -0
- package/browserLauncher/index.js +3 -3
- package/commands/mcp/mcp_cmds/tools/createTest.js +38 -0
- package/commands/mcp/mcp_cmds/tools/getApplications.js +69 -0
- package/commands/mcp/mcp_cmds/tools/getCredentials.js +41 -0
- package/commands/mcp/mcp_cmds/tools/{getPlanResults.js → getLatestPlanRuns.js} +6 -6
- package/commands/mcp/mcp_cmds/tools/{getPlanRun.js → getPlanRunResult.js} +5 -5
- package/commands/mcp/mcp_cmds/tools/index.js +8 -4
- package/commands/mcp/mcp_cmds/tools/runTest.js +6 -1
- package/execution/index.js +2 -2
- package/http/requestInterceptor.js +10 -5
- package/index.d.ts +2 -0
- package/mablscript/MablStepV2.js +40 -10
- package/mablscript/MablStepWithFindAction.js +126 -2
- package/mablscript/actions/AwaitDownloadAction.js +4 -3
- package/mablscript/actions/AwaitPDFDownloadAction.js +6 -5
- package/mablscript/actions/ConditionAction.js +2 -1
- package/mablscript/actions/ExtractAction.js +8 -13
- package/mablscript/actions/FindAction.js +20 -0
- package/mablscript/actions/GetVariableValue.js +15 -4
- package/mablscript/actions/JavaScriptAction.js +25 -39
- package/mablscript/diffing/diffingUtil.js +5 -5
- package/mablscript/importer.js +79 -59
- package/mablscript/mobile/steps/CreateVariableMobileStep.js +3 -1
- package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +10 -8
- package/mablscript/steps/AccessibilityCheck.js +78 -36
- package/mablscript/steps/AssertStep.js +267 -86
- package/mablscript/steps/AssertStepOld.js +69 -139
- package/mablscript/steps/AwaitTabStep.js +32 -9
- package/mablscript/steps/AwaitUploadsStep.js +24 -8
- package/mablscript/steps/ClearCookiesStep.js +24 -8
- package/mablscript/steps/ClickAndHoldStep.js +47 -47
- package/mablscript/steps/ClickStep.js +38 -33
- package/mablscript/steps/CreateVariableStep.js +169 -137
- package/mablscript/steps/DatabaseQueryStep.js +16 -4
- package/mablscript/steps/DoubleClickStep.js +39 -40
- package/mablscript/steps/DownloadStep.js +81 -63
- package/mablscript/steps/EchoStep.js +28 -8
- package/mablscript/steps/ElseIfConditionStep.js +25 -12
- package/mablscript/steps/ElseStep.js +24 -9
- package/mablscript/steps/EndStep.js +24 -9
- package/mablscript/steps/EnterAuthCodeStep.js +38 -34
- package/mablscript/steps/EnterTextStep.js +53 -64
- package/mablscript/steps/EvaluateFlowStep.js +41 -18
- package/mablscript/steps/EvaluateJavaScriptStep.js +19 -19
- package/mablscript/steps/HoverStep.js +39 -39
- package/mablscript/steps/IfConditionStep.js +141 -99
- package/mablscript/steps/NavigateStep.js +31 -9
- package/mablscript/steps/OpenEmailStep.js +41 -21
- package/mablscript/steps/ReleaseStep.js +48 -38
- package/mablscript/steps/RemoveCookieStep.js +27 -9
- package/mablscript/steps/RightClickStep.js +38 -33
- package/mablscript/steps/SelectStep.js +71 -46
- package/mablscript/steps/SendHttpRequestStep.js +11 -4
- package/mablscript/steps/SendKeyStep.js +175 -49
- package/mablscript/steps/SetCookieStep.js +58 -23
- package/mablscript/steps/SetFilesStep.js +44 -43
- package/mablscript/steps/SetViewportStep.js +40 -12
- package/mablscript/steps/StepGroupStep.js +70 -0
- package/mablscript/steps/SwitchContextStep.js +93 -83
- package/mablscript/steps/SyntheticStep.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +31 -21
- package/mablscript/steps/WaitStep.js +21 -8
- package/mablscript/steps/WaitUntilStep.js +32 -13
- package/mablscript/types/AssertStepDescriptor.js +2 -0
- package/mablscript/types/ConditionDescriptor.js +5 -5
- package/mablscript/types/GetVariableDescriptor.js +0 -8
- package/mablscript/types/StepGroupStepDescriptor.js +2 -0
- package/package.json +9 -8
- package/proxy/index.js +1 -1
- package/upload/index.js +1 -1
|
@@ -12,6 +12,9 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
12
12
|
title: 'Create a mabl test',
|
|
13
13
|
description: 'Create a mabl browser or API test',
|
|
14
14
|
inputSchema: zod_1.z.object({
|
|
15
|
+
applicationId: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.describe('The id of the application to run the test in'),
|
|
15
18
|
environmentId: zod_1.z
|
|
16
19
|
.string()
|
|
17
20
|
.describe('The id of the environment to run the test in'),
|
|
@@ -20,6 +23,14 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
20
23
|
On API tests this will be the endpoint to test.
|
|
21
24
|
Try to validate that the url is correct.
|
|
22
25
|
`),
|
|
26
|
+
credentialsId: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.describe('Optional. The id of the credentials to use for training the test. Cloud type credentials are not valid here. If not provided, the user will be prompted to select from available non-cloud credentials.')
|
|
29
|
+
.optional(),
|
|
30
|
+
withoutCredentials: zod_1.z
|
|
31
|
+
.boolean()
|
|
32
|
+
.describe('Optional. If true, the test will be created without credentials. If false, the user will be prompted to select from available non-cloud credentials.')
|
|
33
|
+
.optional(),
|
|
23
34
|
name: zod_1.z.string().describe('The name of the test'),
|
|
24
35
|
intent: zod_1.z.string().describe(`The intent of the test.
|
|
25
36
|
Be as detailed as possible.
|
|
@@ -55,6 +66,31 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
55
66
|
if (!params.url) {
|
|
56
67
|
return (0, common_1.stringToToolResult)('url is required when creating a test. Try to infer the url from the user context or request the URL explicitly.', true);
|
|
57
68
|
}
|
|
69
|
+
if (!params.applicationId) {
|
|
70
|
+
return (0, common_1.stringToToolResult)('applicationId is required when creating a test. Try to infer the application from the user context or request the application explicitly.', true);
|
|
71
|
+
}
|
|
72
|
+
if (!params.environmentId) {
|
|
73
|
+
return (0, common_1.stringToToolResult)('environmentId is required when creating a test. Request the environment explicitly.', true);
|
|
74
|
+
}
|
|
75
|
+
const allCredentials = await mablApiClient.getCredentials(workspaceId, 500);
|
|
76
|
+
const nonCloudCredentials = allCredentials.filter((credential) => !credential.cloud_only);
|
|
77
|
+
if (params.credentialsId) {
|
|
78
|
+
const selectedCredential = allCredentials.find((cred) => cred.id === params.credentialsId);
|
|
79
|
+
if (!selectedCredential) {
|
|
80
|
+
return (0, common_1.stringToToolResult)(`Credential with id "${params.credentialsId}" not found.`, true);
|
|
81
|
+
}
|
|
82
|
+
if (selectedCredential.cloud_only) {
|
|
83
|
+
return (0, common_1.stringToToolResult)(`Cannot use Cloud Credentials [${params.credentialsId}] for test training. Cloud credentials are only available in cloud runs. Please use a non-cloud credential instead.`, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!params.credentialsId &&
|
|
87
|
+
nonCloudCredentials.length > 0 &&
|
|
88
|
+
!params.withoutCredentials) {
|
|
89
|
+
const credentialsList = nonCloudCredentials
|
|
90
|
+
.map((cred) => `- ${cred.name} (ID: ${cred.id}, Type: ${cred.type})`)
|
|
91
|
+
.join('\n');
|
|
92
|
+
return (0, common_1.stringToToolResult)(`Would you like to add credentials to this test? Here are the available non-cloud credentials:\n\n${credentialsList}\n\nIf you want to use one of these credentials, please specify the credentialsId parameter with the desired credential ID. If you don't want to use any credentials, you can proceed without specifying credentialsId and set withoutCredentials to true.`, false);
|
|
93
|
+
}
|
|
58
94
|
messaging_1.mablEventEmitter.resetOutputEventChannel();
|
|
59
95
|
let fullIntent = params.intent;
|
|
60
96
|
if (params.steps) {
|
|
@@ -71,6 +107,8 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
71
107
|
}
|
|
72
108
|
await (0, trainingSessions_1.trainNewTest)({
|
|
73
109
|
environmentId: params.environmentId,
|
|
110
|
+
applicationId: params.applicationId,
|
|
111
|
+
credentialsId: params.credentialsId,
|
|
74
112
|
url: params.url,
|
|
75
113
|
testName: params.name ?? 'New Test',
|
|
76
114
|
autoBranch: false,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcpMablTool_1 = require("./mcpMablTool");
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const getApplications = (0, mcpMablTool_1.defineTool)({
|
|
6
|
+
schema: {
|
|
7
|
+
name: 'get-applications',
|
|
8
|
+
title: 'Get all mabl applications with their environments',
|
|
9
|
+
description: 'Get all mabl applications with their associated environments',
|
|
10
|
+
inputSchema: zod_1.z.object({}),
|
|
11
|
+
outputSchema: zod_1.z.object({
|
|
12
|
+
applications: zod_1.z.array(zod_1.z.object({
|
|
13
|
+
applicationId: zod_1.z.string(),
|
|
14
|
+
applicationName: zod_1.z.string(),
|
|
15
|
+
environments: zod_1.z.array(zod_1.z.object({
|
|
16
|
+
environmentId: zod_1.z.string(),
|
|
17
|
+
name: zod_1.z.string(),
|
|
18
|
+
url: zod_1.z.string(),
|
|
19
|
+
})),
|
|
20
|
+
})),
|
|
21
|
+
}),
|
|
22
|
+
type: 'readOnly',
|
|
23
|
+
},
|
|
24
|
+
handle: async (_, mablApiClient, _server, workspaceId) => {
|
|
25
|
+
const limit = 500;
|
|
26
|
+
const [applications, deployments, environments] = await Promise.all([
|
|
27
|
+
mablApiClient.getApplications(workspaceId, limit),
|
|
28
|
+
mablApiClient.queryDeploymentEntities(workspaceId),
|
|
29
|
+
mablApiClient.getEnvironments(workspaceId, limit),
|
|
30
|
+
]);
|
|
31
|
+
const environmentMap = new Map();
|
|
32
|
+
environments.forEach((env) => {
|
|
33
|
+
environmentMap.set(env.id, env);
|
|
34
|
+
});
|
|
35
|
+
const deploymentsByAppId = new Map();
|
|
36
|
+
if (deployments.deployments) {
|
|
37
|
+
deployments.deployments.forEach((deployment) => {
|
|
38
|
+
if (deployment.application_id) {
|
|
39
|
+
if (!deploymentsByAppId.has(deployment.application_id)) {
|
|
40
|
+
deploymentsByAppId.set(deployment.application_id, []);
|
|
41
|
+
}
|
|
42
|
+
deploymentsByAppId.get(deployment.application_id).push(deployment);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const applicationsWithEnvironments = applications.map((app) => ({
|
|
47
|
+
applicationId: app.id,
|
|
48
|
+
applicationName: app.name,
|
|
49
|
+
environments: (deploymentsByAppId.get(app.id) || []).map((deployment) => {
|
|
50
|
+
const environment = environmentMap.get(deployment.environment_id);
|
|
51
|
+
return {
|
|
52
|
+
environmentId: deployment.environment_id,
|
|
53
|
+
name: environment?.name || 'Unknown Environment',
|
|
54
|
+
url: deployment.uri || '',
|
|
55
|
+
};
|
|
56
|
+
}),
|
|
57
|
+
}));
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: JSON.stringify({ applications: applicationsWithEnvironments }, undefined, 2),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
structuredContent: { applications: applicationsWithEnvironments },
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
exports.default = [getApplications];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcpMablTool_1 = require("./mcpMablTool");
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const getCredentials = (0, mcpMablTool_1.defineTool)({
|
|
6
|
+
schema: {
|
|
7
|
+
name: 'get-credentials',
|
|
8
|
+
title: 'Get all mabl credentials',
|
|
9
|
+
description: 'Get all mabl credentials',
|
|
10
|
+
inputSchema: zod_1.z.object({}),
|
|
11
|
+
outputSchema: zod_1.z.object({
|
|
12
|
+
credentials: zod_1.z.array(zod_1.z.object({
|
|
13
|
+
id: zod_1.z.string(),
|
|
14
|
+
name: zod_1.z.string(),
|
|
15
|
+
type: zod_1.z.string(),
|
|
16
|
+
cloud_only: zod_1.z.boolean(),
|
|
17
|
+
})),
|
|
18
|
+
}),
|
|
19
|
+
type: 'readOnly',
|
|
20
|
+
},
|
|
21
|
+
handle: async (_, mablApiClient, _server, workspaceId) => {
|
|
22
|
+
const limit = 500;
|
|
23
|
+
const credentials = await mablApiClient.getCredentials(workspaceId, limit);
|
|
24
|
+
const credentialsResponse = credentials.map((credential) => ({
|
|
25
|
+
id: credential.id,
|
|
26
|
+
name: credential.name,
|
|
27
|
+
type: credential.type,
|
|
28
|
+
cloud_only: credential.cloud_only,
|
|
29
|
+
}));
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: JSON.stringify({ credentials: credentialsResponse }, undefined, 2),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
structuredContent: { credentials: credentialsResponse },
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
exports.default = [getCredentials];
|
|
@@ -4,15 +4,15 @@ const mcpMablTool_1 = require("./mcpMablTool");
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const mablApi_1 = require("../../../../mablApi");
|
|
6
6
|
const common_1 = require("./common");
|
|
7
|
-
const
|
|
7
|
+
const getLatestPlanRuns = (0, mcpMablTool_1.defineTool)({
|
|
8
8
|
schema: {
|
|
9
|
-
name: 'get-plan-
|
|
10
|
-
title: 'Get
|
|
11
|
-
description: 'Get
|
|
9
|
+
name: 'get-latest-plan-runs',
|
|
10
|
+
title: 'Get latest mabl plan runs results',
|
|
11
|
+
description: 'Get latest mabl plan runs results',
|
|
12
12
|
inputSchema: zod_1.z.object({
|
|
13
13
|
planId: zod_1.z
|
|
14
14
|
.string()
|
|
15
|
-
.describe('The id of the mabl plan to get
|
|
15
|
+
.describe('The id of the mabl plan to get latest runs results of'),
|
|
16
16
|
}),
|
|
17
17
|
type: 'readOnly',
|
|
18
18
|
outputSchema: zod_1.z.object({
|
|
@@ -78,4 +78,4 @@ const getPlanResults = (0, mcpMablTool_1.defineTool)({
|
|
|
78
78
|
};
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
|
-
exports.default = [
|
|
81
|
+
exports.default = [getLatestPlanRuns];
|
|
@@ -33,11 +33,11 @@ async function processTestRun(testRun, planRun, mablApiClient, workspaceId, serv
|
|
|
33
33
|
credentialsId: planRun.credentialsId,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const getPlanRunResult = (0, mcpMablTool_1.defineTool)({
|
|
37
37
|
schema: {
|
|
38
|
-
name: 'get-plan-run',
|
|
39
|
-
title: 'Get mabl plan run
|
|
40
|
-
description: 'Get a mabl plan run
|
|
38
|
+
name: 'get-plan-run-result',
|
|
39
|
+
title: 'Get mabl plan run result',
|
|
40
|
+
description: 'Get a mabl plan run result. Useful for debugging a single plan run.',
|
|
41
41
|
inputSchema: zod_1.z.object({
|
|
42
42
|
planRunId: zod_1.z
|
|
43
43
|
.string()
|
|
@@ -71,4 +71,4 @@ const getPlanRun = (0, mcpMablTool_1.defineTool)({
|
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
73
|
});
|
|
74
|
-
exports.default = [
|
|
74
|
+
exports.default = [getPlanRunResult];
|
|
@@ -7,14 +7,18 @@ const getEnvironments_1 = __importDefault(require("./getEnvironments"));
|
|
|
7
7
|
const getTests_1 = __importDefault(require("./getTests"));
|
|
8
8
|
const getMablDeployment_1 = __importDefault(require("./getMablDeployment"));
|
|
9
9
|
const getTestResults_1 = __importDefault(require("./getTestResults"));
|
|
10
|
+
const getApplications_1 = __importDefault(require("./getApplications"));
|
|
11
|
+
const getCredentials_1 = __importDefault(require("./getCredentials"));
|
|
10
12
|
const analyzeFailure_1 = __importDefault(require("./analyzeFailure"));
|
|
11
13
|
const runTest_1 = __importDefault(require("./runTest"));
|
|
12
14
|
const exportToPlaywright_1 = __importDefault(require("./exportToPlaywright"));
|
|
13
15
|
const createTest_1 = __importDefault(require("./createTest"));
|
|
14
16
|
const getPlans_1 = __importDefault(require("./getPlans"));
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
+
const getPlanRunResult_1 = __importDefault(require("./getPlanRunResult"));
|
|
18
|
+
const getLatestPlanRuns_1 = __importDefault(require("./getLatestPlanRuns"));
|
|
17
19
|
exports.default = [
|
|
20
|
+
...getApplications_1.default,
|
|
21
|
+
...getCredentials_1.default,
|
|
18
22
|
...getEnvironments_1.default,
|
|
19
23
|
...getTests_1.default,
|
|
20
24
|
...getPlans_1.default,
|
|
@@ -24,6 +28,6 @@ exports.default = [
|
|
|
24
28
|
...runTest_1.default,
|
|
25
29
|
...exportToPlaywright_1.default,
|
|
26
30
|
...createTest_1.default,
|
|
27
|
-
...
|
|
28
|
-
...
|
|
31
|
+
...getPlanRunResult_1.default,
|
|
32
|
+
...getLatestPlanRuns_1.default,
|
|
29
33
|
];
|
|
@@ -21,6 +21,10 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
21
21
|
.string()
|
|
22
22
|
.describe('The id of the environment to run the test in'),
|
|
23
23
|
testId: zod_1.z.string().describe('The id of the test to run'),
|
|
24
|
+
credentialsId: zod_1.z
|
|
25
|
+
.string()
|
|
26
|
+
.describe('Optional. The id of the credentials to use for running the test. If not provided, the user will be prompted to select from available non-cloud credentials.')
|
|
27
|
+
.optional(),
|
|
24
28
|
}),
|
|
25
29
|
type: 'destructive',
|
|
26
30
|
outputSchema: runTestOutputSchema,
|
|
@@ -39,7 +43,8 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
39
43
|
.on(messaging_1.EventChannelMessageType.outputLogLine, logListener);
|
|
40
44
|
const result = await (0, run_1.run)({
|
|
41
45
|
id: params.testId,
|
|
42
|
-
'environment-id': params.environmentId
|
|
46
|
+
'environment-id': params.environmentId ?? '',
|
|
47
|
+
'credentials-id': params.credentialsId ?? '',
|
|
43
48
|
branch: 'master',
|
|
44
49
|
'branch-changes-only': false,
|
|
45
50
|
browser: 'chrome',
|