mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-08 00:58:06 +00:00
fix(test): ExploreTree.spec (#22606)
* fix explore tree tests * fix test --------- Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com>
This commit is contained in:
parent
e35dc186b0
commit
da728687a3
@ -51,7 +51,7 @@ test.beforeEach(async ({ page }) => {
|
|||||||
await sidebarClick(page, SidebarItem.EXPLORE);
|
await sidebarClick(page, SidebarItem.EXPLORE);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Explore Tree scenarios ', () => {
|
test.describe('Explore Tree scenarios', () => {
|
||||||
test('Explore Tree', async ({ page }) => {
|
test('Explore Tree', async ({ page }) => {
|
||||||
await test.step('Check the explore tree', async () => {
|
await test.step('Check the explore tree', async () => {
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
@ -60,15 +60,30 @@ test.describe('Explore Tree scenarios ', () => {
|
|||||||
state: 'detached',
|
state: 'detached',
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(page.getByRole('tree')).toContainText('Databases');
|
await expect(
|
||||||
await expect(page.getByRole('tree')).toContainText('Dashboards');
|
page.getByTestId('explore-tree-title-Databases')
|
||||||
await expect(page.getByRole('tree')).toContainText('Pipelines');
|
).toContainText('Databases');
|
||||||
await expect(page.getByRole('tree')).toContainText('Topics');
|
await expect(
|
||||||
await expect(page.getByRole('tree')).toContainText('ML Models');
|
page.getByTestId('explore-tree-title-Dashboards')
|
||||||
await expect(page.getByRole('tree')).toContainText('Containers');
|
).toContainText('Dashboards');
|
||||||
await expect(page.getByRole('tree')).toContainText('Search Indexes');
|
await expect(
|
||||||
await expect(page.getByRole('tree')).toContainText('Governance');
|
page.getByTestId('explore-tree-title-Pipelines')
|
||||||
await expect(page.getByRole('tree')).toContainText('APIs');
|
).toContainText('Pipelines');
|
||||||
|
await expect(page.getByTestId('explore-tree-title-Topics')).toContainText(
|
||||||
|
'Topics'
|
||||||
|
);
|
||||||
|
await expect(
|
||||||
|
page.getByTestId('explore-tree-title-ML Models')
|
||||||
|
).toContainText('ML Models');
|
||||||
|
await expect(
|
||||||
|
page.getByTestId('explore-tree-title-Containers')
|
||||||
|
).toContainText('Containers');
|
||||||
|
await expect(
|
||||||
|
page.getByTestId('explore-tree-title-Search Indexes')
|
||||||
|
).toContainText('Search Indexes');
|
||||||
|
await expect(
|
||||||
|
page.getByTestId('explore-tree-title-Governance')
|
||||||
|
).toContainText('Governance');
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.locator('div')
|
.locator('div')
|
||||||
@ -77,18 +92,12 @@ test.describe('Explore Tree scenarios ', () => {
|
|||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
await expect(page.getByRole('tree')).toContainText('Glossaries');
|
await expect(
|
||||||
await expect(page.getByRole('tree')).toContainText('Tags');
|
page.getByTestId('explore-tree-title-Glossaries')
|
||||||
|
).toContainText('Glossaries');
|
||||||
// APIs
|
await expect(page.getByTestId('explore-tree-title-Tags')).toContainText(
|
||||||
await page
|
'Tags'
|
||||||
.locator('div')
|
);
|
||||||
.filter({ hasText: /^APIs$/ })
|
|
||||||
.locator('svg')
|
|
||||||
.first()
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await expect(page.getByRole('tree')).toContainText('rest');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step('Check the quick filters', async () => {
|
await test.step('Check the quick filters', async () => {
|
||||||
@ -285,6 +294,8 @@ test.describe('Explore page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach('Setup pre-requisits', async ({ page }) => {
|
test.beforeEach('Setup pre-requisits', async ({ page }) => {
|
||||||
|
test.slow(true);
|
||||||
|
|
||||||
const { apiContext, afterAction } = await getApiContext(page);
|
const { apiContext, afterAction } = await getApiContext(page);
|
||||||
await table.create(apiContext);
|
await table.create(apiContext);
|
||||||
await glossary.create(apiContext);
|
await glossary.create(apiContext);
|
||||||
@ -308,6 +319,8 @@ test.describe('Explore page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.afterEach('Cleanup', async ({ page }) => {
|
test.afterEach('Cleanup', async ({ page }) => {
|
||||||
|
test.slow(true);
|
||||||
|
|
||||||
const { apiContext, afterAction } = await getApiContext(page);
|
const { apiContext, afterAction } = await getApiContext(page);
|
||||||
await table.delete(apiContext);
|
await table.delete(apiContext);
|
||||||
await glossary.delete(apiContext);
|
await glossary.delete(apiContext);
|
||||||
@ -380,17 +393,16 @@ test.describe('Explore page', () => {
|
|||||||
|
|
||||||
const buckets = response.aggregations?.['sterms#entityType']?.buckets ?? [];
|
const buckets = response.aggregations?.['sterms#entityType']?.buckets ?? [];
|
||||||
|
|
||||||
const bucketMap = new Map(buckets.map((b: Bucket) => [b.key, b.doc_count]));
|
|
||||||
|
|
||||||
const filteredAssets = DATA_ASSETS.filter((asset) =>
|
const filteredAssets = DATA_ASSETS.filter((asset) =>
|
||||||
bucketMap.has(asset.key)
|
buckets.find((b: Bucket) => b.key === asset.key)
|
||||||
);
|
);
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const asset = filteredAssets[i];
|
const asset = filteredAssets[i];
|
||||||
const doc_count = Number(bucketMap.get(asset.key) ?? 0);
|
const bucket = buckets.find((b: Bucket) => b.key === asset.key);
|
||||||
|
const doc_count = Number(bucket.doc_count);
|
||||||
const tab = page.getByTestId(`${asset.label}-tab`);
|
const tab = page.getByTestId(`${asset.label}-tab`);
|
||||||
|
|
||||||
if (i !== 0) {
|
if (i !== 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user