TEST : fix DataInsightSetting cypress and glossary rename playwright issue (#17313)

* fix DataInsightSetting cypress and glossary rename playwright issue

* fix sonar
This commit is contained in:
Ashish Gupta 2024-08-07 14:16:02 +05:30 committed by GitHub
parent d3baf4fcf2
commit 6ab3d932f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 60 additions and 20 deletions

View File

@ -11,9 +11,13 @@
* limitations under the License.
*/
import {
customFormatDateTime,
getCurrentMillis,
getEpochMillisForFutureDays,
} from '../../../src/utils/date-time/DateTimeUtils';
import { interceptURL, verifyResponseStatusCode } from '../../common/common';
import { checkDataInsightSuccessStatus } from '../../common/DataInsightUtils';
import { BASE_URL } from '../../constants/constants';
import { GlobalSettingOptions } from '../../constants/settings.constant';
describe(
@ -89,6 +93,23 @@ describe(
).click();
cy.get('[data-testid="install-application"]').click();
cy.get('[data-testid="save-button"]').click();
cy.get('#root\\/backfillConfiguration\\/enabled').click();
const startDate = customFormatDateTime(getCurrentMillis(), 'yyyy-MM-dd');
const endDate = customFormatDateTime(
getEpochMillisForFutureDays(5),
'yyyy-MM-dd'
);
cy.get('#root\\/backfillConfiguration\\/startDate')
.click()
.type(`${startDate}`);
cy.get('#root\\/backfillConfiguration\\/endDate')
.click()
.type(`${endDate}`);
cy.get('[data-testid="submit-btn"]').click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.rc-virtual-list [title="Day"]').click();
cy.get('[data-testid="cron-type"]').should('contain', 'Day');
@ -106,11 +127,6 @@ describe(
'/api/v1/apps/name/DataInsightsApplication?fields=*',
'getDataInsightDetails'
);
interceptURL(
'POST',
'/api/v1/apps/deploy/DataInsightsApplication',
'deploy'
);
interceptURL(
'POST',
'/api/v1/apps/trigger/DataInsightsApplication',
@ -120,20 +136,18 @@ describe(
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@getDataInsightDetails', 200);
cy.get('[data-testid="deploy-button"]').click();
verifyResponseStatusCode('@deploy', 200);
cy.reload();
verifyResponseStatusCode('@getDataInsightDetails', 200);
// Adding a manual wait to allow some time between deploying the pipeline and triggering it
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.get('[data-testid="run-now-button"]').click();
verifyResponseStatusCode('@triggerPipeline', 200);
cy.reload();
checkDataInsightSuccessStatus();
cy.get('[data-testid="logs"]').click();
cy.url().should('eq', `${BASE_URL}/apps/DataInsightsApplication/logs`);
cy.get('[data-testid="stats-component"]').contains('Success');
cy.get('[data-testid="app-entity-stats-history-table"]').should(
'be.visible'
);
});
}
);

View File

@ -385,6 +385,8 @@ test.describe('Glossary tests', () => {
});
test('Rename Glossary Term and verify assets', async ({ browser }) => {
test.slow();
const { page, afterAction, apiContext } = await performAdminLogin(browser);
const table = new TableClass();
const topic = new TopicClass();

View File

@ -11,6 +11,7 @@
* limitations under the License.
*/
import Icon from '@ant-design/icons/lib/components/Icon';
import {
Badge,
Button,
@ -22,11 +23,11 @@ import {
Table,
Typography,
} from 'antd';
import { isEmpty, isNil } from 'lodash';
import { capitalize, isEmpty, isNil } from 'lodash';
import React, { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { LazyLog } from 'react-lazylog';
import { ReactComponent as IconSuccessBadge } from '../../../../assets/svg/success-badge.svg';
import { ICON_DIMENSION, STATUS_ICON } from '../../../../constants/constants';
import { getEntityStatsData } from '../../../../utils/ApplicationUtils';
import { formatDateTimeWithTimezone } from '../../../../utils/date-time/DateTimeUtils';
import { formatJsonString } from '../../../../utils/StringsUtils';
@ -42,7 +43,7 @@ import {
const AppLogsViewer = ({ data }: AppLogsViewerProps) => {
const { t } = useTranslation();
const { successContext, failureContext, timestamp } = data;
const { successContext, failureContext, timestamp, status } = data;
const handleJumpToEnd = () => {
const logsBody = document.getElementsByClassName(
@ -101,8 +102,11 @@ const AppLogsViewer = ({ data }: AppLogsViewerProps) => {
)}:`}</span>
<Space align="center" className="m-l-xs" size={8}>
<IconSuccessBadge height={14} width={14} />
<span>{t('label.success')}</span>
<Icon
component={STATUS_ICON[status as keyof typeof STATUS_ICON]}
style={ICON_DIMENSION}
/>
<span>{capitalize(status)}</span>
</Space>
</div>
<Divider type="vertical" />

View File

@ -13,6 +13,7 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import { ReactComponent as IconSuccessBadge } from '../../../../assets/svg/success-badge.svg';
import {
ScheduleTimeline,
Status,
@ -55,6 +56,16 @@ jest.mock('../../../common/Badge/Badge.component', () =>
})
);
jest.mock('../../../../constants/constants', () => ({
ICON_DIMENSION: {
with: 14,
height: 14,
},
STATUS_ICON: {
success: IconSuccessBadge,
},
}));
const mockProps1 = {
data: {
appId: '6e4d3dcf-238d-4874-b4e4-dd863ede6544',
@ -175,7 +186,7 @@ describe('AppLogsViewer component', () => {
render(<AppLogsViewer {...mockProps1} />);
expect(screen.getByText('label.status:')).toBeInTheDocument();
expect(screen.getByText('label.success')).toBeInTheDocument();
expect(screen.getByText('Success')).toBeInTheDocument();
expect(screen.getByText('label.index-states:')).toBeInTheDocument();
expect(screen.getAllByText('Badge')).toHaveLength(3);
expect(screen.getByText('label.last-updated:')).toBeInTheDocument();

View File

@ -15,6 +15,9 @@ import { t } from 'i18next';
import { isUndefined } from 'lodash';
import Qs from 'qs';
import { CSSProperties } from 'react';
import { ReactComponent as IconCompleteBadge } from '../assets/svg/complete.svg';
import { ReactComponent as IconFailedBadge } from '../assets/svg/fail-badge.svg';
import { ReactComponent as IconSuccessBadge } from '../assets/svg/success-badge.svg';
import { COOKIE_VERSION } from '../components/Modals/WhatsNewModal/whatsNewData';
import { EntityTabs, EntityType } from '../enums/entity.enum';
import { getPartialNameFromFQN } from '../utils/CommonUtils';
@ -579,3 +582,9 @@ export const COMMON_ICON_STYLES: CSSProperties = {
export const APPLICATION_JSON_CONTENT_TYPE_HEADER = {
headers: { 'Content-type': 'application/json' },
};
export const STATUS_ICON = {
success: IconSuccessBadge,
failed: IconFailedBadge,
completed: IconCompleteBadge,
};