mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-24 17:59:52 +00:00
UI : Fix Test cases breaking issue while editing (#10095)
* Fix Test cases while edit * Added cypress for null test type * fix unit test issue
This commit is contained in:
parent
852edc74d3
commit
942b553edc
@ -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',
|
||||
|
@ -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');
|
||||
|
@ -69,7 +69,7 @@ const EditTestCaseModal: React.FC<EditTestCaseModalProps> = ({
|
||||
|
||||
const GenerateParamsField = useCallback(() => {
|
||||
if (selectedDefinition && selectedDefinition.parameterDefinition) {
|
||||
const name = selectedDefinition.parameterDefinition[0].name;
|
||||
const name = selectedDefinition.parameterDefinition[0]?.name;
|
||||
if (name === 'sqlExpression') {
|
||||
return (
|
||||
<Form.Item
|
||||
@ -166,7 +166,7 @@ const EditTestCaseModal: React.FC<EditTestCaseModalProps> = ({
|
||||
(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,
|
||||
|
@ -63,7 +63,7 @@ jest.mock('../containers/PageLayout', () => {
|
||||
return jest
|
||||
.fn()
|
||||
.mockImplementation(({ children }) => (
|
||||
<div data-testid="page-container">{children}</div>
|
||||
<div data-testid="page-layout-v1">{children}</div>
|
||||
));
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
@ -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<ProfilerDashboardProps> = ({
|
||||
}, [table]);
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageLayoutV1>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
<EntityPageInfo
|
||||
@ -575,7 +575,7 @@ const ProfilerDashboard: React.FC<ProfilerDashboardProps> = ({
|
||||
</Col>
|
||||
)}
|
||||
</Row>
|
||||
</PageLayout>
|
||||
</PageLayoutV1>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,11 @@ const PageLayoutV1: FC<PageLayoutProp> = ({
|
||||
center = false,
|
||||
}: PageLayoutProp) => {
|
||||
return (
|
||||
<Row className={className} gutter={[16, 16]} style={pageContainerStyles}>
|
||||
<Row
|
||||
className={className}
|
||||
data-testid="page-layout-v1"
|
||||
gutter={[16, 16]}
|
||||
style={pageContainerStyles}>
|
||||
{leftPanel && (
|
||||
<Col
|
||||
className="page-layout-v1-vertical-scroll"
|
||||
|
Loading…
x
Reference in New Issue
Block a user