diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.test.tsx
index a376344a38e..5fd789a679e 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.test.tsx
@@ -14,6 +14,7 @@
import { act, render, screen } from '@testing-library/react';
import { TestDefinition } from 'generated/tests/testDefinition';
import {
+ MOCK_TABLE_COLUMN_NAME_TO_EXIST,
MOCK_TABLE_ROW_INSERTED_COUNT_TO_BE_BETWEEN,
MOCK_TABLE_WITH_DATE_TIME_COLUMNS,
} from 'mocks/TestSuite.mock';
@@ -32,7 +33,7 @@ describe('ParameterForm component test', () => {
/>
);
});
-
+ // test definition should be "tableRowInsertedCountToBeBetween"
const selectBox = await screen.findByRole('combobox');
const parameters = await screen.findAllByTestId('parameter');
@@ -61,4 +62,23 @@ describe('ParameterForm component test', () => {
MOCK_TABLE_ROW_INSERTED_COUNT_TO_BE_BETWEEN.parameterDefinition.length
);
});
+
+ it('Select box should not render if "columnName" field is present but test definition is not "tableRowInsertedCountToBeBetween"', async () => {
+ await act(async () => {
+ render(
+
+ );
+ });
+
+ const selectBox = screen.queryByRole('combobox');
+ const parameters = await screen.findAllByTestId('parameter');
+
+ expect(selectBox).not.toBeInTheDocument();
+ expect(parameters).toHaveLength(
+ MOCK_TABLE_COLUMN_NAME_TO_EXIST.parameterDefinition.length
+ );
+ });
});
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx
index e8788d11e0b..a4d00dd922b 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx
@@ -39,7 +39,11 @@ const ParameterForm: React.FC = ({ definition, table }) => {
);
switch (data.dataType) {
case TestDataType.String:
- if (data.name === 'columnName' && !isUndefined(table)) {
+ if (
+ !isUndefined(table) &&
+ definition.name === 'tableRowInsertedCountToBeBetween' &&
+ data.name === 'columnName'
+ ) {
const partitionColumnOptions = table.columns.reduce(
(result, column) => {
if (SUPPORTED_PARTITION_TYPE.includes(column.dataType)) {
diff --git a/openmetadata-ui/src/main/resources/ui/src/mocks/TestSuite.mock.ts b/openmetadata-ui/src/main/resources/ui/src/mocks/TestSuite.mock.ts
index 7bba44015b7..ca80c5518df 100644
--- a/openmetadata-ui/src/main/resources/ui/src/mocks/TestSuite.mock.ts
+++ b/openmetadata-ui/src/main/resources/ui/src/mocks/TestSuite.mock.ts
@@ -738,3 +738,29 @@ export const MOCK_TABLE_ROW_INSERTED_COUNT_TO_BE_BETWEEN = {
href: 'http://sandbox-beta.open-metadata.org/api/v1/testDefinition/756c7770-0af3-49a9-9905-75a2886e5eec',
deleted: false,
};
+
+export const MOCK_TABLE_COLUMN_NAME_TO_EXIST = {
+ id: '6d4e4673-fd7f-4b37-811e-7645c3c17e93',
+ name: 'tableColumnNameToExist',
+ displayName: 'Table Column Name To Exist',
+ fullyQualifiedName: 'tableColumnNameToExist',
+ description:
+ 'This test defines the test TableColumnNameToExist. Test the table columns exists in the table.',
+ entityType: 'TABLE',
+ testPlatforms: ['OpenMetadata'],
+ supportedDataTypes: [],
+ parameterDefinition: [
+ {
+ name: 'columnName',
+ displayName: 'Column Name',
+ dataType: 'STRING',
+ description: 'Expected column of the table to exist',
+ required: true,
+ },
+ ],
+ version: 0.1,
+ updatedAt: 1672236872076,
+ updatedBy: 'admin',
+ href: 'http://sandbox-beta.open-metadata.org/api/v1/testDefinition/6d4e4673-fd7f-4b37-811e-7645c3c17e93',
+ deleted: false,
+};