mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-03 06:03:12 +00:00
fix query encoding for team asset query (#18480)
(cherry picked from commit 854c3d6cca6e3273c3f627ae1f4b666df5e3fe46)
This commit is contained in:
parent
61713892e9
commit
fc924f00da
@ -13,6 +13,7 @@
|
|||||||
import test, { expect } from '@playwright/test';
|
import test, { expect } from '@playwright/test';
|
||||||
import { GlobalSettingOptions } from '../../constant/settings';
|
import { GlobalSettingOptions } from '../../constant/settings';
|
||||||
import { EntityTypeEndpoint } from '../../support/entity/Entity.interface';
|
import { EntityTypeEndpoint } from '../../support/entity/Entity.interface';
|
||||||
|
import { TableClass } from '../../support/entity/TableClass';
|
||||||
import { TeamClass } from '../../support/team/TeamClass';
|
import { TeamClass } from '../../support/team/TeamClass';
|
||||||
import { UserClass } from '../../support/user/UserClass';
|
import { UserClass } from '../../support/user/UserClass';
|
||||||
import {
|
import {
|
||||||
@ -26,10 +27,12 @@ import {
|
|||||||
import { addMultiOwner } from '../../utils/entity';
|
import { addMultiOwner } from '../../utils/entity';
|
||||||
import { settingClick } from '../../utils/sidebar';
|
import { settingClick } from '../../utils/sidebar';
|
||||||
import {
|
import {
|
||||||
|
addTeamOwnerToEntity,
|
||||||
createTeam,
|
createTeam,
|
||||||
hardDeleteTeam,
|
hardDeleteTeam,
|
||||||
searchTeam,
|
searchTeam,
|
||||||
softDeleteTeam,
|
softDeleteTeam,
|
||||||
|
verifyAssetsInTeamsPage,
|
||||||
} from '../../utils/team';
|
} from '../../utils/team';
|
||||||
|
|
||||||
// use the admin user to login
|
// use the admin user to login
|
||||||
@ -490,4 +493,70 @@ test.describe('Teams Page', () => {
|
|||||||
await team.delete(apiContext);
|
await team.delete(apiContext);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Team assets should', async ({ page }) => {
|
||||||
|
const { apiContext, afterAction } = await getApiContext(page);
|
||||||
|
const id = uuid();
|
||||||
|
|
||||||
|
const table1 = new TableClass();
|
||||||
|
const table2 = new TableClass();
|
||||||
|
const table3 = new TableClass();
|
||||||
|
const table4 = new TableClass();
|
||||||
|
|
||||||
|
const team1 = new TeamClass({
|
||||||
|
name: `pw%percent-${id}`,
|
||||||
|
displayName: `pw team percent ${id}`,
|
||||||
|
description: 'playwright team with percent description',
|
||||||
|
teamType: 'Group',
|
||||||
|
});
|
||||||
|
const team2 = new TeamClass({
|
||||||
|
name: `pw&-${id}`,
|
||||||
|
displayName: `pw team ampersand ${id}`,
|
||||||
|
description: 'playwright team with ampersand description',
|
||||||
|
teamType: 'Group',
|
||||||
|
});
|
||||||
|
const team3 = new TeamClass({
|
||||||
|
name: `pw.team.dot-${id}`,
|
||||||
|
displayName: `pw.team.dot ${id}`,
|
||||||
|
description: 'playwright team with dot description',
|
||||||
|
teamType: 'Group',
|
||||||
|
});
|
||||||
|
const team4 = new TeamClass({
|
||||||
|
name: `pw team space-${id}`,
|
||||||
|
displayName: `pw team space ${id}`,
|
||||||
|
description: 'playwright team with space description',
|
||||||
|
teamType: 'Group',
|
||||||
|
});
|
||||||
|
|
||||||
|
await table1.create(apiContext);
|
||||||
|
await table2.create(apiContext);
|
||||||
|
await table3.create(apiContext);
|
||||||
|
await table4.create(apiContext);
|
||||||
|
await team1.create(apiContext);
|
||||||
|
await team2.create(apiContext);
|
||||||
|
await team3.create(apiContext);
|
||||||
|
await team4.create(apiContext);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await addTeamOwnerToEntity(page, table1, team1);
|
||||||
|
await addTeamOwnerToEntity(page, table2, team2);
|
||||||
|
await addTeamOwnerToEntity(page, table3, team3);
|
||||||
|
await addTeamOwnerToEntity(page, table4, team4);
|
||||||
|
|
||||||
|
await verifyAssetsInTeamsPage(page, table1, team1, 1);
|
||||||
|
await verifyAssetsInTeamsPage(page, table2, team2, 1);
|
||||||
|
await verifyAssetsInTeamsPage(page, table3, team3, 1);
|
||||||
|
await verifyAssetsInTeamsPage(page, table4, team4, 1);
|
||||||
|
} finally {
|
||||||
|
await table1.delete(apiContext);
|
||||||
|
await table2.delete(apiContext);
|
||||||
|
await table3.delete(apiContext);
|
||||||
|
await table4.delete(apiContext);
|
||||||
|
await team1.delete(apiContext);
|
||||||
|
await team2.delete(apiContext);
|
||||||
|
await team3.delete(apiContext);
|
||||||
|
await team4.delete(apiContext);
|
||||||
|
await afterAction();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { APIRequestContext, expect, Page } from '@playwright/test';
|
import { APIRequestContext, expect, Page } from '@playwright/test';
|
||||||
|
import { TableClass } from '../support/entity/TableClass';
|
||||||
|
import { TeamClass } from '../support/team/TeamClass';
|
||||||
import { descriptionBox, toastNotification, uuid } from './common';
|
import { descriptionBox, toastNotification, uuid } from './common';
|
||||||
|
import { addOwner } from './entity';
|
||||||
import { validateFormNameFieldInput } from './form';
|
import { validateFormNameFieldInput } from './form';
|
||||||
|
|
||||||
const TEAM_TYPES = ['Department', 'Division', 'Group'];
|
const TEAM_TYPES = ['Department', 'Division', 'Group'];
|
||||||
@ -259,3 +262,49 @@ export const searchTeam = async (page: Page, teamName: string) => {
|
|||||||
|
|
||||||
await expect(page.locator('table')).toContainText(teamName);
|
await expect(page.locator('table')).toContainText(teamName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addTeamOwnerToEntity = async (
|
||||||
|
page: Page,
|
||||||
|
table: TableClass,
|
||||||
|
team: TeamClass
|
||||||
|
) => {
|
||||||
|
await table.visitEntityPage(page);
|
||||||
|
await addOwner({
|
||||||
|
page,
|
||||||
|
owner: team.data.displayName,
|
||||||
|
type: 'Teams',
|
||||||
|
endpoint: table.endpoint,
|
||||||
|
dataTestId: 'data-assets-header',
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const verifyAssetsInTeamsPage = async (
|
||||||
|
page: Page,
|
||||||
|
table: TableClass,
|
||||||
|
team: TeamClass,
|
||||||
|
assetCount: number
|
||||||
|
) => {
|
||||||
|
const fullyQualifiedName = table.entityResponseData?.['fullyQualifiedName'];
|
||||||
|
await table.visitEntityPage(page);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByTestId('data-assets-header').getByTestId('owner-link')
|
||||||
|
).toContainText(team.data.displayName);
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByTestId('data-assets-header')
|
||||||
|
.locator(`a:has-text("${team.data.displayName}")`)
|
||||||
|
.click();
|
||||||
|
|
||||||
|
const res = page.waitForResponse('/api/v1/search/query?*size=15');
|
||||||
|
await page.getByTestId('assets').click();
|
||||||
|
await res;
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.locator(`[data-testid="table-data-card_${fullyQualifiedName}"]`)
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByTestId('assets').getByTestId('filter-count')
|
||||||
|
).toContainText(assetCount.toString());
|
||||||
|
};
|
||||||
|
@ -206,8 +206,8 @@ const AssetsTabs = forwardRef(
|
|||||||
return `(dataProducts.fullyQualifiedName:"${encodedFqn}")`;
|
return `(dataProducts.fullyQualifiedName:"${encodedFqn}")`;
|
||||||
|
|
||||||
case AssetsOfEntity.TEAM:
|
case AssetsOfEntity.TEAM:
|
||||||
return `(owners.fullyQualifiedName:"${escapeESReservedCharacters(
|
return `(owners.fullyQualifiedName:"${getEncodedFqn(
|
||||||
fqn
|
escapeESReservedCharacters(fqn)
|
||||||
)}")`;
|
)}")`;
|
||||||
|
|
||||||
case AssetsOfEntity.MY_DATA:
|
case AssetsOfEntity.MY_DATA:
|
||||||
|
@ -109,7 +109,9 @@ export const OwnerLabel = ({
|
|||||||
key={owner.id}
|
key={owner.id}
|
||||||
to={
|
to={
|
||||||
owner.type === OwnerType.TEAM
|
owner.type === OwnerType.TEAM
|
||||||
? getTeamAndUserDetailsPath(owner.name ?? '')
|
? getTeamAndUserDetailsPath(
|
||||||
|
owner.fullyQualifiedName ?? ''
|
||||||
|
)
|
||||||
: getUserPath(owner.name ?? '')
|
: getUserPath(owner.name ?? '')
|
||||||
}>
|
}>
|
||||||
{ownerDisplayName?.[index] ?? displayName}
|
{ownerDisplayName?.[index] ?? displayName}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user