@mablhq/mabl-cli 2.5.2 → 2.6.7

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.
@@ -40,6 +40,7 @@ const webkitBrowserDelegate_1 = require("./webkit/webkitBrowserDelegate");
40
40
  const loggingProvider_1 = require("../../providers/logging/loggingProvider");
41
41
  const playwrightApiResponse_1 = require("./playwrightApiResponse");
42
42
  const httpUtil_1 = require("../../http/httpUtil");
43
+ const logUtils_1 = require("../../util/logUtils");
43
44
  class PlaywrightBrowser extends events_1.default {
44
45
  static async create(browserType, defaultContext, downloadDirectory, browserWSEndpoint, preferenceDirectory, disableFocusEmulation) {
45
46
  const delegate = getBrowserDelegate(browserType, defaultContext);
@@ -110,9 +111,11 @@ class PlaywrightBrowser extends events_1.default {
110
111
  return this.downloadDirectory;
111
112
  }
112
113
  async pages() {
113
- return Promise.all(this.getDefaultContext()
114
+ const playwrightPages = this.getDefaultContext()
114
115
  .pages()
115
- .map((page) => this.getOrCreatePage(page)));
116
+ .map((page) => this.getOrCreatePage(page));
117
+ const settledPages = await Promise.allSettled(playwrightPages);
118
+ return (0, logUtils_1.getPromiseSettledValues)(settledPages);
116
119
  }
117
120
  addCookies(cookies) {
118
121
  return this.getDefaultContext().addCookies(cookies);
@@ -48,6 +48,12 @@ class PlaywrightBrowserLauncher {
48
48
  executablePath: options.browserPath,
49
49
  extraHTTPHeaders: options.extraHttpHeaders,
50
50
  geolocation: DEFAULT_GEOLOCATION,
51
+ recordHar: options.harLogFilePath
52
+ ? {
53
+ path: options.harLogFilePath,
54
+ mode: 'full',
55
+ }
56
+ : undefined,
51
57
  hasTouch: (_b = options.defaultDeviceDescriptor) === null || _b === void 0 ? void 0 : _b.hasTouch,
52
58
  headless: options.headless,
53
59
  httpCredentials: options.credentials,
@@ -31,6 +31,7 @@ const utils_1 = require("../utils");
31
31
  const playwrightHttpResponse_1 = require("./playwrightHttpResponse");
32
32
  const playwrightDom_1 = require("./playwrightDom");
33
33
  const testsUtil_1 = require("../../commands/tests/testsUtil");
34
+ const logUtils_1 = require("../../util/logUtils");
34
35
  const WAIT_FOR_CONTEXT_TIMEOUT = 1000;
35
36
  const MAIN_CONTEXT = 'main';
36
37
  const UTILITY_CONTEXT = 'utility';
@@ -147,6 +148,7 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
147
148
  return await this.tryGoto(url, lifecycleEvent, options);
148
149
  }
149
150
  catch (e) {
151
+ (0, logUtils_1.logErrorVerbose)(e);
150
152
  if (e instanceof playwright.errors.TimeoutError) {
151
153
  throw new browserLauncher_1.RUNNER_ERRORS.TimeoutError(e.message);
152
154
  }
@@ -166,6 +168,7 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
166
168
  }
167
169
  catch (e) {
168
170
  if (browserLauncher_1.RunnerError.isPlaywrightNavigationInterruptedError(e)) {
171
+ (0, logUtils_1.logErrorVerbose)(e);
169
172
  responseHasNavigationError = true;
170
173
  }
171
174
  else {
@@ -6,6 +6,8 @@ const moment = require("moment");
6
6
  const bitBucketApiClient_1 = require("../../api/atlassian/bitBucketApiClient");
7
7
  const CodeAnnotation_1 = require("../../api/atlassian/entities/CodeAnnotation");
8
8
  const loggingProvider_1 = require("../../providers/logging/loggingProvider");
9
+ const logUtils_1 = require("../../util/logUtils");
10
+ const pureUtil_1 = require("../../util/pureUtil");
9
11
  const chalk = require('chalk');
10
12
  const bitbucketUserKey = 'MABL_BITBUCKET_USER';
11
13
  const bitbucketAppToken = 'MABL_BITBUCKET_APP_TOKEN';
@@ -137,7 +139,11 @@ async function putCodeReportAndAnnotations(executionResult, executionEventId, ou
137
139
  const codeReportResponse = await bitBucketApiClient.putCodeReport(codeReport, workspace, repoSlug, node);
138
140
  const codeAnnotations = generateCodeAnnotationsForReport(executionResult);
139
141
  const requests = codeAnnotations.map((annotation) => bitBucketApiClient.putCodeAnnotation(annotation, workspace, repoSlug, node, codeReportResponse.external_id));
140
- await Promise.all(requests).catch(() => new Error('Error writing Code Annotations to Bitbucket'));
142
+ const results = await Promise.allSettled(requests);
143
+ (0, logUtils_1.logPromiseSettledRejections)(results);
144
+ if (results.some(pureUtil_1.isRejectedPromise)) {
145
+ throw new Error('Error writing Code Annotations to Bitbucket');
146
+ }
141
147
  return codeReportResponse;
142
148
  }
143
149
  exports.putCodeReportAndAnnotations = putCodeReportAndAnnotations;