@bigbinary/neeto-playwright-commons 1.8.43 → 1.8.44

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.d.ts CHANGED
@@ -331,6 +331,31 @@ declare class WebhooksPage {
331
331
  verifyWebhookDeliveryByEvent: ({ event, callbackToVerifyDeliveries, ...fieldsToBeVerified }: VerifyWebhookDeliveryByEventParams) => Promise<void>;
332
332
  }
333
333
 
334
+ declare class ZapierPage extends IntegrationBase {
335
+ zapierWebPage: Page;
336
+ mailosaur: MailosaurClient;
337
+ continueButton: Locator;
338
+ constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }: {
339
+ page: Page;
340
+ neetoPlaywrightUtilities: CustomCommands;
341
+ integrationRouteIndex?: string;
342
+ });
343
+ loginToZapier: (zapierWebPage: Page) => Promise<void>;
344
+ logoutFromZapier: () => Promise<void>;
345
+ reconnectAccountAndPublish: (zapierApiKey: string) => Promise<void>;
346
+ deleteAllConnections: (zapierAppLink: string) => Promise<void>;
347
+ verifyZapIsTriggered: ({ productName, submittedEmail, zapTriggeredAfter, }: {
348
+ submittedEmail: string;
349
+ zapTriggeredAfter: Date;
350
+ productName: string;
351
+ }) => Promise<mailosaur_lib_models.Message>;
352
+ skipIfTaskLimitIsExhausted: () => Promise<void>;
353
+ connectAndVerify: ({ apiKeyLabel }: {
354
+ apiKeyLabel: string;
355
+ }) => Promise<string>;
356
+ disconnectAndVerify: () => Promise<void>;
357
+ }
358
+
334
359
  interface CreateOrganizationProps {
335
360
  email: string;
336
361
  businessName: string;
@@ -374,6 +399,7 @@ declare const CREDENTIALS: {
374
399
  };
375
400
  declare const OTP_EMAIL_PATTERN = "is your login code";
376
401
  declare const SLACK_DEFAULT_CHANNEL = "general";
402
+ declare const ZAPIER_TEST_EMAIL: (product: string) => string;
377
403
 
378
404
  declare const USER_AGENTS: {
379
405
  windows: string;
@@ -409,6 +435,11 @@ declare const API_ROUTES: {
409
435
  index: string;
410
436
  show: (id: string) => string;
411
437
  };
438
+ integrations: {
439
+ zapier: {
440
+ api_keys: string;
441
+ };
442
+ };
412
443
  };
413
444
  declare const THIRD_PARTY_ROUTES: {
414
445
  webhooks: {
@@ -417,6 +448,11 @@ declare const THIRD_PARTY_ROUTES: {
417
448
  slack: {
418
449
  loginWithPassword: (workspace: string) => string;
419
450
  };
451
+ zapier: {
452
+ login: string;
453
+ logOut: string;
454
+ zapEditor: (zapId: string) => string;
455
+ };
420
456
  };
421
457
 
422
458
  declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling", Protocol.Network.emulateNetworkConditionsParameters>;
@@ -716,6 +752,25 @@ declare const INTEGRATION_SELECTORS: {
716
752
  manageButton: string;
717
753
  };
718
754
 
755
+ declare const ZAPIER_SELECTORS: {
756
+ zapTriggerStep: (zapId: string) => string;
757
+ zapAccountSubstep: string;
758
+ zapOpenSubstepContainer: string;
759
+ modal: string;
760
+ fmPrettytext: string;
761
+ spinner: string;
762
+ skeletonBlock: string;
763
+ accountsLoader: string;
764
+ floatingBox: string;
765
+ connection: string;
766
+ deleteConnectionModal: string;
767
+ deleteConnectionDropdownButton: string;
768
+ usageAmounts: string;
769
+ universalSidebar: string;
770
+ sidebarFooter: string;
771
+ contextualSideBar: string;
772
+ };
773
+
719
774
  declare const EMBED_SELECTORS: {
720
775
  iframe: (appName: string) => string;
721
776
  modal: (appName: string) => string;
@@ -759,6 +814,34 @@ declare const SLACK_WEB_TEXTS: {
759
814
  permanentlyDeleteTheChannel: string;
760
815
  deleteChannel: string;
761
816
  };
817
+ declare const ZAPIER_WEB_TEXTS: {
818
+ account: string;
819
+ email: string;
820
+ continue: string;
821
+ statusLabel: string;
822
+ password: string;
823
+ editExistingDraft: string;
824
+ signInTo: string;
825
+ yesContinueTo: string;
826
+ testTrigger: string;
827
+ editStep: string;
828
+ continueWithSelectedRecord: string;
829
+ publish: string;
830
+ delete: string;
831
+ loading: string;
832
+ subdomain: string;
833
+ apiKey: string;
834
+ publishingZapHeading: string;
835
+ connectionListMenu: string;
836
+ usageRegExp: string;
837
+ trialEndsRegExp: string;
838
+ testCurrentlyInQueue: string;
839
+ welcomeText: (zapierLoginEmail: string) => string;
840
+ };
841
+ declare const TOASTR_MESSAGES: {
842
+ zapierApiKeyGenerated: string;
843
+ };
844
+ declare const ZAPIER_LIMIT_EXHAUSTED_MESSAGE = "Zapier free task limit is exhausted. Test will be aborted";
762
845
 
763
846
  declare const initializeCredentials: (product: string) => void;
764
847
 
@@ -911,4 +994,4 @@ interface Overrides {
911
994
  }
912
995
  declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
913
996
 
914
- export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, EMBED_SELECTORS, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, 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, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
997
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, EMBED_SELECTORS, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, 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, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, USER_AGENTS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
package/index.js CHANGED
@@ -42,6 +42,7 @@ const CREDENTIALS = {
42
42
  };
43
43
  const OTP_EMAIL_PATTERN = "is your login code";
44
44
  const SLACK_DEFAULT_CHANNEL = "general";
45
+ const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.INTEGRATION_MAILOSAUR_SERVER_ID}.mailosaur.net`;
45
46
 
46
47
  /* eslint-disable playwright/no-skipped-test */
47
48
  const execCommand = (command) => execSync(command)
@@ -12543,12 +12544,22 @@ const API_ROUTES = {
12543
12544
  index: "/team_members/teams",
12544
12545
  show: (id) => `/team_members/teams/${id}`,
12545
12546
  },
12547
+ integrations: {
12548
+ zapier: {
12549
+ api_keys: "/neeto_integrations/zapier/api_keys",
12550
+ },
12551
+ },
12546
12552
  };
12547
12553
  const THIRD_PARTY_ROUTES = {
12548
12554
  webhooks: { site: "https://webhook.site/" },
12549
12555
  slack: {
12550
12556
  loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
12551
12557
  },
12558
+ zapier: {
12559
+ login: "https://zapier.com/app/login",
12560
+ logOut: "https://zapier.com/logout",
12561
+ zapEditor: (zapId) => `https://zapier.com/editor/${zapId}`,
12562
+ },
12552
12563
  };
12553
12564
 
12554
12565
  const CHAT_WIDGET_TEXTS = {
@@ -12571,6 +12582,34 @@ const SLACK_WEB_TEXTS = {
12571
12582
  permanentlyDeleteTheChannel: "Yes, permanently delete the channel",
12572
12583
  deleteChannel: "Delete channel",
12573
12584
  };
12585
+ const ZAPIER_WEB_TEXTS = {
12586
+ account: "Account",
12587
+ email: "Email",
12588
+ continue: "Continue",
12589
+ statusLabel: "Status",
12590
+ password: "Password",
12591
+ editExistingDraft: "Edit existing draft",
12592
+ signInTo: "Sign in to *",
12593
+ yesContinueTo: "Yes, Continue to *",
12594
+ testTrigger: "Test trigger",
12595
+ editStep: "Edit step",
12596
+ continueWithSelectedRecord: "Continue with selected record",
12597
+ publish: "Publish",
12598
+ delete: "Delete",
12599
+ loading: "Loading",
12600
+ subdomain: "Subdomain",
12601
+ apiKey: "API key",
12602
+ publishingZapHeading: "Preparing Zap to go live",
12603
+ connectionListMenu: "Connection List Item Menu",
12604
+ usageRegExp: "Usage resets in *",
12605
+ trialEndsRegExp: "Trial ends on",
12606
+ testCurrentlyInQueue: "Test currently in queue",
12607
+ welcomeText: (zapierLoginEmail) => `Welcome back ${zapierLoginEmail}`,
12608
+ };
12609
+ const TOASTR_MESSAGES = {
12610
+ zapierApiKeyGenerated: "Zapier API key is generated successfully!",
12611
+ };
12612
+ const ZAPIER_LIMIT_EXHAUSTED_MESSAGE = "Zapier free task limit is exhausted. Test will be aborted";
12574
12613
 
12575
12614
  const HELP_CENTER_SELECTORS = {
12576
12615
  helpButton: "help-button",
@@ -13183,6 +13222,228 @@ class WebhooksPage {
13183
13222
  }
13184
13223
  }
13185
13224
 
13225
+ const ZAPIER_SELECTORS = {
13226
+ zapTriggerStep: (zapId) => `[data-testid='step-node-${zapId}']`,
13227
+ zapAccountSubstep: "[data-testid='substep-Account']",
13228
+ zapOpenSubstepContainer: "[data-testid='open-sub-step-container']",
13229
+ modal: "[data-testid='Modal']",
13230
+ fmPrettytext: ".fm-prettytext",
13231
+ spinner: "[data-testid='spinner']",
13232
+ skeletonBlock: "[data-testid='SkeletonBlock']",
13233
+ accountsLoader: "[data-testid='accounts-loader']",
13234
+ floatingBox: "[data-testid='floating-box']",
13235
+ connection: "[data-testid='Connection']",
13236
+ deleteConnectionModal: "[data-testid='DeleteAuthModal-root']",
13237
+ deleteConnectionDropdownButton: "[data-testid='connection-list-item-dropdown-item-Delete']",
13238
+ usageAmounts: "css=[class$=UsageBar__amounts]",
13239
+ universalSidebar: "[data-testid='universalSidebar']",
13240
+ sidebarFooter: "css=[class$=InAppSidebarFooter__footerWrapper]",
13241
+ contextualSideBar: "[data-testid='contextual-sidebar']",
13242
+ };
13243
+
13244
+ class ZapierPage extends IntegrationBase {
13245
+ constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }) {
13246
+ super({
13247
+ page,
13248
+ integration: "zapier",
13249
+ neetoPlaywrightUtilities,
13250
+ integrationRouteIndex,
13251
+ });
13252
+ this.loginToZapier = async (zapierWebPage) => {
13253
+ this.zapierWebPage = zapierWebPage;
13254
+ this.continueButton = this.zapierWebPage.getByRole("button", {
13255
+ name: ZAPIER_WEB_TEXTS.continue,
13256
+ exact: true,
13257
+ });
13258
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.login);
13259
+ await this.zapierWebPage
13260
+ .getByLabel(ZAPIER_WEB_TEXTS.email)
13261
+ .pressSequentially(process.env.ZAPIER_LOGIN_EMAIL, { delay: 100 });
13262
+ await this.continueButton.click();
13263
+ await expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.welcomeText(process.env.ZAPIER_LOGIN_EMAIL))).toBeVisible();
13264
+ await this.zapierWebPage
13265
+ .getByLabel(ZAPIER_WEB_TEXTS.password)
13266
+ .pressSequentially(process.env.ZAPIER_LOGIN_PASSWORD, { delay: 100 });
13267
+ await this.continueButton.click();
13268
+ };
13269
+ this.logoutFromZapier = async () => {
13270
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.logOut, {
13271
+ waitUntil: "commit",
13272
+ });
13273
+ await this.zapierWebPage.close();
13274
+ };
13275
+ this.reconnectAccountAndPublish = async (zapierApiKey) => {
13276
+ var _a;
13277
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.zapEditor(process.env.ZAP_ID));
13278
+ await this.zapierWebPage
13279
+ .locator(ZAPIER_SELECTORS.zapTriggerStep(process.env.ZAP_ID))
13280
+ .getByLabel(ZAPIER_WEB_TEXTS.editStep)
13281
+ .click();
13282
+ if (await this.zapierWebPage.locator(ZAPIER_SELECTORS.modal).isVisible()) {
13283
+ await this.zapierWebPage
13284
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.editExistingDraft })
13285
+ .click();
13286
+ }
13287
+ await this.zapierWebPage
13288
+ .getByRole("link", { name: ZAPIER_WEB_TEXTS.account })
13289
+ .or(this.zapierWebPage.locator(ZAPIER_SELECTORS.zapAccountSubstep))
13290
+ .click();
13291
+ const signInPagePromise = this.zapierWebPage.waitForEvent("popup");
13292
+ await this.zapierWebPage
13293
+ .getByLabel(RegExp(ZAPIER_WEB_TEXTS.signInTo))
13294
+ .click();
13295
+ const signInPage = await signInPagePromise;
13296
+ await signInPage.waitForLoadState();
13297
+ await expect(signInPage.getByRole("heading", { name: ZAPIER_WEB_TEXTS.loading })).toBeHidden({ timeout: 10000 });
13298
+ // The zapier connect page have two custom fm-prettytext boxes
13299
+ // (not an input/textarea) without aria-label or data-cy
13300
+ const subdomainBox = signInPage
13301
+ .locator(ZAPIER_SELECTORS.fmPrettytext)
13302
+ // eslint-disable-next-line playwright/no-nth-methods
13303
+ .nth(0);
13304
+ // eslint-disable-next-line playwright/no-nth-methods
13305
+ const apiKeyBox = signInPage.locator(ZAPIER_SELECTORS.fmPrettytext).nth(1);
13306
+ await subdomainBox.click();
13307
+ await subdomainBox.pressSequentially((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.subdomainName, {
13308
+ delay: 100,
13309
+ });
13310
+ await apiKeyBox.click();
13311
+ await apiKeyBox.pressSequentially(zapierApiKey, { delay: 100 });
13312
+ await signInPage
13313
+ .getByRole("button", {
13314
+ name: RegExp(ZAPIER_WEB_TEXTS.yesContinueTo),
13315
+ })
13316
+ .click();
13317
+ await this.continueButton.click({ timeout: 30000 });
13318
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.spinner)).toBeHidden({ timeout: 10000 });
13319
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.skeletonBlock)).toHaveCount(0, { timeout: 10000 });
13320
+ const testTriggerButton = this.zapierWebPage.getByRole("button", {
13321
+ name: ZAPIER_WEB_TEXTS.testTrigger,
13322
+ });
13323
+ await expect(testTriggerButton).toBeVisible();
13324
+ await testTriggerButton.click();
13325
+ await expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.testCurrentlyInQueue)).toBeHidden({ timeout: 20000 });
13326
+ await expect(this.zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.statusLabel, {
13327
+ exact: true,
13328
+ })).toBeVisible({ timeout: 10000 });
13329
+ await this.zapierWebPage
13330
+ .getByRole("button", {
13331
+ name: ZAPIER_WEB_TEXTS.continueWithSelectedRecord,
13332
+ })
13333
+ .click({ timeout: 20000 });
13334
+ await this.continueButton.click();
13335
+ await this.continueButton.click();
13336
+ await this.zapierWebPage
13337
+ .locator(ZAPIER_SELECTORS.contextualSideBar)
13338
+ .getByLabel(ZAPIER_WEB_TEXTS.publish)
13339
+ .or(this.zapierWebPage
13340
+ .locator(ZAPIER_SELECTORS.zapOpenSubstepContainer)
13341
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.publish }))
13342
+ .click();
13343
+ await this.zapierWebPage
13344
+ .locator(ZAPIER_SELECTORS.modal)
13345
+ .getByLabel(ZAPIER_WEB_TEXTS.publish)
13346
+ .or(this.zapierWebPage
13347
+ .locator(ZAPIER_SELECTORS.modal)
13348
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.publish, exact: true }))
13349
+ .click();
13350
+ await this.zapierWebPage
13351
+ .getByLabel(ZAPIER_WEB_TEXTS.publishingZapHeading)
13352
+ .waitFor();
13353
+ await expect(this.zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.publishingZapHeading)).toBeHidden({ timeout: 15000 });
13354
+ };
13355
+ this.deleteAllConnections = async (zapierAppLink) => {
13356
+ await this.zapierWebPage.goto(zapierAppLink);
13357
+ await this.zapierWebPage.waitForLoadState();
13358
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.accountsLoader)).toBeHidden();
13359
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.skeletonBlock)).toHaveCount(0);
13360
+ const connectionLocator = this.zapierWebPage.locator(ZAPIER_SELECTORS.connection);
13361
+ const connections = await connectionLocator.all();
13362
+ const deleteButton = this.zapierWebPage
13363
+ .locator(ZAPIER_SELECTORS.floatingBox)
13364
+ .locator(ZAPIER_SELECTORS.deleteConnectionDropdownButton);
13365
+ for (const connection of connections) {
13366
+ await expect(async () => {
13367
+ await connection
13368
+ .getByLabel(ZAPIER_WEB_TEXTS.connectionListMenu)
13369
+ .click();
13370
+ await deleteButton.click();
13371
+ await this.zapierWebPage
13372
+ .locator(ZAPIER_SELECTORS.deleteConnectionModal)
13373
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.delete })
13374
+ .click();
13375
+ }).toPass({ timeout: 20000 });
13376
+ }
13377
+ // eslint-disable-next-line playwright/no-standalone-expect
13378
+ await expect(connectionLocator).toHaveCount(0, {
13379
+ timeout: 10000,
13380
+ });
13381
+ };
13382
+ this.verifyZapIsTriggered = ({ productName, submittedEmail, zapTriggeredAfter, }) => this.mailosaur.messages.get(process.env.INTEGRATION_MAILOSAUR_SERVER_ID, { sentTo: ZAPIER_TEST_EMAIL(productName), body: submittedEmail }, { timeout: 2 * 60000, receivedAfter: zapTriggeredAfter });
13383
+ this.skipIfTaskLimitIsExhausted = async () => {
13384
+ var _a;
13385
+ // Zapier provides 100 free task limit for free account; skip test if it's exhausted
13386
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar)).toBeVisible({ timeout: 15000 });
13387
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.sidebarFooter)).toBeVisible({ timeout: 10000 });
13388
+ if (await this.zapierWebPage
13389
+ .getByText(RegExp(ZAPIER_WEB_TEXTS.trialEndsRegExp))
13390
+ .isVisible()) {
13391
+ return;
13392
+ }
13393
+ await expect(this.zapierWebPage.getByText(RegExp(ZAPIER_WEB_TEXTS.usageRegExp))).toBeVisible({ timeout: 30000 });
13394
+ const freeTaskLimit = (_a = (await this.zapierWebPage
13395
+ .locator(ZAPIER_SELECTORS.usageAmounts)
13396
+ // There are two usageAmount span elements
13397
+ // and there is no better approach than to use first()
13398
+ // eslint-disable-next-line playwright/no-nth-methods
13399
+ .first()
13400
+ .textContent())) !== null && _a !== void 0 ? _a : "";
13401
+ const [taskRunCount, taskLimitForMonth] = freeTaskLimit
13402
+ .split("/")
13403
+ .map(str => parseInt(str));
13404
+ // eslint-disable-next-line playwright/no-skipped-test
13405
+ test$1.skip(taskRunCount >= taskLimitForMonth, ZAPIER_LIMIT_EXHAUSTED_MESSAGE);
13406
+ };
13407
+ this.connectAndVerify = async ({ apiKeyLabel }) => {
13408
+ await this.connect();
13409
+ await this.page.getByTestId(COMMON_SELECTORS.inputField).fill(apiKeyLabel);
13410
+ await this.page
13411
+ .getByRole("button", {
13412
+ name: this.t("neetoIntegrations.zapier.generateApiKey"),
13413
+ })
13414
+ .click();
13415
+ await this.neetoPlaywrightUtilities.verifySuccessToast({
13416
+ message: TOASTR_MESSAGES.zapierApiKeyGenerated,
13417
+ });
13418
+ await this.page
13419
+ .getByRole("button", {
13420
+ name: this.t("neetoIntegrations.zapier.copyApiKey"),
13421
+ })
13422
+ .click();
13423
+ const apiKey = await this.page.evaluate(() => navigator.clipboard.readText());
13424
+ await this.verifyIntegrationStatus();
13425
+ return apiKey;
13426
+ };
13427
+ this.disconnectAndVerify = async () => {
13428
+ await this.disconnect({
13429
+ times: 1,
13430
+ responseUrl: API_ROUTES.integrations.zapier.api_keys,
13431
+ });
13432
+ await this.verifyIntegrationStatus("disconnected");
13433
+ };
13434
+ if (isNil(process.env.INTEGRATION_MAILOSAUR_API_KEY) ||
13435
+ isNil(process.env.INTEGRATION_MAILOSAUR_SERVER_ID)) {
13436
+ throw new Error("ENV variable INTEGRATION_MAILOSAUR_API_KEY or INTEGRATION_MAILOSAUR_SERVER_ID is not properly configured");
13437
+ }
13438
+ if (isNil(process.env.ZAPIER_LOGIN_PASSWORD) ||
13439
+ isNil(process.env.ZAPIER_LOGIN_EMAIL) ||
13440
+ isNil(process.env.ZAP_ID)) {
13441
+ throw new Error("ENV variable ZAPIER_LOGIN_PASSWORD or ZAPIER_LOGIN_EMAIL or ZAP_ID is not properly configured");
13442
+ }
13443
+ this.mailosaur = new MailosaurClient(process.env.INTEGRATION_MAILOSAUR_API_KEY);
13444
+ }
13445
+ }
13446
+
13186
13447
  const SIGNUP_SELECTORS = {
13187
13448
  emailTextField: "signup-email-text-field",
13188
13449
  firstNameTextField: "signup-profile-first-name-text-field",
@@ -147128,5 +147389,5 @@ const definePlaywrightConfig = (overrides) => {
147128
147389
  });
147129
147390
  };
147130
147391
 
147131
- export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, EMBED_SELECTORS, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, 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, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
147392
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, EMBED_SELECTORS, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, 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, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, USER_AGENTS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
147132
147393
  //# sourceMappingURL=index.js.map