@mablhq/mabl-cli 1.12.33 → 1.13.19

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.
@@ -145,20 +145,37 @@ exports.builder = (yargs) => {
145
145
  describe: 'Enable browser extensions on [Chrome]',
146
146
  default: false,
147
147
  type: 'boolean',
148
+ })
149
+ .option(constants_1.CommandArgHttpHeaders, {
150
+ describe: 'Space delimited HTTP headers added to browser requests (e.g. "x-header:foo")',
151
+ type: 'array',
148
152
  })
149
153
  .option(constants_1.CommandArgTestInteractionSpeed, {
150
154
  describe: 'Set the speed that mabl interacts with webpages. Overrides test run settings if specified.',
151
155
  type: 'string',
152
156
  choices: Object.keys(mablApi_1.JourneyParameters.PageLoadWaitEnum).map((pageLoadWait) => pageLoadWait.toLowerCase()),
153
157
  })
154
- .check((argv) => testsUtil_1.validateRunCommandWithLabels(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude], argv[constants_1.CommandArgTestRunId], argv[constants_1.CommandArgFromPlanId], true, argv[constants_1.CommandArgTestFile]));
158
+ .check((argv) => {
159
+ testsUtil_1.validateRunCommandWithLabels(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude], argv[constants_1.CommandArgTestRunId], argv[constants_1.CommandArgFromPlanId], true, argv[constants_1.CommandArgTestFile]);
160
+ const httpHeaders = argv[constants_1.CommandArgHttpHeaders];
161
+ util_1.validateArrayInputs(httpHeaders, 'HTTP headers must be SPACE delimited, e.g. "--http-headers "foo:bar" "baz:qux"');
162
+ argv[constants_1.CommandArgHttpHeaders] = util_1.validateValuePairInputs('HTTP header', httpHeaders);
163
+ return true;
164
+ });
155
165
  };
156
166
  const exitCodeOnError = 1;
157
167
  exports.handler = util_1.failWrapper(run, exitCodeOnError);
158
168
  async function run(parsed) {
159
- var _a, _b;
169
+ var _a, _b, _c;
160
170
  const commandStartTime = Date.now();
161
171
  const workspaceId = (_a = parsed['workspace-id']) !== null && _a !== void 0 ? _a : (_b = cliConfigProvider_1.CliConfigProvider.getWorkspace()) === null || _b === void 0 ? void 0 : _b.id;
172
+ const extraHttpHeaders = {};
173
+ ((_c = parsed['http-headers']) !== null && _c !== void 0 ? _c : []).forEach((header) => {
174
+ const headerParts = header.split(':');
175
+ if (headerParts.length === 2 && headerParts[0] && headerParts[1]) {
176
+ extraHttpHeaders[headerParts[0].toLowerCase()] = headerParts[1];
177
+ }
178
+ });
162
179
  const testRunnerConfig = {
163
180
  _cliCreated: true,
164
181
  branchName: parsed['mabl-branch'],
@@ -174,6 +191,7 @@ async function run(parsed) {
174
191
  ignoreCertificateErrors: parsed[constants_1.CommandArgBrowserIgnoreCertificateErrors],
175
192
  interactionSpeed: parsed[constants_1.CommandArgTestInteractionSpeed],
176
193
  enableExtensions: parsed[constants_1.CommandArgBrowserEnableExtensions],
194
+ extraHttpHeaders,
177
195
  keepBrowserOpen: parsed['keep-browser-open'],
178
196
  labelsExclude: parsed['exclude-labels'],
179
197
  labelsInclude: parsed.labels,