mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 09:55:52 +00:00
fix playwright tests for search and owners (#17816)
* fix playwright tests * fix tests * fix minor tests
This commit is contained in:
parent
3f582e3063
commit
67820a2aa7
@ -14,6 +14,7 @@ import test from '@playwright/test';
|
||||
import { SidebarItem } from '../../constant/sidebar';
|
||||
import { TableClass } from '../../support/entity/TableClass';
|
||||
import { TopicClass } from '../../support/entity/TopicClass';
|
||||
import { TagClass } from '../../support/tag/TagClass';
|
||||
import { UserClass } from '../../support/user/UserClass';
|
||||
import {
|
||||
FIELDS,
|
||||
@ -35,6 +36,8 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
|
||||
const table2 = new TableClass();
|
||||
const topic1 = new TopicClass();
|
||||
const topic2 = new TopicClass();
|
||||
const tierTag1 = new TagClass({ classification: 'Tier' });
|
||||
const tierTag2 = new TagClass({ classification: 'Tier' });
|
||||
|
||||
let searchCriteria = {};
|
||||
|
||||
@ -49,6 +52,8 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
|
||||
table2.create(apiContext),
|
||||
topic1.create(apiContext),
|
||||
topic2.create(apiContext),
|
||||
tierTag1.create(apiContext),
|
||||
tierTag2.create(apiContext),
|
||||
]);
|
||||
|
||||
// Add Owner & Tag to the table
|
||||
@ -76,17 +81,20 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
|
||||
|
||||
// Add Tier To the topic 1
|
||||
await topic1.visitEntityPage(page);
|
||||
await assignTier(page, 'Tier1', topic1.endpoint);
|
||||
await assignTier(page, tierTag1.data.displayName, topic1.endpoint);
|
||||
|
||||
// Add Tier To the topic 2
|
||||
await topic2.visitEntityPage(page);
|
||||
await assignTier(page, 'Tier2', topic2.endpoint);
|
||||
await assignTier(page, tierTag2.data.displayName, topic2.endpoint);
|
||||
|
||||
// Update Search Criteria here
|
||||
searchCriteria = {
|
||||
'owners.displayName.keyword': [user1.getUserName(), user2.getUserName()],
|
||||
'tags.tagFQN': ['PersonalData.Personal', 'PII.None'],
|
||||
'tier.tagFQN': ['Tier.Tier1', 'Tier.Tier2'],
|
||||
'tier.tagFQN': [
|
||||
tierTag1.responseData.fullyQualifiedName,
|
||||
tierTag2.responseData.fullyQualifiedName,
|
||||
],
|
||||
'service.displayName.keyword': [table1.service.name, table2.service.name],
|
||||
'database.displayName.keyword': [
|
||||
table1.database.name,
|
||||
@ -111,6 +119,8 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
|
||||
table2.delete(apiContext),
|
||||
topic1.delete(apiContext),
|
||||
topic2.delete(apiContext),
|
||||
tierTag1.delete(apiContext),
|
||||
tierTag2.delete(apiContext),
|
||||
]);
|
||||
await afterAction();
|
||||
});
|
||||
|
@ -499,9 +499,7 @@ export const approveGlossaryTermTask = async (
|
||||
await taskResolve;
|
||||
|
||||
// Display toast notification
|
||||
await expect(page.locator('.Toastify__toast-body')).toHaveText(
|
||||
/Task resolved successfully/
|
||||
);
|
||||
await toastNotification(page, /Task resolved successfully/);
|
||||
};
|
||||
|
||||
export const validateGlossaryTerm = async (
|
||||
|
@ -52,6 +52,7 @@ const TierCard = ({
|
||||
try {
|
||||
const { data } = await getTags({
|
||||
parent: 'Tier',
|
||||
limit: 50,
|
||||
});
|
||||
|
||||
if (data) {
|
||||
@ -131,7 +132,7 @@ const TierCard = ({
|
||||
<Radio.Group value={currentTier} onChange={handleTierSelection}>
|
||||
<Collapse
|
||||
accordion
|
||||
className="bg-white border-none"
|
||||
className="bg-white border-none tier-card-content"
|
||||
collapsible="icon"
|
||||
defaultActiveKey={currentTier}
|
||||
expandIconPosition="end">
|
||||
|
@ -73,3 +73,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tier-card-content {
|
||||
max-height: 460px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ export const UserTeamSelectableList = ({
|
||||
const [popupVisible, setPopupVisible] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState<'teams' | 'users'>('teams');
|
||||
const [count, setCount] = useState({ team: 0, user: 0 });
|
||||
|
||||
const [selectedUsers, setSelectedUsers] = useState<EntityReference[]>([]);
|
||||
|
||||
const ownerType = useMemo(() => {
|
||||
@ -89,16 +90,6 @@ export const UserTeamSelectableList = ({
|
||||
};
|
||||
}, [selectedUsers]);
|
||||
|
||||
const reset = () => {
|
||||
let selectedUsers: EntityReference[] = [];
|
||||
if (isArray(owner)) {
|
||||
selectedUsers = owner;
|
||||
} else if (owner) {
|
||||
selectedUsers = [owner];
|
||||
}
|
||||
setSelectedUsers(selectedUsers);
|
||||
};
|
||||
|
||||
const fetchUserOptions = async (searchText: string, after?: string) => {
|
||||
if (searchText) {
|
||||
try {
|
||||
@ -216,7 +207,6 @@ export const UserTeamSelectableList = ({
|
||||
|
||||
const init = async () => {
|
||||
if (popupVisible || popoverProps?.open) {
|
||||
reset();
|
||||
if (ownerType === EntityType.USER) {
|
||||
await getTeamCount();
|
||||
setActiveTab('users');
|
||||
@ -256,6 +246,11 @@ export const UserTeamSelectableList = ({
|
||||
setSelectedUsers(selectedItems);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const activeOwners = isArray(owner) ? owner : owner ? [owner] : [];
|
||||
setSelectedUsers(activeOwners);
|
||||
}, [owner]);
|
||||
|
||||
useEffect(() => {
|
||||
init();
|
||||
}, [popupVisible]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user