@bigbinary/neeto-playwright-commons 3.0.5 → 3.0.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.
- package/index.cjs.js +37 -23
- package/index.cjs.js.map +1 -1
- package/index.d.ts +92 -54
- package/index.js +37 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -238,6 +238,7 @@ const APP_RESOURCES = [
|
|
|
238
238
|
"**/sticky_ribbons",
|
|
239
239
|
"**/neeto_widget_tokens",
|
|
240
240
|
];
|
|
241
|
+
const ALL_RESOURCES = Array.from(new Set([...THIRD_PARTY_RESOURCES, ...APP_RESOURCES]));
|
|
241
242
|
|
|
242
243
|
class ApiKeysApi {
|
|
243
244
|
neetoPlaywrightUtilities;
|
|
@@ -340,23 +341,6 @@ class MemberApis {
|
|
|
340
341
|
});
|
|
341
342
|
}
|
|
342
343
|
|
|
343
|
-
const NEETO_EMAIL_DELIVERY_TESTING_BASE_URL = "/neeto_email_delivery/api/v1/testing";
|
|
344
|
-
class NeetoEmailDeliveryApi {
|
|
345
|
-
neetoPlaywrightUtilities;
|
|
346
|
-
constructor(neetoPlaywrightUtilities) {
|
|
347
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
348
|
-
}
|
|
349
|
-
connect = ({ ownerId, ...payload }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
350
|
-
method: "post",
|
|
351
|
-
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/connect`,
|
|
352
|
-
body: neetoCist.keysToSnakeCase({ ownerId, connect: payload }),
|
|
353
|
-
});
|
|
354
|
-
verifyEmail = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
355
|
-
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/verify_email`,
|
|
356
|
-
params: neetoCist.keysToSnakeCase(params),
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
|
|
360
344
|
class RailsEmailApiClient {
|
|
361
345
|
port = process.env.RAILS_SERVER_PORT;
|
|
362
346
|
subdomain = process.env.SUBDOMAIN ?? "spinkart";
|
|
@@ -6041,13 +6025,12 @@ class CustomCommands {
|
|
|
6041
6025
|
blockInternalResources = (page = this.page) => Promise.all(APP_RESOURCES.map(pattern => page.context().route(pattern, route => route.abort())));
|
|
6042
6026
|
blockNonEssentialResourceTypes = (page = this.page) => page
|
|
6043
6027
|
.context()
|
|
6044
|
-
.route("**/*", route => ["image", "stylesheet", "font"
|
|
6028
|
+
.route("**/*", route => ["image", "stylesheet", "font"].includes(route.request().resourceType())
|
|
6045
6029
|
? route.abort()
|
|
6046
|
-
: route.
|
|
6030
|
+
: route.fallback());
|
|
6047
6031
|
blockAllResources = (page = this.page) => Promise.all([
|
|
6048
|
-
this.blockExternalResources(page),
|
|
6049
|
-
this.blockInternalResources(page),
|
|
6050
6032
|
this.blockNonEssentialResourceTypes(page),
|
|
6033
|
+
...ALL_RESOURCES.map(pattern => page.context().route(pattern, route => route.abort())),
|
|
6051
6034
|
]);
|
|
6052
6035
|
waitForFloatingMenu = () => test.expect(this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 25_000 });
|
|
6053
6036
|
interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext = this.page, timeout = 35_000, } = {}) => Promise.all([...new Array(times)].map(() => customPageContext.waitForResponse((response) => {
|
|
@@ -8832,7 +8815,6 @@ class OrganizationPage {
|
|
|
8832
8815
|
await fillCredentialsAndSubmit({ page: this.page, email });
|
|
8833
8816
|
return;
|
|
8834
8817
|
}
|
|
8835
|
-
await this.neetoPlaywrightUtilities.blockInternalResources();
|
|
8836
8818
|
await this.fillEmailAndSubmit(email, loginTimeout);
|
|
8837
8819
|
await this.fillOTP();
|
|
8838
8820
|
await this.dismissAuthenticatorSetupPromptIfPresent();
|
|
@@ -8898,7 +8880,6 @@ class OrganizationPage {
|
|
|
8898
8880
|
}
|
|
8899
8881
|
else {
|
|
8900
8882
|
let otp = "123456";
|
|
8901
|
-
await this.neetoPlaywrightUtilities.blockInternalResources();
|
|
8902
8883
|
await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${credentials.domain}`, { timeout: 20_000 });
|
|
8903
8884
|
await this.submitEmail(credentials.email);
|
|
8904
8885
|
if (fetchOtpFromEmail !== undefined) {
|
|
@@ -125297,6 +125278,23 @@ class NeetoAuthServer {
|
|
|
125297
125278
|
};
|
|
125298
125279
|
}
|
|
125299
125280
|
|
|
125281
|
+
const NEETO_EMAIL_DELIVERY_TESTING_BASE_URL = "/neeto_email_delivery/api/v1/testing";
|
|
125282
|
+
class NeetoEmailDeliveryApi {
|
|
125283
|
+
neetoPlaywrightUtilities;
|
|
125284
|
+
constructor(neetoPlaywrightUtilities) {
|
|
125285
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
125286
|
+
}
|
|
125287
|
+
connect = ({ ownerId, ...payload }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
125288
|
+
method: "post",
|
|
125289
|
+
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/connect`,
|
|
125290
|
+
body: neetoCist.keysToSnakeCase({ ownerId, connect: payload }),
|
|
125291
|
+
});
|
|
125292
|
+
verifyEmail = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
125293
|
+
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/verify_email`,
|
|
125294
|
+
params: neetoCist.keysToSnakeCase(params),
|
|
125295
|
+
});
|
|
125296
|
+
}
|
|
125297
|
+
|
|
125300
125298
|
const REFRESH_TOKEN_ENV_KEYS = {
|
|
125301
125299
|
gmail: "EMAIL_DELIVERY_GMAIL_REFRESH_TOKEN",
|
|
125302
125300
|
outlook: "EMAIL_DELIVERY_OUTLOOK_REFRESH_TOKEN",
|
|
@@ -125304,6 +125302,7 @@ const REFRESH_TOKEN_ENV_KEYS = {
|
|
|
125304
125302
|
const FROM_EMAIL_ENV_KEYS = {
|
|
125305
125303
|
gmail: "EMAIL_DELIVERY_CONNECTED_GMAIL",
|
|
125306
125304
|
outlook: "EMAIL_DELIVERY_CONNECTED_OUTLOOK",
|
|
125305
|
+
sparkpost: "EMAIL_DELIVERY_CONNECTED_SPARKPOST",
|
|
125307
125306
|
};
|
|
125308
125307
|
class EmailDeliveryUtils {
|
|
125309
125308
|
neetoPlaywrightUtilities;
|
|
@@ -125313,6 +125312,20 @@ class EmailDeliveryUtils {
|
|
|
125313
125312
|
this.emailDeliveryApi = new NeetoEmailDeliveryApi(neetoPlaywrightUtilities);
|
|
125314
125313
|
}
|
|
125315
125314
|
connectViaRequest = async ({ provider, ownerId }) => {
|
|
125315
|
+
if (provider === "sparkpost") {
|
|
125316
|
+
const sparkpostEmailEnvKey = FROM_EMAIL_ENV_KEYS.sparkpost;
|
|
125317
|
+
const email = process.env[sparkpostEmailEnvKey];
|
|
125318
|
+
if (ramda.isNil(email)) {
|
|
125319
|
+
throw new Error(`ENV variable ${sparkpostEmailEnvKey} is not properly configured`);
|
|
125320
|
+
}
|
|
125321
|
+
const response = await this.emailDeliveryApi.connect({
|
|
125322
|
+
emailProvider: "sparkpost",
|
|
125323
|
+
email,
|
|
125324
|
+
ownerId,
|
|
125325
|
+
});
|
|
125326
|
+
test.expect(response?.ok()).toBeTruthy();
|
|
125327
|
+
return response;
|
|
125328
|
+
}
|
|
125316
125329
|
const refreshTokenEnvKey = REFRESH_TOKEN_ENV_KEYS[provider];
|
|
125317
125330
|
const refreshToken = process.env[refreshTokenEnvKey];
|
|
125318
125331
|
if (ramda.isNil(refreshToken)) {
|
|
@@ -126189,6 +126202,7 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
126189
126202
|
|
|
126190
126203
|
exports.ACTIONS = ACTIONS;
|
|
126191
126204
|
exports.ADMIN_PANEL_SELECTORS = ADMIN_PANEL_SELECTORS;
|
|
126205
|
+
exports.ALL_RESOURCES = ALL_RESOURCES;
|
|
126192
126206
|
exports.ANALYTICS_RESOURCES = ANALYTICS_RESOURCES;
|
|
126193
126207
|
exports.API_KEYS_SELECTORS = API_KEYS_SELECTORS;
|
|
126194
126208
|
exports.API_ROUTES = API_ROUTES;
|