Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix playwright tests for search and owners #17816

Merged
merged 5 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {};

Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const TierCard = ({
try {
const { data } = await getTags({
parent: 'Tier',
limit: 50,
});

if (data) {
Expand Down Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@
}
}
}

.tier-card-content {
max-height: 460px;
overflow-y: auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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 {
Expand Down Expand Up @@ -216,7 +207,6 @@ export const UserTeamSelectableList = ({

const init = async () => {
if (popupVisible || popoverProps?.open) {
reset();
if (ownerType === EntityType.USER) {
await getTeamCount();
setActiveTab('users');
Expand Down Expand Up @@ -256,6 +246,11 @@ export const UserTeamSelectableList = ({
setSelectedUsers(selectedItems);
};

useEffect(() => {
const activeOwners = isArray(owner) ? owner : owner ? [owner] : [];
setSelectedUsers(activeOwners);
}, [owner]);

useEffect(() => {
init();
}, [popupVisible]);
Expand Down
Loading