@bigbinary/neeto-playwright-commons 1.9.24 → 1.9.26

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
@@ -941,16 +941,16 @@ declare class SlackPage extends IntegrationBase {
941
941
  }: SlackPageParams);
942
942
  /**
943
943
  *
944
- * Closes the coach mark modal that appears when a user logs in to Slack for the first time. It can be useful in scenarios where the coach mark is blocking the view of the elements that need to be interacted with. It takes the following parameters:
944
+ * Closes the coach mark modal, upgrades banner, and permissions banner that appears when a user logs in to Slack for the first time, if present. It can be useful in scenarios where the banners are blocking the view of the elements that needs to be interacted with. It takes the following parameters:
945
945
  *
946
946
  * slackWebappPage (optional): Playwright Page object for Slack web app.
947
947
  *
948
948
  * @example
949
949
  *
950
- * await slackPage.closeCoachMark(slackWebappPageInstance);
950
+ * await slackPage.setupCloseHandlers(slackWebappPageInstance);
951
951
  * @endexample
952
952
  */
953
- closeCoachMark: (slackWebappPage?: Page) => Promise<void>;
953
+ setupCloseHandlers: (slackWebappPage?: Page) => Promise<void>;
954
954
  /**
955
955
  *
956
956
  * Connects to slack integration and verifies the connection. It takes the following parameters:
@@ -2246,15 +2246,44 @@ interface SearchAndSelectProps {
2246
2246
  interface MergeTagsViaUIProps {
2247
2247
  sourceTagName: string;
2248
2248
  destinationTagName: string;
2249
- mergeTagsLabel: string;
2250
- tagsBreadcrumbLabel: string;
2249
+ tagsBreadcrumbSelector: string;
2251
2250
  }
2252
2251
  declare class TagsPage {
2253
2252
  page: Page;
2254
2253
  neetoPlaywrightUtilities: CustomCommands;
2255
2254
  t: TFunction;
2256
2255
  constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
2256
+ /**
2257
+ *
2258
+ * Used to search and verify the tags by providing tag name as the search term. It takes the following parameters:
2259
+ *
2260
+ * tagName (required): The name of the tag to be searched.
2261
+ *
2262
+ * @example
2263
+ *
2264
+ * await tagsPage.searchAndVerifyTags("tagName");
2265
+ * @endexample
2266
+ */
2257
2267
  searchAndVerifyTags: (tagName: string) => Promise<void>;
2268
+ /**
2269
+ *
2270
+ * Used to add a tag using the add button in the header. It takes the following parameters:
2271
+ *
2272
+ * tagName (required): The name of the tag to be added.
2273
+ *
2274
+ * addTagsLabel (required): The label of the add new tags pane header.
2275
+ *
2276
+ * tagsResponseUrl (required): the response URL of tags when the save button is clicked while adding new tags.
2277
+ *
2278
+ * @example
2279
+ *
2280
+ * await tagsPage.addTagViaUI({
2281
+ * tagName: "tagName",
2282
+ * addTagsLabel: "Add new tag",
2283
+ * tagsResponseUrl: API_ROUTES.tags.index,
2284
+ * });
2285
+ * @endexample
2286
+ */
2258
2287
  addTagViaUI: ({
2259
2288
  tagName,
2260
2289
  addTagsLabel,
@@ -2264,7 +2293,36 @@ declare class TagsPage {
2264
2293
  addTagsLabel: string;
2265
2294
  tagsResponseUrl: string;
2266
2295
  }) => Promise<void>;
2296
+ /**
2297
+ *
2298
+ * Used to filter tags using the filter button in the header. It takes the following parameters:
2299
+ *
2300
+ * tagName (required): The name of the tag to be filtered.
2301
+ *
2302
+ * @example
2303
+ *
2304
+ * await tagsPage.filterTagsViaUI({
2305
+ * tagName: "tagName",
2306
+ * });
2307
+ * @endexample
2308
+ */
2267
2309
  filterTagsViaUI: (tagName: string) => Promise<void>;
2310
+ /**
2311
+ *
2312
+ * Used to edit a tag using the edit button in row dropdown. It takes the following parameters:
2313
+ *
2314
+ * tagName (required): The name of the tag to be edited.
2315
+ *
2316
+ * newTagName (required): The new name of the tag.
2317
+ *
2318
+ * @example
2319
+ *
2320
+ * await tagsPage.editTagViaUI({
2321
+ * tagName: "tagName",
2322
+ * newTagName: "newTagName",
2323
+ * });
2324
+ * @endexample
2325
+ */
2268
2326
  editTagViaUI: ({
2269
2327
  tagName,
2270
2328
  newTagName
@@ -2272,27 +2330,105 @@ declare class TagsPage {
2272
2330
  tagName: string;
2273
2331
  newTagName: string;
2274
2332
  }) => Promise<void>;
2333
+ /**
2334
+ *
2335
+ * Used to delete a tag using the delete button in row dropdown. It takes the following parameters:
2336
+ *
2337
+ * tagName (required): The name of the tag to be deleted.
2338
+ *
2339
+ * @example
2340
+ *
2341
+ * await tagsPage.deleteTagViaUI({
2342
+ * tagName: "tagName",
2343
+ * });
2344
+ * @endexample
2345
+ */
2275
2346
  deleteTagViaUI: (tagName: string) => Promise<void>;
2276
- addTagsViaResponse: ({
2347
+ /**
2348
+ *
2349
+ * Used to add tags via API request. It takes the following parameters:
2350
+ *
2351
+ * name (required): The name of the tag to be added.
2352
+ *
2353
+ * description (optional): The description of the tag to be added. Default is "".
2354
+ *
2355
+ * tagsRequestUrl (required): The URL of the tags API endpoint.
2356
+ *
2357
+ * @example
2358
+ *
2359
+ * await tagsPage.addTagsViaRequest({
2360
+ * name: "tagName",
2361
+ * description: "tagDescription",
2362
+ * tagsRequestUrl: ROUTES.tags.index,
2363
+ * });
2364
+ * @endexample
2365
+ */
2366
+ addTagsViaRequest: ({
2277
2367
  name,
2278
2368
  description,
2279
- tagsResponseUrl
2369
+ tagsRequestUrl
2280
2370
  }: {
2281
2371
  name: string;
2282
- description: string;
2283
- tagsResponseUrl: string;
2372
+ description?: string;
2373
+ tagsRequestUrl: string;
2284
2374
  }) => Promise<playwright_core.APIResponse | undefined>;
2285
- navigateToMergeTagsPage: (mergeTagsLabel: string) => Promise<void>;
2375
+ /**
2376
+ *
2377
+ * Used to navigate to merge tags page.
2378
+ *
2379
+ * @example
2380
+ *
2381
+ * await tagsPage.navigateToMergeTagsPage();
2382
+ * @endexample
2383
+ */
2384
+ navigateToMergeTagsPage: () => Promise<void>;
2385
+ /**
2386
+ *
2387
+ * Used to search a tag and select that tag in the tags table. It takes the following parameters:
2388
+ *
2389
+ * selector (required): The selector used to search a tag.
2390
+ *
2391
+ * tagName (required): The name of the tag to be searched and selected.
2392
+ *
2393
+ * rowSelector (required): The selector of the row used to select a tag.
2394
+ *
2395
+ * @example
2396
+ *
2397
+ * await tagsPage.searchAndSelect({
2398
+ * selector: MERGE_TAGS_SELECTORS.sourceSearchTextField,
2399
+ * tagName: "tagName",
2400
+ * rowSelector: MERGE_TAGS_SELECTORS.sourceTagRow,
2401
+ * });
2402
+ * @endexample
2403
+ */
2286
2404
  searchAndSelect: ({
2287
2405
  selector,
2288
2406
  tagName,
2289
2407
  rowSelector
2290
2408
  }: SearchAndSelectProps) => Promise<void>;
2291
- mergeTagsViaUI: ({
2409
+ /**
2410
+ *
2411
+ * Used to merge tags and verify the merged tags in tags table. It takes the following parameters:
2412
+ *
2413
+ * sourceTagName (required): The name of the source tag to be merged.
2414
+ *
2415
+ * destinationTagName (required): The name of the destination tag to be merged.
2416
+ *
2417
+ * tagsBreadcrumbSelector (required): The selector of the tags breadcrumb used to redirect to the tags page.
2418
+ *
2419
+ * @example
2420
+ *
2421
+ * tagsPage.mergeAndVerifyTagsViaUI({
2422
+ * sourceTagName: "sourceTagName",
2423
+ * destinationTagName: "destinationTagName",
2424
+ * tagsBreadcrumbSelector: SETTINGS_SELECTORS.ticketTagsBreadcrumb,
2425
+ * })
2426
+ * @endexample
2427
+ */
2428
+ mergeAndVerifyTagsViaUI: ({
2292
2429
  sourceTagName,
2293
2430
  destinationTagName,
2294
- mergeTagsLabel,
2295
- tagsBreadcrumbLabel
2431
+ tagsBreadcrumbSelector
2296
2432
  }: MergeTagsViaUIProps) => Promise<void>;
2297
2433
  }
2298
2434
  /**
@@ -3543,6 +3679,8 @@ declare const SLACK_SELECTORS: {
3543
3679
  declare const SLACK_DATA_QA_SELECTORS: {
3544
3680
  sectionHeadingButton: string;
3545
3681
  coachMarkCloseButton: string;
3682
+ messagePaneBannerCloseIcon: string;
3683
+ permissionBannerCloseIcon: string;
3546
3684
  channelSectionSubmenuCreate: string;
3547
3685
  channelSectionMenuCreateChannel: string;
3548
3686
  skModalContent: string;
package/index.js CHANGED
@@ -13885,6 +13885,8 @@ const SLACK_SELECTORS = {
13885
13885
  const SLACK_DATA_QA_SELECTORS = {
13886
13886
  sectionHeadingButton: "section_heading_button__channels",
13887
13887
  coachMarkCloseButton: "coachmark-close-button",
13888
+ messagePaneBannerCloseIcon: "message_pane_banner_close_icon",
13889
+ permissionBannerCloseIcon: "banner_close_btn",
13888
13890
  channelSectionSubmenuCreate: "channel_section_submenu_create",
13889
13891
  channelSectionMenuCreateChannel: "channel_section_menu__create_channel",
13890
13892
  skModalContent: "sk-modal-content",
@@ -13907,10 +13909,11 @@ class SlackPage extends IntegrationBase {
13907
13909
  integration: "slack",
13908
13910
  integrationRouteIndex,
13909
13911
  });
13910
- this.closeCoachMark = async (slackWebappPage = this.page) => {
13912
+ this.setupCloseHandlers = async (slackWebappPage = this.page) => {
13911
13913
  const slackWebappPageDataQa = getByDataQA(slackWebappPage);
13912
- const closeCoachMarkButton = slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.coachMarkCloseButton);
13913
- await closeCoachMarkButton.click();
13914
+ await slackWebappPage.addLocatorHandler(slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.coachMarkCloseButton), () => slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.coachMarkCloseButton).click());
13915
+ await slackWebappPage.addLocatorHandler(slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.messagePaneBannerCloseIcon), () => slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.messagePaneBannerCloseIcon).click());
13916
+ await slackWebappPage.addLocatorHandler(slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.permissionBannerCloseIcon), () => slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.permissionBannerCloseIcon).click());
13914
13917
  };
13915
13918
  this.connectAndVerifyIntegration = async (redirectUrl, customSteps, channelToConfigure = SLACK_DEFAULT_CHANNEL) => {
13916
13919
  await this.connect();
@@ -14016,7 +14019,7 @@ class SlackPage extends IntegrationBase {
14016
14019
  await slackWebappPage
14017
14020
  .locator(SLACK_SELECTORS.redirectOpenInBrowser)
14018
14021
  .click();
14019
- await this.closeCoachMark(slackWebappPage);
14022
+ await this.setupCloseHandlers(slackWebappPage);
14020
14023
  }
14021
14024
  else {
14022
14025
  throw new Error("ENV variable SLACK_LOGIN_EMAIL or SLACK_LOGIN_PASSWORD or SLACK_WORKSPACE is not defined.");
@@ -14039,9 +14042,6 @@ class SlackPage extends IntegrationBase {
14039
14042
  .click();
14040
14043
  };
14041
14044
  this.createNewSlackChannel = async ({ channelName, kind = "public", }) => {
14042
- const closeCoachMarkButton = this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.coachMarkCloseButton);
14043
- (await closeCoachMarkButton.isVisible()) &&
14044
- (await closeCoachMarkButton.click());
14045
14045
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.sectionHeadingButton).click();
14046
14046
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelSectionSubmenuCreate).click();
14047
14047
  await this.slackWebappPageDataQa(SLACK_DATA_QA_SELECTORS.channelSectionMenuCreateChannel).click();
@@ -14575,7 +14575,7 @@ class EditorPage {
14575
14575
  await this.neetoPlaywrightUtilities.interceptMultipleResponses({
14576
14576
  responseUrl: ROUTES.attachment,
14577
14577
  });
14578
- await this.neetoPlaywrightUtilities.verifySuccessToast();
14578
+ await this.neetoPlaywrightUtilities.verifyToast();
14579
14579
  await expect(this.attachmentPreview).toBeVisible();
14580
14580
  await this.attachmentPreview
14581
14581
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
@@ -14587,7 +14587,7 @@ class EditorPage {
14587
14587
  .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
14588
14588
  .click();
14589
14589
  }
14590
- await this.neetoPlaywrightUtilities.verifySuccessToast({
14590
+ await this.neetoPlaywrightUtilities.verifyToast({
14591
14591
  message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
14592
14592
  });
14593
14593
  if (await this.imageUploadOption.isVisible()) {
@@ -14600,7 +14600,7 @@ class EditorPage {
14600
14600
  const imagePath = Path.join(__dirname, filePath);
14601
14601
  await fileUploader.setFiles(imagePath);
14602
14602
  await expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
14603
- await this.neetoPlaywrightUtilities.verifySuccessToast();
14603
+ await this.neetoPlaywrightUtilities.verifyToast();
14604
14604
  await this.imageWrapper
14605
14605
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
14606
14606
  .click();
@@ -14637,7 +14637,7 @@ class EditorPage {
14637
14637
  .getByTestId(COMMON_SELECTORS.selectOption(this.t("neetoRules.labels.feedback")))
14638
14638
  .click();
14639
14639
  await this.page.getByTestId(NEETO_EDITOR_SELECTORS.applyButton).click();
14640
- await this.neetoPlaywrightUtilities.verifySuccessToast({
14640
+ await this.neetoPlaywrightUtilities.verifyToast({
14641
14641
  message: cannedResponseSuccessMessage,
14642
14642
  });
14643
14643
  }
@@ -15390,7 +15390,7 @@ class TagsPage {
15390
15390
  });
15391
15391
  await this.page.getByTestId(TAGS_SELECTORS.submitButton).click();
15392
15392
  await waitForSave;
15393
- await this.neetoPlaywrightUtilities.verifySuccessToast();
15393
+ await this.neetoPlaywrightUtilities.verifyToast();
15394
15394
  await this.searchAndVerifyTags(tagName);
15395
15395
  };
15396
15396
  this.filterTagsViaUI = async (tagName) => {
@@ -15422,7 +15422,7 @@ class TagsPage {
15422
15422
  .getByTestId(TAGS_SELECTORS.tagNameTextField)
15423
15423
  .fill(newTagName);
15424
15424
  await this.page.getByTestId(TAGS_SELECTORS.submitButton).click();
15425
- await this.neetoPlaywrightUtilities.verifySuccessToast();
15425
+ await this.neetoPlaywrightUtilities.verifyToast();
15426
15426
  await expect(this.page.getByRole("row", { name: tagName })).toBeHidden();
15427
15427
  await expect(this.page.getByRole("row", { name: newTagName })).toBeVisible();
15428
15428
  };
@@ -15435,18 +15435,18 @@ class TagsPage {
15435
15435
  await this.page
15436
15436
  .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
15437
15437
  .click();
15438
- await this.neetoPlaywrightUtilities.verifySuccessToast();
15438
+ await this.neetoPlaywrightUtilities.verifyToast();
15439
15439
  await expect(this.page.getByRole("row", { name: tagName })).toBeHidden();
15440
15440
  };
15441
- this.addTagsViaResponse = ({ name, description, tagsResponseUrl, }) => this.neetoPlaywrightUtilities.apiRequest({
15442
- url: tagsResponseUrl,
15441
+ this.addTagsViaRequest = ({ name, description = "", tagsRequestUrl, }) => this.neetoPlaywrightUtilities.apiRequest({
15442
+ url: tagsRequestUrl,
15443
15443
  body: { name, description },
15444
15444
  method: "post",
15445
15445
  });
15446
- this.navigateToMergeTagsPage = async (mergeTagsLabel) => {
15446
+ this.navigateToMergeTagsPage = async () => {
15447
15447
  await this.page.getByTestId(MERGE_TAGS_SELECTORS.mergeTagsButton).click();
15448
15448
  await this.neetoPlaywrightUtilities.waitForPageLoad();
15449
- await expect(this.page.getByTestId(COMMON_SELECTORS.heading)).toHaveText(mergeTagsLabel);
15449
+ await expect(this.page.getByTestId(COMMON_SELECTORS.heading)).toHaveText(this.t("neetoTags.common.mergeTag_other"));
15450
15450
  };
15451
15451
  this.searchAndSelect = async ({ selector, tagName, rowSelector, }) => {
15452
15452
  await this.page.getByTestId(selector).fill(tagName);
@@ -15455,7 +15455,7 @@ class TagsPage {
15455
15455
  .filter({ hasText: tagName })
15456
15456
  .click();
15457
15457
  };
15458
- this.mergeTagsViaUI = async ({ sourceTagName, destinationTagName, mergeTagsLabel, tagsBreadcrumbLabel, }) => {
15458
+ this.mergeAndVerifyTagsViaUI = async ({ sourceTagName, destinationTagName, tagsBreadcrumbSelector, }) => {
15459
15459
  await this.searchAndSelect({
15460
15460
  selector: MERGE_TAGS_SELECTORS.sourceSearchTextField,
15461
15461
  tagName: sourceTagName,
@@ -15467,10 +15467,10 @@ class TagsPage {
15467
15467
  rowSelector: MERGE_TAGS_SELECTORS.destinationTagRow,
15468
15468
  });
15469
15469
  await this.page.getByTestId(MERGE_TAGS_SELECTORS.mergeButton).click();
15470
- await expect(this.page.getByTestId(COMMON_SELECTORS.modalHeader)).toHaveText(mergeTagsLabel);
15470
+ await expect(this.page.getByTestId(COMMON_SELECTORS.modalHeader)).toHaveText(this.t("neetoTags.common.mergeTag_other"));
15471
15471
  await this.page.getByTestId(MERGE_TAGS_SELECTORS.proceedButton).click();
15472
- await this.neetoPlaywrightUtilities.verifySuccessToast();
15473
- await this.page.getByTestId(tagsBreadcrumbLabel).click();
15472
+ await this.neetoPlaywrightUtilities.verifyToast();
15473
+ await this.page.getByTestId(tagsBreadcrumbSelector).click();
15474
15474
  await expect(this.page.getByText(sourceTagName)).toBeHidden();
15475
15475
  await expect(this.page.getByText(destinationTagName)).toBeVisible();
15476
15476
  };