@bigbinary/neeto-playwright-commons 3.3.7 → 3.3.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
@@ -1084,6 +1084,7 @@ declare class Health {
1084
1084
  neetoPlaywrightUtilities: CustomCommands;
1085
1085
  private readonly email;
1086
1086
  private loginPage;
1087
+ private teamMembers;
1087
1088
  constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
1088
1089
  /**
1089
1090
  *
@@ -1117,7 +1118,9 @@ declare class Health {
1117
1118
  *
1118
1119
  * Performs login, waits until the main application UI (floating menu, logo, and
1119
1120
  *
1120
- * heading) is present, and then executes your custom verification steps.
1121
+ * heading) is present, verifies team members can be added and removed, and then
1122
+ *
1123
+ * executes your custom verification steps.
1121
1124
  *
1122
1125
  * customSteps (optional): An async function (no arguments) that runs after login
1123
1126
  *
@@ -1126,7 +1129,7 @@ declare class Health {
1126
1129
  * @example
1127
1130
  *
1128
1131
  * await health.verifyAppIsLive(async () => {
1129
- * await test.step("3: Verify dashboard", async () => {
1132
+ * await test.step("5: Verify dashboard", async () => {
1130
1133
  * await expect(
1131
1134
  * page.getByRole("heading", { name: "Dashboard" })
1132
1135
  * ).toBeVisible();
@@ -4217,6 +4220,8 @@ declare class TeamMembers {
4217
4220
  * @endexample
4218
4221
  */
4219
4222
  navigateToTeamMembers: () => Promise<void>;
4223
+ openMemberPane: () => Promise<void>;
4224
+ fillMemberForm: (emails: string[], role?: string) => Promise<void>;
4220
4225
  /**
4221
4226
  *
4222
4227
  * Used to add a member using the add button in the header. It takes the following parameters:
@@ -4311,7 +4316,7 @@ declare class TeamMembers {
4311
4316
  * await teamMembers.removeMemberViaUI();
4312
4317
  * @endexample
4313
4318
  */
4314
- removeMemberViaUI: () => Promise<void>;
4319
+ removeMemberViaUI: (parentLocator?: Locator | Page) => Promise<void>;
4315
4320
  /**
4316
4321
  *
4317
4322
  * Used to filter members by multi select fields such as role, group, teams, etc. The filter pane should be opened and closed before and after filtering. It takes the following parameters:
@@ -4382,7 +4387,7 @@ declare class TeamMembers {
4382
4387
  * await teamMembers.getMemberRowByName("Sam");
4383
4388
  * @endexample
4384
4389
  */
4385
- getMemberRowByName: (name: string) => playwright_core.Locator;
4390
+ getMemberRowByName: (name: string) => Locator;
4386
4391
  /**
4387
4392
  *
4388
4393
  * Used to take action on members by selecting the members and clicking on the take action button in the subheader. It takes the following parameters:
@@ -5656,6 +5661,7 @@ declare const ROUTES: {
5656
5661
  loginLink: string;
5657
5662
  profile: string;
5658
5663
  admin: string;
5664
+ members: string;
5659
5665
  myProfile: string;
5660
5666
  updateEmail: string;
5661
5667
  authSettings: string;
package/index.js CHANGED
@@ -41,6 +41,7 @@ const ROUTES = {
41
41
  loginLink: "/login",
42
42
  profile: "/profile",
43
43
  admin: "/admin",
44
+ members: "/admin/members",
44
45
  myProfile: "/my/profile",
45
46
  updateEmail: "/my/profile/email",
46
47
  authSettings: "/settings",
@@ -2456,6 +2457,278 @@ const THEMES_TEXTS = {
2456
2457
  darkThemeClass: /neeto-ui-theme--dark/,
2457
2458
  };
2458
2459
 
2460
+ const openFilterPane = async (page) => {
2461
+ await page
2462
+ .getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
2463
+ .or(page.getByTestId(COMMON_SELECTORS.filterButon))
2464
+ .click();
2465
+ await expect(page.getByTestId(COMMON_SELECTORS.paneHeader)).toHaveText(getI18nInstance().t("neetoFilters.common.filters"));
2466
+ };
2467
+ const clearFiltersFromActionBlock = async (page) => {
2468
+ const isClearButtonVisible = await page
2469
+ .getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
2470
+ .isVisible();
2471
+ if (isClearButtonVisible) {
2472
+ await page
2473
+ .getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
2474
+ .click();
2475
+ await Promise.all([
2476
+ expect(page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeHidden(),
2477
+ expect(page.locator(COMMON_SELECTORS.tableSpinner)).toHaveCount(0, {
2478
+ timeout: 15_000,
2479
+ }),
2480
+ ]);
2481
+ }
2482
+ };
2483
+ const filterUtils = {
2484
+ openFilterPane,
2485
+ clearFiltersFromActionBlock,
2486
+ };
2487
+
2488
+ class TeamMembers {
2489
+ page;
2490
+ neetoPlaywrightUtilities;
2491
+ t;
2492
+ constructor({ page, neetoPlaywrightUtilities, }) {
2493
+ this.page = page;
2494
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
2495
+ this.t = getI18nInstance().t;
2496
+ }
2497
+ navigateToTeamMembers = async () => {
2498
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2499
+ await this.page.getByTestId(MEMBER_SELECTORS.membersTab).click();
2500
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2501
+ };
2502
+ openMemberPane = async () => {
2503
+ await this.page.getByTestId(MEMBER_SELECTORS.newButton).click();
2504
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2505
+ const continueButton = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
2506
+ await expect(continueButton).toBeVisible();
2507
+ await expect(continueButton.getByTestId(COMMON_SELECTORS.uiSpinner)).toBeHidden({ timeout: 35_000 });
2508
+ };
2509
+ fillMemberForm = async (emails, role) => {
2510
+ await this.page
2511
+ .getByTestId(MEMBER_FORM_SELECTORS.emailTextField)
2512
+ .fill(emails.join(", "));
2513
+ await this.page.keyboard.press("Enter");
2514
+ role &&
2515
+ (await this.neetoPlaywrightUtilities.toggleElement({
2516
+ locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
2517
+ }));
2518
+ const continueBtn = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
2519
+ await continueBtn.click();
2520
+ if (IS_DEV_ENV)
2521
+ return;
2522
+ await this.page
2523
+ .getByTestId(COMMON_SELECTORS.paneBody)
2524
+ .getByTestId(COMMON_SELECTORS.checkboxLabel)
2525
+ .click();
2526
+ await continueBtn.click();
2527
+ };
2528
+ addMemberViaUI = async ({ emails = [faker.internet.exampleEmail()], role = "standard", } = {}) => {
2529
+ await this.openMemberPane();
2530
+ await this.fillMemberForm(emails, role);
2531
+ await this.submit();
2532
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2533
+ };
2534
+ submit = async () => {
2535
+ const pane = this.page.getByTestId(COMMON_SELECTORS.paneBody);
2536
+ const submitBtn = this.page.getByTestId(MEMBER_SELECTORS.submitButton);
2537
+ const buttonSpinner = submitBtn.getByTestId(COMMON_SELECTORS.uiSpinner);
2538
+ await expect(submitBtn).toBeVisible({ timeout: 10_000 });
2539
+ await expect(async () => {
2540
+ if (await pane.isHidden())
2541
+ return;
2542
+ (await buttonSpinner.isHidden()) && (await submitBtn.click());
2543
+ await expect(buttonSpinner).toBeHidden({ timeout: 10_000 });
2544
+ await expect(pane).toBeHidden();
2545
+ }).toPass({ timeout: 60_000 });
2546
+ await this.neetoPlaywrightUtilities.verifyToast();
2547
+ };
2548
+ searchAndVerifyMemberByEmail = async ({ email }) => {
2549
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2550
+ await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
2551
+ const emailSubstr = email.length > 20 ? email.substring(0, 20) : email;
2552
+ await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.searchTermBlock)).toContainText(emailSubstr);
2553
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2554
+ await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
2555
+ await expect(this.page.getByRole("cell", { name: email, exact: true })).toBeVisible();
2556
+ };
2557
+ editMemberViaUI = async ({ email = "", firstName = "", lastName = "", role = "standard", } = {}) => {
2558
+ await this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
2559
+ await this.page.getByTestId(MEMBER_SELECTORS.editButton).click();
2560
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2561
+ isPresent(email) &&
2562
+ (await this.page
2563
+ .getByTestId(MEMBER_FORM_SELECTORS.emailInput)
2564
+ .fill(email));
2565
+ isPresent(firstName) &&
2566
+ (await this.page
2567
+ .getByTestId(MEMBER_FORM_SELECTORS.firstNameTextField)
2568
+ .fill(firstName));
2569
+ isPresent(lastName) &&
2570
+ (await this.page
2571
+ .getByTestId(MEMBER_FORM_SELECTORS.lastNameTextField)
2572
+ .fill(lastName));
2573
+ await this.neetoPlaywrightUtilities.toggleElement({
2574
+ locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
2575
+ });
2576
+ await this.submit();
2577
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2578
+ };
2579
+ removeMemberViaUI = async (parentLocator = this.page) => {
2580
+ await parentLocator.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
2581
+ await this.page.getByTestId(MEMBER_SELECTORS.removeMember).click();
2582
+ await this.page
2583
+ .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
2584
+ .click();
2585
+ await this.neetoPlaywrightUtilities.verifyToast();
2586
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2587
+ };
2588
+ filterMembersByMultiSelect = async ({ selectedOptions = [], selectContainerLocator = NEETO_FILTERS_SELECTORS.roleSelectContainer, }) => {
2589
+ await this.page
2590
+ .getByTestId(selectContainerLocator)
2591
+ .getByTestId(COMMON_SELECTORS.actionSelectIndicator)
2592
+ .click();
2593
+ for (const option of selectedOptions) {
2594
+ await this.page
2595
+ .getByTestId(COMMON_SELECTORS.selectOption(option))
2596
+ .click();
2597
+ }
2598
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2599
+ await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
2600
+ };
2601
+ filterMembers = async ({ email = { id: "", condition: "Is" }, roles = [], name = "", }) => {
2602
+ await filterUtils.clearFiltersFromActionBlock(this.page);
2603
+ await filterUtils.openFilterPane(this.page);
2604
+ if (isPresent(email.id)) {
2605
+ await this.page
2606
+ .getByTestId(NEETO_FILTERS_SELECTORS.emailSelectContainer)
2607
+ .getByTestId(COMMON_SELECTORS.actionSelectIndicator)
2608
+ .click();
2609
+ await this.page
2610
+ .getByTestId(COMMON_SELECTORS.selectOption(email.condition))
2611
+ .click();
2612
+ await this.page
2613
+ .getByTestId(NEETO_FILTERS_SELECTORS.filtersEmailFilter)
2614
+ .fill(email.id);
2615
+ }
2616
+ isPresent(name) &&
2617
+ (await this.page
2618
+ .getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersNameFilterField)
2619
+ .fill(name));
2620
+ isPresent(roles) &&
2621
+ (await this.filterMembersByMultiSelect({ selectedOptions: roles }));
2622
+ await this.applyFilter();
2623
+ };
2624
+ getMemberRowByName = (name) => this.page.getByRole("row").filter({
2625
+ has: this.page.getByTestId(MEMBER_SELECTORS.memberNameCell(name)),
2626
+ });
2627
+ takeActionOnMembers = async ({ names = [], state, action, }) => {
2628
+ if (isPresent(names)) {
2629
+ for (const name of names) {
2630
+ await this.getMemberRowByName(name).getByRole("checkbox").click();
2631
+ }
2632
+ }
2633
+ else {
2634
+ await this.page
2635
+ .getByRole("columnheader", { name: MEMBER_TEXTS.selectAll })
2636
+ .click();
2637
+ }
2638
+ await this.page.getByTestId(COMMON_SELECTORS.takeActionDropdown).click();
2639
+ if (isPresent(state)) {
2640
+ await this.page
2641
+ .getByTestId(MEMBER_SELECTORS.takeActionStateOption(state))
2642
+ .click();
2643
+ }
2644
+ else {
2645
+ await this.page
2646
+ .getByRole("button", { name: action?.actionButtonText })
2647
+ .click();
2648
+ await this.page
2649
+ .getByRole("button", { name: action?.valueButtonText })
2650
+ .click();
2651
+ }
2652
+ await this.page
2653
+ .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
2654
+ .click();
2655
+ await this.neetoPlaywrightUtilities.verifyToast();
2656
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2657
+ };
2658
+ performColumnAction = async ({ columnName = "Name", actionButtonText = "Ascending", } = {}) => {
2659
+ await this.page
2660
+ .getByTestId(MEMBER_SELECTORS.teamMembersTable)
2661
+ .getByLabel(columnName)
2662
+ .getByTestId(TABLE_SELECTORS.columnMenuButton)
2663
+ .click();
2664
+ await this.page.getByRole("button", { name: actionButtonText }).click();
2665
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2666
+ await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
2667
+ };
2668
+ toggleMemberColumns = async ({ columns = [], bulkAction, }) => {
2669
+ await expect(async () => {
2670
+ await this.page
2671
+ .getByTestId(COMMON_SELECTORS.columnsDropdownButton)
2672
+ .click();
2673
+ await expect(this.page.getByTestId(COMMON_SELECTORS.columnsSearchInput)).toBeVisible();
2674
+ }).toPass({ timeout: 15_000 });
2675
+ if (isPresent(bulkAction)) {
2676
+ await this.page
2677
+ .getByTestId(COMMON_SELECTORS.columnVisibilityBtn(bulkAction === "hide" ? "hide-all" : "reset"))
2678
+ .click();
2679
+ }
2680
+ else {
2681
+ for (const column of columns) {
2682
+ await this.page
2683
+ .getByTestId(COMMON_SELECTORS.columnsSearchInput)
2684
+ .fill(column);
2685
+ const columnCheckbox = this.page
2686
+ .getByTestId(COMMON_SELECTORS.nuiCheckboxContainer)
2687
+ .filter({ hasText: column })
2688
+ .getByTestId(MEMBER_SELECTORS.columnCheckBox);
2689
+ const isChecked = await columnCheckbox.isChecked();
2690
+ await columnCheckbox.click();
2691
+ await expect(columnCheckbox).toBeChecked({ checked: !isChecked });
2692
+ }
2693
+ }
2694
+ await this.page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
2695
+ };
2696
+ verifyMemberInTable = ({ name, email }) => expect(this.getMemberRowByName(name).getByRole("cell", {
2697
+ name: email,
2698
+ exact: true,
2699
+ })).toBeVisible();
2700
+ applyFilter = async () => {
2701
+ await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
2702
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2703
+ await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden({
2704
+ timeout: 30_000,
2705
+ });
2706
+ await this.page
2707
+ .getByTestId(NEETO_FILTERS_SELECTORS.filterDoneButton)
2708
+ .click();
2709
+ };
2710
+ exportDetails = async (fileType, adminEmail) => {
2711
+ await this.page.getByTestId(MEMBER_SELECTORS.downloadButton).click();
2712
+ await expect(this.page.getByTestId(MEMBER_SELECTORS.exportMemberHeading)).toHaveText(this.t("neetoTeamMembers.exportPane.title"));
2713
+ await this.page
2714
+ .getByTestId(MEMBER_SELECTORS.downloadAsRadioItem(fileType))
2715
+ .check();
2716
+ const exportStartTime = new Date();
2717
+ await this.page.getByTestId(MEMBER_SELECTORS.exportSubmitBtn).click();
2718
+ await this.neetoPlaywrightUtilities.verifyToast({
2719
+ message: this.t("toastr.success.exportMembers", { email: adminEmail }),
2720
+ });
2721
+ return exportStartTime;
2722
+ };
2723
+ verifyNoDataTitle = async (email) => {
2724
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
2725
+ await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
2726
+ await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
2727
+ await expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible({ timeout: 10_000 });
2728
+ await filterUtils.clearFiltersFromActionBlock(this.page);
2729
+ };
2730
+ }
2731
+
2459
2732
  const fillCredentialsAndSubmit = async ({ page, loginPath, email = CREDENTIALS.email, }) => {
2460
2733
  loginPath && (await page.goto(loginPath, { timeout: 30_000 }));
2461
2734
  await page.waitForLoadState("load", { timeout: 35_000 });
@@ -18042,14 +18315,17 @@ class Health {
18042
18315
  neetoPlaywrightUtilities;
18043
18316
  email = process.env.PLAYWRIGHT_PRODUCTION_EMAIL;
18044
18317
  loginPage;
18318
+ teamMembers;
18045
18319
  constructor(page, neetoPlaywrightUtilities) {
18046
18320
  this.page = page;
18047
18321
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
18048
18322
  if (!process.env.PLAYWRIGHT_PRODUCTION_EMAIL ||
18049
- !process.env.PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY) {
18050
- throw new Error("One or more required env variables are missing: PLAYWRIGHT_PRODUCTION_EMAIL, PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY");
18323
+ !process.env.PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY ||
18324
+ !process.env.FASTMAIL_DOMAIN_NAME) {
18325
+ throw new Error("One or more required env variables are missing: PLAYWRIGHT_PRODUCTION_EMAIL, PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY, FASTMAIL_DOMAIN_NAME");
18051
18326
  }
18052
18327
  this.loginPage = new OrganizationPage(page, neetoPlaywrightUtilities);
18328
+ this.teamMembers = new TeamMembers({ page, neetoPlaywrightUtilities });
18053
18329
  }
18054
18330
  loginToApp = async (route = ROUTES.adminPanel.index) => {
18055
18331
  await this.page.goto(route);
@@ -18064,6 +18340,26 @@ class Health {
18064
18340
  verifyAppIsLive = async (customSteps) => {
18065
18341
  await test.step("1: Login to the application", () => this.loginToApp());
18066
18342
  await test.step("2: Verify application UI", this.verifyAppUI);
18343
+ await test.step("3: Navigate to team members page", async () => {
18344
+ await this.page.goto(ROUTES.members);
18345
+ await this.neetoPlaywrightUtilities.waitForFloatingMenu();
18346
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
18347
+ });
18348
+ await test.step("4: Verify adding & removing members", async () => {
18349
+ const email = faker.internet
18350
+ .email({ provider: process.env.FASTMAIL_DOMAIN_NAME })
18351
+ .toLowerCase();
18352
+ const memberRow = this.page.getByRole("row").filter({
18353
+ has: this.page.getByRole("cell", { name: email, exact: true }),
18354
+ });
18355
+ await this.teamMembers.openMemberPane();
18356
+ await this.teamMembers.fillMemberForm([email]);
18357
+ await this.teamMembers.submit();
18358
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
18359
+ await expect(memberRow).toBeVisible();
18360
+ await this.teamMembers.removeMemberViaUI(memberRow);
18361
+ await expect(memberRow).toBeHidden();
18362
+ });
18067
18363
  await customSteps?.();
18068
18364
  };
18069
18365
  }
@@ -121304,270 +121600,6 @@ class ImageUploader {
121304
121600
  };
121305
121601
  }
121306
121602
 
121307
- const openFilterPane = async (page) => {
121308
- await page
121309
- .getByTestId(NEETO_FILTERS_SELECTORS.filterButton)
121310
- .or(page.getByTestId(COMMON_SELECTORS.filterButon))
121311
- .click();
121312
- await expect(page.getByTestId(COMMON_SELECTORS.paneHeader)).toHaveText(getI18nInstance().t("neetoFilters.common.filters"));
121313
- };
121314
- const clearFiltersFromActionBlock = async (page) => {
121315
- const isClearButtonVisible = await page
121316
- .getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
121317
- .isVisible();
121318
- if (isClearButtonVisible) {
121319
- await page
121320
- .getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)
121321
- .click();
121322
- await Promise.all([
121323
- expect(page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeHidden(),
121324
- expect(page.locator(COMMON_SELECTORS.tableSpinner)).toHaveCount(0, {
121325
- timeout: 15_000,
121326
- }),
121327
- ]);
121328
- }
121329
- };
121330
- const filterUtils = {
121331
- openFilterPane,
121332
- clearFiltersFromActionBlock,
121333
- };
121334
-
121335
- class TeamMembers {
121336
- page;
121337
- neetoPlaywrightUtilities;
121338
- t;
121339
- constructor({ page, neetoPlaywrightUtilities, }) {
121340
- this.page = page;
121341
- this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
121342
- this.t = getI18nInstance().t;
121343
- }
121344
- navigateToTeamMembers = async () => {
121345
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121346
- await this.page.getByTestId(MEMBER_SELECTORS.membersTab).click();
121347
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121348
- };
121349
- addMemberViaUI = async ({ emails = [faker.internet.exampleEmail()], role = "standard", } = {}) => {
121350
- await this.page.getByTestId(MEMBER_SELECTORS.newButton).click();
121351
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121352
- const continueButton = this.page.getByTestId(MEMBER_SELECTORS.continueButton);
121353
- await expect(continueButton).toBeVisible();
121354
- await expect(continueButton.getByTestId(COMMON_SELECTORS.uiSpinner)).toBeHidden({ timeout: 35_000 });
121355
- await this.page
121356
- .getByTestId(MEMBER_FORM_SELECTORS.emailTextField)
121357
- .fill(emails.join(", "));
121358
- await this.page.keyboard.press("Enter");
121359
- await this.neetoPlaywrightUtilities.toggleElement({
121360
- locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
121361
- });
121362
- await continueButton.click();
121363
- if (IS_STAGING_ENV) {
121364
- await this.page
121365
- .getByTestId(COMMON_SELECTORS.paneBody)
121366
- .getByTestId(COMMON_SELECTORS.checkboxLabel)
121367
- .click();
121368
- await this.page.getByTestId(MEMBER_SELECTORS.continueButton).click();
121369
- }
121370
- await this.submit();
121371
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121372
- };
121373
- submit = async () => {
121374
- const pane = this.page.getByTestId(COMMON_SELECTORS.paneBody);
121375
- const submitBtn = this.page.getByTestId(MEMBER_SELECTORS.submitButton);
121376
- const buttonSpinner = submitBtn.getByTestId(COMMON_SELECTORS.uiSpinner);
121377
- await expect(submitBtn).toBeVisible({ timeout: 10_000 });
121378
- await expect(async () => {
121379
- if (await pane.isHidden())
121380
- return;
121381
- (await buttonSpinner.isHidden()) && (await submitBtn.click());
121382
- await expect(buttonSpinner).toBeHidden({ timeout: 10_000 });
121383
- await expect(pane).toBeHidden();
121384
- }).toPass({ timeout: 60_000 });
121385
- await this.neetoPlaywrightUtilities.verifyToast();
121386
- };
121387
- searchAndVerifyMemberByEmail = async ({ email }) => {
121388
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121389
- await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
121390
- const emailSubstr = email.length > 20 ? email.substring(0, 20) : email;
121391
- await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.searchTermBlock)).toContainText(emailSubstr);
121392
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121393
- await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
121394
- await expect(this.page.getByRole("cell", { name: email, exact: true })).toBeVisible();
121395
- };
121396
- editMemberViaUI = async ({ email = "", firstName = "", lastName = "", role = "standard", } = {}) => {
121397
- await this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
121398
- await this.page.getByTestId(MEMBER_SELECTORS.editButton).click();
121399
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121400
- isPresent(email) &&
121401
- (await this.page
121402
- .getByTestId(MEMBER_FORM_SELECTORS.emailInput)
121403
- .fill(email));
121404
- isPresent(firstName) &&
121405
- (await this.page
121406
- .getByTestId(MEMBER_FORM_SELECTORS.firstNameTextField)
121407
- .fill(firstName));
121408
- isPresent(lastName) &&
121409
- (await this.page
121410
- .getByTestId(MEMBER_FORM_SELECTORS.lastNameTextField)
121411
- .fill(lastName));
121412
- await this.neetoPlaywrightUtilities.toggleElement({
121413
- locator: this.page.getByTestId(MEMBER_SELECTORS.roleLabel(role)),
121414
- });
121415
- await this.submit();
121416
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121417
- };
121418
- removeMemberViaUI = async () => {
121419
- await this.page.getByTestId(MEMBER_SELECTORS.dropDownIcon).click();
121420
- await this.page.getByTestId(MEMBER_SELECTORS.removeMember).click();
121421
- await this.page
121422
- .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
121423
- .click();
121424
- await this.neetoPlaywrightUtilities.verifyToast();
121425
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121426
- };
121427
- filterMembersByMultiSelect = async ({ selectedOptions = [], selectContainerLocator = NEETO_FILTERS_SELECTORS.roleSelectContainer, }) => {
121428
- await this.page
121429
- .getByTestId(selectContainerLocator)
121430
- .getByTestId(COMMON_SELECTORS.actionSelectIndicator)
121431
- .click();
121432
- for (const option of selectedOptions) {
121433
- await this.page
121434
- .getByTestId(COMMON_SELECTORS.selectOption(option))
121435
- .click();
121436
- }
121437
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121438
- await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
121439
- };
121440
- filterMembers = async ({ email = { id: "", condition: "Is" }, roles = [], name = "", }) => {
121441
- await filterUtils.clearFiltersFromActionBlock(this.page);
121442
- await filterUtils.openFilterPane(this.page);
121443
- if (isPresent(email.id)) {
121444
- await this.page
121445
- .getByTestId(NEETO_FILTERS_SELECTORS.emailSelectContainer)
121446
- .getByTestId(COMMON_SELECTORS.actionSelectIndicator)
121447
- .click();
121448
- await this.page
121449
- .getByTestId(COMMON_SELECTORS.selectOption(email.condition))
121450
- .click();
121451
- await this.page
121452
- .getByTestId(NEETO_FILTERS_SELECTORS.filtersEmailFilter)
121453
- .fill(email.id);
121454
- }
121455
- isPresent(name) &&
121456
- (await this.page
121457
- .getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersNameFilterField)
121458
- .fill(name));
121459
- isPresent(roles) &&
121460
- (await this.filterMembersByMultiSelect({ selectedOptions: roles }));
121461
- await this.applyFilter();
121462
- };
121463
- getMemberRowByName = (name) => this.page.getByRole("row").filter({
121464
- has: this.page.getByTestId(MEMBER_SELECTORS.memberNameCell(name)),
121465
- });
121466
- takeActionOnMembers = async ({ names = [], state, action, }) => {
121467
- if (isPresent(names)) {
121468
- for (const name of names) {
121469
- await this.getMemberRowByName(name).getByRole("checkbox").click();
121470
- }
121471
- }
121472
- else {
121473
- await this.page
121474
- .getByRole("columnheader", { name: MEMBER_TEXTS.selectAll })
121475
- .click();
121476
- }
121477
- await this.page.getByTestId(COMMON_SELECTORS.takeActionDropdown).click();
121478
- if (isPresent(state)) {
121479
- await this.page
121480
- .getByTestId(MEMBER_SELECTORS.takeActionStateOption(state))
121481
- .click();
121482
- }
121483
- else {
121484
- await this.page
121485
- .getByRole("button", { name: action?.actionButtonText })
121486
- .click();
121487
- await this.page
121488
- .getByRole("button", { name: action?.valueButtonText })
121489
- .click();
121490
- }
121491
- await this.page
121492
- .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
121493
- .click();
121494
- await this.neetoPlaywrightUtilities.verifyToast();
121495
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121496
- };
121497
- performColumnAction = async ({ columnName = "Name", actionButtonText = "Ascending", } = {}) => {
121498
- await this.page
121499
- .getByTestId(MEMBER_SELECTORS.teamMembersTable)
121500
- .getByLabel(columnName)
121501
- .getByTestId(TABLE_SELECTORS.columnMenuButton)
121502
- .click();
121503
- await this.page.getByRole("button", { name: actionButtonText }).click();
121504
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121505
- await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden();
121506
- };
121507
- toggleMemberColumns = async ({ columns = [], bulkAction, }) => {
121508
- await expect(async () => {
121509
- await this.page
121510
- .getByTestId(COMMON_SELECTORS.columnsDropdownButton)
121511
- .click();
121512
- await expect(this.page.getByTestId(COMMON_SELECTORS.columnsSearchInput)).toBeVisible();
121513
- }).toPass({ timeout: 15_000 });
121514
- if (isPresent(bulkAction)) {
121515
- await this.page
121516
- .getByTestId(COMMON_SELECTORS.columnVisibilityBtn(bulkAction === "hide" ? "hide-all" : "reset"))
121517
- .click();
121518
- }
121519
- else {
121520
- for (const column of columns) {
121521
- await this.page
121522
- .getByTestId(COMMON_SELECTORS.columnsSearchInput)
121523
- .fill(column);
121524
- const columnCheckbox = this.page
121525
- .getByTestId(COMMON_SELECTORS.nuiCheckboxContainer)
121526
- .filter({ hasText: column })
121527
- .getByTestId(MEMBER_SELECTORS.columnCheckBox);
121528
- const isChecked = await columnCheckbox.isChecked();
121529
- await columnCheckbox.click();
121530
- await expect(columnCheckbox).toBeChecked({ checked: !isChecked });
121531
- }
121532
- }
121533
- await this.page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
121534
- };
121535
- verifyMemberInTable = ({ name, email }) => expect(this.getMemberRowByName(name).getByRole("cell", {
121536
- name: email,
121537
- exact: true,
121538
- })).toBeVisible();
121539
- applyFilter = async () => {
121540
- await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
121541
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121542
- await expect(this.page.locator(COMMON_SELECTORS.tableSpinner)).toBeHidden({
121543
- timeout: 30_000,
121544
- });
121545
- await this.page
121546
- .getByTestId(NEETO_FILTERS_SELECTORS.filterDoneButton)
121547
- .click();
121548
- };
121549
- exportDetails = async (fileType, adminEmail) => {
121550
- await this.page.getByTestId(MEMBER_SELECTORS.downloadButton).click();
121551
- await expect(this.page.getByTestId(MEMBER_SELECTORS.exportMemberHeading)).toHaveText(this.t("neetoTeamMembers.exportPane.title"));
121552
- await this.page
121553
- .getByTestId(MEMBER_SELECTORS.downloadAsRadioItem(fileType))
121554
- .check();
121555
- const exportStartTime = new Date();
121556
- await this.page.getByTestId(MEMBER_SELECTORS.exportSubmitBtn).click();
121557
- await this.neetoPlaywrightUtilities.verifyToast({
121558
- message: this.t("toastr.success.exportMembers", { email: adminEmail }),
121559
- });
121560
- return exportStartTime;
121561
- };
121562
- verifyNoDataTitle = async (email) => {
121563
- await this.neetoPlaywrightUtilities.waitForPageLoad();
121564
- await this.page.getByTestId(MEMBER_SELECTORS.searchTextField).fill(email);
121565
- await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.neetoFiltersBarClearButton)).toBeVisible();
121566
- await expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible({ timeout: 10_000 });
121567
- await filterUtils.clearFiltersFromActionBlock(this.page);
121568
- };
121569
- }
121570
-
121571
121603
  dayjs.extend(customParseFormat);
121572
121604
  class ApiKeysPage {
121573
121605
  page;
@@ -121670,7 +121702,7 @@ class AuditLogsPage {
121670
121702
  this.currentDate = dayjs().tz("Asia/Kolkata").format("MMM D, YYYY");
121671
121703
  this.messageBuilders = {
121672
121704
  [ACTIONS.inviteUsers]: (data) => `${this.admin} added ${data.emails.join(", ").toLowerCase()} to Neeto${this.product}.`,
121673
- [ACTIONS.updatedUser]: (data) => `${this.admin} changed ${data.emails[0].toLowerCase()}'s email from ${data.emails[0].toLowerCase()} to ${data.emails[1]} on Neeto${this.product}.`,
121705
+ [ACTIONS.updatedUser]: (data) => `${this.admin} changed ${data.emails[0].toLowerCase()}'s email from ${data.emails[0].toLowerCase()} to ${data.emails[1].toLowerCase()} on Neeto${this.product}.`,
121674
121706
  [ACTIONS.removedUser]: (data) => `${this.admin} removed ${data.emails[0].toLowerCase()} from Neeto${this.product}.`,
121675
121707
  [ACTIONS.createdRole]: (data) => `${this.admin} created ${data.roleName} role on Neeto${this.product}.`,
121676
121708
  [ACTIONS.addedPermission]: (data) => `${this.admin} added ${data.permissions.join(", ").toLowerCase()} permission to ${data.roleName} role on Neeto${this.product}.`,