Skip to content

Commit b1e577e

Browse files
authored
Enable column layer when entering edit mode (#24853)
* Enable column layer on entering edit mode and disable on exiting * Add unit tests * Enable column layer while entering edit mode * Fix dependencies * Fix playwright test * Reset traced nodes and columns on exit * Add playwright tests * Fixed playwright tests
1 parent 8dc423b commit b1e577e

4 files changed

Lines changed: 318 additions & 12 deletions

File tree

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

Lines changed: 114 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { SearchIndexClass } from '../../support/entity/SearchIndexClass';
2323
import { TableClass } from '../../support/entity/TableClass';
2424
import { TopicClass } from '../../support/entity/TopicClass';
2525
import {
26+
clickOutside,
2627
createNewPage,
2728
getApiContext,
2829
redirectToHomePage,
@@ -33,6 +34,7 @@ import {
3334
addColumnLineage,
3435
addPipelineBetweenNodes,
3536
applyPipelineFromModal,
37+
clickLineageNode,
3638
connectEdgeBetweenNodes,
3739
connectEdgeBetweenNodesViaAPI,
3840
deleteEdge,
@@ -142,9 +144,8 @@ for (const EntityClass of entities) {
142144
entity,
143145
'entityResponseData.fullyQualifiedName'
144146
);
145-
await page
146-
.locator(`[data-testid="lineage-node-${toNodeFqn}"]`)
147-
.click();
147+
148+
await clickLineageNode(page, toNodeFqn);
148149

149150
await expect(
150151
page
@@ -169,9 +170,8 @@ for (const EntityClass of entities) {
169170
currentEntity,
170171
'entityResponseData.fullyQualifiedName'
171172
);
172-
await page
173-
.locator(`[data-testid="lineage-node-${fromNodeFqn}"]`)
174-
.click();
173+
174+
await clickLineageNode(page, fromNodeFqn);
175175

176176
for (const entity of entities) {
177177
await applyPipelineFromModal(page, currentEntity, entity, pipeline);
@@ -526,7 +526,7 @@ test('Verify table search with special characters as handled', async ({
526526

527527
await expect(page.locator('[data-testid="lineage-details"]')).toBeVisible();
528528

529-
await page.locator(`[data-testid="lineage-node-${dbFqn}"]`).click();
529+
await clickLineageNode(page, dbFqn);
530530
await page.waitForLoadState('networkidle');
531531

532532
await expect(
@@ -689,6 +689,110 @@ test('Verify cycle lineage should be handled properly', async ({ page }) => {
689689
}
690690
});
691691

692+
test('Verify column layer is applied on entering edit mode', async ({
693+
page,
694+
}) => {
695+
const { apiContext, afterAction } = await getApiContext(page);
696+
const table = new TableClass();
697+
698+
await table.create(apiContext);
699+
700+
try {
701+
await table.visitEntityPage(page);
702+
await visitLineageTab(page);
703+
704+
const columnLayerBtn = page.locator(
705+
'[data-testid="lineage-layer-column-btn"]'
706+
);
707+
708+
await test.step('Verify column layer is inactive initially', async () => {
709+
await page.click('[data-testid="lineage-layer-btn"]');
710+
711+
await expect(columnLayerBtn).not.toHaveClass(/Mui-selected/);
712+
713+
await clickOutside(page);
714+
});
715+
716+
await test.step(
717+
'Enter edit mode and verify column layer is active',
718+
async () => {
719+
await editLineageClick(page);
720+
721+
await page.click('[data-testid="lineage-layer-btn"]');
722+
723+
await expect(columnLayerBtn).toHaveClass(/Mui-selected/);
724+
725+
await clickOutside(page);
726+
}
727+
);
728+
} finally {
729+
await table.delete(apiContext);
730+
await afterAction();
731+
}
732+
});
733+
734+
test('Verify there is no traced nodes and columns on exiting edit mode', async ({
735+
page,
736+
}) => {
737+
const { apiContext, afterAction } = await getApiContext(page);
738+
const table = new TableClass();
739+
740+
await table.create(apiContext);
741+
742+
try {
743+
await table.visitEntityPage(page);
744+
await visitLineageTab(page);
745+
746+
const tableFqn = get(table, 'entityResponseData.fullyQualifiedName');
747+
const tableNode = page.locator(`[data-testid="lineage-node-${tableFqn}"]`);
748+
const firstColumnName = get(table, 'entityResponseData.columns[0].name');
749+
const firstColumn = page.locator(
750+
`[data-testid="column-${tableFqn}.${firstColumnName}"]`
751+
);
752+
753+
await test.step(
754+
'Verify node tracing is cleared on exiting edit mode',
755+
async () => {
756+
await editLineageClick(page);
757+
758+
await expect(tableNode).not.toHaveClass(/custom-node-header-active/);
759+
760+
await tableNode.click({ position: { x: 5, y: 5 } });
761+
762+
await expect(tableNode).toHaveClass(/custom-node-header-active/);
763+
764+
await editLineageClick(page);
765+
766+
await expect(tableNode).not.toHaveClass(/custom-node-header-active/);
767+
}
768+
);
769+
770+
await test.step(
771+
'Verify column tracing is cleared on exiting edit mode',
772+
async () => {
773+
await editLineageClick(page);
774+
775+
await firstColumn.click();
776+
777+
await expect(firstColumn).toHaveClass(
778+
/custom-node-header-column-tracing/
779+
);
780+
781+
await editLineageClick(page);
782+
783+
await toggleLineageFilters(page, tableFqn);
784+
785+
await expect(firstColumn).not.toHaveClass(
786+
/custom-node-header-column-tracing/
787+
);
788+
}
789+
);
790+
} finally {
791+
await table.delete(apiContext);
792+
await afterAction();
793+
}
794+
});
795+
692796
test.describe.serial('Test pagination in column level lineage', () => {
693797
const generateColumnsWithNames = (count: number) => {
694798
const columns = [];
@@ -731,7 +835,7 @@ test.describe.serial('Test pagination in column level lineage', () => {
731835

732836
await addPipelineBetweenNodes(page, table1, table2);
733837

734-
await activateColumnLayer(page);
838+
await rearrangeNodes(page);
735839

736840
await page.waitForSelector(
737841
`[data-testid="column-${table1Fqn}.${table1Columns[0].name}"]`,
@@ -1300,11 +1404,11 @@ test.describe.serial('Test pagination in column level lineage', () => {
13001404
});
13011405

13021406
test('Verify edges for column level lineage between 2 nodes when filter is toggled', async ({
1303-
browser,
1407+
page,
13041408
}) => {
13051409
test.slow();
13061410

1307-
const { page, afterAction } = await createNewPage(browser);
1411+
const { afterAction } = await getApiContext(page);
13081412

13091413
try {
13101414
await test.step('1. Load both the table', async () => {

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ export const verifyColumnLayerInactive = async (page: Page) => {
9090

9191
export const activateColumnLayer = async (page: Page) => {
9292
await page.click('[data-testid="lineage-layer-btn"]');
93+
94+
const isColumnLayerSelected = await page
95+
.locator('[data-testid="lineage-layer-column-btn"]')
96+
.evaluate((el) => el.classList.contains('Mui-selected'));
97+
98+
if (isColumnLayerSelected) {
99+
await clickOutside(page);
100+
return;
101+
}
102+
93103
await page.click('[data-testid="lineage-layer-column-btn"]');
94104
await clickOutside(page);
95105
};
@@ -812,3 +822,10 @@ export const toggleLineageFilters = async (page: Page, tableFqn: string) => {
812822
.getByTestId('lineage-filter-button')
813823
.click();
814824
};
825+
826+
export const clickLineageNode = async (page: Page, nodeFqn: string) => {
827+
await page
828+
.locator(`[data-testid="lineage-node-${nodeFqn}"]`)
829+
.locator(`[data-testid="entity-header-display-name"]`)
830+
.click();
831+
};

0 commit comments

Comments
 (0)