fix: flaky MM-T5521-8 (#35385)

This commit is contained in:
sabril
2026-02-24 11:36:00 +08:00
committed by GitHub
parent 8fd7aea63c
commit 4b8ff4e6a3
2 changed files with 42 additions and 12 deletions
@@ -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)
*/
@@ -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();