Skip to content

Commit 1419ab6

Browse files
fix lineageFilters.spec.ts
1 parent b166405 commit 1419ab6

2 files changed

Lines changed: 35 additions & 22 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Lineage/LineageFilters.spec.ts

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { WorksheetClass } from '../../../support/entity/WorksheetClass';
3131
import {
3232
getApiContext,
3333
getDefaultAdminAPIContext,
34-
getEntityTypeSearchIndexMapping,
34+
getEntityTypeMapping,
3535
redirectToHomePage,
3636
} from '../../../utils/common';
3737
import { waitForAllLoadersToDisappear } from '../../../utils/entity';
@@ -99,11 +99,11 @@ test.describe('Lineage Filters', () => {
9999
apiContext,
100100
{
101101
id: lineageEntity.entityResponseData.id,
102-
type: getEntityTypeSearchIndexMapping(lineageEntity.type),
102+
type: getEntityTypeMapping(lineageEntity.type),
103103
},
104104
{
105105
id: depth1Entity.entityResponseData.id,
106-
type: getEntityTypeSearchIndexMapping(depth1Entity.type),
106+
type: getEntityTypeMapping(depth1Entity.type),
107107
}
108108
);
109109

@@ -112,11 +112,11 @@ test.describe('Lineage Filters', () => {
112112
apiContext,
113113
{
114114
id: depth1Entity.entityResponseData.id,
115-
type: getEntityTypeSearchIndexMapping(lineageEntity.type),
115+
type: getEntityTypeMapping(lineageEntity.type),
116116
},
117117
{
118118
id: entity.entityResponseData.id,
119-
type: getEntityTypeSearchIndexMapping(entity.type),
119+
type: getEntityTypeMapping(entity.type),
120120
}
121121
);
122122
}
@@ -309,14 +309,7 @@ test.describe('Lineage Filters', () => {
309309

310310
await test.step('Verify filters working for Impact Analysis tab', async () => {
311311
// Navigate to Impact Analysis
312-
const impactAnalysisTab = page.getByRole('tab', {
313-
name: 'Impact Analysis',
314-
});
315-
316-
await expect(impactAnalysisTab).toBeVisible();
317-
await impactAnalysisTab.scrollIntoViewIfNeeded();
318-
await impactAnalysisTab.click();
319-
await waitForAllLoadersToDisappear(page);
312+
await openImpactAnalysisTab(page);
320313

321314
await page.getByRole('button', { name: 'Filters' }).click();
322315
await page.getByTestId(`search-dropdown-${filterTestId}`).click();
@@ -728,11 +721,11 @@ test.describe('Lineage Filters', () => {
728721
apiContext,
729722
{
730723
id: lineageEntity.entityResponseData.id,
731-
type: getEntityTypeSearchIndexMapping(lineageEntity.type),
724+
type: getEntityTypeMapping(lineageEntity.type),
732725
},
733726
{
734727
id: depth1Entity.entityResponseData.id,
735-
type: getEntityTypeSearchIndexMapping(depth1Entity.type),
728+
type: getEntityTypeMapping(depth1Entity.type),
736729
},
737730
[
738731
{
@@ -940,7 +933,7 @@ test.describe('Lineage Filters', () => {
940933

941934
test.describe('Verify filters for Impact Analysis', () => {
942935
test.beforeEach('navigate to impact analysis', async ({ page }) => {
943-
await page.getByRole('tab', { name: 'Impact Analysis' }).click();
936+
await openImpactAnalysisTab(page);
944937
await waitForAllLoadersToDisappear(page);
945938
});
946939

@@ -955,7 +948,7 @@ test.describe('Lineage Filters', () => {
955948

956949
await depth1Entity.visitEntityPage(page);
957950
await visitLineageTab(page);
958-
await page.getByRole('tab', { name: 'Impact Analysis' }).click();
951+
await openImpactAnalysisTab(page);
959952
await waitForAllLoadersToDisappear(page);
960953

961954
await expect(
@@ -965,7 +958,7 @@ test.describe('Lineage Filters', () => {
965958
for (const entity of depth2ndEntities) {
966959
await entity.visitEntityPage(page);
967960
await visitLineageTab(page);
968-
await page.getByRole('tab', { name: 'Impact Analysis' }).click();
961+
await openImpactAnalysisTab(page);
969962
await waitForAllLoadersToDisappear(page);
970963

971964
await expect(
@@ -990,8 +983,7 @@ test.describe('Lineage Filters', () => {
990983

991984
await depth1Entity.visitEntityPage(page);
992985
await visitLineageTab(page);
993-
await page.getByRole('tab', { name: 'Impact Analysis' }).click();
994-
await waitForAllLoadersToDisappear(page);
986+
await openImpactAnalysisTab(page);
995987

996988
// Verify Dashboard is visible in Impact Analysis for Upstream
997989
await page.getByRole('button', { name: 'Upstream' }).click();
@@ -1004,9 +996,8 @@ test.describe('Lineage Filters', () => {
1004996
for (const entity of depth2ndEntities) {
1005997
await entity.visitEntityPage(page);
1006998
await visitLineageTab(page);
1007-
await page.getByRole('tab', { name: 'Impact Analysis' }).click();
999+
await openImpactAnalysisTab(page);
10081000

1009-
await waitForAllLoadersToDisappear(page);
10101001
// Verify Dashboard is visible in Impact Analysis for Upstream
10111002
await page.getByRole('button', { name: 'Upstream' }).click();
10121003
await waitForAllLoadersToDisappear(page);

openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,28 @@ export const getEntityTypeSearchIndexMapping = (entityType: string) => {
171171
return entityMapping[entityType as keyof typeof entityMapping];
172172
};
173173

174+
export const getEntityTypeMapping = (entityType: string) => {
175+
const entityMapping = {
176+
Table: 'table',
177+
Topic: 'topic',
178+
Dashboard: 'dashboard',
179+
Pipeline: 'pipeline',
180+
MlModel: 'mlmodel',
181+
Container: 'container',
182+
SearchIndex: 'searchIndex',
183+
ApiEndpoint: 'apiEndpoint',
184+
Metric: 'metric',
185+
['Store Procedure']: 'storedProcedure',
186+
Directory: 'directory',
187+
File: 'file',
188+
Spreadsheet: 'spreadsheet',
189+
Worksheet: 'worksheet',
190+
[DASHBOARD_DATA_MODEL]: 'dashboardDataModel',
191+
};
192+
193+
return entityMapping[entityType as keyof typeof entityMapping];
194+
};
195+
174196
export const toastNotification = async (
175197
page: Page,
176198
message: string | RegExp,

0 commit comments

Comments
 (0)