@mablhq/mabl-cli 2.30.0 → 2.31.2

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 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
  }
@@ -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 = {
@@ -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 playwrightToMablStepConverter_1 = require("../../../../execution/codeGenerators/playwrightTest/playwrightToMablStepConverter");
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 playwrightToMablStepConverter_1.PlaywrightToMablStepConverter();
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 = false;
54
+ exports.describe = 'Import an existing Selenium-based test';
55
55
  exports.builder = (yargs) => {
56
56
  yargs
57
57
  .option(constants_1.CommandArgAuto, {