mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 03:29:03 +00:00
This commit is contained in:
parent
500043a753
commit
ca45765de4
@ -28,6 +28,7 @@ import {
|
||||
verifyResponseStatusCode,
|
||||
visitEntityDetailsPage,
|
||||
} from '../../common/common';
|
||||
import { createEntityTable, hardDeleteService } from '../../common/entityUtils';
|
||||
import { searchServiceFromSettingPage } from '../../common/serviceUtils';
|
||||
import {
|
||||
API_SERVICE,
|
||||
@ -41,9 +42,25 @@ import {
|
||||
SERVICE_TYPE,
|
||||
TEAM_ENTITY,
|
||||
} from '../../constants/constants';
|
||||
import { DATABASE_SERVICE } from '../../constants/entityConstant';
|
||||
import { SERVICE_CATEGORIES } from '../../constants/service.constants';
|
||||
|
||||
const serviceType = 'Mysql';
|
||||
const serviceName = `${serviceType}-ct-test-${uuid()}`;
|
||||
const tableFqn = `${DATABASE_SERVICE.tables.databaseSchema}.${DATABASE_SERVICE.tables.name}`;
|
||||
const testSuite = {
|
||||
name: `${tableFqn}.testSuite`,
|
||||
executableEntityReference: tableFqn,
|
||||
};
|
||||
const testCase = {
|
||||
name: `user_tokens_table_column_name_to_exist_${uuid()}`,
|
||||
entityLink: `<#E::table::${testSuite.executableEntityReference}>`,
|
||||
parameterValues: [{ name: 'columnName', value: 'id' }],
|
||||
testDefinition: 'tableColumnNameToExist',
|
||||
description: 'test case description',
|
||||
testSuite: testSuite.name,
|
||||
};
|
||||
let testCaseId = '';
|
||||
|
||||
const goToProfilerTab = () => {
|
||||
interceptURL(
|
||||
@ -89,6 +106,52 @@ const visitTestSuiteDetailsPage = (testSuiteName) => {
|
||||
};
|
||||
|
||||
describe('Data Quality and Profiler should work properly', () => {
|
||||
before(() => {
|
||||
cy.login();
|
||||
cy.getAllLocalStorage().then((data) => {
|
||||
const token = Object.values(data)[0].oidcIdToken;
|
||||
|
||||
createEntityTable({
|
||||
token,
|
||||
...DATABASE_SERVICE,
|
||||
tables: [DATABASE_SERVICE.tables],
|
||||
});
|
||||
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `/api/v1/dataQuality/testSuites/executable`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body: testSuite,
|
||||
}).then(() => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `/api/v1/dataQuality/testCases`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body: testCase,
|
||||
}).then((response) => {
|
||||
testCaseId = response.body.id;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.login();
|
||||
cy.getAllLocalStorage().then((data) => {
|
||||
const token = Object.values(data)[0].oidcIdToken;
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
url: `/api/v1/dataQuality/testCases/${testCaseId}?hardDelete=true&recursive=false`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
hardDeleteService({
|
||||
token,
|
||||
serviceFqn: DATABASE_SERVICE.service.name,
|
||||
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
interceptURL('GET', `/api/v1/tables/*/systemProfile?*`, 'systemProfile');
|
||||
@ -705,4 +768,35 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
.should('be.visible')
|
||||
.contains(sqlQuery);
|
||||
});
|
||||
|
||||
it('Update displayName of test case', () => {
|
||||
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'getTestCase');
|
||||
cy.get('[data-testid="app-bar-item-data-quality"]').click();
|
||||
cy.get('[data-testid="by-test-cases"]').click();
|
||||
verifyResponseStatusCode('@getTestCase', 200);
|
||||
interceptURL(
|
||||
'GET',
|
||||
`/api/v1/search/query?q=*${testCase.name}*&index=test_case_search_index*`,
|
||||
'searchTestCase'
|
||||
);
|
||||
cy.get(
|
||||
'[data-testid="test-case-container"] [data-testid="searchbar"]'
|
||||
).type(testCase.name);
|
||||
verifyResponseStatusCode('@searchTestCase', 200);
|
||||
cy.get(`[data-testid="${testCase.name}"]`)
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
cy.get(`[data-testid="edit-${testCase.name}"]`).click();
|
||||
cy.get('.ant-modal-body').should('be.visible');
|
||||
cy.get('#tableTestForm_displayName').type('Table test case display name');
|
||||
interceptURL('PATCH', '/api/v1/dataQuality/testCases/*', 'updateTestCase');
|
||||
cy.get('.ant-modal-footer').contains('Submit').click();
|
||||
verifyResponseStatusCode('@updateTestCase', 200);
|
||||
cy.get(`[data-testid="${testCase.name}"]`)
|
||||
.scrollIntoView()
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
expect(text).to.eq('Table test case display name');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -85,7 +85,7 @@ export const TestCases = ({ summaryPanel }: { summaryPanel: ReactNode }) => {
|
||||
test.id === data.id ? { ...test, ...data } : test
|
||||
);
|
||||
|
||||
return { ...prev, data: updatedTestCase };
|
||||
return updatedTestCase;
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -118,7 +118,7 @@ export const TestCases = ({ summaryPanel }: { summaryPanel: ReactNode }) => {
|
||||
return test;
|
||||
});
|
||||
|
||||
return { ...prev, data };
|
||||
return data;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -332,23 +332,6 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
|
||||
}
|
||||
}, [isTourOpen]);
|
||||
|
||||
const handleResultUpdate = (testCase: TestCase) => {
|
||||
setTableTests((prev) => {
|
||||
const tests = prev.tests.map((test) => {
|
||||
if (test.fullyQualifiedName === testCase.fullyQualifiedName) {
|
||||
return testCase;
|
||||
}
|
||||
|
||||
return test;
|
||||
});
|
||||
|
||||
return {
|
||||
...prev,
|
||||
tests,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const handleDateRangeChange = (value: DateRangeObject) => {
|
||||
if (!isEqual(value, dateRangeObject)) {
|
||||
setDateRangeObject(value);
|
||||
@ -702,7 +685,7 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
|
||||
showTableColumn={false}
|
||||
testCases={filteredTestCase}
|
||||
testSuite={testSuite}
|
||||
onTestCaseResultUpdate={handleResultUpdate}
|
||||
onTestCaseResultUpdate={handleTestUpdate}
|
||||
onTestUpdate={handleTestUpdate}
|
||||
/>
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user