@mablhq/mabl-cli 2.30.0 → 2.31.32
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/api/featureSet.js +5 -1
- package/api/mablApiClient.js +18 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +2 -2
- package/commands/app-files/app-files_cmds/create.js +1 -1
- package/commands/config/config_cmds/install.js +1 -1
- package/commands/tests/testsUtil.js +9 -1
- package/commands/tests/tests_cmds/import_cmds/import_playwright.js +2 -3
- package/commands/tests/tests_cmds/import_cmds/import_selenium.js +1 -1
- package/env/defaultEnv.js +1 -2
- package/env/dev.js +1 -2
- package/env/env.js +1 -3
- package/env/local.js +1 -2
- package/env/prod.js +1 -2
- package/execution/index.js +2 -2
- package/mablApi/index.js +1 -1
- package/mablscript/actions/ConditionAction.js +59 -26
- package/mablscript/importer.js +55 -27
- package/mablscript/mobile/steps/OpenAppStep.js +22 -0
- package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +10 -0
- package/mablscript/steps/AssertStep.js +29 -6
- package/mablscript/steps/DatabaseQueryStep.js +5 -1
- package/mablscript/steps/EnterAuthCodeStep.js +4 -3
- package/mablscript/steps/IfConditionStep.js +6 -7
- package/mablscript/steps/OpenEmailStep.js +4 -3
- package/mablscript/steps/ReleaseStep.js +3 -5
- package/mablscript/types/ConditionDescriptor.js +54 -1
- package/mablscript/types/ExtractDescriptor.js +1 -0
- package/mablscript/types/ReleaseStepDescriptor.js +5 -0
- package/mablscript/types/mobile/OpenAppStepDescriptor.js +2 -0
- package/package.json +5 -5
- package/upload/index.js +1 -1
- package/util/MobileAppFileCache.js +1 -0
package/api/featureSet.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeatureSet = exports.FindImplementationVersion = exports.ADVANCED_AUTO_HEALING_FEATURE_FLAG = exports.GENERATIVE_AI_FEATURE_FLAG = void 0;
|
|
3
|
+
exports.FeatureSet = exports.FindImplementationVersion = exports.AI_ASSERTIONS_FEATURE_FLAG = exports.ADVANCED_AUTO_HEALING_FEATURE_FLAG = exports.GENERATIVE_AI_FEATURE_FLAG = void 0;
|
|
4
4
|
const types_1 = require("../browserLauncher/types");
|
|
5
5
|
const ACCESSIBILITY_CHECK_FEATURE_FLAG = 'accessibility_checks';
|
|
6
6
|
const PERFORMANCE_TESTING_FEATURE_FLAG = 'performance_testing';
|
|
7
7
|
const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
|
|
8
8
|
exports.GENERATIVE_AI_FEATURE_FLAG = 'generative_ai';
|
|
9
9
|
exports.ADVANCED_AUTO_HEALING_FEATURE_FLAG = 'advanced_auto_healing';
|
|
10
|
+
exports.AI_ASSERTIONS_FEATURE_FLAG = 'ai_assertions';
|
|
10
11
|
var FindImplementationVersion;
|
|
11
12
|
(function (FindImplementationVersion) {
|
|
12
13
|
FindImplementationVersion[FindImplementationVersion["V1"] = 0] = "V1";
|
|
@@ -30,6 +31,9 @@ class FeatureSet {
|
|
|
30
31
|
hasPerformanceTestingFeatureEnabled() {
|
|
31
32
|
return this.featureFlags.has(PERFORMANCE_TESTING_FEATURE_FLAG);
|
|
32
33
|
}
|
|
34
|
+
hasAIAssertions() {
|
|
35
|
+
return this.featureFlags.has(exports.AI_ASSERTIONS_FEATURE_FLAG);
|
|
36
|
+
}
|
|
33
37
|
allowGenerativeAi() {
|
|
34
38
|
return this.featureFlags.has(exports.GENERATIVE_AI_FEATURE_FLAG);
|
|
35
39
|
}
|
package/api/mablApiClient.js
CHANGED
|
@@ -569,6 +569,24 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
569
569
|
throw toApiError(`Failed to update mailbox ${mailboxId} with error`, error);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
+
async evaluateAiAssertion(workspaceId, testRunId, screenshot, userPrompt, metaPrompt) {
|
|
573
|
+
try {
|
|
574
|
+
const body = {
|
|
575
|
+
test_run_id: testRunId,
|
|
576
|
+
assertion_prompt: userPrompt,
|
|
577
|
+
screenshot: Buffer.from(screenshot).toString('base64'),
|
|
578
|
+
};
|
|
579
|
+
if (metaPrompt !== undefined) {
|
|
580
|
+
body.override = {
|
|
581
|
+
meta_prompt: metaPrompt,
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
return await this.makePostRequestWithRetries(`${this.baseApiUrl}/analysis/${workspaceId}/assertion/evaluate`, body);
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
throw toApiError('Failed to evaluate the AI prompt assertion', error);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
572
590
|
async createBranch(workspaceId, branchName) {
|
|
573
591
|
try {
|
|
574
592
|
const body = {
|
|
@@ -271,8 +271,8 @@ class PlaywrightPage extends events_1.default {
|
|
|
271
271
|
mouseDown() {
|
|
272
272
|
return this.page.mouse.down();
|
|
273
273
|
}
|
|
274
|
-
mouseMove(x, y) {
|
|
275
|
-
return this.page.mouse.move(x, y);
|
|
274
|
+
mouseMove(x, y, options) {
|
|
275
|
+
return this.page.mouse.move(x, y, options);
|
|
276
276
|
}
|
|
277
277
|
mouseUp() {
|
|
278
278
|
return this.page.mouse.up();
|
|
@@ -67,7 +67,7 @@ async function createMobileAppFile(parsed) {
|
|
|
67
67
|
const uploadClient = new upload_1.UploadClient({
|
|
68
68
|
authorizationProvider: createAuthorizationProvider(),
|
|
69
69
|
httpClient,
|
|
70
|
-
uploadServiceUrl: new URL(env_1.
|
|
70
|
+
uploadServiceUrl: new URL(env_1.BASE_API_URL),
|
|
71
71
|
});
|
|
72
72
|
loggingProvider_1.logger.info(`Beginning upload of mobile app file ${(0, path_1.basename)((0, path_1.resolve)(file))} to ${workspaceId}`);
|
|
73
73
|
const mobileAppFile = await uploadClient.uploadMobileAppFile(file, mobileAppFilePrototype, await createUploadProgressListener(file));
|
|
@@ -75,7 +75,7 @@ function installAddOn(parsed) {
|
|
|
75
75
|
default:
|
|
76
76
|
loggingProvider_1.logger.info(`android version: ${androidVersion}`);
|
|
77
77
|
loggingProvider_1.logger.info(`ios driver only supported on Mac OS, ${operatingSystem} platform detected`);
|
|
78
|
-
(0, child_process_1.execSync)(`
|
|
78
|
+
(0, child_process_1.execSync)(`npm install appium-uiautomator2-driver@${androidVersion}`, {
|
|
79
79
|
cwd: parentDirOfNodeModulesDir,
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.parseBrowserType = exports.toBasicHttpAuthenticationCredentials = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.headerArrayToRecord = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.cleanupTestResources = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.createBrowserForExecutionEngine = exports.createBrowser = exports.getFinalUrl = void 0;
|
|
29
|
+
exports.parseBrowserType = exports.toBasicHttpAuthenticationCredentials = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.headerArrayToRecord = exports.getLinkCrawlerUrlOverride = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.cleanupTestResources = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.createBrowserForExecutionEngine = exports.createBrowser = exports.getFinalUrl = void 0;
|
|
30
30
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
31
31
|
const fs = __importStar(require("fs-extra"));
|
|
32
32
|
const os = __importStar(require("os"));
|
|
@@ -45,6 +45,7 @@ const constants_1 = require("../constants");
|
|
|
45
45
|
const utils_1 = require("../datatables/utils");
|
|
46
46
|
const trainerUtil_1 = require("./tests_cmds/trainerUtil");
|
|
47
47
|
const chalk = require('chalk');
|
|
48
|
+
const linkCrawlerStartUrlParam = 'mabl.link_crawler.starting_url';
|
|
48
49
|
let RUNNING_TEST = false;
|
|
49
50
|
function getFinalUrl(test, parsedUrl) {
|
|
50
51
|
const finalUrl = parsedUrl || test.url;
|
|
@@ -425,6 +426,7 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
|
425
426
|
: undefined,
|
|
426
427
|
filterHttpRequests: false,
|
|
427
428
|
importedVariables: (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.imported_variables,
|
|
429
|
+
linkCrawlerStartingUrlOverride: getLinkCrawlerUrlOverride(journeyRun),
|
|
428
430
|
localizationOptions: journeyRun.localization_options,
|
|
429
431
|
pageLoadWait: (_q = journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.page_load_wait,
|
|
430
432
|
runId: journeyRun.id,
|
|
@@ -458,6 +460,7 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
458
460
|
: undefined,
|
|
459
461
|
filterHttpRequests: true,
|
|
460
462
|
importedVariables: (_r = journeyRun.journey_parameters) === null || _r === void 0 ? void 0 : _r.imported_variables,
|
|
463
|
+
linkCrawlerStartingUrlOverride: getLinkCrawlerUrlOverride(journeyRun),
|
|
461
464
|
localizationOptions: journeyRun.localization_options,
|
|
462
465
|
pageLoadWait: (_s = journeyRun.journey_parameters) === null || _s === void 0 ? void 0 : _s.page_load_wait,
|
|
463
466
|
runId: journeyRun.id,
|
|
@@ -477,6 +480,11 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
477
480
|
return config;
|
|
478
481
|
}
|
|
479
482
|
exports.extractTestRunConfig = extractTestRunConfig;
|
|
483
|
+
function getLinkCrawlerUrlOverride(journeyRun) {
|
|
484
|
+
var _a, _b, _c;
|
|
485
|
+
return (_c = (_b = (_a = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_configuration) === null || _a === void 0 ? void 0 : _a.parameters) === null || _b === void 0 ? void 0 : _b.find((param) => param.name === linkCrawlerStartUrlParam)) === null || _c === void 0 ? void 0 : _c.value;
|
|
486
|
+
}
|
|
487
|
+
exports.getLinkCrawlerUrlOverride = getLinkCrawlerUrlOverride;
|
|
480
488
|
function headerArrayToRecord(headers) {
|
|
481
489
|
return headers === null || headers === void 0 ? void 0 : headers.reduce((headers, header) => {
|
|
482
490
|
var _a;
|
|
@@ -39,11 +39,10 @@ const loggingProvider_1 = require("../../../../providers/logging/loggingProvider
|
|
|
39
39
|
const chromiumBrowserEngine_1 = require("../../../../browserEngines/chromiumBrowserEngine");
|
|
40
40
|
const RichPromise_1 = __importDefault(require("../../../../util/RichPromise"));
|
|
41
41
|
const { spawn } = require('child_process');
|
|
42
|
-
const execution_1 = require("../../../../execution");
|
|
43
42
|
const fs_1 = __importDefault(require("fs"));
|
|
44
43
|
const path_1 = __importDefault(require("path"));
|
|
45
44
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
46
|
-
const
|
|
45
|
+
const execution_1 = require("../../../../execution");
|
|
47
46
|
const projectInfoTestFile = `
|
|
48
47
|
import { test } from "@playwright/test";
|
|
49
48
|
test("mablImportInfo", async ({baseURL, trace}) => {
|
|
@@ -151,7 +150,7 @@ async function importTests(args) {
|
|
|
151
150
|
await runPlaywrightProject(args, tracesPath, cwd);
|
|
152
151
|
}
|
|
153
152
|
let importedTests = [];
|
|
154
|
-
const converter = new
|
|
153
|
+
const converter = new execution_1.PlaywrightToMablStepConverter();
|
|
155
154
|
if (args[constants_1.CommandArgTraceFile]) {
|
|
156
155
|
importedTests = processSingleTraceFile(args[constants_1.CommandArgTraceFile], playwrightProject, converter);
|
|
157
156
|
}
|
|
@@ -51,7 +51,7 @@ var PostImportActions;
|
|
|
51
51
|
PostImportActions["View"] = "View the test description";
|
|
52
52
|
})(PostImportActions || (PostImportActions = {}));
|
|
53
53
|
exports.command = 'selenium';
|
|
54
|
-
exports.describe =
|
|
54
|
+
exports.describe = 'Import an existing Selenium-based test';
|
|
55
55
|
exports.builder = (yargs) => {
|
|
56
56
|
yargs
|
|
57
57
|
.option(constants_1.CommandArgAuto, {
|
package/env/defaultEnv.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FIND_OVERRIDE_PATH = exports.ELECTRON_PROTOCOL = exports.SCRIPT_NAME = exports.OKTA_URL = exports.OKTA_CLIENT_ID = exports.LOCAL_TRAINER_PATH = exports.EXTENSION_ID = exports.ENV = exports.DEBUG_EVENT_EMITTER = exports.CONSOLE_LOGGING_LEVEL = exports.CONF_FILE_VERSION = exports.CONF_FILE_PROJECT_NAME = exports.BASE_APP_URL = exports.BASE_API_URL = void 0;
|
|
4
4
|
exports.BASE_API_URL = 'https://api.mabl.com';
|
|
5
5
|
exports.BASE_APP_URL = 'https://app.mabl.com';
|
|
6
6
|
exports.CONF_FILE_PROJECT_NAME = 'mabl-cli';
|
|
@@ -15,4 +15,3 @@ exports.OKTA_URL = 'https://auth2.mabl.com';
|
|
|
15
15
|
exports.SCRIPT_NAME = 'mabl';
|
|
16
16
|
exports.ELECTRON_PROTOCOL = 'mabl-app';
|
|
17
17
|
exports.FIND_OVERRIDE_PATH = undefined;
|
|
18
|
-
exports.UPLOAD_SERVICE_URL = 'https://upload.mabl.com';
|
package/env/dev.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FIND_OVERRIDE_PATH = exports.ELECTRON_PROTOCOL = exports.SCRIPT_NAME = exports.OKTA_URL = exports.OKTA_CLIENT_ID = exports.LOCAL_TRAINER_PATH = exports.EXTENSION_ID = exports.ENV = exports.DEBUG_EVENT_EMITTER = exports.CONSOLE_LOGGING_LEVEL = exports.CONF_FILE_VERSION = exports.CONF_FILE_PROJECT_NAME = exports.BASE_APP_URL = exports.BASE_API_URL = void 0;
|
|
4
4
|
exports.BASE_API_URL = 'https://api-dev.mabl.com';
|
|
5
5
|
exports.BASE_APP_URL = 'https://app-dev.mabl.com';
|
|
6
6
|
exports.CONF_FILE_PROJECT_NAME = 'mabl-cli-dev';
|
|
@@ -15,4 +15,3 @@ exports.OKTA_URL = 'https://auth2-dev.mabl.com';
|
|
|
15
15
|
exports.SCRIPT_NAME = 'mabl-dev';
|
|
16
16
|
exports.ELECTRON_PROTOCOL = 'mabl-app-dev';
|
|
17
17
|
exports.FIND_OVERRIDE_PATH = undefined;
|
|
18
|
-
exports.UPLOAD_SERVICE_URL = 'https://upload-dev.mabl.com';
|
package/env/env.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.setConfigFileProjectName = exports.setGlobalConfigEnv = exports.EnvOption = exports.
|
|
26
|
+
exports.setConfigFileProjectName = exports.setGlobalConfigEnv = exports.EnvOption = exports.ELECTRON_PROTOCOL = exports.SCRIPT_NAME = exports.OKTA_URL = exports.OKTA_CLIENT_ID = exports.LOCAL_TRAINER_PATH = exports.FIND_OVERRIDE_PATH = exports.EXTENSION_ID = exports.ENV = exports.DEBUG_EVENT_EMITTER = exports.CONSOLE_LOGGING_LEVEL = exports.CONF_FILE_VERSION = exports.CONF_FILE_PROJECT_NAME = exports.BASE_APP_URL = exports.BASE_API_URL = void 0;
|
|
27
27
|
const localEnv = __importStar(require("./local"));
|
|
28
28
|
const devEnv = __importStar(require("./dev"));
|
|
29
29
|
const prodEnv = __importStar(require("./prod"));
|
|
@@ -42,7 +42,6 @@ exports.OKTA_CLIENT_ID = defaultEnv.OKTA_CLIENT_ID;
|
|
|
42
42
|
exports.OKTA_URL = defaultEnv.OKTA_URL;
|
|
43
43
|
exports.SCRIPT_NAME = defaultEnv.SCRIPT_NAME;
|
|
44
44
|
exports.ELECTRON_PROTOCOL = defaultEnv.ELECTRON_PROTOCOL;
|
|
45
|
-
exports.UPLOAD_SERVICE_URL = defaultEnv.UPLOAD_SERVICE_URL;
|
|
46
45
|
var EnvOption;
|
|
47
46
|
(function (EnvOption) {
|
|
48
47
|
EnvOption["dev"] = "dev";
|
|
@@ -69,7 +68,6 @@ function setGlobalConfigEnv(env) {
|
|
|
69
68
|
exports.SCRIPT_NAME = envMap[env].SCRIPT_NAME;
|
|
70
69
|
exports.ELECTRON_PROTOCOL = envMap[env].ELECTRON_PROTOCOL;
|
|
71
70
|
exports.FIND_OVERRIDE_PATH = envMap[env].FIND_OVERRIDE_PATH;
|
|
72
|
-
exports.UPLOAD_SERVICE_URL = envMap[env].UPLOAD_SERVICE_URL;
|
|
73
71
|
}
|
|
74
72
|
exports.setGlobalConfigEnv = setGlobalConfigEnv;
|
|
75
73
|
function setConfigFileProjectName(projectName) {
|
package/env/local.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FIND_OVERRIDE_PATH = exports.ELECTRON_PROTOCOL = exports.SCRIPT_NAME = exports.OKTA_URL = exports.OKTA_CLIENT_ID = exports.LOCAL_TRAINER_PATH = exports.EXTENSION_ID = exports.ENV = exports.DEBUG_EVENT_EMITTER = exports.CONSOLE_LOGGING_LEVEL = exports.CONF_FILE_VERSION = exports.CONF_FILE_PROJECT_NAME = exports.BASE_APP_URL = exports.BASE_API_URL = void 0;
|
|
4
4
|
exports.BASE_API_URL = 'http://localhost:8080';
|
|
5
5
|
exports.BASE_APP_URL = 'https://app-local.mabl.com:3000';
|
|
6
6
|
exports.CONF_FILE_PROJECT_NAME = 'mabl-cli-local';
|
|
@@ -15,4 +15,3 @@ exports.OKTA_URL = 'https://auth2-dev.mabl.com';
|
|
|
15
15
|
exports.SCRIPT_NAME = 'mabl-local';
|
|
16
16
|
exports.ELECTRON_PROTOCOL = 'mabl-app-local';
|
|
17
17
|
exports.FIND_OVERRIDE_PATH = undefined;
|
|
18
|
-
exports.UPLOAD_SERVICE_URL = 'https://upload-dev.mabl.com';
|
package/env/prod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FIND_OVERRIDE_PATH = exports.ELECTRON_PROTOCOL = exports.SCRIPT_NAME = exports.OKTA_URL = exports.OKTA_CLIENT_ID = exports.LOCAL_TRAINER_PATH = exports.EXTENSION_ID = exports.ENV = exports.DEBUG_EVENT_EMITTER = exports.CONSOLE_LOGGING_LEVEL = exports.CONF_FILE_VERSION = exports.CONF_FILE_PROJECT_NAME = exports.BASE_APP_URL = exports.BASE_API_URL = void 0;
|
|
4
4
|
exports.BASE_API_URL = 'https://api.mabl.com';
|
|
5
5
|
exports.BASE_APP_URL = 'https://app.mabl.com';
|
|
6
6
|
exports.CONF_FILE_PROJECT_NAME = 'mabl-cli';
|
|
@@ -15,4 +15,3 @@ exports.OKTA_URL = 'https://auth2.mabl.com';
|
|
|
15
15
|
exports.SCRIPT_NAME = 'mabl';
|
|
16
16
|
exports.ELECTRON_PROTOCOL = 'mabl-app';
|
|
17
17
|
exports.FIND_OVERRIDE_PATH = undefined;
|
|
18
|
-
exports.UPLOAD_SERVICE_URL = 'https://upload.mabl.com';
|