@bigbinary/neeto-playwright-commons 1.26.8 → 1.26.9

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
@@ -2639,12 +2639,37 @@ declare class ZapierPage extends IntegrationBase {
2639
2639
  zapierWebPage: Page;
2640
2640
  continueButton: Locator;
2641
2641
  mailerUtils: MailerUtils;
2642
+ private stepBlock;
2643
+ private navbar;
2644
+ private zapToggle;
2645
+ private tabPanel;
2646
+ private panelFooter;
2647
+ private firstStepBlock;
2642
2648
  constructor({
2643
2649
  page,
2644
2650
  neetoPlaywrightUtilities,
2645
2651
  integrationRouteIndex,
2646
2652
  mailerUtils
2647
2653
  }: ZapierPageInitializer);
2654
+ private gotoZapEditor;
2655
+ private editZap;
2656
+ private openMoreOptions;
2657
+ private toggleZap;
2658
+ /**
2659
+ *
2660
+ * Reconnects a Zapier account by navigating to the zap editor, editing the zap, opening the reconnect popup, and updating the subdomain and API key. After
2661
+ *
2662
+ * reconnecting, it waits for the connection to be established and toggles the zap on.
2663
+ *
2664
+ * zapierApiKey: Zapier API key to use for reconnection.
2665
+ *
2666
+ * @example
2667
+ *
2668
+ * await zapierPage.reconnectAccount("your-zapier-api-key");
2669
+ * @endexample
2670
+ */
2671
+ reconnectAccount: (zapierApiKey: string) => Promise<void>;
2672
+ private setTextEditorValue;
2648
2673
  /**
2649
2674
  *
2650
2675
  * Logs into zapier web app. It takes the following parameters:
@@ -2669,11 +2694,11 @@ declare class ZapierPage extends IntegrationBase {
2669
2694
  logoutFromZapier: () => Promise<void>;
2670
2695
  /**
2671
2696
  *
2672
- * Reconnects zapier account and publishes changes. It takes the following parameters:
2697
+ * Reconnects zapier account and publishes changes. It takes the following
2673
2698
  *
2674
- * zapierApiKey: Zapier API key.
2699
+ * parameters:
2675
2700
  *
2676
- * appName: Name of the application.
2701
+ * zapierApiKey: Zapier API key. appName: Name of the application.
2677
2702
  *
2678
2703
  * @example
2679
2704
  *
@@ -2697,13 +2722,13 @@ declare class ZapierPage extends IntegrationBase {
2697
2722
  *
2698
2723
  * Verifies that a Zap is triggered. It takes the following parameters:
2699
2724
  *
2700
- * submittedEmail: Submitted email address.
2725
+ * submittedEmail: Submitted email address. zapTriggeredAfter: Date after which
2701
2726
  *
2702
- * zapTriggeredAfter: Date after which the Zap should be triggered.
2727
+ * the Zap should be triggered. productName: Name of the product.
2703
2728
  *
2704
- * productName: Name of the product.
2729
+ * timeout(optional): Timeout in milliseconds to fetch the latest response.
2705
2730
  *
2706
- * timeout(optional): Timeout in milliseconds to fetch the latest response. Default is 2 * 60_000.
2731
+ * Default is 2 * 60_000.
2707
2732
  *
2708
2733
  * @example
2709
2734
  *
@@ -2732,7 +2757,9 @@ declare class ZapierPage extends IntegrationBase {
2732
2757
  skipIfTaskLimitIsExhausted: () => Promise<void>;
2733
2758
  /**
2734
2759
  *
2735
- * Connects to zapier integration and verifies the connection. It takes the following parameters:
2760
+ * Connects to zapier integration and verifies the connection. It takes the
2761
+ *
2762
+ * following parameters:
2736
2763
  *
2737
2764
  * apiKeyLabel: Label for Zapier API key.
2738
2765
  *
@@ -2764,7 +2791,9 @@ declare class ZapierPage extends IntegrationBase {
2764
2791
  disconnectAndVerify: (toastMessage?: string) => Promise<void>;
2765
2792
  /**
2766
2793
  *
2767
- * Creates a new Zapier API key with the given label and copies it to the clipboard.
2794
+ * Creates a new Zapier API key with the given label and copies it to the
2795
+ *
2796
+ * clipboard.
2768
2797
  *
2769
2798
  * apiKeyLabel : The label/name to assign to the newly created API key.
2770
2799
  *
@@ -5206,6 +5235,14 @@ declare const SLACK_WEB_TEXTS: {
5206
5235
  *
5207
5236
  */
5208
5237
  declare const ZAPIER_WEB_TEXTS: {
5238
+ editZap: string;
5239
+ newSubmission: string;
5240
+ sendOutboundEmail: string;
5241
+ moreOptions: string;
5242
+ reconnect: string;
5243
+ retestStep: string;
5244
+ editThisZap: string;
5245
+ staging: string;
5209
5246
  create: string;
5210
5247
  account: string;
5211
5248
  email: string;
@@ -7111,6 +7148,16 @@ declare const ZAPIER_SELECTORS: {
7111
7148
  iconContainer: string;
7112
7149
  deleteApiButton: string;
7113
7150
  zapierSubLink: string;
7151
+ navbar: string;
7152
+ authTitle: string;
7153
+ publishButton: string;
7154
+ panelFooter: string;
7155
+ zapToggle: string;
7156
+ stepBlock: string;
7157
+ fmPrettyBox: string;
7158
+ universalTopbar: string;
7159
+ accountsMenu: string;
7160
+ zapToggleCheckbox: string;
7114
7161
  };
7115
7162
  declare const TWILIO_SELECTORS: {
7116
7163
  sidField: string;
package/index.js CHANGED
@@ -5447,10 +5447,10 @@ const ZAPIER_SELECTORS = {
5447
5447
  zapOpenSubstepContainer: "[data-testid='open-sub-step-container']",
5448
5448
  modal: "[data-testid='Modal']",
5449
5449
  fmPrettytext: ".fm-prettytext",
5450
- spinner: "[data-testid='spinner']",
5450
+ spinner: "spinner",
5451
5451
  skeletonBlock: "[data-testid='SkeletonBlock']",
5452
5452
  accountsLoader: "[data-testid='accounts-loader']",
5453
- floatingBox: "[data-testid='floating-box']",
5453
+ floatingBox: "floating-box",
5454
5454
  connection: "[data-testid='Connection']",
5455
5455
  deleteConnectionModal: "[data-testid='DeleteAuthModal-root']",
5456
5456
  deleteConnectionDropdownButton: "[data-testid='connection-list-item-dropdown-item-Delete']",
@@ -5461,6 +5461,16 @@ const ZAPIER_SELECTORS = {
5461
5461
  iconContainer: "[data-testid='iconContainer']",
5462
5462
  deleteApiButton: "delete-apikey-button",
5463
5463
  zapierSubLink: "zapier-sub-link",
5464
+ navbar: "top-nav-test-id",
5465
+ authTitle: "auth-title",
5466
+ publishButton: "publish-button-wrapper",
5467
+ panelFooter: "#details-panel-footer",
5468
+ zapToggle: "zap-toggle",
5469
+ stepBlock: `step-node-${process.env.ZAP_ID}`,
5470
+ fmPrettyBox: ".fm-pretty-text-input.pretty-text-box",
5471
+ universalTopbar: "universalTopbar",
5472
+ accountsMenu: "accountsMenu",
5473
+ zapToggleCheckbox: "input[type='checkbox']",
5464
5474
  };
5465
5475
 
5466
5476
  const TWILIO_SELECTORS = {
@@ -113836,6 +113846,14 @@ const SLACK_WEB_TEXTS = {
113836
113846
  deleteChannel: "Delete channel",
113837
113847
  };
113838
113848
  const ZAPIER_WEB_TEXTS = {
113849
+ editZap: "Edit Zap",
113850
+ newSubmission: "New Submission",
113851
+ sendOutboundEmail: "Send Outbound Email",
113852
+ moreOptions: "More options",
113853
+ reconnect: "Reconnect this authentication",
113854
+ retestStep: "Retest step",
113855
+ editThisZap: "Edit this Zap",
113856
+ staging: "Staging",
113839
113857
  create: "Create",
113840
113858
  account: "Account",
113841
113859
  email: "Email",
@@ -116928,6 +116946,90 @@ class ZapierPage extends IntegrationBase {
116928
116946
  neetoPlaywrightUtilities,
116929
116947
  integrationRouteIndex,
116930
116948
  });
116949
+ this.gotoZapEditor = async () => {
116950
+ await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.zapEditor(process.env.ZAP_ID));
116951
+ await this.zapierWebPage.waitForLoadState();
116952
+ await expect(this.firstStepBlock).toBeVisible({ timeout: 25000 });
116953
+ };
116954
+ this.editZap = async () => {
116955
+ await this.navbar
116956
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.editThisZap })
116957
+ .click();
116958
+ await this.zapierWebPage.waitForLoadState();
116959
+ await expect(this.navbar.getByTestId(ZAPIER_SELECTORS.publishButton)).toBeVisible({ timeout: 25000 });
116960
+ };
116961
+ this.openMoreOptions = async () => {
116962
+ await this.firstStepBlock.waitFor({ timeout: 25000 });
116963
+ await this.firstStepBlock.click();
116964
+ await expect(this.tabPanel).toBeVisible({ timeout: 25000 });
116965
+ await this.tabPanel.getByLabel(ZAPIER_WEB_TEXTS.moreOptions).click();
116966
+ };
116967
+ this.toggleZap = async () => {
116968
+ const checkbox = this.zapToggle.locator(ZAPIER_SELECTORS.zapToggleCheckbox);
116969
+ const isZapTurnedOn = await checkbox.isChecked();
116970
+ if (isZapTurnedOn)
116971
+ return;
116972
+ await this.zapToggle.click();
116973
+ await expect(this.zapToggle.getByTestId(ZAPIER_SELECTORS.spinner)).toBeHidden({ timeout: 30000 });
116974
+ await expect(checkbox).toBeChecked({ timeout: 15000 });
116975
+ };
116976
+ this.reconnectAccount = async (zapierApiKey) => {
116977
+ var _a;
116978
+ this.stepBlock = this.zapierWebPage.getByTestId(ZAPIER_SELECTORS.stepBlock);
116979
+ this.navbar = this.zapierWebPage.getByTestId(ZAPIER_SELECTORS.navbar);
116980
+ this.tabPanel = this.zapierWebPage.getByRole("tabpanel");
116981
+ this.panelFooter = this.zapierWebPage.locator(ZAPIER_SELECTORS.panelFooter);
116982
+ this.firstStepBlock = this.stepBlock.getByText(ZAPIER_WEB_TEXTS.staging);
116983
+ this.zapToggle = this.navbar.getByTestId(ZAPIER_SELECTORS.zapToggle);
116984
+ await this.gotoZapEditor();
116985
+ await this.editZap();
116986
+ await this.openMoreOptions();
116987
+ const reconnectPopup = this.zapierWebPage.waitForEvent("popup");
116988
+ await this.zapierWebPage
116989
+ .getByTestId(ZAPIER_SELECTORS.floatingBox)
116990
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.reconnect, exact: true })
116991
+ .click();
116992
+ const reconnectPage = await reconnectPopup;
116993
+ await reconnectPage.waitForLoadState();
116994
+ await expect(reconnectPage.getByRole("heading", { name: ZAPIER_WEB_TEXTS.loading })).toBeHidden({ timeout: 15000 });
116995
+ const yesBtn = reconnectPage.getByRole("button", {
116996
+ name: RegExp(ZAPIER_WEB_TEXTS.yesContinueTo),
116997
+ });
116998
+ const prettyTextBox = reconnectPage.locator(ZAPIER_SELECTORS.fmPrettytext);
116999
+ const [subdomainBox, apiKeyBox] = [0, 1].map(index =>
117000
+ // eslint-disable-next-line playwright/no-nth-methods
117001
+ prettyTextBox.nth(index));
117002
+ await expect(yesBtn).toBeVisible({ timeout: 25000 });
117003
+ const subdomain = (_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.subdomainName;
117004
+ await subdomainBox.click();
117005
+ await this.setTextEditorValue(reconnectPage, subdomain);
117006
+ await apiKeyBox.click();
117007
+ await this.setTextEditorValue(reconnectPage, zapierApiKey, 1);
117008
+ await yesBtn.click();
117009
+ const continueBtn = this.panelFooter.getByRole("button", {
117010
+ name: ZAPIER_WEB_TEXTS.continue,
117011
+ exact: true,
117012
+ });
117013
+ await this.tabPanel
117014
+ .getByTestId(ZAPIER_SELECTORS.authTitle)
117015
+ .getByText(ZAPIER_WEB_TEXTS.staging)
117016
+ .waitFor({ timeout: 35000 });
117017
+ await continueBtn.waitFor({ timeout: 30000 });
117018
+ await continueBtn.click({ timeout: 30000 });
117019
+ await expect(continueBtn).toBeHidden({ timeout: 25000 });
117020
+ await expect(this.panelFooter.getByRole("button", {
117021
+ name: ZAPIER_WEB_TEXTS.continueWithSelectedRecord,
117022
+ })).toBeVisible({ timeout: 35000 });
117023
+ await this.toggleZap();
117024
+ };
117025
+ this.setTextEditorValue = (page, value, index = 0) => page.evaluate(({ selector, index, value }) => {
117026
+ const container = document.querySelectorAll(selector)[index];
117027
+ const cmElement = container.querySelector(".CodeMirror");
117028
+ const cm = cmElement.CodeMirror;
117029
+ cm.focus();
117030
+ cm.setValue(value);
117031
+ cm.refresh();
117032
+ }, { selector: ZAPIER_SELECTORS.fmPrettyBox, index, value });
116931
117033
  this.loginToZapier = async (zapierWebPage) => {
116932
117034
  this.zapierWebPage = zapierWebPage;
116933
117035
  this.continueButton = this.zapierWebPage.getByRole("button", {
@@ -116969,6 +117071,10 @@ class ZapierPage extends IntegrationBase {
116969
117071
  element: this.continueButton,
116970
117072
  page: zapierWebPage,
116971
117073
  });
117074
+ await this.zapierWebPage
117075
+ .getByTestId(ZAPIER_SELECTORS.universalTopbar)
117076
+ .getByTestId(ZAPIER_SELECTORS.accountsMenu)
117077
+ .waitFor({ timeout: 25000 });
116972
117078
  };
116973
117079
  this.logoutFromZapier = async () => {
116974
117080
  await this.zapierWebPage.goto(THIRD_PARTY_ROUTES.zapier.logOut, {
@@ -117019,12 +117125,12 @@ class ZapierPage extends IntegrationBase {
117019
117125
  await this.continueButton.click({ timeout: 30000 });
117020
117126
  await expect(this.zapierWebPage
117021
117127
  .getByLabel(ZAPIER_WEB_TEXTS.testTrigger)
117022
- .locator(ZAPIER_SELECTORS.spinner)).toBeHidden({ timeout: 10000 });
117128
+ .getByTestId(ZAPIER_SELECTORS.spinner)).toBeHidden({ timeout: 10000 });
117023
117129
  await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.skeletonBlock)).toHaveCount(0, { timeout: 10000 });
117024
117130
  const testTriggerButton = this.zapierWebPage.getByRole("button", {
117025
117131
  name: ZAPIER_WEB_TEXTS.testTrigger,
117026
117132
  });
117027
- await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.spinner)).toHaveCount(0, { timeout: 30000 });
117133
+ await expect(this.zapierWebPage.getByTestId(ZAPIER_SELECTORS.spinner)).toHaveCount(0, { timeout: 30000 });
117028
117134
  const continueWithRecordBtn = this.zapierWebPage.getByRole("button", {
117029
117135
  name: ZAPIER_WEB_TEXTS.continueWithSelectedRecord,
117030
117136
  });