@bigbinary/neeto-playwright-commons 1.24.1 → 1.24.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/index.cjs.js CHANGED
@@ -156,6 +156,9 @@ class CustomDomainApi {
156
156
  url: `${BASE_URL}/custom_domains/${customDomain}`,
157
157
  method: "delete",
158
158
  });
159
+ this.fetch = () => this.neetoPlaywrightUtilities.apiRequest({
160
+ url: `${BASE_URL}/custom_domains`,
161
+ });
159
162
  }
160
163
  }
161
164
 
@@ -4431,6 +4434,8 @@ const DATE_RANGES = {
4431
4434
  before: "Before",
4432
4435
  customDateRange: "Custom date range",
4433
4436
  };
4437
+ const CERTIFICATE_LIMIT_EXCEEDED_REGEXP = `too many certificates \\(\\d+\\) already issued for "${CUSTOM_DOMAIN_SUFFIX}"`;
4438
+ const CERTIFICATE_LIMIT_EXCEEDED_MESSAGE = "Certificate limit exceeded for custom domain";
4434
4439
 
4435
4440
  const COMMON_SELECTORS = {
4436
4441
  emailInputError: "email-input-error",
@@ -118175,13 +118180,20 @@ class CustomDomainPage {
118175
118180
  test.expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader).getByText(domain)).toBeVisible(),
118176
118181
  ]);
118177
118182
  await this.neetoPlaywrightUtilities.waitForPageLoad();
118183
+ let isCertificateLimitExceeded = false;
118178
118184
  await test.expect(async () => {
118185
+ isCertificateLimitExceeded = await this.isCertificateLimitExceeded();
118186
+ if (isCertificateLimitExceeded)
118187
+ return;
118179
118188
  await validateButton.click();
118180
118189
  await this.neetoPlaywrightUtilities.verifyToast({
118181
- timeout: 20000,
118182
118190
  message: this.t("neetoCustomDomains.validation.successMessage"),
118183
118191
  });
118184
118192
  }).toPass({ timeout: 60000 });
118193
+ if (isCertificateLimitExceeded) {
118194
+ test.test.skip(true, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE);
118195
+ return;
118196
+ }
118185
118197
  await this.neetoPlaywrightUtilities.waitForPageLoad();
118186
118198
  await test.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.activeTagContainer)).toBeVisible();
118187
118199
  };
@@ -118244,8 +118256,15 @@ class CustomDomainPage {
118244
118256
  await this.waitForTrustedSSL();
118245
118257
  await this.waitForDomainPropagation();
118246
118258
  };
118259
+ this.getCustomDomainFromAPI = async () => {
118260
+ const { custom_domains } = await this.customDomainApi
118261
+ .fetch()
118262
+ .then(response => response === null || response === void 0 ? void 0 : response.json());
118263
+ return custom_domains;
118264
+ };
118247
118265
  this.disconnectCustomDomain = async () => {
118248
- if (shouldSkipCustomDomainSetup())
118266
+ const customDomains = await this.getCustomDomainFromAPI();
118267
+ if (ramda.isEmpty(customDomains))
118249
118268
  return;
118250
118269
  const baseURL = baseURLGenerator(this.product, this.subdomain);
118251
118270
  await this.neetoPlaywrightUtilities.waitForPageLoad();
@@ -118263,13 +118282,15 @@ class CustomDomainPage {
118263
118282
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible();
118264
118283
  };
118265
118284
  this.disconnectViaRequest = async () => {
118266
- if (shouldSkipCustomDomainSetup())
118267
- return;
118268
- const customDomain = this.getCustomDomain(this.subdomain);
118269
- if (!neetoCist.isPresent(customDomain))
118285
+ const customDomains = await this.getCustomDomainFromAPI();
118286
+ if (ramda.isEmpty(customDomains))
118270
118287
  return;
118271
- await this.customDomainApi.delete(customDomain);
118288
+ await Promise.all(customDomains.map(({ hostname }) => this.customDomainApi.delete(hostname)));
118272
118289
  };
118290
+ this.isCertificateLimitExceeded = () => this.page
118291
+ .getByTestId(COMMON_SELECTORS.paneBody)
118292
+ .getByText(RegExp(CERTIFICATE_LIMIT_EXCEEDED_REGEXP, "i"))
118293
+ .isVisible();
118273
118294
  this.page = page;
118274
118295
  this.browser = browser;
118275
118296
  this.product = product;
@@ -123879,6 +123900,7 @@ dotenvExpand.expand(env);
123879
123900
  if (require$$0__namespace.existsSync("./e2e/config/.env.local")) {
123880
123901
  const localEnv = dotenv.config({
123881
123902
  path: "./e2e/config/.env.local",
123903
+ quiet: true,
123882
123904
  });
123883
123905
  dotenvExpand.expand(localEnv);
123884
123906
  }
@@ -123992,6 +124014,8 @@ exports.ApiKeysApi = ApiKeysApi;
123992
124014
  exports.ApiKeysPage = ApiKeysPage;
123993
124015
  exports.AuditLogsPage = AuditLogsPage;
123994
124016
  exports.BASE_URL = BASE_URL;
124017
+ exports.CERTIFICATE_LIMIT_EXCEEDED_MESSAGE = CERTIFICATE_LIMIT_EXCEEDED_MESSAGE;
124018
+ exports.CERTIFICATE_LIMIT_EXCEEDED_REGEXP = CERTIFICATE_LIMIT_EXCEEDED_REGEXP;
123995
124019
  exports.CHANGELOG_WIDGET_SELECTORS = CHANGELOG_WIDGET_SELECTORS;
123996
124020
  exports.CHAT_WIDGET_SELECTORS = CHAT_WIDGET_SELECTORS;
123997
124021
  exports.CHAT_WIDGET_TEXTS = CHAT_WIDGET_TEXTS;