mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-05 12:07:10 +00:00
cypress: fixed e2e cypress test (#12715)
* ui: fixed multiple API call in table profiler tab * fixed welcome screen alignment issue * cypress: fixed e2e cypress failure * fixed setting modal issue * encoded url for data quality * revert isLoading changes in tableprofilerV1 tab * fixed multi-api call on tab switch --------- Co-authored-by: Ashish Gupta <ashish@getcollate.io>
This commit is contained in:
parent
73b58011d4
commit
94fbbe5d98
@ -38,12 +38,54 @@ const reactOnFeed = (feedSelector, reaction) => {
|
||||
).click();
|
||||
};
|
||||
|
||||
describe('Recently viwed data assets', () => {
|
||||
describe('Activity feed', () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
cy.get("[data-testid='welcome-screen-close-btn']").click();
|
||||
});
|
||||
|
||||
it('Create feed', () => {
|
||||
interceptURL('GET', '/api/v1/permissions/*/name/*', 'entityPermission');
|
||||
interceptURL('GET', '/api/v1/feed/count?entityLink=*', 'activityFeed');
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/search/query?q=**teamType:Group&from=0&size=15&index=team_search_index',
|
||||
'getTeams'
|
||||
);
|
||||
interceptURL('GET', '/api/v1/users?&isBot=false&limit=15', 'getUsers');
|
||||
const value = SEARCH_ENTITY_TABLE.table_4;
|
||||
const OWNER = 'admin';
|
||||
interceptURL('PATCH', `/api/v1/${value.entity}/*`, 'patchOwner');
|
||||
|
||||
visitEntityDetailsPage(
|
||||
value.term,
|
||||
value.serviceName,
|
||||
value.entity,
|
||||
undefined,
|
||||
value.entityType
|
||||
);
|
||||
verifyResponseStatusCode('@entityPermission', 200);
|
||||
verifyResponseStatusCode('@activityFeed', 200);
|
||||
|
||||
cy.get('[data-testid="edit-owner"]').click();
|
||||
|
||||
cy.get('.ant-tabs [id*=tab-users]').click();
|
||||
verifyResponseStatusCode('@getUsers', 200);
|
||||
|
||||
interceptURL(
|
||||
'GET',
|
||||
`api/v1/search/query?q=*${encodeURI(OWNER)}*`,
|
||||
'searchOwner'
|
||||
);
|
||||
|
||||
cy.get('[data-testid="owner-select-users-search-bar"]').type(OWNER);
|
||||
|
||||
verifyResponseStatusCode('@searchOwner', 200);
|
||||
|
||||
cy.get(`.ant-popover [title="${OWNER}"]`).click();
|
||||
verifyResponseStatusCode('@patchOwner', 200);
|
||||
});
|
||||
|
||||
it('Feed widget should be visible', () => {
|
||||
cy.get('[data-testid="activity-feed-widget"]').as('feedWidget');
|
||||
cy.get('@feedWidget').should('be.visible');
|
||||
|
||||
@ -63,6 +63,8 @@ const goToProfilerTab = () => {
|
||||
describe('Data Quality and Profiler should work properly', () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
interceptURL('GET', `/api/v1/tables/*/systemProfile?*`, 'systemProfile');
|
||||
interceptURL('GET', `/api/v1/tables/*/tableProfile?*`, 'tableProfile');
|
||||
});
|
||||
|
||||
it('Add and ingest mysql data', () => {
|
||||
@ -159,6 +161,8 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
`api/v1/tables/name/${serviceName}.*.${term}?include=all`,
|
||||
'addTableTestPage'
|
||||
);
|
||||
verifyResponseStatusCode('@systemProfile', 200);
|
||||
verifyResponseStatusCode('@tableProfile', 200);
|
||||
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
||||
cy.get('[data-testid="table"]').click();
|
||||
|
||||
@ -263,6 +267,8 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
`api/v1/tables/name/${serviceName}.*.${TEAM_ENTITY}?include=all`,
|
||||
'addTableTestPage'
|
||||
);
|
||||
verifyResponseStatusCode('@systemProfile', 200);
|
||||
verifyResponseStatusCode('@tableProfile', 200);
|
||||
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
||||
cy.get('[data-testid="column"]').click();
|
||||
|
||||
@ -306,6 +312,8 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
`api/v1/tables/name/${serviceName}.*.${TEAM_ENTITY}?include=all`,
|
||||
'addTableTestPage'
|
||||
);
|
||||
verifyResponseStatusCode('@systemProfile', 200);
|
||||
verifyResponseStatusCode('@tableProfile', 200);
|
||||
cy.get('[data-testid="profiler-add-table-test-btn"]').click();
|
||||
cy.get('[data-testid="column"]').click();
|
||||
|
||||
@ -426,11 +434,17 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
});
|
||||
|
||||
it('Create logical test suite', () => {
|
||||
const testCaseName = 'column_value_max_to_be_between';
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/dataQuality/testSuites?fields=*&testSuiteType=logical',
|
||||
'testSuite'
|
||||
);
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/search/query?q=*&index=test_case_search_index*',
|
||||
'getTestCase'
|
||||
);
|
||||
cy.get('[data-testid="appbar-item-data-quality"]').click();
|
||||
cy.get('[data-testid="by-test-suites"]').click();
|
||||
verifyResponseStatusCode('@testSuite', 200);
|
||||
@ -441,8 +455,10 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
cy.get(descriptionBox).scrollIntoView().type(NEW_TEST_SUITE.description);
|
||||
|
||||
cy.get('[data-testid="submit-button"]').click();
|
||||
|
||||
cy.get('[data-testid="column_value_max_to_be_between"]').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(
|
||||
@ -452,6 +468,12 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
});
|
||||
|
||||
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/testSuites?fields=*&testSuiteType=logical',
|
||||
@ -472,7 +494,13 @@ describe('Data Quality and Profiler should work properly', () => {
|
||||
|
||||
cy.get('[data-testid="add-test-case-btn"]').click();
|
||||
verifyResponseStatusCode('@testCase', 200);
|
||||
cy.get('[data-testid="column_values_to_be_between"]').click();
|
||||
|
||||
cy.get('[data-testid="searchbar"]').type(testCaseName);
|
||||
verifyResponseStatusCode('@searchTestCase', 200);
|
||||
cy.get(`[data-testid="${testCaseName}"]`)
|
||||
.scrollIntoView()
|
||||
.as('newTestCase');
|
||||
cy.get('@newTestCase').click();
|
||||
cy.get('[data-testid="submit"]').scrollIntoView().click();
|
||||
verifyResponseStatusCode('@putTestCase', 200);
|
||||
});
|
||||
|
||||
@ -82,7 +82,9 @@ const ActivityFeedListV1 = ({
|
||||
)
|
||||
}
|
||||
type={ERROR_PLACEHOLDER_TYPE.CUSTOM}>
|
||||
<Typography.Paragraph style={{ marginBottom: '0' }}>
|
||||
<Typography.Paragraph
|
||||
className="tw-max-w-md"
|
||||
style={{ marginBottom: '0' }}>
|
||||
{isTaskTab && (
|
||||
<Typography.Text strong>
|
||||
{t('message.no-open-tasks')} <br />
|
||||
|
||||
@ -33,6 +33,7 @@ import {
|
||||
import { useHistory, useParams } from 'react-router-dom';
|
||||
import { createExecutableTestSuite, createTestCase } from 'rest/testAPI';
|
||||
import { getEntityBreadcrumbs, getEntityName } from 'utils/EntityUtils';
|
||||
import { getEncodedFqn } from 'utils/StringsUtils';
|
||||
import { getTableTabPath } from '../../constants/constants';
|
||||
import {
|
||||
allowedServiceForOperationGraph,
|
||||
@ -100,7 +101,7 @@ const AddDataQualityTestV1: React.FC<AddDataQualityTestProps> = ({
|
||||
const handleRedirection = () => {
|
||||
history.push({
|
||||
pathname: getTableTabPath(
|
||||
table.fullyQualifiedName ?? '',
|
||||
getEncodedFqn(table.fullyQualifiedName ?? ''),
|
||||
EntityTabs.PROFILER
|
||||
),
|
||||
search: Qs.stringify({ activeTab: TableProfilerTab.DATA_QUALITY }),
|
||||
|
||||
@ -27,7 +27,7 @@ import { Link } from 'react-router-dom';
|
||||
import { searchQuery } from 'rest/searchAPI';
|
||||
import { getNameFromFQN } from 'utils/CommonUtils';
|
||||
import { getEntityName } from 'utils/EntityUtils';
|
||||
import { getDecodedFqn } from 'utils/StringsUtils';
|
||||
import { replacePlus } from 'utils/StringsUtils';
|
||||
import { getEntityFqnFromEntityLink } from 'utils/TableUtils';
|
||||
import { AddTestCaseModalProps } from './AddTestCaseList.interface';
|
||||
|
||||
@ -212,12 +212,11 @@ export const AddTestCaseList = ({
|
||||
)}:`}</Typography.Text>
|
||||
<Typography.Text className="text-grey-muted text-xs">
|
||||
{getNameFromFQN(
|
||||
getDecodedFqn(
|
||||
replacePlus(
|
||||
getEntityFqnFromEntityLink(
|
||||
test.entityLink,
|
||||
isColumn
|
||||
),
|
||||
true
|
||||
)
|
||||
)
|
||||
) ?? '--'}
|
||||
</Typography.Text>
|
||||
|
||||
@ -168,7 +168,7 @@ export const TestSuites = ({ summaryPanel }: { summaryPanel: ReactNode }) => {
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, [tab, testSuitePermission]);
|
||||
}, [testSuitePermission]);
|
||||
|
||||
if (!testSuitePermission?.ViewAll && !testSuitePermission?.ViewBasic) {
|
||||
return <ErrorPlaceHolder type={ERROR_PLACEHOLDER_TYPE.PERMISSION} />;
|
||||
|
||||
@ -38,6 +38,7 @@ import { isUndefined, sortBy } from 'lodash';
|
||||
import QueryString from 'qs';
|
||||
import { putTestCaseResult, removeTestCaseFromTestSuite } from 'rest/testAPI';
|
||||
import { checkPermission } from 'utils/PermissionsUtils';
|
||||
import { getEncodedFqn, replacePlus } from 'utils/StringsUtils';
|
||||
import { showErrorToast } from 'utils/ToastUtils';
|
||||
import { getTableTabPath, PAGE_SIZE } from '../../../constants/constants';
|
||||
import { NO_PERMISSION_FOR_ACTION } from '../../../constants/HelperTextUtil';
|
||||
@ -47,7 +48,6 @@ import {
|
||||
TestCaseResult,
|
||||
} from '../../../generated/tests/testCase';
|
||||
import { getNameFromFQN } from '../../../utils/CommonUtils';
|
||||
import { getDecodedFqn } from '../../../utils/StringsUtils';
|
||||
import {
|
||||
getEntityFqnFromEntityLink,
|
||||
getTableExpandableConfig,
|
||||
@ -198,7 +198,10 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
|
||||
<Link
|
||||
data-testid="table-link"
|
||||
to={{
|
||||
pathname: getTableTabPath(tableFqn, 'profiler'),
|
||||
pathname: getTableTabPath(
|
||||
getEncodedFqn(tableFqn),
|
||||
'profiler'
|
||||
),
|
||||
search: QueryString.stringify({
|
||||
activeTab: TableProfilerTab.DATA_QUALITY,
|
||||
}),
|
||||
@ -218,13 +221,9 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
|
||||
width: 150,
|
||||
render: (entityLink) => {
|
||||
const isColumn = entityLink.includes('::columns::');
|
||||
|
||||
if (isColumn) {
|
||||
const name = getNameFromFQN(
|
||||
getDecodedFqn(
|
||||
getEntityFqnFromEntityLink(entityLink, isColumn),
|
||||
true
|
||||
)
|
||||
replacePlus(getEntityFqnFromEntityLink(entityLink, isColumn))
|
||||
);
|
||||
|
||||
return name;
|
||||
|
||||
@ -61,7 +61,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { Link, useHistory, useLocation, useParams } from 'react-router-dom';
|
||||
import { getLatestTableProfileByFqn } from 'rest/tableAPI';
|
||||
import { getListTestCase, ListTestCaseParams } from 'rest/testAPI';
|
||||
import { bytesToSize } from 'utils/StringsUtils';
|
||||
import { bytesToSize, getDecodedFqn } from 'utils/StringsUtils';
|
||||
import { ReactComponent as ColumnProfileIcon } from '../../assets/svg/column-profile.svg';
|
||||
import { ReactComponent as DataQualityIcon } from '../../assets/svg/data-quality.svg';
|
||||
import { ReactComponent as SettingIcon } from '../../assets/svg/ic-settings-primery.svg';
|
||||
@ -299,7 +299,10 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
|
||||
|
||||
const handleAddTestClick = (type: ProfilerDashboardType) => {
|
||||
history.push(
|
||||
getAddDataQualityTableTestPath(type, `${table?.fullyQualifiedName}`)
|
||||
getAddDataQualityTableTestPath(
|
||||
type,
|
||||
`${getDecodedFqn(datasetFQN) ?? table?.fullyQualifiedName}`
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@ -582,7 +585,7 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
|
||||
</Dropdown>
|
||||
)}
|
||||
|
||||
{editDataProfile && (
|
||||
{editDataProfile && !isDataQuality && (
|
||||
<Tooltip
|
||||
placement="topRight"
|
||||
title={t('label.setting-plural')}>
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
height: @welcome-page-height;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ import { getTableDetailsByFQN } from 'rest/tableAPI';
|
||||
import { getTopicByFqn } from 'rest/topicsAPI';
|
||||
import { getTableFQNFromColumnFQN } from 'utils/CommonUtils';
|
||||
import { getEntityName } from 'utils/EntityUtils';
|
||||
import { getEncodedFqn } from 'utils/StringsUtils';
|
||||
import { getDecodedFqn, getEncodedFqn } from 'utils/StringsUtils';
|
||||
import AppState from '../../../AppState';
|
||||
import { EntityType } from '../../../enums/entity.enum';
|
||||
import { Table } from '../../../generated/entity/data/table';
|
||||
@ -69,7 +69,7 @@ const PopoverContent: React.FC<{
|
||||
break;
|
||||
case EntityType.TEST_CASE:
|
||||
promise = getTableDetailsByFQN(
|
||||
getTableFQNFromColumnFQN(entityFQN),
|
||||
getEncodedFqn(getTableFQNFromColumnFQN(getDecodedFqn(entityFQN))),
|
||||
fields
|
||||
);
|
||||
|
||||
|
||||
@ -18,23 +18,17 @@ import { Table } from 'generated/entity/data/table';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { getTableDetailsByFQN } from 'rest/tableAPI';
|
||||
import { ProfilerDashboardType } from '../../enums/table.enum';
|
||||
import { getTableFQNFromColumnFQN } from '../../utils/CommonUtils';
|
||||
import { showErrorToast } from '../../utils/ToastUtils';
|
||||
|
||||
const AddDataQualityTestPage = () => {
|
||||
const { entityTypeFQN, dashboardType } = useParams<Record<string, string>>();
|
||||
const isColumnFqn = dashboardType === ProfilerDashboardType.COLUMN;
|
||||
const { entityTypeFQN } = useParams<Record<string, string>>();
|
||||
const [table, setTable] = useState({} as Table);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
const fetchTableData = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const fqn = isColumnFqn
|
||||
? getTableFQNFromColumnFQN(entityTypeFQN)
|
||||
: entityTypeFQN;
|
||||
const table = await getTableDetailsByFQN(fqn, 'testSuite');
|
||||
const table = await getTableDetailsByFQN(entityTypeFQN, 'testSuite');
|
||||
setTable(table);
|
||||
} catch (error) {
|
||||
showErrorToast(error as AxiosError);
|
||||
|
||||
@ -179,3 +179,10 @@ export const customServiceComparator = (a: string, b: string): number => {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fqn - Value to be encoded
|
||||
* @returns - String text replacing + to valid component of a Uniform Resource Identifier (URI).
|
||||
*/
|
||||
export const replacePlus = (fqn: string) => fqn.replaceAll('+', ' ');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user