@bigbinary/neeto-playwright-commons 1.7.0 → 1.7.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 +62 -3
- package/index.cjs.js.map +1 -1
- package/index.d.ts +38 -4
- package/index.js +61 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWor
|
|
|
3
3
|
import MailosaurClient from 'mailosaur';
|
|
4
4
|
import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
|
|
5
5
|
import { TFunction } from 'i18next';
|
|
6
|
+
import * as playwright_core from 'playwright-core';
|
|
6
7
|
|
|
7
8
|
interface InterceptMultipleResponsesParams {
|
|
8
9
|
responseUrl: string;
|
|
@@ -19,10 +20,9 @@ interface ExecuteRecursivelyParams {
|
|
|
19
20
|
}
|
|
20
21
|
type ExecuteRecursively = (params: ExecuteRecursivelyParams) => Promise<void>;
|
|
21
22
|
interface VerifySuccessToastParams {
|
|
22
|
-
message
|
|
23
|
+
message: string;
|
|
23
24
|
closeAfterVerification: boolean;
|
|
24
25
|
}
|
|
25
|
-
type VerifySuccessToast = (params: VerifySuccessToastParams) => Promise<void>;
|
|
26
26
|
type BasicTypesInterface = Record<string, number | string | boolean>;
|
|
27
27
|
type HttpMethods = "get" | "patch" | "post" | "put" | "delete";
|
|
28
28
|
interface ApiRequestProps {
|
|
@@ -47,7 +47,7 @@ declare class CustomCommands {
|
|
|
47
47
|
interceptMultipleResponses: ({ responseUrl, times, baseUrl, customPageContext, timeout, }?: Partial<InterceptMultipleResponsesParams>) => Promise<Response[]>;
|
|
48
48
|
private recursiveMethod;
|
|
49
49
|
executeRecursively: ExecuteRecursively;
|
|
50
|
-
verifySuccessToast:
|
|
50
|
+
verifySuccessToast: ({ message, closeAfterVerification, }?: Partial<VerifySuccessToastParams>) => Promise<void>;
|
|
51
51
|
reloadAndWait: (requestCount: number) => Promise<void>;
|
|
52
52
|
apiRequest: ApiRequest;
|
|
53
53
|
verifyFieldValue: VerifyFieldValue;
|
|
@@ -187,6 +187,14 @@ declare const ROUTES: {
|
|
|
187
187
|
show: (id: string) => string;
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
+
declare const API_ROUTES: {
|
|
191
|
+
teamMembers: {
|
|
192
|
+
all: string;
|
|
193
|
+
bulkUpdate: string;
|
|
194
|
+
index: string;
|
|
195
|
+
show: (id: string) => string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
190
198
|
|
|
191
199
|
declare const COMMON_SELECTORS: {
|
|
192
200
|
spinner: string;
|
|
@@ -463,6 +471,32 @@ declare const login: ({ page, neetoPlaywrightUtilities, loginPath, }: LoginProps
|
|
|
463
471
|
|
|
464
472
|
declare const extractSubdomainFromError: (errorString: string) => string;
|
|
465
473
|
|
|
474
|
+
interface AddMemberProps {
|
|
475
|
+
email: string;
|
|
476
|
+
role?: string;
|
|
477
|
+
appName: string;
|
|
478
|
+
requestCount?: number;
|
|
479
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
480
|
+
}
|
|
481
|
+
interface EditMemberProps {
|
|
482
|
+
email: string;
|
|
483
|
+
firstName?: string;
|
|
484
|
+
lastName?: string;
|
|
485
|
+
newRole?: string;
|
|
486
|
+
requestCount?: number;
|
|
487
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
488
|
+
}
|
|
489
|
+
interface DeactiveMemberProps {
|
|
490
|
+
email: string;
|
|
491
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
492
|
+
requestCount?: number;
|
|
493
|
+
}
|
|
494
|
+
declare const memberUtils: {
|
|
495
|
+
addMemberViaRequest: ({ email, role, appName, neetoPlaywrightUtilities, }: AddMemberProps) => Promise<playwright_core.APIResponse | undefined>;
|
|
496
|
+
editMemberViaRequest: ({ email, firstName, lastName, newRole, neetoPlaywrightUtilities, }: EditMemberProps) => Promise<void>;
|
|
497
|
+
deactivateMemberViaRequest: ({ email, neetoPlaywrightUtilities, }: DeactiveMemberProps) => Promise<playwright_core.APIResponse | undefined>;
|
|
498
|
+
};
|
|
499
|
+
|
|
466
500
|
interface CurrentsOverrides {
|
|
467
501
|
projectId: string;
|
|
468
502
|
}
|
|
@@ -475,4 +509,4 @@ interface Overrides {
|
|
|
475
509
|
}
|
|
476
510
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
477
511
|
|
|
478
|
-
export { BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
|
|
512
|
+
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import test, { expect, test as test$1, defineConfig, devices } from '@playwright/test';
|
|
2
2
|
import * as require$$0 from 'fs';
|
|
3
3
|
import require$$0__default from 'fs';
|
|
4
|
+
import { isEmpty as isEmpty$1, isNil, isNotNil, mergeDeepLeft, mergeAll, mergeLeft } from 'ramda';
|
|
4
5
|
import { faker } from '@faker-js/faker';
|
|
5
|
-
import { isNil, isNotNil, mergeDeepLeft, mergeAll, mergeLeft } from 'ramda';
|
|
6
6
|
import MailosaurClient from 'mailosaur';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import require$$2 from 'os';
|
|
@@ -175,8 +175,8 @@ class CustomCommands {
|
|
|
175
175
|
const startTime = Date.now();
|
|
176
176
|
await this.recursiveMethod(callback, condition, timeout, startTime);
|
|
177
177
|
};
|
|
178
|
-
this.verifySuccessToast = async ({ message =
|
|
179
|
-
if (message) {
|
|
178
|
+
this.verifySuccessToast = async ({ message = "", closeAfterVerification = true, } = {}) => {
|
|
179
|
+
if (isEmpty$1(message)) {
|
|
180
180
|
await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message);
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
@@ -7157,11 +7157,22 @@ const ROUTES = {
|
|
|
7157
7157
|
show: (id) => `/team_members/teams/${id}`,
|
|
7158
7158
|
},
|
|
7159
7159
|
};
|
|
7160
|
+
const API_ROUTES = {
|
|
7161
|
+
teamMembers: {
|
|
7162
|
+
all: "/team_members*/**",
|
|
7163
|
+
bulkUpdate: "/team_members/teams/bulk_update",
|
|
7164
|
+
index: "/team_members/teams",
|
|
7165
|
+
show: (id) => `/team_members/teams/${id}`,
|
|
7166
|
+
},
|
|
7167
|
+
};
|
|
7160
7168
|
|
|
7161
7169
|
const CHAT_WIDGET_TEXTS = {
|
|
7162
7170
|
newConversation: "New Conversation",
|
|
7163
7171
|
welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
|
|
7164
7172
|
};
|
|
7173
|
+
const MEMBER_TEXTS = {
|
|
7174
|
+
agent: "Agent",
|
|
7175
|
+
};
|
|
7165
7176
|
|
|
7166
7177
|
const HELP_CENTER_SELECTORS = {
|
|
7167
7178
|
helpButton: "help-button",
|
|
@@ -7708,6 +7719,52 @@ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/"
|
|
|
7708
7719
|
const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
|
|
7709
7720
|
(await loginWithoutSSO({ page, neetoPlaywrightUtilities, loginPath }));
|
|
7710
7721
|
|
|
7722
|
+
const addMemberViaRequest = ({ email, role = MEMBER_TEXTS.agent, appName, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
|
|
7723
|
+
method: "post",
|
|
7724
|
+
url: API_ROUTES.teamMembers.index,
|
|
7725
|
+
body: {
|
|
7726
|
+
user: {
|
|
7727
|
+
emails: [email],
|
|
7728
|
+
organization_role: role,
|
|
7729
|
+
app_roles: [{ app_name: appName, active_role: role, is_enabled: true }],
|
|
7730
|
+
},
|
|
7731
|
+
},
|
|
7732
|
+
});
|
|
7733
|
+
const editMemberViaRequest = async ({ email, firstName, lastName, newRole, neetoPlaywrightUtilities, }) => {
|
|
7734
|
+
const response = await neetoPlaywrightUtilities.apiRequest({
|
|
7735
|
+
method: "get",
|
|
7736
|
+
url: API_ROUTES.teamMembers.index,
|
|
7737
|
+
params: { search: email },
|
|
7738
|
+
});
|
|
7739
|
+
if (response) {
|
|
7740
|
+
const responseBodyBuffer = await response.body();
|
|
7741
|
+
const responseBody = JSON.parse(responseBodyBuffer.toString());
|
|
7742
|
+
const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members[0];
|
|
7743
|
+
await neetoPlaywrightUtilities.apiRequest({
|
|
7744
|
+
method: "put",
|
|
7745
|
+
url: API_ROUTES.teamMembers.show(memberDetails.id),
|
|
7746
|
+
body: {
|
|
7747
|
+
team: {
|
|
7748
|
+
active: true,
|
|
7749
|
+
first_name: firstName,
|
|
7750
|
+
last_name: lastName,
|
|
7751
|
+
organization_role: newRole,
|
|
7752
|
+
},
|
|
7753
|
+
},
|
|
7754
|
+
});
|
|
7755
|
+
}
|
|
7756
|
+
};
|
|
7757
|
+
const deactivateMemberViaRequest = ({ email, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
|
|
7758
|
+
method: "patch",
|
|
7759
|
+
url: API_ROUTES.teamMembers.bulkUpdate,
|
|
7760
|
+
body: { users: { active: false, emails: [email] } },
|
|
7761
|
+
});
|
|
7762
|
+
const memberUtils = {
|
|
7763
|
+
addMemberViaRequest,
|
|
7764
|
+
editMemberViaRequest,
|
|
7765
|
+
deactivateMemberViaRequest,
|
|
7766
|
+
};
|
|
7767
|
+
|
|
7711
7768
|
var main$2 = {exports: {}};
|
|
7712
7769
|
|
|
7713
7770
|
var name = "dotenv";
|
|
@@ -8244,5 +8301,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
8244
8301
|
});
|
|
8245
8302
|
};
|
|
8246
8303
|
|
|
8247
|
-
export { BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
|
|
8304
|
+
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
|
|
8248
8305
|
//# sourceMappingURL=index.js.map
|