@bigbinary/neeto-playwright-commons 1.9.21 → 1.9.23

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
@@ -27,6 +27,11 @@ interface VerifySuccessToastParams {
27
27
  message: string;
28
28
  closeAfterVerification: boolean;
29
29
  }
30
+ interface VerifyToastParams {
31
+ message: string;
32
+ closeAfterVerification: boolean;
33
+ toastType: "success" | "error";
34
+ }
30
35
  type ConditionProps = Record<string, string>[];
31
36
  type FilterProps = Record<string, ConditionProps>;
32
37
  type ParamFilters = FilterProps[];
@@ -119,9 +124,12 @@ declare class CustomCommands {
119
124
  * @endexample
120
125
  */
121
126
  executeRecursively: ExecuteRecursively;
127
+ /**
128
+ * @deprecated Use verifyToast instead.
129
+ */
122
130
  /**
123
131
  *
124
- * Command to assert the toastr message. It takes the following parameters:
132
+ * Command to assert the success toastr message. It takes the following parameters:
125
133
  *
126
134
  * closeAfterVerification(optional): Boolean to close the toast after verification. Default is true.
127
135
  *
@@ -139,6 +147,30 @@ declare class CustomCommands {
139
147
  message,
140
148
  closeAfterVerification
141
149
  }?: Partial<VerifySuccessToastParams>) => Promise<void>;
150
+ /**
151
+ *
152
+ * Command to assert the toastr message. It takes the following parameters:
153
+ *
154
+ * closeAfterVerification(optional): Boolean to close the toast after verification. Default is true.
155
+ *
156
+ * message(optional): Text that should be on toast.
157
+ *
158
+ * toastType(optional): Type of toast. It takes either success or error as it's value. Default is success.
159
+ *
160
+ * @example
161
+ *
162
+ * await neetoPlaywrightUtilities.verifyToast({
163
+ * message: "Toastr message",
164
+ * closeAfterVerification: false,
165
+ * toastType: "error"
166
+ * });
167
+ * @endexample
168
+ */
169
+ verifyToast: ({
170
+ message,
171
+ toastType,
172
+ closeAfterVerification
173
+ }?: Partial<VerifyToastParams>) => Promise<void>;
142
174
  /**
143
175
  *
144
176
  * Command to reload and wait for the API responses.
@@ -2733,6 +2765,7 @@ declare const COMMON_SELECTORS: {
2733
2765
  actionSelectIndicator: string;
2734
2766
  takeActionDropdown: string;
2735
2767
  columnsSearchInput: string;
2768
+ errorToastIcon: string;
2736
2769
  };
2737
2770
  /**
2738
2771
  *
@@ -3497,6 +3530,7 @@ declare const SLACK_SELECTORS: {
3497
3530
  */
3498
3531
  declare const SLACK_DATA_QA_SELECTORS: {
3499
3532
  sectionHeadingButton: string;
3533
+ coachMarkCloseButton: string;
3500
3534
  channelSectionSubmenuCreate: string;
3501
3535
  channelSectionMenuCreateChannel: string;
3502
3536
  skModalContent: string;
package/index.js CHANGED
@@ -313,6 +313,7 @@ const COMMON_SELECTORS = {
313
313
  actionSelectIndicator: "action-select-indicator",
314
314
  takeActionDropdown: "take-action-dropdown-icon",
315
315
  columnsSearchInput: "neeto-ui-columns-search",
316
+ errorToastIcon: "error-toast-icon",
316
317
  };
317
318
 
318
319
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -3427,6 +3428,9 @@ class CustomCommands {
3427
3428
  const startTime = Date.now();
3428
3429
  await this.recursiveMethod(callback, condition, timeout, startTime);
3429
3430
  };
3431
+ /**
3432
+ * @deprecated Use verifyToast instead.
3433
+ */
3430
3434
  this.verifySuccessToast = async ({ message = "", closeAfterVerification = true, } = {}) => {
3431
3435
  if (!isEmpty$1(message)) {
3432
3436
  await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message);
@@ -3438,6 +3442,22 @@ class CustomCommands {
3438
3442
  (await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
3439
3443
  await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
3440
3444
  };
3445
+ this.verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, } = {}) => {
3446
+ if (toastType === "error") {
3447
+ await expect(this.page.getByTestId(COMMON_SELECTORS.errorToastIcon)).toBeVisible({ timeout: 10000 });
3448
+ }
3449
+ const toastrCloseButton = this.page.getByTestId(COMMON_SELECTORS.toastCloseButton);
3450
+ if (!isEmpty$1(message)) {
3451
+ await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message, { timeout: 10000 });
3452
+ }
3453
+ else {
3454
+ await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍");
3455
+ }
3456
+ if (closeAfterVerification && (await toastrCloseButton.isVisible())) {
3457
+ await toastrCloseButton.click();
3458
+ await expect(toastrCloseButton).toBeHidden();
3459
+ }
3460
+ };
3441
3461
  this.reloadAndWait = async (requestCount, customPageContext, interceptMultipleResponsesProps = {}) => {
3442
3462
  const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
3443
3463
  const reloadRequests = this.interceptMultipleResponses({
@@ -13864,6 +13884,7 @@ const SLACK_SELECTORS = {
13864
13884
  };
13865
13885
  const SLACK_DATA_QA_SELECTORS = {
13866
13886
  sectionHeadingButton: "section_heading_button__channels",
13887
+ coachMarkCloseButton: "coachmark-close-button",
13867
13888
  channelSectionSubmenuCreate: "channel_section_submenu_create",
13868
13889
  channelSectionMenuCreateChannel: "channel_section_menu__create_channel",
13869
13890
  skModalContent: "sk-modal-content",
@@ -14012,6 +14033,9 @@ class SlackPage extends IntegrationBase {
14012
14033
  .click();
14013
14034
  };
14014
14035
  this.createNewSlackChannel = async ({ channelName, kind = "public", }) => {
14036
+ const closeCoachMarkButton = this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.coachMarkCloseButton);
14037
+ (await closeCoachMarkButton.isVisible()) &&
14038
+ (await closeCoachMarkButton.click());
14015
14039
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.sectionHeadingButton).click();
14016
14040
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelSectionSubmenuCreate).click();
14017
14041
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelSectionMenuCreateChannel).click();