From cfeff93ec4950b01e87b5155262f4598e399d038 Mon Sep 17 00:00:00 2001 From: Sweta Agarwalla Date: Mon, 10 Feb 2025 16:38:59 +0530 Subject: [PATCH 1/4] update data model header asset to include project --- .../main/resources/ui/src/utils/DataAssetsHeader.utils.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/DataAssetsHeader.utils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/DataAssetsHeader.utils.tsx index efe3f0947670..e5aa67619a17 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/DataAssetsHeader.utils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/DataAssetsHeader.utils.tsx @@ -239,6 +239,12 @@ export const getDataAssetsHeaderInfo = ( value={dataModelDetails.dataModelType} /> )} + {dataModelDetails.project && ( + + )} ); From d73a5cd487bef46f40939309817d48d365311d11 Mon Sep 17 00:00:00 2001 From: Sweta Agarwalla Date: Tue, 11 Feb 2025 15:09:48 +0530 Subject: [PATCH 2/4] add playwright test for project --- .../e2e/Features/EntityProject.spec.ts | 56 +++++++++++++++++++ .../support/entity/DashboardClass.ts | 2 + 2 files changed, 58 insertions(+) create mode 100644 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts new file mode 100644 index 000000000000..9938cc4a74ec --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts @@ -0,0 +1,56 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import test, { expect } from '@playwright/test'; +import { DashboardClass } from '../../support/entity/DashboardClass'; +import { DashboardDataModelClass } from '../../support/entity/DashboardDataModelClass'; +import { createNewPage, redirectToHomePage } from '../../utils/common'; + +const entities = [DashboardClass, DashboardDataModelClass] as const; + +// use the admin user to login +test.use({ storageState: 'playwright/.auth/admin.json' }); + +entities.forEach((EntityClass) => { + const entity = new EntityClass(); + const entityName = entity.getType(); + + test.describe(entityName, () => { + test.beforeAll('Setup pre-requests', async ({ browser }) => { + const { afterAction, apiContext } = await createNewPage(browser); + + await entity.create(apiContext); + + await afterAction(); + }); + + test.afterAll('Clean up', async ({ browser }) => { + const { afterAction, apiContext } = await createNewPage(browser); + + await entity.delete(apiContext); + + await afterAction(); + }); + + test.beforeEach('Visit home page', async ({ page }) => { + await redirectToHomePage(page); + }); + + test(`${entityName} page should show the project name`, async ({ + page, + }) => { + await entity.visitEntityPage(page); + + await expect(page.getByText(entity.entity.project)).toBeVisible(); + }); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/support/entity/DashboardClass.ts b/openmetadata-ui/src/main/resources/ui/playwright/support/entity/DashboardClass.ts index 6350f15ce96b..b1c8c226be4b 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/support/entity/DashboardClass.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/support/entity/DashboardClass.ts @@ -26,6 +26,7 @@ import { EntityClass } from './EntityClass'; export class DashboardClass extends EntityClass { private dashboardName = `pw-dashboard-${uuid()}`; private dashboardDataModelName = `pw-dashboard-data-model-${uuid()}`; + private projectName = `pw-project-${uuid()}`; service = { name: `pw-dashboard-service-${uuid()}`, serviceType: 'Superset', @@ -51,6 +52,7 @@ export class DashboardClass extends EntityClass { name: this.dashboardName, displayName: this.dashboardName, service: this.service.name, + project: this.projectName, }; children = [ { From 32d3cf8da45cce56589415a120117c30744e1351 Mon Sep 17 00:00:00 2001 From: Sweta Agarwalla Date: Tue, 11 Feb 2025 15:38:23 +0530 Subject: [PATCH 3/4] update entity test --- .../e2e/Features/EntityProject.spec.ts | 56 ------------------- .../ui/playwright/e2e/Pages/Entity.spec.ts | 18 +++++- 2 files changed, 16 insertions(+), 58 deletions(-) delete mode 100644 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts deleted file mode 100644 index 9938cc4a74ec..000000000000 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityProject.spec.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2024 Collate. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import test, { expect } from '@playwright/test'; -import { DashboardClass } from '../../support/entity/DashboardClass'; -import { DashboardDataModelClass } from '../../support/entity/DashboardDataModelClass'; -import { createNewPage, redirectToHomePage } from '../../utils/common'; - -const entities = [DashboardClass, DashboardDataModelClass] as const; - -// use the admin user to login -test.use({ storageState: 'playwright/.auth/admin.json' }); - -entities.forEach((EntityClass) => { - const entity = new EntityClass(); - const entityName = entity.getType(); - - test.describe(entityName, () => { - test.beforeAll('Setup pre-requests', async ({ browser }) => { - const { afterAction, apiContext } = await createNewPage(browser); - - await entity.create(apiContext); - - await afterAction(); - }); - - test.afterAll('Clean up', async ({ browser }) => { - const { afterAction, apiContext } = await createNewPage(browser); - - await entity.delete(apiContext); - - await afterAction(); - }); - - test.beforeEach('Visit home page', async ({ page }) => { - await redirectToHomePage(page); - }); - - test(`${entityName} page should show the project name`, async ({ - page, - }) => { - await entity.visitEntityPage(page); - - await expect(page.getByText(entity.entity.project)).toBeVisible(); - }); - }); -}); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts index 01d983cf9aef..7ccd740c7501 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts @@ -10,7 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { test } from '@playwright/test'; +import { expect, test } from '@playwright/test'; import { isUndefined } from 'lodash'; import { CustomPropertySupportedEntityList } from '../../constant/customProperty'; import { ApiEndpointClass } from '../../support/entity/ApiEndpointClass'; @@ -65,8 +65,9 @@ test.use({ storageState: 'playwright/.auth/admin.json' }); entities.forEach((EntityClass) => { const entity = new EntityClass(); const deleteEntity = new EntityClass(); + const entityName = entity.getType(); - test.describe(entity.getType(), () => { + test.describe(entityName, () => { test.beforeAll('Setup pre-requests', async ({ browser }) => { const { apiContext, afterAction } = await createNewPage(browser); @@ -192,6 +193,19 @@ entities.forEach((EntityClass) => { ); }); + if ( + EntityClass === DashboardDataModelClass || + EntityClass === DashboardClass + ) { + test(`${entityName} page should show the project name`, async ({ + page, + }) => { + await expect( + page.getByText((entity.entity as { project: string }).project) + ).toBeVisible(); + }); + } + test('Update description', async ({ page }) => { await entity.descriptionUpdate(page); }); From 142c0efe94b6b7b15dd22b8c08d8af5cb8d98ea2 Mon Sep 17 00:00:00 2001 From: Sweta Agarwalla Date: Tue, 11 Feb 2025 15:51:22 +0530 Subject: [PATCH 4/4] update condition for test --- .../main/resources/ui/playwright/e2e/Pages/Entity.spec.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts index 7ccd740c7501..f0aa8825e374 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts @@ -193,10 +193,7 @@ entities.forEach((EntityClass) => { ); }); - if ( - EntityClass === DashboardDataModelClass || - EntityClass === DashboardClass - ) { + if (['Dashboard', 'Dashboard Data Model'].includes(entityName)) { test(`${entityName} page should show the project name`, async ({ page, }) => {