From 4b8ff4e6a3fd82364709d07bade18afbcbb79d87 Mon Sep 17 00:00:00 2001 From: sabril <5334504+saturninoabril@users.noreply.github.com> Date: Tue, 24 Feb 2026 11:36:00 +0800 Subject: [PATCH] fix: flaky MM-T5521-8 (#35385) --- .../sections/user_management/users/menus.ts | 39 +++++++++++++++++++ .../system_users/filter_popover.spec.ts | 15 ++----- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/e2e-tests/playwright/lib/src/ui/components/system_console/sections/user_management/users/menus.ts b/e2e-tests/playwright/lib/src/ui/components/system_console/sections/user_management/users/menus.ts index 424a22bd219..658a470b2df 100644 --- a/e2e-tests/playwright/lib/src/ui/components/system_console/sections/user_management/users/menus.ts +++ b/e2e-tests/playwright/lib/src/ui/components/system_console/sections/user_management/users/menus.ts @@ -50,6 +50,9 @@ export class ColumnToggleMenu { } } +type RoleFilter = 'Any' | 'System Admin' | 'Member' | 'Guest'; +type StatusFilter = 'Any' | 'Activated users' | 'Deactivated users'; + /** * Filter popover that appears when clicking the Filters button */ @@ -92,6 +95,22 @@ export class FilterPopover { await this.container.page().waitForTimeout(500); } + /** + * Select a team from the dropdown. For "All teams" and "No teams", opens the + * dropdown directly. For specific team names, searches first then selects. + */ + async filterByTeam(team: 'All teams' | 'No teams' | (string & {})) { + if (team === 'All teams' || team === 'No teams') { + await expect(this.teamMenuInput).toBeVisible(); + await this.teamMenuInput.click(); + } else { + await this.searchInTeamMenu(team); + } + const option = this.container.getByRole('option', {name: team}); + await option.waitFor(); + await option.click(); + } + /** * Open the role filter menu */ @@ -100,6 +119,16 @@ export class FilterPopover { await this.roleMenuButton.click(); } + /** + * Open the role filter menu and select a role option + */ + async filterByRole(role: RoleFilter) { + await this.openRoleMenu(); + const option = this.container.getByRole('option', {name: role}); + await option.waitFor(); + await option.click(); + } + /** * Open the status filter menu */ @@ -108,6 +137,16 @@ export class FilterPopover { await this.statusMenuButton.click(); } + /** + * Open the status filter menu and select a status option + */ + async filterByStatus(status: StatusFilter) { + await this.openStatusMenu(); + const option = this.container.getByRole('option', {name: status}); + await option.waitFor(); + await option.click(); + } + /** * Close the popover (if still open) */ diff --git a/e2e-tests/playwright/specs/functional/system_console/system_users/filter_popover.spec.ts b/e2e-tests/playwright/specs/functional/system_console/system_users/filter_popover.spec.ts index bc84c31b227..2ea663e00b0 100644 --- a/e2e-tests/playwright/specs/functional/system_console/system_users/filter_popover.spec.ts +++ b/e2e-tests/playwright/specs/functional/system_console/system_users/filter_popover.spec.ts @@ -35,8 +35,7 @@ test('MM-T5521-7 Should be able to filter users with team filter', async ({pw}) const filterPopover = await systemConsolePage.users.openFilterPopover(); // # Enter the team name of the first user and select it - await filterPopover.searchInTeamMenu(team1.display_name); - await filterPopover.teamMenuInput.press('Enter'); + await filterPopover.filterByTeam(team1.display_name); // # Save the filter and close the popover await filterPopover.save(); @@ -79,11 +78,7 @@ test('MM-T5521-8 Should be able to filter users with role filter', async ({pw}) const filterPopover = await systemConsolePage.users.openFilterPopover(); // # Open the role filter in the popover and select Guest - await filterPopover.openRoleMenu(); - // Wait for dropdown options and click on Guest - const guestOption = systemConsolePage.page.getByText('Guest', {exact: true}); - await guestOption.waitFor(); - await guestOption.click(); + await filterPopover.filterByRole('Guest'); // # Save the filter and close the popover await filterPopover.save(); @@ -132,11 +127,7 @@ test('MM-T5521-9 Should be able to filter users with status filter', async ({pw} const filterPopover = await systemConsolePage.users.openFilterPopover(); // # Open the status filter in the popover and select Deactivated users - await filterPopover.openStatusMenu(); - // Wait for dropdown options and click on Deactivated users - const deactivatedOption = systemConsolePage.page.getByText('Deactivated users', {exact: true}); - await deactivatedOption.waitFor(); - await deactivatedOption.click(); + await filterPopover.filterByStatus('Deactivated users'); // # Save the filter and close the popover await filterPopover.save();