fix playwright tests for search and owners (#17816)

* fix playwright tests

* fix tests

* fix minor tests
This commit is contained in:
Karan Hotchandani 2024-09-13 01:46:05 +05:30 committed by GitHub
parent 3f582e3063
commit 67820a2aa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 18 deletions

View File

@ -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();
});

View File

@ -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 (

View File

@ -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">

View File

@ -73,3 +73,8 @@
}
}
}
.tier-card-content {
max-height: 460px;
overflow-y: auto;
}

View File

@ -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]);