@bigbinary/neeto-playwright-commons 4.1.8 → 4.1.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.
Files changed (3) hide show
  1. package/index.d.ts +21 -4
  2. package/index.js +25 -27
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -91,6 +91,10 @@ interface WaitForPageLoadParams {
91
91
  customPageContext: Page | undefined;
92
92
  waitForOption: "serial" | "parallel";
93
93
  }
94
+ interface WaitForPaneToLoadParams {
95
+ visibilityTimeout: number;
96
+ customPageContext: Page;
97
+ }
94
98
  type ApiRequest = (props: ApiRequestProps & Record<string, unknown>) => Promise<APIResponse | undefined>;
95
99
  interface FieldValue {
96
100
  field: string;
@@ -261,6 +265,22 @@ declare class CustomCommands {
261
265
  customPageContext,
262
266
  waitForOption
263
267
  }?: Partial<WaitForPageLoadParams>) => Promise<void>;
268
+ /**
269
+ *
270
+ * Command to wait until the pane body is visible and the pane has no spinners.
271
+ *
272
+ * @example
273
+ *
274
+ * await neetoPlaywrightUtilities.waitForPaneToLoad({
275
+ * visibilityTimeout = 35_000,
276
+ * customPageContext,
277
+ * });
278
+ * @endexample
279
+ */
280
+ waitForPaneToLoad: ({
281
+ visibilityTimeout,
282
+ customPageContext
283
+ }?: Partial<WaitForPaneToLoadParams>) => Promise<void>;
264
284
  /**
265
285
  *
266
286
  * Command to send an API request.
@@ -3298,7 +3318,6 @@ declare class ZapierPage extends IntegrationBase {
3298
3318
  * @endexample
3299
3319
  */
3300
3320
  reconnectAccount: (zapierApiKey: string) => Promise<void>;
3301
- private setTextEditorValue;
3302
3321
  /**
3303
3322
  *
3304
3323
  * Logs into zapier web app. It takes the following parameters:
@@ -5958,7 +5977,7 @@ declare const ZAPIER_WEB_TEXTS: {
5958
5977
  password: string;
5959
5978
  editExistingDraft: string;
5960
5979
  signInTo: string;
5961
- yesContinueTo: string;
5980
+ reconnectBtn: string;
5962
5981
  testTrigger: string;
5963
5982
  editStep: string;
5964
5983
  continueWithSelectedRecord: string;
@@ -7883,7 +7902,6 @@ declare const ZAPIER_SELECTORS: {
7883
7902
  zapAccountSubstep: string;
7884
7903
  zapOpenSubstepContainer: string;
7885
7904
  modal: string;
7886
- fmPrettytext: string;
7887
7905
  spinner: string;
7888
7906
  skeletonBlock: string;
7889
7907
  accountsLoader: string;
@@ -7904,7 +7922,6 @@ declare const ZAPIER_SELECTORS: {
7904
7922
  panelFooter: string;
7905
7923
  zapToggle: string;
7906
7924
  stepBlock: string;
7907
- fmPrettyBox: string;
7908
7925
  universalTopbar: string;
7909
7926
  accountsMenu: string;
7910
7927
  zapToggleCheckbox: string;
package/index.js CHANGED
@@ -1796,7 +1796,6 @@ const ZAPIER_SELECTORS = {
1796
1796
  zapAccountSubstep: "[data-testid='substep-Account']",
1797
1797
  zapOpenSubstepContainer: "[data-testid='open-sub-step-container']",
1798
1798
  modal: "[data-testid='Modal']",
1799
- fmPrettytext: ".fm-prettytext",
1800
1799
  spinner: "spinner",
1801
1800
  skeletonBlock: "[data-testid='SkeletonBlock']",
1802
1801
  accountsLoader: "[data-testid='accounts-loader']",
@@ -1817,7 +1816,6 @@ const ZAPIER_SELECTORS = {
1817
1816
  panelFooter: "#details-panel-footer",
1818
1817
  zapToggle: "zap-toggle",
1819
1818
  stepBlock: `step-node-${process.env.ZAP_ID}`,
1820
- fmPrettyBox: ".fm-pretty-text-input.pretty-text-box",
1821
1819
  universalTopbar: "universalTopbar",
1822
1820
  accountsMenu: "accountsMenu",
1823
1821
  zapToggleCheckbox: "input[type='checkbox']",
@@ -2090,6 +2088,13 @@ class CustomCommands {
2090
2088
  }
2091
2089
  await Promise.all(loaders.map(loader => expect(loader).toHaveCount(0, { timeout: visibilityTimeout })));
2092
2090
  };
2091
+ waitForPaneToLoad = async ({ visibilityTimeout = 35_000, customPageContext = this.page, } = {}) => {
2092
+ const pane = customPageContext.getByTestId(COMMON_SELECTORS.paneBody);
2093
+ await expect(pane).toBeVisible({ timeout: visibilityTimeout });
2094
+ await expect(pane.getByTestId(COMMON_SELECTORS.uiSpinner)).toHaveCount(0, {
2095
+ timeout: visibilityTimeout,
2096
+ });
2097
+ };
2093
2098
  apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, timeout = 30_000, ...otherOptions }) => {
2094
2099
  const csrfToken = this.csrfToken ?? (await this.initializeCsrfToken());
2095
2100
  const requestOptions = {
@@ -2404,7 +2409,7 @@ const ZAPIER_WEB_TEXTS = {
2404
2409
  password: "Password",
2405
2410
  editExistingDraft: "Edit existing draft",
2406
2411
  signInTo: "Sign in to *",
2407
- yesContinueTo: "Yes, Continue to *",
2412
+ reconnectBtn: "Reconnect",
2408
2413
  testTrigger: "Test trigger",
2409
2414
  editStep: "Edit step",
2410
2415
  continueWithSelectedRecord: "Continue with selected record",
@@ -2455,7 +2460,7 @@ const GOOGLE_LOGIN_TEXTS = {
2455
2460
  googleAccount: "Google Account:",
2456
2461
  connectYourGoogleAccount: "Connect your Google account",
2457
2462
  signInWithGoogle: "Sign in with Google",
2458
- signInHeading: (appName) => new RegExp(`(You’re signing back in to ${appName}\\.net|Sign in to ${appName}\\.net)`, "i"),
2463
+ signInHeading: (appName) => new RegExp(`^(?:You[']re signing back in to ${appName}\\.net|Sign in to ${appName}\\.net)$`, "i"),
2459
2464
  stagingAppName: (appName) => `${appName} - Staging`,
2460
2465
  continue: "Continue",
2461
2466
  selectAll: "Select All",
@@ -118733,6 +118738,7 @@ class HelpAndProfilePage {
118733
118738
  expect(statusPage).toHaveURL(PROFILE_LINKS.neetoStatus),
118734
118739
  expect(statusPage.getByRole("link", {
118735
118740
  name: STATUS_TEXTS.appName(this.product),
118741
+ exact: true,
118736
118742
  })).toBeVisible(),
118737
118743
  ]);
118738
118744
  });
@@ -119308,20 +119314,17 @@ class ZapierPage extends IntegrationBase {
119308
119314
  const reconnectPage = await reconnectPopup;
119309
119315
  await reconnectPage.waitForLoadState();
119310
119316
  await expect(reconnectPage.getByRole("heading", { name: ZAPIER_WEB_TEXTS.loading })).toBeHidden({ timeout: 15_000 });
119311
- const yesBtn = reconnectPage.getByRole("button", {
119312
- name: RegExp(ZAPIER_WEB_TEXTS.yesContinueTo),
119317
+ const reconnectBtn = reconnectPage.getByRole("button", {
119318
+ name: ZAPIER_WEB_TEXTS.reconnectBtn,
119313
119319
  });
119314
- const prettyTextBox = reconnectPage.locator(ZAPIER_SELECTORS.fmPrettytext);
119315
- const [subdomainBox, apiKeyBox] = [0, 1].map(index =>
119316
- // eslint-disable-next-line playwright/no-nth-methods
119317
- prettyTextBox.nth(index));
119318
- await expect(yesBtn).toBeVisible({ timeout: 25_000 });
119319
- const subdomain = getGlobalUserState()?.subdomainName;
119320
- await subdomainBox.click();
119321
- await this.setTextEditorValue(reconnectPage, subdomain);
119322
- await apiKeyBox.click();
119323
- await this.setTextEditorValue(reconnectPage, zapierApiKey, 1);
119324
- await yesBtn.click();
119320
+ await expect(reconnectBtn).toBeVisible({ timeout: 25_000 });
119321
+ await reconnectPage
119322
+ .getByRole("textbox", { name: ZAPIER_WEB_TEXTS.subdomain })
119323
+ .pressSequentially(getGlobalUserState()?.subdomainName);
119324
+ await reconnectPage
119325
+ .getByRole("textbox", { name: ZAPIER_WEB_TEXTS.apiKey })
119326
+ .pressSequentially(zapierApiKey);
119327
+ await reconnectBtn.click();
119325
119328
  const continueBtn = this.panelFooter.getByRole("button", {
119326
119329
  name: ZAPIER_WEB_TEXTS.continue,
119327
119330
  exact: true,
@@ -119338,14 +119341,6 @@ class ZapierPage extends IntegrationBase {
119338
119341
  })).toBeVisible({ timeout: 35_000 });
119339
119342
  await this.toggleZap();
119340
119343
  };
119341
- setTextEditorValue = (page, value, index = 0) => page.evaluate(({ selector, index, value }) => {
119342
- const container = document.querySelectorAll(selector)[index];
119343
- const cmElement = container.querySelector(".CodeMirror");
119344
- const cm = cmElement.CodeMirror;
119345
- cm.focus();
119346
- cm.setValue(value);
119347
- cm.refresh();
119348
- }, { selector: ZAPIER_SELECTORS.fmPrettyBox, index, value });
119349
119344
  loginToZapier = async (zapierWebPage) => {
119350
119345
  this.zapierWebPage = zapierWebPage;
119351
119346
  this.continueButton = this.zapierWebPage.getByRole("button", {
@@ -120532,7 +120527,7 @@ class TeamMembers {
120532
120527
  if (await pane.isHidden())
120533
120528
  return;
120534
120529
  (await buttonSpinner.isHidden()) && (await submitBtn.click());
120535
- await expect(buttonSpinner).toBeHidden({ timeout: 10_000 });
120530
+ await expect(buttonSpinner).toHaveCount(0, { timeout: 10_000 });
120536
120531
  await expect(pane).toBeHidden();
120537
120532
  }).toPass({ timeout: 60_000 });
120538
120533
  await this.neetoPlaywrightUtilities.verifyToast();
@@ -120549,7 +120544,10 @@ class TeamMembers {
120549
120544
  editMemberViaUI = async ({ email = "", firstName = "", lastName = "", role = "standard", } = {}) => {
120550
120545
  await this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
120551
120546
  await this.page.getByTestId(MEMBER_SELECTORS.editButton).click();
120552
- await this.neetoPlaywrightUtilities.waitForPageLoad();
120547
+ await this.neetoPlaywrightUtilities.waitForPaneToLoad();
120548
+ await expect(this.page
120549
+ .getByTestId(MEMBER_SELECTORS.submitButton)
120550
+ .getByTestId(COMMON_SELECTORS.uiSpinner)).toHaveCount(0, { timeout: 35_000 });
120553
120551
  isPresent(email) &&
120554
120552
  (await this.page
120555
120553
  .getByTestId(MEMBER_FORM_SELECTORS.emailInput)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "4.1.8",
3
+ "version": "4.1.9",
4
4
  "description": "A package encapsulating common playwright code across neeto projects.",
5
5
  "repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
6
6
  "license": "apache-2.0",