diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js index d6aa894314b..1f388d735de 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js @@ -170,6 +170,12 @@ export const NEW_COLUMN_TEST_CASE = { description: 'New table test case for columnValueLengthsToBeBetween', }; +export const NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE = { + column: 'id', + type: 'columnValuesToBeNotNull', + description: 'New table test case for columnValuesToBeNotNull', +}; + export const NEW_TEAM = { team_1: { name: 'account', diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js index b620c889cc9..ef1c6cf9889 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js @@ -33,6 +33,7 @@ import { DELETE_TERM, MYDATA_SUMMARY_OPTIONS, NEW_COLUMN_TEST_CASE, + NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE, NEW_TABLE_TEST_CASE, NEW_TEST_SUITE, SERVICE_TYPE, @@ -42,6 +43,7 @@ import { const serviceType = 'Mysql'; const serviceName = `${serviceType}-ct-test-${uuid()}`; const columnTestName = `${NEW_COLUMN_TEST_CASE.column}_${NEW_COLUMN_TEST_CASE.type}`; +const nonTeamTypeColumnTestName = `${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.column}_${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.type}`; const goToProfilerTab = () => { interceptURL( @@ -325,6 +327,49 @@ describe('Data Quality and Profiler should work properly', () => { 'contain', 'id_columnValueLengthsToBeBetween' ); + + // Creating new test case and selecting Null team type + + goToProfilerTab(); + cy.get('[data-testid="profiler-tab-left-panel"]') + .contains('Column Profile') + .should('be.visible') + .click(); + + cy.get('[data-testid="add-test-id"]') + .scrollIntoView() + .should('be.visible') + .click(); + + // selecting existing test suite + cy.get('#selectTestSuite_testSuiteId').should('exist').click(); + cy.contains(NEW_TEST_SUITE.name).should('be.visible').click(); + cy.get('[data-testid="next-button"]') + .scrollIntoView() + .should('be.visible') + .click(); + + cy.get('#tableTestForm_testTypeId').scrollIntoView().click(); + cy.get(`[title="${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.type}"]`) + .scrollIntoView() + .should('be.visible') + .click(); + cy.get(descriptionBox) + .scrollIntoView() + .type(NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.description); + + cy.get('[data-testid="submit-test"]') + .scrollIntoView() + .should('be.visible') + .click(); + + cy.get('[data-testid="success-line"]') + .contains( + 'has been created successfully. This will be picked up in the next run.' + ) + .should('be.visible'); + cy.get('[data-testid="view-service-button"]').scrollIntoView().click(); + cy.get('.ant-table-row').should('contain', 'id_columnValuesToBeNotNull'); }); it('Edit column test case should work properly', () => { @@ -358,6 +403,14 @@ describe('Data Quality and Profiler should work properly', () => { .wait(200); cy.get(`[data-testid="${columnTestName}"]`).should('be.visible').click(); cy.contains('minLength: 4').scrollIntoView().should('exist'); + + // Editing Non Team Type Test Case + cy.get(`[data-testid="${nonTeamTypeColumnTestName}"]`).should('be.visible'); + cy.get(`[data-testid="edit-${nonTeamTypeColumnTestName}"]`) + .scrollIntoView() + .should('be.visible') + .click(); + cy.get('.ant-modal-footer').contains('Cancel').click(); }); it('Delete Column Test Case should work properly', () => { @@ -373,28 +426,31 @@ describe('Data Quality and Profiler should work properly', () => { .should('be.visible') .click(); - cy.get(`[data-testid="${columnTestName}"]`).should('be.visible'); - cy.get(`[data-testid="delete-${columnTestName}"]`) - .scrollIntoView() - .should('be.visible') - .click(); - cy.get('[data-testid="hard-delete-option"]').should('be.visible').click(); - cy.get('[data-testid="confirmation-text-input"]') - .should('be.visible') - .type(DELETE_TERM); - interceptURL( - 'DELETE', - '/api/v1/testCase/*?hardDelete=true&recursive=false', - 'deleteTest' - ); - interceptURL('GET', '/api/v1/testCase?*', 'getTestCase'); - cy.get('[data-testid="confirm-button"]') - .should('be.visible') - .should('not.be.disabled') - .click(); - verifyResponseStatusCode('@deleteTest', 200); - verifyResponseStatusCode('@getTestCase', 200); - toastNotification('Test Case deleted successfully!'); + [columnTestName, nonTeamTypeColumnTestName].map((test) => { + cy.get(`[data-testid="${test}"]`).should('be.visible'); + cy.get(`[data-testid="delete-${test}"]`) + .scrollIntoView() + .should('be.visible') + .click(); + cy.get('[data-testid="hard-delete-option"]').should('be.visible').click(); + cy.get('[data-testid="confirmation-text-input"]') + .should('be.visible') + .type(DELETE_TERM); + interceptURL( + 'DELETE', + '/api/v1/testCase/*?hardDelete=true&recursive=false', + 'deleteTest' + ); + interceptURL('GET', '/api/v1/testCase?*', 'getTestCase'); + cy.get('[data-testid="confirm-button"]') + .should('be.visible') + .should('not.be.disabled') + .click(); + verifyResponseStatusCode('@deleteTest', 200); + verifyResponseStatusCode('@getTestCase', 200); + toastNotification('Test Case deleted successfully!'); + }); + cy.get('[class="ant-empty-description"]') .invoke('text') .should('eq', 'No data'); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx index 630b5942454..2f348d49762 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx @@ -69,7 +69,7 @@ const EditTestCaseModal: React.FC = ({ const GenerateParamsField = useCallback(() => { if (selectedDefinition && selectedDefinition.parameterDefinition) { - const name = selectedDefinition.parameterDefinition[0].name; + const name = selectedDefinition.parameterDefinition[0]?.name; if (name === 'sqlExpression') { return ( = ({ (acc, curr) => ({ ...acc, [curr.name || '']: - selectedDefinition?.parameterDefinition?.[0].dataType === + selectedDefinition?.parameterDefinition?.[0]?.dataType === TestDataType.Array ? (JSON.parse(curr.value || '[]') as string[]).map((val) => ({ value: val, diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.test.tsx index 295f9cca3d8..a3a86268d44 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.test.tsx @@ -63,7 +63,7 @@ jest.mock('../containers/PageLayout', () => { return jest .fn() .mockImplementation(({ children }) => ( -
{children}
+
{children}
)); }); @@ -107,7 +107,7 @@ describe('Test ProfilerDashboardPage component', () => { wrapper: MemoryRouter, }); }); - const pageContainer = await screen.findByTestId('page-container'); + const pageContainer = await screen.findByTestId('page-layout-v1'); const profilerSwitch = await screen.findByTestId('profiler-switch'); const EntityPageInfo = await screen.findByText('EntityPageInfo component'); const ProfilerTab = await screen.findByText('ProfilerTab component'); @@ -132,7 +132,7 @@ describe('Test ProfilerDashboardPage component', () => { wrapper: MemoryRouter, }); }); - const pageContainer = await screen.findByTestId('page-container'); + const pageContainer = await screen.findByTestId('page-layout-v1'); const profilerSwitch = await screen.findByTestId('profiler-switch'); const EntityPageInfo = await screen.findByText('EntityPageInfo component'); const ProfilerTab = screen.queryByText('ProfilerTab component'); @@ -159,7 +159,7 @@ describe('Test ProfilerDashboardPage component', () => { wrapper: MemoryRouter, }); }); - const pageContainer = await screen.findByTestId('page-container'); + const pageContainer = await screen.findByTestId('page-layout-v1'); const profilerSwitch = await screen.findByTestId('profiler-switch'); const EntityPageInfo = await screen.findByText('EntityPageInfo component'); const ProfilerTab = await screen.findByText('ProfilerTab component'); @@ -225,7 +225,7 @@ describe('Test ProfilerDashboardPage component', () => { }); }); - const pageContainer = await screen.findByTestId('page-container'); + const pageContainer = await screen.findByTestId('page-layout-v1'); const addTest = await screen.findByTestId('add-test'); expect(pageContainer).toBeInTheDocument(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.tsx index e9ea340dcd9..a20c12e2063 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/ProfilerDashboard.tsx @@ -25,6 +25,7 @@ import { import { RadioChangeEvent } from 'antd/lib/radio'; import { SwitchChangeEventHandler } from 'antd/lib/switch'; import { AxiosError } from 'axios'; +import PageLayoutV1 from 'components/containers/PageLayoutV1'; import { EntityTags, ExtraInfo } from 'Models'; import React, { useEffect, useMemo, useState } from 'react'; import { useHistory, useParams } from 'react-router-dom'; @@ -71,7 +72,6 @@ import { import { showErrorToast } from '../../utils/ToastUtils'; import EntityPageInfo from '../common/entityPageInfo/EntityPageInfo'; import { TitleBreadcrumbProps } from '../common/title-breadcrumb/title-breadcrumb.interface'; -import PageLayout from '../containers/PageLayout'; import { usePermissionProvider } from '../PermissionProvider/PermissionProvider'; import { OperationPermission, @@ -454,7 +454,7 @@ const ProfilerDashboard: React.FC = ({ }, [table]); return ( - + = ({ )} - + ); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/containers/PageLayoutV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/containers/PageLayoutV1.tsx index c437e24e39a..d0d74b5d4f2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/containers/PageLayoutV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/containers/PageLayoutV1.tsx @@ -38,7 +38,11 @@ const PageLayoutV1: FC = ({ center = false, }: PageLayoutProp) => { return ( - + {leftPanel && (