@bigbinary/neeto-playwright-commons 1.8.7 → 1.8.8
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 +78 -2
- package/index.cjs.js.map +1 -1
- package/index.d.ts +49 -3
- package/index.js +77 -3
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
|
-
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Locator, FrameLocator } from '@playwright/test';
|
|
2
|
+
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Locator, FrameLocator, BrowserContext } from '@playwright/test';
|
|
3
3
|
import MailosaurClient from 'mailosaur';
|
|
4
4
|
import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
|
|
5
5
|
import { TFunction } from 'i18next';
|
|
@@ -48,7 +48,7 @@ declare class CustomCommands {
|
|
|
48
48
|
private recursiveMethod;
|
|
49
49
|
executeRecursively: ExecuteRecursively;
|
|
50
50
|
verifySuccessToast: ({ message, closeAfterVerification, }?: Partial<VerifySuccessToastParams>) => Promise<void>;
|
|
51
|
-
reloadAndWait: (requestCount: number) => Promise<void>;
|
|
51
|
+
reloadAndWait: (requestCount: number, customPageContext?: Page) => Promise<void>;
|
|
52
52
|
apiRequest: ApiRequest;
|
|
53
53
|
verifyFieldValue: VerifyFieldValue;
|
|
54
54
|
}
|
|
@@ -140,6 +140,43 @@ declare class HelpAndProfilePage {
|
|
|
140
140
|
verifyLogoutV2: () => Promise<void>;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
interface WebhooksPageParams {
|
|
144
|
+
page: Page;
|
|
145
|
+
request: APIRequestContext;
|
|
146
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
147
|
+
context: BrowserContext;
|
|
148
|
+
}
|
|
149
|
+
type CallbackFunction = (args: Record<string, unknown>) => void;
|
|
150
|
+
interface VerifyWebhookResponseParams extends Record<string, unknown> {
|
|
151
|
+
callback?: CallbackFunction;
|
|
152
|
+
webhookToken: string;
|
|
153
|
+
}
|
|
154
|
+
interface VerifyWebhookDeliveriesParams extends Record<string, unknown> {
|
|
155
|
+
callback: CallbackFunction;
|
|
156
|
+
}
|
|
157
|
+
interface VerifyWebhookDeliveryByEventParams extends Record<string, unknown> {
|
|
158
|
+
event: string;
|
|
159
|
+
callbackToVerifyDeliveries: (args: Record<string, unknown>) => void;
|
|
160
|
+
}
|
|
161
|
+
declare class WebhooksPage {
|
|
162
|
+
page: Page;
|
|
163
|
+
request: APIRequestContext;
|
|
164
|
+
context: BrowserContext;
|
|
165
|
+
neetoPlaywrightUtilities: CustomCommands;
|
|
166
|
+
t: TFunction;
|
|
167
|
+
constructor({ page, request, neetoPlaywrightUtilities, context, }: WebhooksPageParams);
|
|
168
|
+
getWebhookURL: () => Promise<{
|
|
169
|
+
webhookSiteURL: string;
|
|
170
|
+
webhookToken: string;
|
|
171
|
+
}>;
|
|
172
|
+
addWebhook: ({ webhookSiteURL }: {
|
|
173
|
+
webhookSiteURL: string;
|
|
174
|
+
}) => Promise<void>;
|
|
175
|
+
verifyLatestWebhookResponse: ({ callback, webhookToken, ...otherParams }: VerifyWebhookResponseParams) => Promise<void>;
|
|
176
|
+
verifyWebhookDeliveries: ({ callback, ...otherParams }: VerifyWebhookDeliveriesParams) => Promise<void>;
|
|
177
|
+
verifyWebhookDeliveryByEvent: ({ event, callbackToVerifyDeliveries, ...fieldsToBeVerified }: VerifyWebhookDeliveryByEventParams) => Promise<void>;
|
|
178
|
+
}
|
|
179
|
+
|
|
143
180
|
interface CreateOrganizationProps {
|
|
144
181
|
email: string;
|
|
145
182
|
businessName: string;
|
|
@@ -188,6 +225,7 @@ declare const ROUTES: {
|
|
|
188
225
|
profile: string;
|
|
189
226
|
myProfile: string;
|
|
190
227
|
authSettings: string;
|
|
228
|
+
webhooks: string;
|
|
191
229
|
login: string;
|
|
192
230
|
signup: string;
|
|
193
231
|
subdomainAvailability: string;
|
|
@@ -208,6 +246,11 @@ declare const API_ROUTES: {
|
|
|
208
246
|
show: (id: string) => string;
|
|
209
247
|
};
|
|
210
248
|
};
|
|
249
|
+
declare const THIRD_PARTY_ROUTES: {
|
|
250
|
+
webhooks: {
|
|
251
|
+
site: string;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
211
254
|
|
|
212
255
|
declare const COMMON_SELECTORS: {
|
|
213
256
|
spinner: string;
|
|
@@ -378,6 +421,9 @@ declare const ROLES_SELECTORS: {
|
|
|
378
421
|
headerColumn: string;
|
|
379
422
|
dropDownIcon: string;
|
|
380
423
|
tableHeaderRoleTitle: string;
|
|
424
|
+
permissionCheckbox: string;
|
|
425
|
+
editRoleButton: string;
|
|
426
|
+
deleteRoleButton: string;
|
|
381
427
|
};
|
|
382
428
|
|
|
383
429
|
declare const SIGNUP_SELECTORS: {
|
|
@@ -526,4 +572,4 @@ interface Overrides {
|
|
|
526
572
|
}
|
|
527
573
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
528
574
|
|
|
529
|
-
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, getGlobalUserState, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, updateCredentials, writeDataToFile };
|
|
575
|
+
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, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, getGlobalUserState, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -194,11 +194,12 @@ class CustomCommands {
|
|
|
194
194
|
(await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
|
|
195
195
|
await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
|
|
196
196
|
};
|
|
197
|
-
this.reloadAndWait = async (requestCount) => {
|
|
197
|
+
this.reloadAndWait = async (requestCount, customPageContext) => {
|
|
198
|
+
const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
|
|
198
199
|
const reloadRequests = this.interceptMultipleResponses({
|
|
199
200
|
times: requestCount,
|
|
200
201
|
});
|
|
201
|
-
await
|
|
202
|
+
await pageContext.reload();
|
|
202
203
|
await reloadRequests;
|
|
203
204
|
};
|
|
204
205
|
this.apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
@@ -7154,6 +7155,7 @@ const ROUTES = {
|
|
|
7154
7155
|
profile: "/profile",
|
|
7155
7156
|
myProfile: "/my/profile",
|
|
7156
7157
|
authSettings: "/settings",
|
|
7158
|
+
webhooks: "/webhooks",
|
|
7157
7159
|
login: `${BASE_URL}/login`,
|
|
7158
7160
|
signup: `${BASE_URL}/signups`,
|
|
7159
7161
|
subdomainAvailability: `${BASE_URL}/subdomain_availability`,
|
|
@@ -7174,6 +7176,9 @@ const API_ROUTES = {
|
|
|
7174
7176
|
show: (id) => `/team_members/teams/${id}`,
|
|
7175
7177
|
},
|
|
7176
7178
|
};
|
|
7179
|
+
const THIRD_PARTY_ROUTES = {
|
|
7180
|
+
webhooks: { site: "https://webhook.site/" },
|
|
7181
|
+
};
|
|
7177
7182
|
|
|
7178
7183
|
const CHAT_WIDGET_TEXTS = {
|
|
7179
7184
|
newConversation: "New Conversation",
|
|
@@ -7618,6 +7623,72 @@ class HelpAndProfilePage {
|
|
|
7618
7623
|
}
|
|
7619
7624
|
}
|
|
7620
7625
|
|
|
7626
|
+
const WEBHOOK_SELECTORS = {
|
|
7627
|
+
addNewWebhook: "add-new-webhook-button",
|
|
7628
|
+
endpointInputField: "endpoint-input-field",
|
|
7629
|
+
deliveryResponseCode: "delivery-response-code",
|
|
7630
|
+
deliveryRequestPayload: "delivery-request-payload",
|
|
7631
|
+
};
|
|
7632
|
+
|
|
7633
|
+
class WebhooksPage {
|
|
7634
|
+
constructor({ page, request, neetoPlaywrightUtilities, context, }) {
|
|
7635
|
+
this.getWebhookURL = async () => {
|
|
7636
|
+
const webhookSitePage = await this.context.newPage();
|
|
7637
|
+
await webhookSitePage.goto(THIRD_PARTY_ROUTES.webhooks.site);
|
|
7638
|
+
await webhookSitePage.waitForURL(/.*#!\/\w+/);
|
|
7639
|
+
const webhookToken = webhookSitePage.url().split("#!/")[1];
|
|
7640
|
+
const webhookSiteURL = `${THIRD_PARTY_ROUTES.webhooks.site}${webhookToken}`;
|
|
7641
|
+
await webhookSitePage.close();
|
|
7642
|
+
return { webhookSiteURL, webhookToken };
|
|
7643
|
+
};
|
|
7644
|
+
this.addWebhook = async ({ webhookSiteURL }) => {
|
|
7645
|
+
await this.page.getByTestId(WEBHOOK_SELECTORS.addNewWebhook).click();
|
|
7646
|
+
await this.page
|
|
7647
|
+
.getByTestId(WEBHOOK_SELECTORS.endpointInputField)
|
|
7648
|
+
.fill(webhookSiteURL);
|
|
7649
|
+
const addWebhook = this.neetoPlaywrightUtilities.interceptMultipleResponses({ responseUrl: ROUTES.webhooks, times: 2 });
|
|
7650
|
+
await this.page.getByTestId(COMMON_SELECTORS.saveChangesButton).click();
|
|
7651
|
+
await addWebhook;
|
|
7652
|
+
await expect(this.page.getByRole("row", { name: webhookSiteURL })).toBeVisible();
|
|
7653
|
+
};
|
|
7654
|
+
this.verifyLatestWebhookResponse = async ({ callback = () => { }, webhookToken, ...otherParams }) => {
|
|
7655
|
+
let response;
|
|
7656
|
+
await expect(async () => {
|
|
7657
|
+
response = await this.request.get(`https://webhook.site/token/${webhookToken}/request/latest`);
|
|
7658
|
+
expect(response.status()).toBe(200);
|
|
7659
|
+
if (response.status() === 200) {
|
|
7660
|
+
const { content } = await response.json();
|
|
7661
|
+
const parsedResponse = JSON.parse(content).webhook;
|
|
7662
|
+
callback({ parsedResponse, ...otherParams });
|
|
7663
|
+
}
|
|
7664
|
+
}).toPass({ timeout: 10000 });
|
|
7665
|
+
};
|
|
7666
|
+
this.verifyWebhookDeliveries = async ({ callback = () => { }, ...otherParams }) => {
|
|
7667
|
+
await expect(this.page.getByTestId(WEBHOOK_SELECTORS.deliveryResponseCode)).toHaveText("200");
|
|
7668
|
+
const requestPayload = (await this.page
|
|
7669
|
+
.getByTestId(WEBHOOK_SELECTORS.deliveryRequestPayload)
|
|
7670
|
+
.textContent());
|
|
7671
|
+
const parsedResponse = JSON.parse(requestPayload).webhook;
|
|
7672
|
+
callback({ parsedResponse, ...otherParams });
|
|
7673
|
+
};
|
|
7674
|
+
this.verifyWebhookDeliveryByEvent = async ({ event, callbackToVerifyDeliveries, ...fieldsToBeVerified }) => {
|
|
7675
|
+
await this.page
|
|
7676
|
+
.getByRole("row", { name: event })
|
|
7677
|
+
.getByRole("button")
|
|
7678
|
+
.click();
|
|
7679
|
+
await this.verifyWebhookDeliveries({
|
|
7680
|
+
callback: callbackToVerifyDeliveries,
|
|
7681
|
+
...fieldsToBeVerified,
|
|
7682
|
+
});
|
|
7683
|
+
};
|
|
7684
|
+
this.page = page;
|
|
7685
|
+
this.request = request;
|
|
7686
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7687
|
+
this.context = context;
|
|
7688
|
+
this.t = getI18nInstance().t;
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7691
|
+
|
|
7621
7692
|
const SIGNUP_SELECTORS = {
|
|
7622
7693
|
emailTextField: "signup-email-text-field",
|
|
7623
7694
|
firstNameTextField: "signup-profile-first-name-text-field",
|
|
@@ -7879,6 +7950,9 @@ const ROLES_SELECTORS = {
|
|
|
7879
7950
|
headerColumn: "ntm-roles-table-header",
|
|
7880
7951
|
dropDownIcon: "ntm-roles-table-header-role-dropdown-button",
|
|
7881
7952
|
tableHeaderRoleTitle: "ntm-roles-table-header-role-title",
|
|
7953
|
+
permissionCheckbox: "ntm-roles-permission-checkbox",
|
|
7954
|
+
editRoleButton: "ntm-roles-table-edit-role-button",
|
|
7955
|
+
deleteRoleButton: " ntm-roles-table-delete-role-button",
|
|
7882
7956
|
};
|
|
7883
7957
|
|
|
7884
7958
|
const TAGS_SELECTORS = {
|
|
@@ -8534,5 +8608,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
8534
8608
|
});
|
|
8535
8609
|
};
|
|
8536
8610
|
|
|
8537
|
-
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, getGlobalUserState, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, updateCredentials, writeDataToFile };
|
|
8611
|
+
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, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, getGlobalUserState, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, updateCredentials, writeDataToFile };
|
|
8538
8612
|
//# sourceMappingURL=index.js.map
|