mirror of
https://github.com/open-metadata/OpenMetadata
synced 2026-05-24 09:39:11 +00:00
fix incident manager breadcrumb via different routes (#24653)
* fix incident manager breadcrumb via different routes * added playwright test
This commit is contained in:
parent
35e777bad4
commit
e3074afa32
4 changed files with 92 additions and 28 deletions
|
|
@ -33,7 +33,11 @@ import {
|
|||
import { getCurrentMillis } from '../../utils/dateTime';
|
||||
import { visitEntityPage } from '../../utils/entity';
|
||||
import { sidebarClick } from '../../utils/sidebar';
|
||||
import { deleteTestCase, visitDataQualityTab } from '../../utils/testCases';
|
||||
import {
|
||||
deleteTestCase,
|
||||
verifyIncidentBreadcrumbsFromTablePageRedirect,
|
||||
visitDataQualityTab,
|
||||
} from '../../utils/testCases';
|
||||
import { test } from '../fixtures/pages';
|
||||
|
||||
const table1 = new TableClass();
|
||||
|
|
@ -269,6 +273,17 @@ test('Table test case', PLAYWRIGHT_INGESTION_TAG_OBJ, async ({ page }) => {
|
|||
await page.getByRole('button', { name: 'Cancel' }).click();
|
||||
});
|
||||
|
||||
await test.step(
|
||||
'Redirect to IncidentPage and verify breadcrumb',
|
||||
async () => {
|
||||
await verifyIncidentBreadcrumbsFromTablePageRedirect(
|
||||
page,
|
||||
table1,
|
||||
NEW_TABLE_TEST_CASE.name
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
await test.step('Delete', async () => {
|
||||
await deleteTestCase(page, NEW_TABLE_TEST_CASE.name);
|
||||
});
|
||||
|
|
@ -429,6 +444,17 @@ test('Column test case', PLAYWRIGHT_INGESTION_TAG_OBJ, async ({ page }) => {
|
|||
await page.locator('button').getByText('Cancel').click();
|
||||
});
|
||||
|
||||
await test.step(
|
||||
'Redirect to IncidentPage and verify breadcrumb',
|
||||
async () => {
|
||||
await verifyIncidentBreadcrumbsFromTablePageRedirect(
|
||||
page,
|
||||
table1,
|
||||
NEW_COLUMN_TEST_CASE.name
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
await test.step('Delete', async () => {
|
||||
await deleteTestCase(page, NEW_COLUMN_TEST_CASE.name);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,3 +39,40 @@ export const visitDataQualityTab = async (page: Page, table: TableClass) => {
|
|||
await page.getByRole('tab', { name: 'Data Quality' }).click();
|
||||
await testCaseResponse;
|
||||
};
|
||||
|
||||
export const verifyIncidentBreadcrumbsFromTablePageRedirect = async (
|
||||
page: Page,
|
||||
table: TableClass,
|
||||
testCaseName: string
|
||||
) => {
|
||||
await page
|
||||
.getByRole('link', {
|
||||
name: testCaseName,
|
||||
})
|
||||
.click();
|
||||
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
|
||||
await expect(page.getByTestId('breadcrumb-link').nth(0)).toHaveText(
|
||||
`${table.entityResponseData.service.displayName}/`
|
||||
);
|
||||
await expect(page.getByTestId('breadcrumb-link').nth(1)).toHaveText(
|
||||
`${table.entityResponseData?.['database'].displayName}/`
|
||||
);
|
||||
await expect(page.getByTestId('breadcrumb-link').nth(2)).toHaveText(
|
||||
`${table.entityResponseData?.['databaseSchema'].displayName}/`
|
||||
);
|
||||
await expect(page.getByTestId('breadcrumb-link').nth(3)).toHaveText(
|
||||
`${table.entityResponseData?.displayName}/`
|
||||
);
|
||||
|
||||
await page.getByTestId('breadcrumb-link').nth(3).click();
|
||||
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -269,7 +269,6 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
|
|||
pathname: getTestCaseDetailPagePath(
|
||||
record.fullyQualifiedName ?? ''
|
||||
),
|
||||
state: { breadcrumbData },
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -277,7 +276,9 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
|
|||
className="m-0"
|
||||
data-testid={name}
|
||||
style={{ maxWidth: 280 }}>
|
||||
<Link to={urlData}>{getEntityName(record)}</Link>
|
||||
<Link state={{ breadcrumbData }} to={urlData}>
|
||||
{getEntityName(record)}
|
||||
</Link>
|
||||
</Typography.Paragraph>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ const IncidentManagerDetailPage = ({
|
|||
const breadcrumb = useMemo(() => {
|
||||
const data: TitleBreadcrumbProps['titleLinks'] = location.state
|
||||
?.breadcrumbData
|
||||
? location.state.breadcrumbData
|
||||
? [...location.state.breadcrumbData]
|
||||
: [
|
||||
{
|
||||
name: t('label.incident-manager'),
|
||||
|
|
@ -221,33 +221,33 @@ const IncidentManagerDetailPage = ({
|
|||
];
|
||||
|
||||
if (isDimensionPage) {
|
||||
data.push(
|
||||
...[
|
||||
{
|
||||
name: testCase?.name ?? '',
|
||||
url: getTestCaseDetailPagePath(
|
||||
testCaseFQN,
|
||||
activeTab as TestCasePageTabs
|
||||
),
|
||||
activeTitle: false,
|
||||
},
|
||||
{
|
||||
name: dimensionKey || '',
|
||||
url: '',
|
||||
activeTitle: true,
|
||||
},
|
||||
]
|
||||
);
|
||||
} else {
|
||||
data.push({
|
||||
return [
|
||||
...data,
|
||||
{
|
||||
name: testCase?.name ?? '',
|
||||
url: getTestCaseDetailPagePath(
|
||||
testCaseFQN,
|
||||
activeTab as TestCasePageTabs
|
||||
),
|
||||
activeTitle: false,
|
||||
},
|
||||
{
|
||||
name: dimensionKey || '',
|
||||
url: '',
|
||||
activeTitle: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
...data,
|
||||
{
|
||||
name: testCase?.name ?? '',
|
||||
url: '',
|
||||
activeTitle: true,
|
||||
});
|
||||
}
|
||||
|
||||
return data;
|
||||
}, [testCase, location, isDimensionPage, dimensionKey]);
|
||||
},
|
||||
];
|
||||
}, [testCase, location.state, isDimensionPage, dimensionKey]);
|
||||
|
||||
const handleTabChange = (activeKey: string) => {
|
||||
if (activeKey !== activeTab) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue