mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-24 08:58:06 +00:00
MINOR: fix the wrong team count displayed on team tab (#19368)
* fix the wrong team count displayed on team tab * added playwright test for checking counts
This commit is contained in:
parent
69342d4783
commit
58f95e9e98
@ -34,6 +34,7 @@ import { settingClick } from '../../utils/sidebar';
|
|||||||
import {
|
import {
|
||||||
addTeamOwnerToEntity,
|
addTeamOwnerToEntity,
|
||||||
addUserInTeam,
|
addUserInTeam,
|
||||||
|
checkTeamTabCount,
|
||||||
createTeam,
|
createTeam,
|
||||||
hardDeleteTeam,
|
hardDeleteTeam,
|
||||||
searchTeam,
|
searchTeam,
|
||||||
@ -114,6 +115,8 @@ test.describe('Teams Page', () => {
|
|||||||
test('Teams Page Flow', async ({ page }) => {
|
test('Teams Page Flow', async ({ page }) => {
|
||||||
await test.step('Create a new team', async () => {
|
await test.step('Create a new team', async () => {
|
||||||
await settingClick(page, GlobalSettingOptions.TEAMS);
|
await settingClick(page, GlobalSettingOptions.TEAMS);
|
||||||
|
|
||||||
|
await checkTeamTabCount(page);
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="add-team"]');
|
await page.waitForSelector('[data-testid="add-team"]');
|
||||||
|
@ -349,3 +349,17 @@ export const addUserInTeam = async (page: Page, user: UserClass) => {
|
|||||||
page.locator(`[data-testid="${userName.toLowerCase()}"]`)
|
page.locator(`[data-testid="${userName.toLowerCase()}"]`)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const checkTeamTabCount = async (page: Page) => {
|
||||||
|
const fetchResponse = page.waitForResponse(
|
||||||
|
'/api/v1/teams/name/*?fields=*childrenCount*include=all'
|
||||||
|
);
|
||||||
|
const response = await fetchResponse;
|
||||||
|
const jsonRes = await response.json();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[data-testid="teams"] [data-testid="count"] [data-testid="filter-count"]'
|
||||||
|
)
|
||||||
|
).toContainText(jsonRes.childrenCount.toString());
|
||||||
|
};
|
||||||
|
@ -210,11 +210,8 @@ const TeamDetailsV1 = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const teamCount = useMemo(
|
const teamCount = useMemo(
|
||||||
() =>
|
() => currentTeam.childrenCount ?? childTeamList.length,
|
||||||
isOrganization && currentTeam && currentTeam.childrenCount
|
[childTeamList, currentTeam.childrenCount]
|
||||||
? currentTeam.childrenCount + 1
|
|
||||||
: childTeamList.length,
|
|
||||||
[childTeamList, isOrganization, currentTeam.childrenCount]
|
|
||||||
);
|
);
|
||||||
const updateActiveTab = (key: string) => {
|
const updateActiveTab = (key: string) => {
|
||||||
history.push({ search: Qs.stringify({ activeTab: key }) });
|
history.push({ search: Qs.stringify({ activeTab: key }) });
|
||||||
|
@ -288,8 +288,8 @@ const TeamsPage = () => {
|
|||||||
|
|
||||||
const res = await createTeam(teamData);
|
const res = await createTeam(teamData);
|
||||||
if (res) {
|
if (res) {
|
||||||
fetchTeamBasicDetails(selectedTeam.name, true);
|
|
||||||
handleAddTeam(false);
|
handleAddTeam(false);
|
||||||
|
await fetchTeamBasicDetails(selectedTeam.name, true);
|
||||||
loadAdvancedDetails();
|
loadAdvancedDetails();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user