fix: Fixed the domain treeview playwright test (#24432)

* fix: Fixed domain treeview playwright test

* fix: fixed the activity feed redirection issue

* fix: fixed the domain version redirection bug

---------

Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
This commit is contained in:
Rohit Jain 2025-11-19 20:05:05 +05:30 committed by GitHub
parent 2fe0b4a74c
commit b4956d2298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 38 additions and 19 deletions

View File

@ -23,6 +23,7 @@ import {
EntityTypeEndpoint,
ENTITY_PATH,
} from '../../support/entity/Entity.interface';
import { EntityDataClass } from '../../support/entity/EntityDataClass';
import { TableClass } from '../../support/entity/TableClass';
import { Glossary } from '../../support/glossary/Glossary';
import { GlossaryTerm } from '../../support/glossary/GlossaryTerm';
@ -1453,14 +1454,14 @@ test.describe('Domain Access with noDomain() Rule', () => {
});
test.describe('Domain Tree View Functionality', () => {
const domain = new Domain();
let subDomain: SubDomain;
const domain = EntityDataClass.domain1;
const domainDisplayName = domain.responseData.displayName;
test.beforeAll('Setup pre-requests', async ({ browser }) => {
test.slow(true);
const { apiContext, afterAction } = await performAdminLogin(browser);
await domain.create(apiContext);
subDomain = new SubDomain(domain);
await subDomain.create(apiContext);
await afterAction();
@ -1471,7 +1472,6 @@ test.describe('Domain Tree View Functionality', () => {
const { apiContext, afterAction } = await performAdminLogin(browser);
await subDomain.delete(apiContext);
await domain.delete(apiContext);
await afterAction();
});
@ -1488,15 +1488,33 @@ test.describe('Domain Tree View Functionality', () => {
await page.waitForLoadState('networkidle');
await waitForAllLoadersToDisappear(page);
await page
.getByTestId('page-layout-v1')
.getByRole('textbox', { name: 'Search' })
.clear();
const searchDomain = page.waitForResponse(
`/api/v1/search/query?q=*${encodeURIComponent(domainDisplayName)}*`
);
await page
.getByTestId('page-layout-v1')
.getByRole('textbox', { name: 'Search' })
.fill(domainDisplayName);
await searchDomain;
await page.waitForLoadState('networkidle');
await waitForAllLoadersToDisappear(page);
await expect(
page
.getByRole('treeitem', { name: domain.data.displayName })
.getByRole('treeitem', {
name: domainDisplayName,
})
.locator('div')
.nth(2)
).toBeVisible();
await page
.getByRole('treeitem', { name: domain.data.displayName })
.getByRole('treeitem', { name: domainDisplayName })
.locator('div')
.nth(2)
.click();
@ -1510,14 +1528,14 @@ test.describe('Domain Tree View Functionality', () => {
await expect(
page
.getByRole('listitem')
.filter({ hasText: domain.data.fullyQualifiedName })
.filter({ hasText: domain.responseData.fullyQualifiedName })
.getByTestId('breadcrumb-link')
).toBeVisible();
await expect(page.getByTestId('entity-header-display-name')).toContainText(
domain.data.displayName
domainDisplayName
);
await expect(page.getByTestId('entity-header-name')).toContainText(
domain.data.name
domain.responseData.name
);
await expect(
page.getByTestId('documentation').getByText('Documentation')
@ -1538,19 +1556,10 @@ test.describe('Domain Tree View Functionality', () => {
await expect(
page
.getByTestId('asset-description-container')
.getByText(domain.data.description)
.getByText(domain.responseData.description)
).toBeVisible();
await expect(page.getByTestId('domain-details-add-button')).toBeVisible();
await page.getByTestId('data_products').getByText('Data Products').click();
await page.waitForLoadState('networkidle');
await waitForAllLoadersToDisappear(page);
await expect(
page.getByTestId('no-data-placeholder').getByRole('paragraph')
).toContainText("Looks like you haven't added any data products yet.");
await expect(page.getByTestId('data-product-add-button')).toBeVisible();
await expect(
page.getByTestId('subdomains').getByTestId('count')
).toContainText('1');

View File

@ -86,12 +86,14 @@ export const ActivityFeedTab = ({
subTab,
layoutType,
feedCount,
urlFqn = '',
}: ActivityFeedTabProps) => {
const navigate = useNavigate();
const { t } = useTranslation();
const { currentUser } = useApplicationStore();
const { isAdminUser } = useAuth();
const { fqn } = useFqn();
const { fqn: hookFqn } = useFqn();
const fqn = hookFqn || urlFqn || '';
const [elementRef, isInView] = useElementInView({
...observerOptions,
root: document.querySelector('#center-container'),

View File

@ -40,6 +40,7 @@ export interface ActivityFeedTabBasicProps {
subTab?: ActivityFeedTabs;
layoutType?: ActivityFeedLayoutType;
feedCount?: FeedCounts;
urlFqn?: string;
}
export type ActivityFeedTabProps = ActivityFeedTabBasicProps &

View File

@ -696,6 +696,12 @@ const DomainTreeView = ({
const handleNavigate = useCallback(
(path: string) => {
if (path.includes('/versions/')) {
navigate(path);
return;
}
const regex = /^\/domain\/([^/]+)(?:\/([^/]+))?/;
const match = regex.exec(path);
if (match) {

View File

@ -487,6 +487,7 @@ export const getDomainDetailTabs = ({
feedCount={feedCount}
layoutType={ActivityFeedLayoutType.THREE_PANEL}
owners={domain.owners}
urlFqn={domain.fullyQualifiedName}
onFeedUpdate={onFeedUpdate ?? noop}
onUpdateEntityDetails={noop}
/>