Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(ui): Persona comments and sonar issues #20011

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2a690be
fix(ui): Persona comments and sonar issues
chirag-madlani Feb 27, 2025
a36b6a3
improve code and add tests for generic tab
chirag-madlani Feb 28, 2025
76546b6
adding test for common widget
chirag-madlani Feb 28, 2025
f5ea5f5
add tests for generic provider
chirag-madlani Feb 28, 2025
16861e7
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 3, 2025
d09cde9
update
chirag-madlani Mar 3, 2025
b952091
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 4, 2025
26fee87
fix tests
chirag-madlani Mar 4, 2025
2d18c80
fix tests
chirag-madlani Mar 4, 2025
7ab43dc
fix tests
chirag-madlani Mar 5, 2025
eeb090c
update localization
chirag-madlani Mar 5, 2025
ece15f5
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 5, 2025
c73df4a
fix test
chirag-madlani Mar 5, 2025
e59a398
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 6, 2025
1c84d30
modify MlModel tabs
chirag-madlani Mar 6, 2025
bc7b50f
fix playwright tests
chirag-madlani Mar 6, 2025
1a43a1b
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 6, 2025
60bb5f4
fix playwright
chirag-madlani Mar 6, 2025
ab5d3b5
update translation
chirag-madlani Mar 6, 2025
b8c5594
fix failing tests
chirag-madlani Mar 7, 2025
5d6ddeb
fix translation
chirag-madlani Mar 7, 2025
9e2c6c5
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 7, 2025
7613827
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 10, 2025
7c8e11f
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 10, 2025
f2e317c
fix unit tests
chirag-madlani Mar 12, 2025
71d8d37
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 12, 2025
d57b098
make first tab as default selected
chirag-madlani Mar 12, 2025
0aa463c
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 12, 2025
2a4fcc3
update tests
chirag-madlani Mar 12, 2025
a873933
fix tests
chirag-madlani Mar 12, 2025
1e5dbb0
Merge branch 'main' into fix-persona-feedbacks
chirag-madlani Mar 12, 2025
62432d6
update default height for widgets
chirag-madlani Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright 2025 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.
*/
export enum ECustomizedDataAssets {
TABLE = 'Table',
TOPIC = 'Topic',
DASHBOARD = 'Dashboard',
ML_MODEL = 'Ml Model',
PIPELINE = 'Pipeline',
DASHBOARD_DATA_MODEL = 'Dashboard Data Model',
API_COLLECTION = 'API Collection',
SEARCH_INDEX = 'Search Index',
CONTAINER = 'Container',
DATABASE = 'Database',
DATABASE_SCHEMA = 'Database Schema',
STORED_PROCEDURE = 'Stored Procedure',
API_ENDPOINT = 'API Endpoint',
}

export const TABLE_DEFAULT_TABS = [
'Schema',
'Activity Feeds & Tasks',
'Sample Data',
'Queries',
'Data Observability',
'Incidents',
'Lineage',
'View Definition',
'Custom Properties',
];

export const TOPIC_DEFAULT_TABS = [
'Schema',
'Activity Feeds & Tasks',
'Sample Data',
'Config',
'Lineage',
'Custom Properties',
];

export const DASHBOARD_DEFAULT_TABS = [
'Details',
'Activity Feeds & Tasks',
'Lineage',
'Custom Properties',
];

export const MLMODEL_DEFAULT_TABS = [
'Features',
'Activity Feeds & Tasks',
'Details',
'Lineage',
'Custom Properties',
];

export const PIPELINE_DEFAULT_TABS = [
'Tasks',
'Activity Feeds & Tasks',
'Executions',
'Lineage',
'Custom Properties',
];

export const DASHBOARD_DATAMODEL_DEFAULT_TABS = [
'Model',
'Activity Feeds & Tasks',
'SQL',
'Lineage',
'Custom Properties',
];

export const API_COLLECTION_DEFAULT_TABS = [
'Collections',
'Activity Feeds & Tasks',
'Custom Properties',
];

export const SEARCH_INDEX_DEFAULT_TABS = [
'Fields',
'Activity Feeds & Tasks',
'Sample Data',
'Lineage',
'Search Index Settings',
'Custom Properties',
];

export const CONTAINER_DEFAULT_TABS = [
'Schema',
'Children',
'Activity Feeds & Tasks',
'Lineage',
'Custom Properties',
];

export const DATABASE_DEFAULT_TABS = [
'Schemas',
'Activity Feeds',
'Custom Properties',
];

export const DATABASE_SCHEMA_DEFAULT_TABS = [
'Tables',
'Stored Procedures',
'Activity Feeds',
'Custom Properties',
];

export const STORED_PROCEDURE_DEFAULT_TABS = [
'Code',
'Activity Feeds & Tasks',
'Lineage',
'Custom Properties',
];

export const API_ENDPOINT_DEFAULT_TABS = [
'Schema',
'Activity Feeds & Tasks',
'Lineage',
'Custom Properties',
];

export const DASHBOARD_DATA_MODEL_DEFAULT_TABS = [
'Model',
'Activity Feeds & Tasks',
'Lineage',
'Custom Properties',
];

export const ML_MODEL_DEFAULT_TABS = [
'Features',
'Activity Feeds & Tasks',
'Details',
'Lineage',
'Custom Properties',
];
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const creationConfig: EntityDataClassCreationConfig = {
apiCollection: true,
searchIndex: true,
container: true,
entityDetails: true,
};

const user = new UserClass();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
/*
* Copyright 2025 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 { expect, Page, test as base } from '@playwright/test';
import { ECustomizedDataAssets } from '../../constant/customizeDetail';
import { GlobalSettingOptions } from '../../constant/settings';
import { EntityDataClass } from '../../support/entity/EntityDataClass';
import { EntityDataClassCreationConfig } from '../../support/entity/EntityDataClass.interface';
import { PersonaClass } from '../../support/persona/PersonaClass';
import { AdminClass } from '../../support/user/AdminClass';
import { UserClass } from '../../support/user/UserClass';
import { performAdminLogin } from '../../utils/admin';
import { redirectToHomePage, toastNotification } from '../../utils/common';
import {
getCustomizeDetailsDefaultTabs,
getCustomizeDetailsEntity,
} from '../../utils/customizeDetails';
import { setUserDefaultPersona } from '../../utils/customizeLandingPage';
import { settingClick } from '../../utils/sidebar';

const persona = new PersonaClass();
const adminUser = new AdminClass();
const user = new UserClass();

const creationConfig: EntityDataClassCreationConfig = {
table: true,
entityDetails: false,
topic: true,
dashboard: true,
mlModel: true,
pipeline: true,
dashboardDataModel: true,
apiCollection: true,
searchIndex: true,
container: true,
storedProcedure: true,
apiEndpoint: true,
database: true,
databaseSchema: true,
};

const test = base.extend<{
adminPage: Page;
userPage: Page;
}>({
adminPage: async ({ browser }, use) => {
const adminPage = await browser.newPage();
await adminUser.login(adminPage);
await use(adminPage);
await adminPage.close();
},
userPage: async ({ browser }, use) => {
const page = await browser.newPage();
await user.login(page);
await use(page);
await page.close();
},
});

test.describe('Customize Detail Page', async () => {
test.beforeAll('Setup Customize tests', async ({ browser }) => {
const { apiContext, afterAction } = await performAdminLogin(browser);

await adminUser.create(apiContext);
await adminUser.setAdminRole(apiContext);
await user.create(apiContext);
await user.setAdminRole(apiContext);
await EntityDataClass.preRequisitesForTests(apiContext, creationConfig);
await persona.create(apiContext);

await afterAction();
});

test.afterAll('Cleanup Customize tests', async ({ browser }) => {
test.slow();

const { apiContext, afterAction } = await performAdminLogin(browser);
await adminUser.delete(apiContext);
await user.delete(apiContext);
await persona.delete(apiContext);
await EntityDataClass.postRequisitesForTests(apiContext, creationConfig);
await afterAction();
});

test.beforeEach(async ({ adminPage, userPage }) => {
await redirectToHomePage(adminPage);
await redirectToHomePage(userPage);
});

test.fixme('should show all the customize options', async ({ adminPage }) => {
await adminPage.getByRole('tab', { name: 'Customize UI' }).click();

await expect(adminPage.getByText('Navigation')).toBeVisible();
await expect(adminPage.getByText('Homepage')).toBeVisible();
await expect(adminPage.getByText('Governance')).toBeVisible();
await expect(adminPage.getByText('Data Assets')).toBeVisible();
});

test.describe.serial('Persona customization', () => {
test.slow();

test('add user to Persona', async ({ adminPage, userPage }) => {
await settingClick(adminPage, GlobalSettingOptions.PERSONA);
await adminPage.waitForLoadState('networkidle');
await adminPage
.getByTestId(`persona-details-card-${persona.data.name}`)
.click();
await adminPage.getByRole('button', { name: 'Add User' }).click();
await adminPage.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await adminPage.getByTestId('searchbar').fill(user.responseData.name);

await adminPage.getByTitle(user.responseData.displayName).click();
await adminPage.getByRole('button', { name: 'Update' }).click();
await adminPage.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});

await expect(
adminPage.locator(`[data-row-key="${user.responseData.name}"]`)
).toBeVisible();

// Update user page with newly added persona
await userPage.reload();
await userPage.waitForLoadState('networkidle');
await userPage.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await setUserDefaultPersona(userPage, persona.responseData.displayName);
});

test.describe('Validate persona customization', async () => {
Object.values(ECustomizedDataAssets).forEach(async (type) => {
test(`${type} - customization should work`, async ({
adminPage,
userPage,
}) => {
await test.step(
`should show all the tabs & widget as default when no customization is done`,
async () => {
await settingClick(adminPage, GlobalSettingOptions.PERSONA);
await adminPage.waitForLoadState('networkidle');
await adminPage
.getByTestId(`persona-details-card-${persona.data.name}`)
.click();
await adminPage
.getByRole('tab', { name: 'Customize UI' })
.click();
await adminPage.waitForLoadState('networkidle');
await adminPage.getByText('Data Assets').click();
await adminPage.getByText(type, { exact: true }).click();

await adminPage.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});

const expectedTabs = getCustomizeDetailsDefaultTabs(type);

const tabs = adminPage.getByRole('tab');

await expect(tabs).toHaveCount(expectedTabs.length);

for (const tabName of expectedTabs) {
await expect(
adminPage.getByRole('tab', {
name: tabName,
exact: true,
})
).toBeVisible();
}
}
);

await test.step('apply customization', async () => {
expect(
adminPage.locator('#KnowledgePanel\\.Description')
).toBeVisible();

await adminPage
.locator('#KnowledgePanel\\.Description')
.getByTestId('remove-widget-button')
.click();

await adminPage.getByRole('button', { name: 'Add tab' }).click();
await adminPage.getByTestId('add-widget-button').click();
await adminPage.getByTestId('Description-widget').click();
await adminPage
.getByTestId('add-widget-modal')
.getByTestId('add-widget-button')
.click();
await adminPage.getByTestId('save-button').click();

await toastNotification(
adminPage,
/^Page layout (created|updated) successfully\.$/
);
});

await test.step('Validate customization', async () => {
await redirectToHomePage(userPage);

const entity = getCustomizeDetailsEntity(type);
await entity.visitEntityPage(userPage);
await userPage.waitForLoadState('networkidle');
await userPage.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});

expect(
userPage.getByRole('tab', { name: 'New Tab' })
).toBeVisible();

await userPage.getByRole('tab', { name: 'New Tab' }).click();

const visibleDescription = userPage
.getByTestId(/KnowledgePanel.Description-/)
.locator('visible=true');

await expect(visibleDescription).toBeVisible();
});
});
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
export interface EntityDataClassCreationConfig {
all?: boolean;
entityDetails?: boolean;
table?: boolean;
topic?: boolean;
dashboard?: boolean;
Expand Down
Loading
Loading