@bigbinary/neeto-playwright-commons 1.8.43 → 1.8.45

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",
@@ -12795,10 +12834,12 @@ class HelpAndProfilePage {
12795
12834
  await expect(profileSidebarHeader).toBeHidden();
12796
12835
  });
12797
12836
  await test$2.step("Step 3: Open Help center and verify", this.openHelpCenterV2);
12798
- await test$2.step("Step 4: Open My organization link and verify", async () => this.openAuthLinkAndVerify({
12799
- linkSelector: PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton,
12800
- redirectLink: ROUTES.authSettings,
12801
- }));
12837
+ await test$2.step("Step 4: Open My organization link and verify", async () => {
12838
+ await this.page
12839
+ .getByTestId(PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton)
12840
+ .click();
12841
+ await expect(this.page).toHaveURL(new RegExp(ROUTES.authSettings));
12842
+ });
12802
12843
  };
12803
12844
  this.verifyLogoutV2 = async () => {
12804
12845
  if (shouldSkipSetupAndTeardown())
@@ -13183,6 +13224,228 @@ class WebhooksPage {
13183
13224
  }
13184
13225
  }
13185
13226
 
13227
+ const ZAPIER_SELECTORS = {
13228
+ zapTriggerStep: (zapId) => `[data-testid='step-node-${zapId}']`,
13229
+ zapAccountSubstep: "[data-testid='substep-Account']",
13230
+ zapOpenSubstepContainer: "[data-testid='open-sub-step-container']",
13231
+ modal: "[data-testid='Modal']",
13232
+ fmPrettytext: ".fm-prettytext",
13233
+ spinner: "[data-testid='spinner']",
13234
+ skeletonBlock: "[data-testid='SkeletonBlock']",
13235
+ accountsLoader: "[data-testid='accounts-loader']",
13236
+ floatingBox: "[data-testid='floating-box']",
13237
+ connection: "[data-testid='Connection']",
13238
+ deleteConnectionModal: "[data-testid='DeleteAuthModal-root']",
13239
+ deleteConnectionDropdownButton: "[data-testid='connection-list-item-dropdown-item-Delete']",
13240
+ usageAmounts: "css=[class$=UsageBar__amounts]",
13241
+ universalSidebar: "[data-testid='universalSidebar']",
13242
+ sidebarFooter: "css=[class$=InAppSidebarFooter__footerWrapper]",
13243
+ contextualSideBar: "[data-testid='contextual-sidebar']",
13244
+ };
13245
+
13246
+ class ZapierPage extends IntegrationBase {
13247
+ constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }) {
13248
+ super({
13249
+ page,
13250
+ integration: "zapier",
13251
+ neetoPlaywrightUtilities,
13252
+ integrationRouteIndex,
13253
+ });
13254
+ this.loginToZapier = async (zapierWebPage) => {
13255
+ this.zapierWebPage = zapierWebPage;
13256
+ this.continueButton = this.zapierWebPage.getByRole("button", {
13257
+ name: ZAPIER_WEB_TEXTS.continue,
13258
+ exact: true,
13259
+ });
13260
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.login);
13261
+ await this.zapierWebPage
13262
+ .getByLabel(ZAPIER_WEB_TEXTS.email)
13263
+ .pressSequentially(process.env.ZAPIER_LOGIN_EMAIL, { delay: 100 });
13264
+ await this.continueButton.click();
13265
+ await expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.welcomeText(process.env.ZAPIER_LOGIN_EMAIL))).toBeVisible();
13266
+ await this.zapierWebPage
13267
+ .getByLabel(ZAPIER_WEB_TEXTS.password)
13268
+ .pressSequentially(process.env.ZAPIER_LOGIN_PASSWORD, { delay: 100 });
13269
+ await this.continueButton.click();
13270
+ };
13271
+ this.logoutFromZapier = async () => {
13272
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.logOut, {
13273
+ waitUntil: "commit",
13274
+ });
13275
+ await this.zapierWebPage.close();
13276
+ };
13277
+ this.reconnectAccountAndPublish = async (zapierApiKey) => {
13278
+ var _a;
13279
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.zapEditor(process.env.ZAP_ID));
13280
+ await this.zapierWebPage
13281
+ .locator(ZAPIER_SELECTORS.zapTriggerStep(process.env.ZAP_ID))
13282
+ .getByLabel(ZAPIER_WEB_TEXTS.editStep)
13283
+ .click();
13284
+ if (await this.zapierWebPage.locator(ZAPIER_SELECTORS.modal).isVisible()) {
13285
+ await this.zapierWebPage
13286
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.editExistingDraft })
13287
+ .click();
13288
+ }
13289
+ await this.zapierWebPage
13290
+ .getByRole("link", { name: ZAPIER_WEB_TEXTS.account })
13291
+ .or(this.zapierWebPage.locator(ZAPIER_SELECTORS.zapAccountSubstep))
13292
+ .click();
13293
+ const signInPagePromise = this.zapierWebPage.waitForEvent("popup");
13294
+ await this.zapierWebPage
13295
+ .getByLabel(RegExp(ZAPIER_WEB_TEXTS.signInTo))
13296
+ .click();
13297
+ const signInPage = await signInPagePromise;
13298
+ await signInPage.waitForLoadState();
13299
+ await expect(signInPage.getByRole("heading", { name: ZAPIER_WEB_TEXTS.loading })).toBeHidden({ timeout: 10000 });
13300
+ // The zapier connect page have two custom fm-prettytext boxes
13301
+ // (not an input/textarea) without aria-label or data-cy
13302
+ const subdomainBox = signInPage
13303
+ .locator(ZAPIER_SELECTORS.fmPrettytext)
13304
+ // eslint-disable-next-line playwright/no-nth-methods
13305
+ .nth(0);
13306
+ // eslint-disable-next-line playwright/no-nth-methods
13307
+ const apiKeyBox = signInPage.locator(ZAPIER_SELECTORS.fmPrettytext).nth(1);
13308
+ await subdomainBox.click();
13309
+ await subdomainBox.pressSequentially((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.subdomainName, {
13310
+ delay: 100,
13311
+ });
13312
+ await apiKeyBox.click();
13313
+ await apiKeyBox.pressSequentially(zapierApiKey, { delay: 100 });
13314
+ await signInPage
13315
+ .getByRole("button", {
13316
+ name: RegExp(ZAPIER_WEB_TEXTS.yesContinueTo),
13317
+ })
13318
+ .click();
13319
+ await this.continueButton.click({ timeout: 30000 });
13320
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.spinner)).toBeHidden({ timeout: 10000 });
13321
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.skeletonBlock)).toHaveCount(0, { timeout: 10000 });
13322
+ const testTriggerButton = this.zapierWebPage.getByRole("button", {
13323
+ name: ZAPIER_WEB_TEXTS.testTrigger,
13324
+ });
13325
+ await expect(testTriggerButton).toBeVisible();
13326
+ await testTriggerButton.click();
13327
+ await expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.testCurrentlyInQueue)).toBeHidden({ timeout: 20000 });
13328
+ await expect(this.zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.statusLabel, {
13329
+ exact: true,
13330
+ })).toBeVisible({ timeout: 10000 });
13331
+ await this.zapierWebPage
13332
+ .getByRole("button", {
13333
+ name: ZAPIER_WEB_TEXTS.continueWithSelectedRecord,
13334
+ })
13335
+ .click({ timeout: 20000 });
13336
+ await this.continueButton.click();
13337
+ await this.continueButton.click();
13338
+ await this.zapierWebPage
13339
+ .locator(ZAPIER_SELECTORS.contextualSideBar)
13340
+ .getByLabel(ZAPIER_WEB_TEXTS.publish)
13341
+ .or(this.zapierWebPage
13342
+ .locator(ZAPIER_SELECTORS.zapOpenSubstepContainer)
13343
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.publish }))
13344
+ .click();
13345
+ await this.zapierWebPage
13346
+ .locator(ZAPIER_SELECTORS.modal)
13347
+ .getByLabel(ZAPIER_WEB_TEXTS.publish)
13348
+ .or(this.zapierWebPage
13349
+ .locator(ZAPIER_SELECTORS.modal)
13350
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.publish, exact: true }))
13351
+ .click();
13352
+ await this.zapierWebPage
13353
+ .getByLabel(ZAPIER_WEB_TEXTS.publishingZapHeading)
13354
+ .waitFor();
13355
+ await expect(this.zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.publishingZapHeading)).toBeHidden({ timeout: 15000 });
13356
+ };
13357
+ this.deleteAllConnections = async (zapierAppLink) => {
13358
+ await this.zapierWebPage.goto(zapierAppLink);
13359
+ await this.zapierWebPage.waitForLoadState();
13360
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.accountsLoader)).toBeHidden();
13361
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.skeletonBlock)).toHaveCount(0);
13362
+ const connectionLocator = this.zapierWebPage.locator(ZAPIER_SELECTORS.connection);
13363
+ const connections = await connectionLocator.all();
13364
+ const deleteButton = this.zapierWebPage
13365
+ .locator(ZAPIER_SELECTORS.floatingBox)
13366
+ .locator(ZAPIER_SELECTORS.deleteConnectionDropdownButton);
13367
+ for (const connection of connections) {
13368
+ await expect(async () => {
13369
+ await connection
13370
+ .getByLabel(ZAPIER_WEB_TEXTS.connectionListMenu)
13371
+ .click();
13372
+ await deleteButton.click();
13373
+ await this.zapierWebPage
13374
+ .locator(ZAPIER_SELECTORS.deleteConnectionModal)
13375
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.delete })
13376
+ .click();
13377
+ }).toPass({ timeout: 20000 });
13378
+ }
13379
+ // eslint-disable-next-line playwright/no-standalone-expect
13380
+ await expect(connectionLocator).toHaveCount(0, {
13381
+ timeout: 10000,
13382
+ });
13383
+ };
13384
+ 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 });
13385
+ this.skipIfTaskLimitIsExhausted = async () => {
13386
+ var _a;
13387
+ // Zapier provides 100 free task limit for free account; skip test if it's exhausted
13388
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar)).toBeVisible({ timeout: 15000 });
13389
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.sidebarFooter)).toBeVisible({ timeout: 10000 });
13390
+ if (await this.zapierWebPage
13391
+ .getByText(RegExp(ZAPIER_WEB_TEXTS.trialEndsRegExp))
13392
+ .isVisible()) {
13393
+ return;
13394
+ }
13395
+ await expect(this.zapierWebPage.getByText(RegExp(ZAPIER_WEB_TEXTS.usageRegExp))).toBeVisible({ timeout: 30000 });
13396
+ const freeTaskLimit = (_a = (await this.zapierWebPage
13397
+ .locator(ZAPIER_SELECTORS.usageAmounts)
13398
+ // There are two usageAmount span elements
13399
+ // and there is no better approach than to use first()
13400
+ // eslint-disable-next-line playwright/no-nth-methods
13401
+ .first()
13402
+ .textContent())) !== null && _a !== void 0 ? _a : "";
13403
+ const [taskRunCount, taskLimitForMonth] = freeTaskLimit
13404
+ .split("/")
13405
+ .map(str => parseInt(str));
13406
+ // eslint-disable-next-line playwright/no-skipped-test
13407
+ test$1.skip(taskRunCount >= taskLimitForMonth, ZAPIER_LIMIT_EXHAUSTED_MESSAGE);
13408
+ };
13409
+ this.connectAndVerify = async ({ apiKeyLabel }) => {
13410
+ await this.connect();
13411
+ await this.page.getByTestId(COMMON_SELECTORS.inputField).fill(apiKeyLabel);
13412
+ await this.page
13413
+ .getByRole("button", {
13414
+ name: this.t("neetoIntegrations.zapier.generateApiKey"),
13415
+ })
13416
+ .click();
13417
+ await this.neetoPlaywrightUtilities.verifySuccessToast({
13418
+ message: TOASTR_MESSAGES.zapierApiKeyGenerated,
13419
+ });
13420
+ await this.page
13421
+ .getByRole("button", {
13422
+ name: this.t("neetoIntegrations.zapier.copyApiKey"),
13423
+ })
13424
+ .click();
13425
+ const apiKey = await this.page.evaluate(() => navigator.clipboard.readText());
13426
+ await this.verifyIntegrationStatus();
13427
+ return apiKey;
13428
+ };
13429
+ this.disconnectAndVerify = async () => {
13430
+ await this.disconnect({
13431
+ times: 1,
13432
+ responseUrl: API_ROUTES.integrations.zapier.api_keys,
13433
+ });
13434
+ await this.verifyIntegrationStatus("disconnected");
13435
+ };
13436
+ if (isNil(process.env.INTEGRATION_MAILOSAUR_API_KEY) ||
13437
+ isNil(process.env.INTEGRATION_MAILOSAUR_SERVER_ID)) {
13438
+ throw new Error("ENV variable INTEGRATION_MAILOSAUR_API_KEY or INTEGRATION_MAILOSAUR_SERVER_ID is not properly configured");
13439
+ }
13440
+ if (isNil(process.env.ZAPIER_LOGIN_PASSWORD) ||
13441
+ isNil(process.env.ZAPIER_LOGIN_EMAIL) ||
13442
+ isNil(process.env.ZAP_ID)) {
13443
+ throw new Error("ENV variable ZAPIER_LOGIN_PASSWORD or ZAPIER_LOGIN_EMAIL or ZAP_ID is not properly configured");
13444
+ }
13445
+ this.mailosaur = new MailosaurClient(process.env.INTEGRATION_MAILOSAUR_API_KEY);
13446
+ }
13447
+ }
13448
+
13186
13449
  const SIGNUP_SELECTORS = {
13187
13450
  emailTextField: "signup-email-text-field",
13188
13451
  firstNameTextField: "signup-profile-first-name-text-field",
@@ -147128,5 +147391,5 @@ const definePlaywrightConfig = (overrides) => {
147128
147391
  });
147129
147392
  };
147130
147393
 
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 };
147394
+ 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
147395
  //# sourceMappingURL=index.js.map