2022-09-19 18:43:39 +05:30
|
|
|
/*
|
2022-12-27 12:37:58 +05:30
|
|
|
* Copyright 2022 Collate.
|
2022-09-19 18:43:39 +05:30
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2022-10-29 09:05:20 +05:30
|
|
|
import {
|
2023-01-15 18:24:10 +05:30
|
|
|
descriptionBox,
|
|
|
|
interceptURL,
|
|
|
|
toastNotification,
|
|
|
|
uuid,
|
|
|
|
verifyResponseStatusCode,
|
2022-10-29 09:05:20 +05:30
|
|
|
} from '../../common/common';
|
2023-11-27 15:31:52 +05:30
|
|
|
import { createEntityTable, hardDeleteService } from '../../common/EntityUtils';
|
2024-03-07 17:06:33 +05:30
|
|
|
import MysqlIngestionClass from '../../common/Services/MysqlIngestionClass';
|
2023-11-11 00:08:32 +05:30
|
|
|
import { searchServiceFromSettingPage } from '../../common/serviceUtils';
|
2024-01-25 12:18:42 +05:30
|
|
|
import { visitEntityDetailsPage } from '../../common/Utils/Entity';
|
2024-03-07 17:06:33 +05:30
|
|
|
import {
|
|
|
|
handleIngestionRetry,
|
|
|
|
scheduleIngestion,
|
|
|
|
} from '../../common/Utils/Ingestion';
|
2024-03-15 03:02:42 +05:30
|
|
|
import { getToken } from '../../common/Utils/LocalStorage';
|
2024-01-08 15:23:39 +05:30
|
|
|
import { addOwner, removeOwner, updateOwner } from '../../common/Utils/Owner';
|
2024-03-07 17:06:33 +05:30
|
|
|
import { goToServiceListingPage, Services } from '../../common/Utils/Services';
|
2022-10-29 09:05:20 +05:30
|
|
|
import {
|
2023-01-15 18:24:10 +05:30
|
|
|
DATA_QUALITY_SAMPLE_DATA_TABLE,
|
|
|
|
DELETE_TERM,
|
|
|
|
NEW_COLUMN_TEST_CASE,
|
2023-02-03 16:30:50 +05:30
|
|
|
NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE,
|
2023-01-15 18:24:10 +05:30
|
|
|
NEW_TABLE_TEST_CASE,
|
|
|
|
NEW_TEST_SUITE,
|
|
|
|
TEAM_ENTITY,
|
2022-10-29 09:05:20 +05:30
|
|
|
} from '../../constants/constants';
|
2024-03-07 17:06:33 +05:30
|
|
|
import { EntityType, SidebarItem } from '../../constants/Entity.interface';
|
2023-11-27 15:31:52 +05:30
|
|
|
import { DATABASE_SERVICE } from '../../constants/EntityConstant';
|
2023-11-23 21:37:26 +05:30
|
|
|
import { SERVICE_CATEGORIES } from '../../constants/service.constants';
|
2024-01-24 14:27:52 +05:30
|
|
|
import { GlobalSettingOptions } from '../../constants/settings.constant';
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-03-07 17:06:33 +05:30
|
|
|
const serviceName = `cypress-mysql`;
|
2023-11-27 15:31:52 +05:30
|
|
|
const tableFqn = `${DATABASE_SERVICE.entity.databaseSchema}.${DATABASE_SERVICE.entity.name}`;
|
2023-11-23 21:37:26 +05:30
|
|
|
const testSuite = {
|
|
|
|
name: `${tableFqn}.testSuite`,
|
|
|
|
executableEntityReference: tableFqn,
|
|
|
|
};
|
2024-01-19 22:21:15 +05:30
|
|
|
const testCase1 = {
|
2023-11-23 21:37:26 +05:30
|
|
|
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,
|
|
|
|
};
|
2024-01-19 22:21:15 +05:30
|
|
|
const testCase2 = {
|
|
|
|
name: `email_column_values_to_be_in_set_${uuid()}`,
|
|
|
|
entityLink: `<#E::table::${testSuite.executableEntityReference}::columns::email>`,
|
|
|
|
parameterValues: [
|
|
|
|
{ name: 'allowedValues', value: '["gmail","yahoo","collate"]' },
|
|
|
|
],
|
|
|
|
testDefinition: 'columnValuesToBeInSet',
|
|
|
|
testSuite: testSuite.name,
|
|
|
|
};
|
|
|
|
|
2023-11-23 21:37:26 +05:30
|
|
|
let testCaseId = '';
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-01-08 15:23:39 +05:30
|
|
|
const OWNER1 = 'Aaron Johnson';
|
|
|
|
const OWNER2 = 'Cynthia Meyer';
|
|
|
|
|
2022-09-19 18:43:39 +05:30
|
|
|
const goToProfilerTab = () => {
|
2022-12-23 15:24:14 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/tables/name/${serviceName}.*.${TEAM_ENTITY}?fields=*&include=all`,
|
|
|
|
'waitForPageLoad'
|
|
|
|
);
|
2023-11-02 10:39:10 +05:30
|
|
|
visitEntityDetailsPage({
|
|
|
|
term: TEAM_ENTITY,
|
2022-09-29 15:21:33 +05:30
|
|
|
serviceName,
|
2024-03-07 17:06:33 +05:30
|
|
|
entity: EntityType.Table,
|
2023-11-02 10:39:10 +05:30
|
|
|
});
|
2022-12-23 15:24:14 +05:30
|
|
|
verifyResponseStatusCode('@waitForPageLoad', 200);
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2023-05-29 12:06:19 +05:30
|
|
|
cy.get('[data-testid="profiler"]').should('be.visible').click();
|
2022-09-19 18:43:39 +05:30
|
|
|
};
|
2023-11-11 00:08:32 +05:30
|
|
|
const clickOnTestSuite = (testSuiteName) => {
|
|
|
|
cy.get('[data-testid="test-suite-container"]').then(($body) => {
|
|
|
|
if ($body.find(`[data-testid="${testSuiteName}"]`).length) {
|
|
|
|
cy.get(`[data-testid="${testSuiteName}"]`).scrollIntoView().click();
|
|
|
|
} else {
|
|
|
|
if ($body.find('[data-testid="next"]').length) {
|
|
|
|
cy.get('[data-testid="next"]').click();
|
|
|
|
verifyResponseStatusCode('@testSuite', 200);
|
|
|
|
clickOnTestSuite(testSuiteName);
|
|
|
|
} else {
|
|
|
|
throw new Error('Test Suite not found');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const visitTestSuiteDetailsPage = (testSuiteName) => {
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/dataQuality/testSuites?*testSuiteType=logical*',
|
|
|
|
'testSuite'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
2024-01-16 13:09:37 +05:30
|
|
|
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_QUALITY);
|
2024-01-16 13:09:37 +05:30
|
|
|
|
2023-11-11 00:08:32 +05:30
|
|
|
cy.get('[data-testid="by-test-suites"]').click();
|
|
|
|
verifyResponseStatusCode('@testSuite', 200);
|
|
|
|
clickOnTestSuite(testSuiteName);
|
|
|
|
};
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
describe(
|
|
|
|
'Data Quality and Profiler should work properly',
|
|
|
|
{ tags: 'Observability' },
|
|
|
|
() => {
|
2024-03-07 17:06:33 +05:30
|
|
|
const mySql = new MysqlIngestionClass();
|
2024-02-17 12:06:59 +05:30
|
|
|
before(() => {
|
|
|
|
cy.login();
|
|
|
|
cy.getAllLocalStorage().then((data) => {
|
2024-03-15 03:02:42 +05:30
|
|
|
const token = getToken(data);
|
2024-02-17 12:06:59 +05:30
|
|
|
|
|
|
|
createEntityTable({
|
|
|
|
token,
|
|
|
|
...DATABASE_SERVICE,
|
|
|
|
tables: [DATABASE_SERVICE.entity],
|
|
|
|
});
|
2023-11-23 21:37:26 +05:30
|
|
|
|
|
|
|
cy.request({
|
|
|
|
method: 'POST',
|
2024-02-17 12:06:59 +05:30
|
|
|
url: `/api/v1/dataQuality/testSuites/executable`,
|
2023-11-23 21:37:26 +05:30
|
|
|
headers: { Authorization: `Bearer ${token}` },
|
2024-02-17 12:06:59 +05:30
|
|
|
body: testSuite,
|
|
|
|
}).then(() => {
|
|
|
|
cy.request({
|
|
|
|
method: 'POST',
|
|
|
|
url: `/api/v1/dataQuality/testCases`,
|
|
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
|
|
body: testCase1,
|
|
|
|
}).then((response) => {
|
|
|
|
testCaseId = response.body.id;
|
|
|
|
});
|
|
|
|
cy.request({
|
|
|
|
method: 'POST',
|
|
|
|
url: `/api/v1/dataQuality/testCases`,
|
|
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
|
|
body: testCase2,
|
|
|
|
});
|
2023-11-23 21:37:26 +05:30
|
|
|
});
|
2024-02-17 12:06:59 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
cy.login();
|
|
|
|
cy.getAllLocalStorage().then((data) => {
|
2024-03-15 03:02:42 +05:30
|
|
|
const token = getToken(data);
|
2024-01-19 22:21:15 +05:30
|
|
|
cy.request({
|
2024-02-17 12:06:59 +05:30
|
|
|
method: 'DELETE',
|
|
|
|
url: `/api/v1/dataQuality/testCases/${testCaseId}?hardDelete=true&recursive=false`,
|
2024-01-19 22:21:15 +05:30
|
|
|
headers: { Authorization: `Bearer ${token}` },
|
2024-02-17 12:06:59 +05:30
|
|
|
});
|
|
|
|
hardDeleteService({
|
|
|
|
token,
|
|
|
|
serviceFqn: DATABASE_SERVICE.service.name,
|
|
|
|
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
|
2024-01-19 22:21:15 +05:30
|
|
|
});
|
2023-11-23 21:37:26 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
cy.login();
|
|
|
|
interceptURL('GET', `/api/v1/tables/*/systemProfile?*`, 'systemProfile');
|
|
|
|
interceptURL('GET', `/api/v1/tables/*/tableProfile?*`, 'tableProfile');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Add and ingest mysql data', () => {
|
2024-03-07 17:06:33 +05:30
|
|
|
goToServiceListingPage(Services.Database);
|
2024-02-17 12:06:59 +05:30
|
|
|
|
2024-03-07 17:06:33 +05:30
|
|
|
mySql.createService();
|
2024-02-17 12:06:59 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('Add Profiler ingestion', () => {
|
|
|
|
interceptURL(
|
|
|
|
'POST',
|
|
|
|
'/api/v1/services/ingestionPipelines/deploy/*',
|
|
|
|
'deployIngestion'
|
|
|
|
);
|
|
|
|
|
|
|
|
goToProfilerTab();
|
|
|
|
|
|
|
|
cy.get('[data-testid="no-profiler-placeholder"]').should('be.visible');
|
|
|
|
cy.clickOnLogo();
|
|
|
|
|
|
|
|
cy.settingClick(GlobalSettingOptions.DATABASES);
|
|
|
|
|
|
|
|
cy.intercept('/api/v1/services/ingestionPipelines?*').as('ingestionData');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/system/config/pipeline-service-client',
|
|
|
|
'airflow'
|
|
|
|
);
|
|
|
|
searchServiceFromSettingPage(serviceName);
|
|
|
|
cy.get(`[data-testid="service-name-${serviceName}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="tabs"]').should('exist');
|
|
|
|
cy.wait('@ingestionData');
|
|
|
|
verifyResponseStatusCode('@airflow', 200);
|
|
|
|
cy.get('[data-testid="ingestions"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="ingestion-details-container"]').should('exist');
|
|
|
|
cy.get('[data-testid="add-new-ingestion-button"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-menu-id*="profiler"')
|
|
|
|
.scrollIntoView()
|
|
|
|
.contains('Profiler Ingestion')
|
|
|
|
.click();
|
|
|
|
cy.get('#root\\/profileSample')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.and('not.be.disabled')
|
2024-03-07 17:06:33 +05:30
|
|
|
.type('10');
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="submit-btn"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
scheduleIngestion(false);
|
|
|
|
|
|
|
|
cy.wait('@deployIngestion').then(() => {
|
|
|
|
cy.get('[data-testid="view-service-button"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2024-03-07 17:06:33 +05:30
|
|
|
handleIngestionRetry(0, 'profiler');
|
2023-11-23 21:37:26 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Verifying profiler ingestion', () => {
|
|
|
|
goToProfilerTab();
|
|
|
|
cy.get('[data-testid="no-profiler-placeholder"]').should('not.exist');
|
|
|
|
});
|
2023-01-15 18:24:10 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Add table test case', () => {
|
|
|
|
const term = TEAM_ENTITY;
|
|
|
|
goToProfilerTab();
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/tables/name/${serviceName}.*.${term}?include=all`,
|
|
|
|
'addTableTestPage'
|
|
|
|
);
|
|
|
|
verifyResponseStatusCode('@systemProfile', 200);
|
|
|
|
verifyResponseStatusCode('@tableProfile', 200);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
|
|
|
cy.get('[data-testid="table"]').click();
|
|
|
|
|
|
|
|
// creating new test case
|
|
|
|
cy.get('#tableTestForm_testTypeId').scrollIntoView().click();
|
|
|
|
cy.contains(NEW_TABLE_TEST_CASE.label).should('be.visible').click();
|
|
|
|
cy.get('#tableTestForm_testName').type(NEW_TABLE_TEST_CASE.name);
|
|
|
|
cy.get('#tableTestForm_params_columnName').type(
|
|
|
|
NEW_TABLE_TEST_CASE.field
|
|
|
|
);
|
|
|
|
cy.get(descriptionBox).scrollIntoView();
|
|
|
|
cy.get(descriptionBox).type(NEW_TABLE_TEST_CASE.description);
|
|
|
|
|
|
|
|
cy.get('[data-testid="submit-test"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="success-line"]')
|
2023-04-17 19:23:23 +05:30
|
|
|
.scrollIntoView()
|
2024-02-17 12:06:59 +05:30
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="add-ingestion-button"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
scheduleIngestion(false);
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="success-line"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
2022-12-13 23:42:29 +05:30
|
|
|
|
|
|
|
cy.get('[data-testid="view-service-button"]')
|
2022-12-02 15:43:12 +05:30
|
|
|
.should('be.visible')
|
2024-02-17 12:06:59 +05:30
|
|
|
.click({ force: true });
|
|
|
|
|
|
|
|
verifyResponseStatusCode('@getEntityDetails', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.contains(NEW_TABLE_TEST_CASE.name).should('be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Edit table test case', () => {
|
|
|
|
goToProfilerTab();
|
|
|
|
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
2022-12-13 23:42:29 +05:30
|
|
|
.click();
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get(`[data-testid="${NEW_TABLE_TEST_CASE.name}"]`).should(
|
|
|
|
'be.visible'
|
|
|
|
);
|
|
|
|
cy.get(`[data-testid="edit-${NEW_TABLE_TEST_CASE.name}"]`).click();
|
|
|
|
cy.get('#tableTestForm_params_columnName')
|
|
|
|
.scrollIntoView()
|
|
|
|
.clear()
|
|
|
|
.type('test');
|
|
|
|
interceptURL('PATCH', '/api/v1/dataQuality/testCases/*', 'updateTest');
|
|
|
|
cy.get('.ant-modal-footer').contains('Submit').click();
|
|
|
|
verifyResponseStatusCode('@updateTest', 200);
|
|
|
|
cy.get('.Toastify__toast-body')
|
|
|
|
.contains('Test case updated successfully.')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
cy.get(`[data-testid="edit-${NEW_TABLE_TEST_CASE.name}"]`).click();
|
|
|
|
cy.get('#tableTestForm_params_columnName').should('have.value', 'test');
|
2022-12-13 23:42:29 +05:30
|
|
|
});
|
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Add Column test case with min max params', () => {
|
|
|
|
goToProfilerTab();
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/tables/name/${serviceName}.*.${TEAM_ENTITY}?include=all`,
|
|
|
|
'addTableTestPage'
|
|
|
|
);
|
|
|
|
verifyResponseStatusCode('@systemProfile', 200);
|
|
|
|
verifyResponseStatusCode('@tableProfile', 200);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
|
|
|
cy.get('[data-testid="column"]').click();
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
// creating new test case
|
|
|
|
cy.get('#tableTestForm_column').click();
|
|
|
|
cy.get(`[title="${NEW_COLUMN_TEST_CASE.column}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
cy.get('#tableTestForm_testName').type(NEW_COLUMN_TEST_CASE.name);
|
|
|
|
cy.get('#tableTestForm_testTypeId').scrollIntoView().click();
|
|
|
|
cy.get(`[title="${NEW_COLUMN_TEST_CASE.label}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
cy.get('#tableTestForm_params_minLength')
|
|
|
|
.scrollIntoView()
|
|
|
|
.type(NEW_COLUMN_TEST_CASE.min);
|
|
|
|
cy.get('#tableTestForm_params_maxLength')
|
|
|
|
.scrollIntoView()
|
|
|
|
.type(NEW_COLUMN_TEST_CASE.max);
|
|
|
|
cy.get(descriptionBox)
|
|
|
|
.scrollIntoView()
|
|
|
|
.type(NEW_COLUMN_TEST_CASE.description);
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="submit-test"]').scrollIntoView().click();
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="success-line"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.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('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
cy.contains(NEW_COLUMN_TEST_CASE.name)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
2023-02-03 16:30:50 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Add column test case for columnValuesToBeNotNull', () => {
|
|
|
|
// Creating new test case and selecting Null team type
|
|
|
|
|
|
|
|
goToProfilerTab();
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/tables/name/${serviceName}.*.${TEAM_ENTITY}?include=all`,
|
|
|
|
'addTableTestPage'
|
|
|
|
);
|
|
|
|
verifyResponseStatusCode('@systemProfile', 200);
|
|
|
|
verifyResponseStatusCode('@tableProfile', 200);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
|
|
|
cy.get('[data-testid="column"]').click();
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('#tableTestForm_column').click();
|
|
|
|
cy.get(`[title="${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.column}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
cy.get('#tableTestForm_testName').type(
|
|
|
|
NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.name
|
|
|
|
);
|
|
|
|
cy.get('#tableTestForm_testTypeId').type(
|
|
|
|
NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.type
|
|
|
|
);
|
|
|
|
cy.get(`[title="${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.label}"]`).click();
|
|
|
|
cy.get(descriptionBox)
|
|
|
|
.scrollIntoView()
|
|
|
|
.type(NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.description);
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="submit-test"]').scrollIntoView().click();
|
2022-09-19 18:43:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
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('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
cy.get(
|
|
|
|
`[data-testid="${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.name}"]`
|
|
|
|
).should('contain', NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.name);
|
|
|
|
});
|
2023-03-10 14:30:53 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Edit column test case should work properly', () => {
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'testCase');
|
|
|
|
goToProfilerTab();
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
2024-03-13 12:54:17 +05:30
|
|
|
.contains('Data Quality')
|
2024-02-17 12:06:59 +05:30
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get(`[data-testid="${NEW_COLUMN_TEST_CASE.name}"]`).should(
|
|
|
|
'be.visible'
|
|
|
|
);
|
|
|
|
cy.get(`[data-testid="edit-${NEW_COLUMN_TEST_CASE.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('#tableTestForm_params_minLength')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.clear()
|
2024-03-07 17:06:33 +05:30
|
|
|
.type('4');
|
2024-02-17 12:06:59 +05:30
|
|
|
interceptURL('PATCH', '/api/v1/dataQuality/testCases/*', 'updateTest');
|
|
|
|
cy.get('.ant-modal-footer').contains('Submit').click();
|
|
|
|
verifyResponseStatusCode('@updateTest', 200);
|
|
|
|
cy.get('.Toastify__toast-body')
|
|
|
|
.contains('Test case updated successfully.')
|
|
|
|
.should('be.visible');
|
2024-01-08 15:23:39 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get(`[data-testid="edit-${NEW_COLUMN_TEST_CASE.name}"]`).click();
|
|
|
|
cy.get('#tableTestForm_params_minLength').should('have.value', '4');
|
|
|
|
cy.get('.ant-modal-footer').contains('Cancel').click();
|
2023-03-10 14:30:53 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
// Editing Non Team Type Test Case
|
|
|
|
cy.get(
|
|
|
|
`[data-testid="${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.name}"]`
|
|
|
|
).should('be.visible');
|
|
|
|
cy.get(`[data-testid="edit-${NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('.ant-modal-footer').contains('Cancel').click();
|
|
|
|
});
|
2023-03-10 14:30:53 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Delete Column Test Case should work properly', () => {
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'testCase');
|
|
|
|
goToProfilerTab();
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
2024-03-13 12:54:17 +05:30
|
|
|
.contains('Data Quality')
|
2024-02-17 12:06:59 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
[NEW_COLUMN_TEST_CASE.name, NEW_COLUMN_TEST_CASE_WITH_NULL_TYPE.name].map(
|
|
|
|
(test) => {
|
|
|
|
cy.get(`[data-testid="${test}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get(`[data-testid="delete-${test}"]`).scrollIntoView().click();
|
|
|
|
cy.get('[data-testid="hard-delete-option"]').click();
|
|
|
|
cy.get('[data-testid="confirmation-text-input"]').type(DELETE_TERM);
|
|
|
|
interceptURL(
|
|
|
|
'DELETE',
|
|
|
|
'/api/v1/dataQuality/testCases/*?hardDelete=true&recursive=false',
|
|
|
|
'deleteTest'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'getTestCase');
|
|
|
|
cy.get('[data-testid="confirm-button"]').click();
|
|
|
|
verifyResponseStatusCode('@deleteTest', 200);
|
|
|
|
verifyResponseStatusCode('@getTestCase', 200);
|
|
|
|
toastNotification(`"${test}" deleted successfully!`);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2022-10-13 15:27:06 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Create logical test suite', () => {
|
|
|
|
const testCaseName = 'column_value_max_to_be_between';
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/dataQuality/testSuites?*testSuiteType=logical*',
|
|
|
|
'testSuite'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?q=*&index=test_case_search_index*',
|
|
|
|
'getTestCase'
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.sidebarClick(SidebarItem.DATA_QUALITY);
|
|
|
|
|
|
|
|
cy.get('[data-testid="by-test-suites"]').click();
|
|
|
|
verifyResponseStatusCode('@testSuite', 200);
|
|
|
|
cy.get('[data-testid="add-test-suite-btn"]').click();
|
|
|
|
|
|
|
|
// creating test suite
|
|
|
|
cy.get('[data-testid="test-suite-name"]').type(NEW_TEST_SUITE.name);
|
|
|
|
cy.get(descriptionBox).scrollIntoView().type(NEW_TEST_SUITE.description);
|
|
|
|
|
|
|
|
cy.get('[data-testid="submit-button"]').click();
|
|
|
|
cy.get('[data-testid="searchbar"]').type(testCaseName);
|
|
|
|
verifyResponseStatusCode('@getTestCase', 200);
|
|
|
|
cy.get(`[data-testid="${testCaseName}"]`).scrollIntoView().as('testCase');
|
|
|
|
cy.get('@testCase').click();
|
|
|
|
cy.get('[data-testid="submit"]').scrollIntoView().click();
|
|
|
|
|
|
|
|
cy.get('[data-testid="success-line"]').should(
|
|
|
|
'contain',
|
|
|
|
'has been created successfully'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('User as Owner assign, update & delete for test suite', () => {
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?q=*&index=test_case_search_index*',
|
|
|
|
'searchTestCase'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
interceptURL(
|
|
|
|
'PUT',
|
|
|
|
'/api/v1/dataQuality/testCases/logicalTestCases',
|
|
|
|
'putTestCase'
|
|
|
|
);
|
|
|
|
|
|
|
|
visitTestSuiteDetailsPage(NEW_TEST_SUITE.name);
|
|
|
|
|
|
|
|
addOwner(OWNER1);
|
|
|
|
updateOwner(OWNER2);
|
|
|
|
removeOwner(OWNER2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Add test case to logical test suite', () => {
|
|
|
|
const testCaseName = 'column_values_to_be_between';
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?q=*&index=test_case_search_index*',
|
|
|
|
'searchTestCase'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
interceptURL(
|
|
|
|
'PUT',
|
|
|
|
'/api/v1/dataQuality/testCases/logicalTestCases',
|
|
|
|
'putTestCase'
|
|
|
|
);
|
|
|
|
|
|
|
|
visitTestSuiteDetailsPage(NEW_TEST_SUITE.name);
|
|
|
|
|
|
|
|
cy.get('[data-testid="add-test-case-btn"]').click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="searchbar"]').type(testCaseName);
|
|
|
|
verifyResponseStatusCode('@searchTestCase', 200);
|
|
|
|
cy.get(`[data-testid="${testCaseName}"]`)
|
2023-08-10 12:30:16 +05:30
|
|
|
.scrollIntoView()
|
2024-02-17 12:06:59 +05:30
|
|
|
.as('newTestCase');
|
|
|
|
cy.get('@newTestCase').click();
|
|
|
|
cy.get('[data-testid="submit"]').scrollIntoView().click();
|
|
|
|
verifyResponseStatusCode('@putTestCase', 200);
|
|
|
|
});
|
|
|
|
|
|
|
|
it.skip('Remove test case from logical test suite', () => {
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/permissions/testSuite/name/mysql_matrix',
|
|
|
|
'testSuitePermission'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'DELETE',
|
|
|
|
'/api/v1/dataQuality/testCases/logicalTestCases/*/*',
|
|
|
|
'removeTestCase'
|
|
|
|
);
|
|
|
|
visitTestSuiteDetailsPage(NEW_TEST_SUITE.name);
|
|
|
|
verifyResponseStatusCode('@testSuitePermission', 200);
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="remove-column_values_to_be_between"]').click();
|
|
|
|
cy.get('[data-testid="save-button"]').click();
|
|
|
|
verifyResponseStatusCode('@removeTestCase', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="remove-column_value_max_to_be_between"]').click();
|
|
|
|
cy.get('[data-testid="save-button"]').click();
|
|
|
|
verifyResponseStatusCode('@removeTestCase', 200);
|
|
|
|
});
|
|
|
|
|
|
|
|
it.skip('Delete test suite', () => {
|
|
|
|
visitTestSuiteDetailsPage(NEW_TEST_SUITE.name);
|
|
|
|
|
|
|
|
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
|
|
|
|
|
|
|
cy.get('[data-testid="delete-button"]').should('be.visible').click();
|
|
|
|
|
|
|
|
// Click on Permanent/Hard delete option
|
|
|
|
cy.get('[data-testid="hard-delete-option"]')
|
|
|
|
.should('contain', NEW_TEST_SUITE.name)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.disabled');
|
|
|
|
|
|
|
|
cy.get('[data-testid="confirmation-text-input"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(DELETE_TERM);
|
|
|
|
interceptURL(
|
|
|
|
'DELETE',
|
|
|
|
'/api/v1/dataQuality/testSuites/*?hardDelete=true&recursive=true',
|
|
|
|
'deleteTestSuite'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.should('not.be.disabled')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@deleteTestSuite', 200);
|
|
|
|
|
|
|
|
toastNotification('Test Suite deleted successfully!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('delete created service', () => {
|
2024-03-07 17:06:33 +05:30
|
|
|
goToServiceListingPage(Services.Database);
|
|
|
|
mySql.deleteService();
|
2024-02-17 12:06:59 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('Profiler matrix and test case graph should visible', () => {
|
|
|
|
const { term, entity, serviceName, testCaseName } =
|
|
|
|
DATA_QUALITY_SAMPLE_DATA_TABLE;
|
|
|
|
visitEntityDetailsPage({ term, serviceName, entity });
|
|
|
|
cy.get('[data-testid="entity-header-display-name"]')
|
|
|
|
.contains(term)
|
2023-08-10 12:30:16 +05:30
|
|
|
.should('be.visible');
|
2024-02-17 12:06:59 +05:30
|
|
|
|
|
|
|
cy.get('[data-testid="profiler"]').should('be.visible').click();
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/tables/*/columnProfile?*',
|
|
|
|
'getProfilerInfo'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'getTestCaseInfo');
|
|
|
|
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Column Profile')
|
|
|
|
.click();
|
2024-03-13 12:54:17 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-row-key="shop_id"]')
|
|
|
|
.contains('shop_id')
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@getProfilerInfo', 200);
|
2024-03-13 12:54:17 +05:30
|
|
|
verifyResponseStatusCode('@getTestCaseInfo', 200);
|
2024-02-17 12:06:59 +05:30
|
|
|
|
|
|
|
cy.get('#count_graph').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('#proportion_graph').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('#math_graph').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('#sum_graph').scrollIntoView().should('be.visible');
|
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/dataQuality/testCases/name/*?fields=*',
|
|
|
|
'getTestCaseDetails'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/dataQuality/testCases/*/testCaseResult?*',
|
|
|
|
'getTestResult'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get(`[data-testid="${testCaseName}"]`).contains(testCaseName).click();
|
|
|
|
verifyResponseStatusCode('@getTestCaseDetails', 200);
|
|
|
|
cy.wait('@getTestResult').then(() => {
|
|
|
|
cy.get(`[id="${testCaseName}_graph"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
2023-08-10 12:30:16 +05:30
|
|
|
});
|
2022-12-13 23:42:29 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('SQL query should be visible while editing the test case', () => {
|
|
|
|
const {
|
|
|
|
term,
|
|
|
|
entity,
|
|
|
|
serviceName,
|
|
|
|
sqlTestCase,
|
|
|
|
sqlQuery,
|
|
|
|
sqlTestCaseName,
|
|
|
|
} = DATA_QUALITY_SAMPLE_DATA_TABLE;
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/tables/name/${serviceName}.*.${term}?fields=*&include=all`,
|
|
|
|
'waitForPageLoad'
|
|
|
|
);
|
|
|
|
visitEntityDetailsPage({ term, serviceName, entity });
|
|
|
|
verifyResponseStatusCode('@waitForPageLoad', 200);
|
|
|
|
cy.get('[data-testid="entity-header-display-name"]').should(
|
|
|
|
'contain',
|
|
|
|
term
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.get('[data-testid="profiler"]').click();
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
|
|
|
cy.get('[data-testid="table"]').click();
|
|
|
|
|
|
|
|
// creating new test case
|
|
|
|
cy.get('#tableTestForm_testName').type(sqlTestCaseName);
|
|
|
|
cy.get('#tableTestForm_testTypeId').scrollIntoView().click();
|
|
|
|
cy.contains(sqlTestCase).should('be.visible').click();
|
|
|
|
cy.get('.CodeMirror-scroll')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(sqlQuery);
|
|
|
|
cy.get(descriptionBox).scrollIntoView().type(sqlTestCase);
|
|
|
|
|
|
|
|
cy.get('[data-testid="submit-test"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/dataQuality/testDefinitions/*',
|
|
|
|
'testCaseDefinition'
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.get('[data-testid="success-line"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="view-service-button"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get('[data-testid="my_sql_test_case_cypress"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="edit-my_sql_test_case_cypress"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2023-11-23 21:37:26 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
verifyResponseStatusCode('@testCaseDefinition', 200);
|
|
|
|
cy.get('#tableTestForm').should('be.visible');
|
|
|
|
cy.get('.CodeMirror-scroll')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(sqlQuery);
|
2024-01-19 22:21:15 +05:30
|
|
|
});
|
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
it('Array params value should be visible while editing the test case', () => {
|
|
|
|
const tableName = DATABASE_SERVICE.entity.name;
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/tables/name/${DATABASE_SERVICE.service.name}.*.${tableName}?fields=*&include=all`,
|
|
|
|
'waitForPageLoad'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/dataQuality/testDefinitions/*',
|
|
|
|
'testCaseDefinition'
|
|
|
|
);
|
|
|
|
visitEntityDetailsPage({
|
|
|
|
term: tableName,
|
|
|
|
serviceName: DATABASE_SERVICE.service.name,
|
2024-03-07 17:06:33 +05:30
|
|
|
entity: EntityType.Table,
|
2023-11-23 21:37:26 +05:30
|
|
|
});
|
2024-02-17 12:06:59 +05:30
|
|
|
verifyResponseStatusCode('@waitForPageLoad', 200);
|
|
|
|
cy.get('[data-testid="entity-header-display-name"]').should(
|
|
|
|
'contain',
|
|
|
|
tableName
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.get('[data-testid="profiler"]').click();
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?fields=*', 'testCase');
|
|
|
|
cy.get('[data-testid="profiler-tab-left-panel"]')
|
|
|
|
.contains('Data Quality')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@testCase', 200);
|
|
|
|
cy.get(`[data-testid="${testCase2.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get(`[data-testid="edit-${testCase2.name}"]`)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2023-12-12 19:04:03 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
verifyResponseStatusCode('@testCaseDefinition', 200);
|
|
|
|
|
|
|
|
cy.get('#tableTestForm_params_allowedValues_0_value')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('have.value', 'gmail');
|
|
|
|
cy.get('#tableTestForm_params_allowedValues_1_value')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('have.value', 'yahoo');
|
|
|
|
cy.get('#tableTestForm_params_allowedValues_2_value')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('have.value', 'collate');
|
2023-12-12 19:04:03 +05:30
|
|
|
});
|
2024-02-17 12:06:59 +05:30
|
|
|
|
|
|
|
it('Update displayName of test case', () => {
|
|
|
|
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'getTestCase');
|
|
|
|
|
|
|
|
cy.sidebarClick(SidebarItem.DATA_QUALITY);
|
|
|
|
|
|
|
|
cy.get('[data-testid="by-test-cases"]').click();
|
|
|
|
verifyResponseStatusCode('@getTestCase', 200);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/search/query?q=*${testCase1.name}*&index=test_case_search_index*`,
|
|
|
|
'searchTestCase'
|
|
|
|
);
|
|
|
|
cy.get(
|
|
|
|
'[data-testid="test-case-container"] [data-testid="searchbar"]'
|
|
|
|
).type(testCase1.name);
|
|
|
|
verifyResponseStatusCode('@searchTestCase', 200);
|
|
|
|
cy.get(`[data-testid="${testCase1.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get(`[data-testid="edit-${testCase1.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="${testCase1.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.invoke('text')
|
|
|
|
.then((text) => {
|
|
|
|
expect(text).to.eq('Table test case display name');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Update profiler setting modal', () => {
|
|
|
|
const profilerSetting = {
|
2024-03-07 17:06:33 +05:30
|
|
|
profileSample: '60',
|
|
|
|
sampleDataCount: '100',
|
2024-02-17 12:06:59 +05:30
|
|
|
profileQuery: 'select * from table',
|
|
|
|
excludeColumns: 'user_id',
|
|
|
|
includeColumns: 'shop_id',
|
|
|
|
partitionColumnName: 'name',
|
|
|
|
partitionIntervalType: 'COLUMN-VALUE',
|
|
|
|
partitionValues: 'test',
|
|
|
|
};
|
2024-03-07 17:06:33 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/tables/*/tableProfile?startTs=*',
|
|
|
|
'tableProfiler'
|
|
|
|
);
|
2024-02-17 12:06:59 +05:30
|
|
|
interceptURL('GET', '/api/v1/tables/*/systemProfile?*', 'systemProfiler');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
2024-03-07 17:06:33 +05:30
|
|
|
'/api/v1/tables/*/tableProfilerConfig',
|
2024-02-17 12:06:59 +05:30
|
|
|
'tableProfilerConfig'
|
|
|
|
);
|
|
|
|
visitEntityDetailsPage({
|
|
|
|
term: DATABASE_SERVICE.entity.name,
|
|
|
|
serviceName: DATABASE_SERVICE.service.name,
|
2024-03-07 17:06:33 +05:30
|
|
|
entity: EntityType.Table,
|
2023-12-12 19:04:03 +05:30
|
|
|
});
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="profiler"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@tableProfiler', 200);
|
|
|
|
verifyResponseStatusCode('@systemProfiler', 200);
|
|
|
|
cy.get('[data-testid="profiler-setting-btn"]').click();
|
|
|
|
cy.get('.ant-modal-body').should('be.visible');
|
2024-04-01 14:28:18 +05:30
|
|
|
verifyResponseStatusCode('@tableProfilerConfig', 200);
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="slider-input"]')
|
|
|
|
.clear()
|
|
|
|
.type(profilerSetting.profileSample);
|
|
|
|
cy.get('[data-testid="sample-data-count-input"]')
|
|
|
|
.clear()
|
|
|
|
.type(profilerSetting.sampleDataCount);
|
|
|
|
cy.get('[data-testid="exclude-column-select"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.type(`${profilerSetting.excludeColumns}{enter}`);
|
|
|
|
cy.clickOutside();
|
|
|
|
cy.get('.CodeMirror-scroll')
|
|
|
|
.scrollIntoView()
|
|
|
|
.click()
|
|
|
|
.type(profilerSetting.profileQuery);
|
2023-12-12 19:04:03 +05:30
|
|
|
|
2024-02-17 12:06:59 +05:30
|
|
|
cy.get('[data-testid="include-column-select"]').scrollIntoView().click();
|
|
|
|
cy.get('.ant-select-dropdown')
|
|
|
|
.not('.ant-select-dropdown-hidden')
|
|
|
|
.find(`[title="${profilerSetting.includeColumns}"]`)
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="enable-partition-switch"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="interval-type"]').scrollIntoView().click();
|
|
|
|
cy.get('.ant-select-dropdown')
|
|
|
|
.not('.ant-select-dropdown-hidden')
|
|
|
|
.find(`[title="${profilerSetting.partitionIntervalType}"]`)
|
|
|
|
.click();
|
|
|
|
cy.get('#includeColumnsProfiler_partitionColumnName').click();
|
|
|
|
cy.get('.ant-select-dropdown')
|
|
|
|
.not('.ant-select-dropdown-hidden')
|
|
|
|
.find(`[title="${profilerSetting.partitionColumnName}"]`)
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="partition-value"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.type(profilerSetting.partitionValues);
|
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'PUT',
|
|
|
|
'/api/v1/tables/*/tableProfilerConfig',
|
|
|
|
'updateTableProfilerConfig'
|
|
|
|
);
|
|
|
|
cy.get('.ant-modal-footer').contains('Save').scrollIntoView().click();
|
|
|
|
cy.wait('@updateTableProfilerConfig').then(({ request }) => {
|
|
|
|
expect(request.body).to.deep.equal({
|
|
|
|
excludeColumns: ['user_id'],
|
|
|
|
profileQuery: 'select * from table',
|
|
|
|
profileSample: 60,
|
|
|
|
profileSampleType: 'PERCENTAGE',
|
|
|
|
includeColumns: [{ columnName: 'shop_id' }],
|
|
|
|
partitioning: {
|
|
|
|
partitionColumnName: 'name',
|
|
|
|
partitionIntervalType: 'COLUMN-VALUE',
|
|
|
|
partitionValues: ['test'],
|
|
|
|
enablePartitioning: true,
|
|
|
|
},
|
|
|
|
sampleDataCount: 100,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
cy.get('[data-testid="table_queries"]').click();
|
|
|
|
cy.get('[data-testid="profiler"]').click();
|
|
|
|
// verify profiler setting details
|
|
|
|
cy.get('[data-testid="profiler-setting-btn"]').click();
|
|
|
|
verifyResponseStatusCode('@tableProfilerConfig', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="slider-input"]').should(
|
|
|
|
'have.value',
|
|
|
|
`${profilerSetting.profileSample}%`
|
|
|
|
);
|
|
|
|
cy.get('.CodeMirror-scroll').should(
|
|
|
|
'contain',
|
|
|
|
profilerSetting.profileQuery
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="exclude-column-select"]').should(
|
|
|
|
'contain',
|
|
|
|
profilerSetting.excludeColumns
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="enable-partition-switch"]').should(
|
|
|
|
'have.value',
|
|
|
|
'true'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="interval-type"]').should(
|
|
|
|
'contain',
|
|
|
|
profilerSetting.partitionIntervalType
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="column-name"]').should(
|
|
|
|
'contain',
|
|
|
|
profilerSetting.partitionColumnName
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="partition-value"]').should(
|
|
|
|
'have.value',
|
|
|
|
profilerSetting.partitionValues
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|