@bigbinary/neeto-playwright-commons 1.25.1 → 1.26.0
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 +201 -66
- package/index.cjs.js.map +1 -1
- package/index.d.ts +146 -1
- package/index.js +197 -67
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
4
|
+
var faker = require('@faker-js/faker');
|
|
3
5
|
var require$$0$4 = require('fs');
|
|
4
6
|
var path$1 = require('path');
|
|
5
7
|
var test = require('@playwright/test');
|
|
6
8
|
var playwrightI18nextFixture = require('playwright-i18next-fixture');
|
|
7
9
|
var require$$0$3 = require('util');
|
|
8
10
|
var ramda = require('ramda');
|
|
9
|
-
var neetoCist = require('@bigbinary/neeto-cist');
|
|
10
11
|
var child_process = require('child_process');
|
|
11
|
-
var faker = require('@faker-js/faker');
|
|
12
12
|
var dayjs = require('dayjs');
|
|
13
13
|
var require$$0$6 = require('stream');
|
|
14
14
|
var node_module = require('node:module');
|
|
@@ -252,6 +252,43 @@ class RoleApis {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
const SECURITY_BASE_URL = `/secure${BASE_URL}/configuration`;
|
|
256
|
+
class SecurityApi {
|
|
257
|
+
constructor(neetoPlaywrightUtilities) {
|
|
258
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
259
|
+
this.buildBody = (auth, value) => {
|
|
260
|
+
switch (auth) {
|
|
261
|
+
case "password":
|
|
262
|
+
return {
|
|
263
|
+
configuration: {
|
|
264
|
+
auth: "basic",
|
|
265
|
+
password: value || faker.faker.internet.password(),
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
case "invite":
|
|
269
|
+
return { configuration: { auth: "invited" } };
|
|
270
|
+
case "member":
|
|
271
|
+
return { configuration: { auth: "session" } };
|
|
272
|
+
case "email":
|
|
273
|
+
return {
|
|
274
|
+
configuration: {
|
|
275
|
+
auth: "email",
|
|
276
|
+
allowed_keywords: [value || faker.faker.internet.domainName()],
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
default:
|
|
280
|
+
return { configuration: { auth: "no" } };
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
this.update = ({ ownerId, auth, value }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
284
|
+
body: this.buildBody(auth, value),
|
|
285
|
+
url: SECURITY_BASE_URL,
|
|
286
|
+
...(ownerId && { params: neetoCist.keysToSnakeCase({ ownerId }) }),
|
|
287
|
+
method: "put",
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
255
292
|
class TagsApi {
|
|
256
293
|
constructor(neetoPlaywrightUtilities) {
|
|
257
294
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
@@ -263,6 +300,119 @@ class TagsApi {
|
|
|
263
300
|
}
|
|
264
301
|
}
|
|
265
302
|
|
|
303
|
+
const ENVIRONMENT = {
|
|
304
|
+
development: "development",
|
|
305
|
+
staging: "staging",
|
|
306
|
+
review: "review",
|
|
307
|
+
};
|
|
308
|
+
const EXAMPLE_URL = "https://example.com";
|
|
309
|
+
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
310
|
+
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
311
|
+
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
312
|
+
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
313
|
+
const CREDENTIALS = {
|
|
314
|
+
name: "Oliver Smith",
|
|
315
|
+
email: "oliver@example.com",
|
|
316
|
+
password: "welcome",
|
|
317
|
+
};
|
|
318
|
+
const OTP_EMAIL_PATTERN = "is your login code";
|
|
319
|
+
const SLACK_DEFAULT_CHANNEL = "general";
|
|
320
|
+
const CUSTOM_DOMAIN_SUFFIX = "aceinvoice.com";
|
|
321
|
+
const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`;
|
|
322
|
+
// constants for translation
|
|
323
|
+
const SINGULAR = { count: 1 };
|
|
324
|
+
const PLURAL = { count: 2 };
|
|
325
|
+
const COLOR = {
|
|
326
|
+
transparent: "rgba(0, 0, 0, 0)",
|
|
327
|
+
softBlue: "rgb(230, 244, 255)",
|
|
328
|
+
};
|
|
329
|
+
const DATE_TEXTS = { now: "Now", nextYear: "next-year" };
|
|
330
|
+
const EMPTY_STORAGE_STATE = {
|
|
331
|
+
storageState: { cookies: [], origins: [] },
|
|
332
|
+
};
|
|
333
|
+
const CURRENT_TIME_RANGES = {
|
|
334
|
+
last24Hours: "Last 24 hours",
|
|
335
|
+
thisWeek: "This week",
|
|
336
|
+
thisMonth: "This month",
|
|
337
|
+
thisYear: "This year",
|
|
338
|
+
thisQuarter: "This quarter",
|
|
339
|
+
last30Days: "Last 30 days",
|
|
340
|
+
last7Days: "Last 7 days",
|
|
341
|
+
};
|
|
342
|
+
const PAST_TIME_RANGES = {
|
|
343
|
+
lastWeek: "Last week",
|
|
344
|
+
lastMonth: "Last month",
|
|
345
|
+
lastYear: "Last year",
|
|
346
|
+
lastQuarter: "Last quarter",
|
|
347
|
+
};
|
|
348
|
+
const TIME_RANGES = {
|
|
349
|
+
...PAST_TIME_RANGES,
|
|
350
|
+
...CURRENT_TIME_RANGES,
|
|
351
|
+
customDuration: "Custom duration",
|
|
352
|
+
};
|
|
353
|
+
const DATE_RANGES = {
|
|
354
|
+
...PAST_TIME_RANGES,
|
|
355
|
+
...CURRENT_TIME_RANGES,
|
|
356
|
+
after: "After",
|
|
357
|
+
before: "Before",
|
|
358
|
+
customDateRange: "Custom date range",
|
|
359
|
+
};
|
|
360
|
+
const CERTIFICATE_LIMIT_EXCEEDED_REGEXP = `too many certificates \\(\\d+\\) already issued for "${CUSTOM_DOMAIN_SUFFIX}"`;
|
|
361
|
+
const CERTIFICATE_LIMIT_EXCEEDED_MESSAGE = "Certificate limit exceeded for custom domain";
|
|
362
|
+
const EXPORT_FILE_TYPES = {
|
|
363
|
+
pdf: "pdf",
|
|
364
|
+
excel: "excel",
|
|
365
|
+
csv: "csv",
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const THANK_YOU_URL = "/neeto_thank_you/thank_you_configurations";
|
|
369
|
+
class ThankYouApi {
|
|
370
|
+
constructor(neetoPlaywrightUtilities) {
|
|
371
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
372
|
+
this.create = ({ entityId, title, }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
373
|
+
method: "post",
|
|
374
|
+
body: { title, description: "" },
|
|
375
|
+
url: THANK_YOU_URL,
|
|
376
|
+
params: neetoCist.keysToSnakeCase({ entityId }),
|
|
377
|
+
});
|
|
378
|
+
this.fetch = ({ entityId }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
379
|
+
url: THANK_YOU_URL,
|
|
380
|
+
params: neetoCist.keysToSnakeCase({ entityId }),
|
|
381
|
+
});
|
|
382
|
+
this.update = ({ thankYouPageId, entityId, }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
383
|
+
method: "put",
|
|
384
|
+
url: `${THANK_YOU_URL}/${thankYouPageId}`,
|
|
385
|
+
body: neetoCist.keysToSnakeCase({
|
|
386
|
+
entityId,
|
|
387
|
+
thankYouConfiguration: {
|
|
388
|
+
id: thankYouPageId,
|
|
389
|
+
kind: "redirect_to_url",
|
|
390
|
+
passEventDetailsToRedirectUrl: false,
|
|
391
|
+
redirectUrl: EXAMPLE_URL,
|
|
392
|
+
},
|
|
393
|
+
}),
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
class SlackApi {
|
|
399
|
+
constructor(neetoPlaywrightUtilities) {
|
|
400
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
401
|
+
this.apiRequest = (endpoint, params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
402
|
+
url: `https://slack.com/api/conversations.${endpoint}`,
|
|
403
|
+
headers: { Authorization: `Bearer ${this.botToken}` },
|
|
404
|
+
params,
|
|
405
|
+
});
|
|
406
|
+
this.fetchMessages = (channelId, unixTimestamp) => this.apiRequest("history", { channel: channelId, oldest: unixTimestamp });
|
|
407
|
+
this.createChannel = (channelName) => this.apiRequest("create", { name: channelName });
|
|
408
|
+
this.addUser = (channelId, userId) => this.apiRequest("invite", { channel: channelId, users: userId });
|
|
409
|
+
if (!process.env.SLACK_BOT_TOKEN) {
|
|
410
|
+
throw new Error("SLACK_BOT_TOKEN is not set");
|
|
411
|
+
}
|
|
412
|
+
this.botToken = process.env.SLACK_BOT_TOKEN;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
266
416
|
class WebhookSiteApi {
|
|
267
417
|
constructor(request) {
|
|
268
418
|
this.request = request;
|
|
@@ -272,6 +422,50 @@ class WebhookSiteApi {
|
|
|
272
422
|
}
|
|
273
423
|
}
|
|
274
424
|
|
|
425
|
+
class TwilioApi {
|
|
426
|
+
constructor(neetoPlaywrightUtilities) {
|
|
427
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
428
|
+
this.apiRequest = ({ endpoint, params, body, method = "get", }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
429
|
+
method,
|
|
430
|
+
url: `/neeto_integrations/${endpoint}`,
|
|
431
|
+
...(params && { params }),
|
|
432
|
+
...(body && { body }),
|
|
433
|
+
});
|
|
434
|
+
this.fetch = ({ integrableId, integrableType }) => this.apiRequest({
|
|
435
|
+
endpoint: "twilio/sms_configurations",
|
|
436
|
+
...(integrableId && {
|
|
437
|
+
params: neetoCist.keysToSnakeCase({ integrableId, integrableType }),
|
|
438
|
+
}),
|
|
439
|
+
});
|
|
440
|
+
this.disconnect = ({ integrableId, integrableType }) => this.apiRequest({
|
|
441
|
+
method: "delete",
|
|
442
|
+
endpoint: "disconnect",
|
|
443
|
+
body: neetoCist.keysToSnakeCase({
|
|
444
|
+
disconnect: { slug: "twilio" },
|
|
445
|
+
...(integrableId && { integrableId, integrableType }),
|
|
446
|
+
}),
|
|
447
|
+
});
|
|
448
|
+
this.connect = ({ integrableId, integrableType }) => this.apiRequest({
|
|
449
|
+
endpoint: "twilio/sms_configurations",
|
|
450
|
+
method: "post",
|
|
451
|
+
body: neetoCist.keysToSnakeCase({
|
|
452
|
+
twilioAuthToken: this.authToken,
|
|
453
|
+
twilioSid: this.sid,
|
|
454
|
+
twilioPhoneNumberSid: this.defaultPhoneSid,
|
|
455
|
+
...(integrableId && { integrableId, integrableType }),
|
|
456
|
+
}),
|
|
457
|
+
});
|
|
458
|
+
if (!process.env.TWILIO_AUTH_TOKEN ||
|
|
459
|
+
!process.env.TWILIO_SID ||
|
|
460
|
+
!process.env.TWILIO_DEFAULT_PHONE_SID) {
|
|
461
|
+
throw new Error("TWILIO_AUTH_TOKEN, TWILIO_SID, and TWILIO_DEFAULT_PHONE_SID are not set");
|
|
462
|
+
}
|
|
463
|
+
this.authToken = process.env.TWILIO_AUTH_TOKEN;
|
|
464
|
+
this.sid = process.env.TWILIO_SID;
|
|
465
|
+
this.defaultPhoneSid = process.env.TWILIO_DEFAULT_PHONE_SID;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
275
469
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
276
470
|
|
|
277
471
|
function getDefaultExportFromCjs (x) {
|
|
@@ -4389,70 +4583,6 @@ function requireLib$c () {
|
|
|
4389
4583
|
var libExports = /*@__PURE__*/ requireLib$c();
|
|
4390
4584
|
var qs = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
4391
4585
|
|
|
4392
|
-
const ENVIRONMENT = {
|
|
4393
|
-
development: "development",
|
|
4394
|
-
staging: "staging",
|
|
4395
|
-
review: "review",
|
|
4396
|
-
};
|
|
4397
|
-
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
4398
|
-
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
4399
|
-
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
4400
|
-
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
4401
|
-
const CREDENTIALS = {
|
|
4402
|
-
name: "Oliver Smith",
|
|
4403
|
-
email: "oliver@example.com",
|
|
4404
|
-
password: "welcome",
|
|
4405
|
-
};
|
|
4406
|
-
const OTP_EMAIL_PATTERN = "is your login code";
|
|
4407
|
-
const SLACK_DEFAULT_CHANNEL = "general";
|
|
4408
|
-
const CUSTOM_DOMAIN_SUFFIX = "aceinvoice.com";
|
|
4409
|
-
const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`;
|
|
4410
|
-
// constants for translation
|
|
4411
|
-
const SINGULAR = { count: 1 };
|
|
4412
|
-
const PLURAL = { count: 2 };
|
|
4413
|
-
const COLOR = {
|
|
4414
|
-
transparent: "rgba(0, 0, 0, 0)",
|
|
4415
|
-
softBlue: "rgb(230, 244, 255)",
|
|
4416
|
-
};
|
|
4417
|
-
const DATE_TEXTS = { now: "Now", nextYear: "next-year" };
|
|
4418
|
-
const EMPTY_STORAGE_STATE = {
|
|
4419
|
-
storageState: { cookies: [], origins: [] },
|
|
4420
|
-
};
|
|
4421
|
-
const CURRENT_TIME_RANGES = {
|
|
4422
|
-
last24Hours: "Last 24 hours",
|
|
4423
|
-
thisWeek: "This week",
|
|
4424
|
-
thisMonth: "This month",
|
|
4425
|
-
thisYear: "This year",
|
|
4426
|
-
thisQuarter: "This quarter",
|
|
4427
|
-
last30Days: "Last 30 days",
|
|
4428
|
-
last7Days: "Last 7 days",
|
|
4429
|
-
};
|
|
4430
|
-
const PAST_TIME_RANGES = {
|
|
4431
|
-
lastWeek: "Last week",
|
|
4432
|
-
lastMonth: "Last month",
|
|
4433
|
-
lastYear: "Last year",
|
|
4434
|
-
lastQuarter: "Last quarter",
|
|
4435
|
-
};
|
|
4436
|
-
const TIME_RANGES = {
|
|
4437
|
-
...PAST_TIME_RANGES,
|
|
4438
|
-
...CURRENT_TIME_RANGES,
|
|
4439
|
-
customDuration: "Custom duration",
|
|
4440
|
-
};
|
|
4441
|
-
const DATE_RANGES = {
|
|
4442
|
-
...PAST_TIME_RANGES,
|
|
4443
|
-
...CURRENT_TIME_RANGES,
|
|
4444
|
-
after: "After",
|
|
4445
|
-
before: "Before",
|
|
4446
|
-
customDateRange: "Custom date range",
|
|
4447
|
-
};
|
|
4448
|
-
const CERTIFICATE_LIMIT_EXCEEDED_REGEXP = `too many certificates \\(\\d+\\) already issued for "${CUSTOM_DOMAIN_SUFFIX}"`;
|
|
4449
|
-
const CERTIFICATE_LIMIT_EXCEEDED_MESSAGE = "Certificate limit exceeded for custom domain";
|
|
4450
|
-
const EXPORT_FILE_TYPES = {
|
|
4451
|
-
pdf: "pdf",
|
|
4452
|
-
excel: "excel",
|
|
4453
|
-
csv: "csv",
|
|
4454
|
-
};
|
|
4455
|
-
|
|
4456
4586
|
const COMMON_SELECTORS = {
|
|
4457
4587
|
emailInputError: "email-input-error",
|
|
4458
4588
|
pane: "pane-wrapper",
|
|
@@ -124199,6 +124329,7 @@ exports.EMOJI_LABEL = EMOJI_LABEL;
|
|
|
124199
124329
|
exports.EMPTY_STORAGE_STATE = EMPTY_STORAGE_STATE;
|
|
124200
124330
|
exports.ENGAGE_TEXTS = ENGAGE_TEXTS;
|
|
124201
124331
|
exports.ENVIRONMENT = ENVIRONMENT;
|
|
124332
|
+
exports.EXAMPLE_URL = EXAMPLE_URL;
|
|
124202
124333
|
exports.EXPANDED_FONT_SIZE = EXPANDED_FONT_SIZE;
|
|
124203
124334
|
exports.EXPORT_FILE_TYPES = EXPORT_FILE_TYPES;
|
|
124204
124335
|
exports.EditorPage = EditorPage;
|
|
@@ -124266,7 +124397,9 @@ exports.SLACK_SELECTORS = SLACK_SELECTORS;
|
|
|
124266
124397
|
exports.SLACK_WEB_TEXTS = SLACK_WEB_TEXTS;
|
|
124267
124398
|
exports.STATUS_TEXTS = STATUS_TEXTS;
|
|
124268
124399
|
exports.STORAGE_STATE = STORAGE_STATE;
|
|
124400
|
+
exports.SecurityApi = SecurityApi;
|
|
124269
124401
|
exports.SidebarSection = SidebarSection;
|
|
124402
|
+
exports.SlackApi = SlackApi;
|
|
124270
124403
|
exports.SlackPage = SlackPage;
|
|
124271
124404
|
exports.TABLE_SELECTORS = TABLE_SELECTORS;
|
|
124272
124405
|
exports.TAB_SELECTORS = TAB_SELECTORS;
|
|
@@ -124285,7 +124418,9 @@ exports.TWILIO_SELECTORS = TWILIO_SELECTORS;
|
|
|
124285
124418
|
exports.TagsApi = TagsApi;
|
|
124286
124419
|
exports.TagsPage = TagsPage;
|
|
124287
124420
|
exports.TeamMembers = TeamMembers;
|
|
124421
|
+
exports.ThankYouApi = ThankYouApi;
|
|
124288
124422
|
exports.ThankYouPage = ThankYouPage;
|
|
124423
|
+
exports.TwilioApi = TwilioApi;
|
|
124289
124424
|
exports.USER_AGENTS = USER_AGENTS;
|
|
124290
124425
|
exports.WEBHOOK_SELECTORS = WEBHOOK_SELECTORS;
|
|
124291
124426
|
exports.WebhookSiteApi = WebhookSiteApi;
|