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