@bigbinary/neeto-playwright-commons 1.24.0 → 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 +49 -15
- package/index.cjs.js.map +1 -1
- package/index.d.ts +6 -1
- package/index.js +48 -16
- package/index.js.map +1 -1
- package/package.json +1 -1
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",
|
|
@@ -116153,14 +116158,24 @@ class GooglePage extends IntegrationBase {
|
|
|
116153
116158
|
await this.page.waitForLoadState("load", { timeout: 25000 });
|
|
116154
116159
|
await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
|
|
116155
116160
|
};
|
|
116156
|
-
this.enterTotpCode =
|
|
116157
|
-
|
|
116158
|
-
await
|
|
116159
|
-
|
|
116160
|
-
|
|
116161
|
-
|
|
116162
|
-
|
|
116163
|
-
|
|
116161
|
+
this.enterTotpCode = async (locator) => {
|
|
116162
|
+
let previousToken = null;
|
|
116163
|
+
await test.expect(async () => {
|
|
116164
|
+
let totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116165
|
+
if (totpToken === previousToken) {
|
|
116166
|
+
const remainingTime = this.totp.remaining({ timestamp: Date.now() });
|
|
116167
|
+
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
116168
|
+
await this.page.waitForTimeout(remainingTime + 500); // Wait for the remaining time plus a small buffer (500ms) to ensure new token
|
|
116169
|
+
totpToken = this.totp.generate({ timestamp: Date.now() });
|
|
116170
|
+
}
|
|
116171
|
+
previousToken = totpToken;
|
|
116172
|
+
await this.page.getByLabel(GOOGLE_LOGIN_TEXTS.enterCode).fill(totpToken);
|
|
116173
|
+
test.expect(this.totp.validate({ token: totpToken })).not.toBeNull();
|
|
116174
|
+
await this.page.locator(GOOGLE_LOGIN_SELECTORS.totpNext).click();
|
|
116175
|
+
await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.wrongCode)).toBeHidden({ timeout: 10000 });
|
|
116176
|
+
await test.expect(locator).toBeHidden({ timeout: 10000 });
|
|
116177
|
+
}).toPass({ timeout: 2 * 60 * 1000 });
|
|
116178
|
+
};
|
|
116164
116179
|
this.logoutFromGoogle = async () => {
|
|
116165
116180
|
await this.page.goto(THIRD_PARTY_ROUTES.google.myAccount, {
|
|
116166
116181
|
timeout: 20000,
|
|
@@ -118165,13 +118180,20 @@ class CustomDomainPage {
|
|
|
118165
118180
|
test.expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader).getByText(domain)).toBeVisible(),
|
|
118166
118181
|
]);
|
|
118167
118182
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
118183
|
+
let isCertificateLimitExceeded = false;
|
|
118168
118184
|
await test.expect(async () => {
|
|
118185
|
+
isCertificateLimitExceeded = await this.isCertificateLimitExceeded();
|
|
118186
|
+
if (isCertificateLimitExceeded)
|
|
118187
|
+
return;
|
|
118169
118188
|
await validateButton.click();
|
|
118170
118189
|
await this.neetoPlaywrightUtilities.verifyToast({
|
|
118171
|
-
timeout: 20000,
|
|
118172
118190
|
message: this.t("neetoCustomDomains.validation.successMessage"),
|
|
118173
118191
|
});
|
|
118174
118192
|
}).toPass({ timeout: 60000 });
|
|
118193
|
+
if (isCertificateLimitExceeded) {
|
|
118194
|
+
test.test.skip(true, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE);
|
|
118195
|
+
return;
|
|
118196
|
+
}
|
|
118175
118197
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
118176
118198
|
await test.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.activeTagContainer)).toBeVisible();
|
|
118177
118199
|
};
|
|
@@ -118234,8 +118256,15 @@ class CustomDomainPage {
|
|
|
118234
118256
|
await this.waitForTrustedSSL();
|
|
118235
118257
|
await this.waitForDomainPropagation();
|
|
118236
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
|
+
};
|
|
118237
118265
|
this.disconnectCustomDomain = async () => {
|
|
118238
|
-
|
|
118266
|
+
const customDomains = await this.getCustomDomainFromAPI();
|
|
118267
|
+
if (ramda.isEmpty(customDomains))
|
|
118239
118268
|
return;
|
|
118240
118269
|
const baseURL = baseURLGenerator(this.product, this.subdomain);
|
|
118241
118270
|
await this.neetoPlaywrightUtilities.waitForPageLoad();
|
|
@@ -118253,13 +118282,15 @@ class CustomDomainPage {
|
|
|
118253
118282
|
await test.expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible();
|
|
118254
118283
|
};
|
|
118255
118284
|
this.disconnectViaRequest = async () => {
|
|
118256
|
-
|
|
118257
|
-
|
|
118258
|
-
const customDomain = this.getCustomDomain(this.subdomain);
|
|
118259
|
-
if (!neetoCist.isPresent(customDomain))
|
|
118285
|
+
const customDomains = await this.getCustomDomainFromAPI();
|
|
118286
|
+
if (ramda.isEmpty(customDomains))
|
|
118260
118287
|
return;
|
|
118261
|
-
await this.customDomainApi.delete(
|
|
118288
|
+
await Promise.all(customDomains.map(({ hostname }) => this.customDomainApi.delete(hostname)));
|
|
118262
118289
|
};
|
|
118290
|
+
this.isCertificateLimitExceeded = () => this.page
|
|
118291
|
+
.getByTestId(COMMON_SELECTORS.paneBody)
|
|
118292
|
+
.getByText(RegExp(CERTIFICATE_LIMIT_EXCEEDED_REGEXP, "i"))
|
|
118293
|
+
.isVisible();
|
|
118263
118294
|
this.page = page;
|
|
118264
118295
|
this.browser = browser;
|
|
118265
118296
|
this.product = product;
|
|
@@ -123869,6 +123900,7 @@ dotenvExpand.expand(env);
|
|
|
123869
123900
|
if (require$$0__namespace.existsSync("./e2e/config/.env.local")) {
|
|
123870
123901
|
const localEnv = dotenv.config({
|
|
123871
123902
|
path: "./e2e/config/.env.local",
|
|
123903
|
+
quiet: true,
|
|
123872
123904
|
});
|
|
123873
123905
|
dotenvExpand.expand(localEnv);
|
|
123874
123906
|
}
|
|
@@ -123982,6 +124014,8 @@ exports.ApiKeysApi = ApiKeysApi;
|
|
|
123982
124014
|
exports.ApiKeysPage = ApiKeysPage;
|
|
123983
124015
|
exports.AuditLogsPage = AuditLogsPage;
|
|
123984
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;
|
|
123985
124019
|
exports.CHANGELOG_WIDGET_SELECTORS = CHANGELOG_WIDGET_SELECTORS;
|
|
123986
124020
|
exports.CHAT_WIDGET_SELECTORS = CHAT_WIDGET_SELECTORS;
|
|
123987
124021
|
exports.CHAT_WIDGET_TEXTS = CHAT_WIDGET_TEXTS;
|