Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/adm 937 #112

Closed
wants to merge 69 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7d7e852
ADM-898[backend][frontend]: feat: block' in board mapping is mutually…
yulongcai Apr 12, 2024
6b43c85
ADM-919[backend] : Speed up the generating of pipeline data in repor…
yulongcai Apr 12, 2024
26a2bbb
chore(deps): update dependency node to v20 (#1375)[docs]
renovate[bot] Apr 14, 2024
598975e
fix(deps): update dependency @emotion/styled to v11.11.5 (#1363)
renovate[bot] Apr 14, 2024
c6f64b1
fix(deps): update dependency @reduxjs/toolkit to v2.2.3 (#1364)
renovate[bot] Apr 14, 2024
578e1c4
fix(deps): update dependency org.springframework:spring-core to v6.1.…
renovate[bot] Apr 14, 2024
26af590
fix(deps): update dependency typescript to v5.4.5 (#1366)
renovate[bot] Apr 15, 2024
221a062
fix(deps): update dependency vite to v5.2.8 (#1367)
renovate[bot] Apr 15, 2024
d223672
ADM-898: [frontend] fix: fix flag card logic (#1377)
TingyuDong Apr 15, 2024
2e9711d
ADM-878:[frontend]feature: add chart API ability for metrics board co…
weiraneve Apr 15, 2024
9411cd9
ADM-919:[backend] feat: delete fetch author from GitHub (#1379)
yulongcai Apr 15, 2024
d8c3fea
ADM-878:[frontend]refactor: rename date range (#1381)
weiraneve Apr 15, 2024
22590c5
ADM-919:[backend] fix: set code committer is null when author is null…
yulongcai Apr 15, 2024
f465952
fix(deps): update dependency org.yaml:snakeyaml to v2.2 (#1373)[backend]
renovate[bot] Apr 15, 2024
05ad6a7
chore(deps): update dependency prettier-plugin-sort-imports to v1.8.5…
renovate[bot] Apr 15, 2024
aa9a2d2
fix(deps): update material-ui monorepo (#1368)
renovate[bot] Apr 15, 2024
c59344e
Adm 889 - remove some 'name' column in DORA Metrics Detail page (#1380)
Rui7ing Apr 16, 2024
f8c0323
chore(deps): bump gradle/wrapper-validation-action from 2 to 3 (#1384)
dependabot[bot] Apr 17, 2024
aebbd87
fix(deps): [backend]update dependency org.springframework.cloud:sprin…
renovate[bot] Apr 18, 2024
cf74ad2
chore(deps): update plugin com.github.jk1.dependency-license-report t…
renovate[bot] Apr 18, 2024
de335b1
fix(deps): update dependency org.springdoc:springdoc-openapi-starter-…
renovate[bot] Apr 18, 2024
935faf2
Revert "fix(deps): [backend]update dependency org.springframework.clo…
guzhongren Apr 18, 2024
fea3c9a
ADM-898:[backend] fix: fix bug for exist block column when choose fla…
yulongcai Apr 18, 2024
7ea514e
Adm-909[frontend] sort time range (#1378)
pfpatrick Apr 18, 2024
409a892
Revert "Adm-909[frontend] sort time range (#1378)"
pfpatrick Apr 18, 2024
b9f0ea8
Adm-909[frontend] sort time range (#1394)
pfpatrick Apr 19, 2024
6984484
ADM-913 [frontend]:receive multiple time ranges in metrics page- pipe…
Leiqiuhong Apr 19, 2024
bb3e0b9
ADM-914:[backend][frontend] feat: set file name with time range when …
yulongcai Apr 19, 2024
50289f0
fix(e2e): fix e2e case
guzhongren Apr 19, 2024
4c4750a
chore(deps): bump gradle/gradle-build-action from 3.2.1 to 3.3.0 (#1383)
dependabot[bot] Apr 20, 2024
f643b86
ADM-913: [frontend] fix: improve test covarage (#1395)
neomgb Apr 21, 2024
5bd7e1b
chore(deps): update plugin org.sonarqube to v5 (#1400)[backend]
renovate[bot] Apr 21, 2024
6a04175
fix security issue according sonar (#1405)
yulongcai Apr 22, 2024
5628bea
chore(deps): update dependency license-compliance to v3 (#1399)[front…
renovate[bot] Apr 22, 2024
a1254fb
AMD-902 [frontend] feat: pipeline configuration need to retain modifi…
neomgb Apr 23, 2024
99274b4
fix(deps): update dependency org.awaitility:awaitility to v4 (#1402)[…
renovate[bot] Apr 23, 2024
6a20213
fix(trivy):ignore trivy[backend]
guzhongren Apr 23, 2024
527e16d
fix(playwright): update e2e base image
guzhongren Apr 24, 2024
79a8ee4
fix(deps): update dependency pmd to v7 (#1403)[backend]
renovate[bot] Apr 24, 2024
9462ea9
chore(deps): bump gradle/gradle-build-action from 3.3.0 to 3.3.1 (#1406)
dependabot[bot] Apr 25, 2024
76932ad
fix(deps): update dependency remark-smartypants to v3 (#1404)[docs]
renovate[bot] Apr 25, 2024
4017224
fix(deps): update dependency @astrojs/check to v0.5.10 (#1397)[docs]
renovate[bot] Apr 25, 2024
7fa4296
chore(deps): update pnpm to v9 (#1401) [docs]
renovate[bot] Apr 26, 2024
87705ba
ADM-927:[frontend]feat: add metrics board and pipeline failed status …
weiraneve Apr 26, 2024
dca98d2
Feat/form management config (#1409)
mrcuriosity-tw Apr 26, 2024
7db10fc
[ADM-887] fix: adjust the aria-label selector to fix the e2e test. (#…
mrcuriosity-tw Apr 26, 2024
b4e7b53
[ADM-887]: adjust unique selector to fix the e2e. (#1412)
mrcuriosity-tw Apr 26, 2024
94f7fd2
chore(deps): update dependency @astrojs/sitemap to v3.1.4 (#1413)[docs]
renovate[bot] Apr 27, 2024
aa00ead
chore(deps): update dependency eslint-plugin-n to v17 (#1398)[frontend]
renovate[bot] Apr 27, 2024
4bfb189
ADM-926:[frontend]feat: add e2e test for charting (#1419)
yulongcai Apr 28, 2024
faf9ede
ADM 927: [frontend] Fix code smell and message text color (#1420)
PengxiWPix Apr 28, 2024
8760abf
ADM-926-fix:[frontend] fix: add two time range to test (#1421)
yulongcai Apr 29, 2024
a0c4367
ADM-926-fix:[frontend] fix: add mapping in generate config file (#1422)
yulongcai Apr 29, 2024
d112ac8
ci(e2e): speedup e2e
guzhongren Apr 29, 2024
6c7b877
fix(e2e): format
guzhongren Apr 29, 2024
4386632
Adm 937[backend][frontend]: Pipeline crew setting could filter out de…
zhou-yinyuan Apr 30, 2024
0684495
chore(deps): update gradle/gradle-build-action action to v3.3.2 (#1416)
renovate[bot] Apr 30, 2024
3f82e95
fix(deps): update dependency @emotion/styled to v11.11.5 (#1417)[fron…
renovate[bot] Apr 30, 2024
6f99b2c
chore(deps): update dependency prettier-plugin-sort-imports to v1.8.5…
renovate[bot] Apr 30, 2024
d3e5697
ADM-879 [frontend] Generate data reports for multiple time ranges (#1…
Leiqiuhong Apr 30, 2024
79fe2d6
Adm-879-fix [frontend]: fix the notification close logic (#1426)
Leiqiuhong Apr 30, 2024
dae9844
chore(deps): update dependency msw to v2 (#1374)[frontend]
renovate[bot] May 3, 2024
bf12a13
Upgrade[frontend] (#1428)
guzhongren May 3, 2024
4b98284
[ADM-931]: [frontend]: optimization of sorting button (#1427)
mrcuriosity-tw May 6, 2024
63d4e32
Adm-897 [frontend]: hide retry button (#1429)
Leiqiuhong May 6, 2024
679b4c8
fix(security): fix security issue
guzhongren May 6, 2024
77d4dc8
[ADM-931] feat: disable the sort button given invalid date (#1431)
mrcuriosity-tw May 7, 2024
827d783
ADM-928:[frontend]feat: add metrics failed date range viewer icon (#1…
weiraneve May 7, 2024
cc60d3d
ADM-937 [frontend]: fix the bug about config file pipeline crew
zhou-yinyuan May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ADM-927:[frontend]feat: add metrics board and pipeline failed status …
…handle logic (#1410)

* ADM-927:[frontend]feat: add retry button

* ADM-927:[frontend]feat: http client handle 5xx error with special route

* ADM-927:[frontend]feat: add failed status for retry

* ADM-927:[frontend]feat: add notification pop up when partial failed

* ADM-927:[frontend]feat: implemented all no cards and all 4xx error cases

* ADM-927:[frontend]feat: map correct api result to board

* ADM-927:[frontend]refactor: restore the http client handle 500 logic

* ADM-927:[frontend]fix: refactor from cr comments

* ADM-927:[frontend]refactor: adapt code style

* ADM-927:[frontend]refactor: remove retry for board info

* ADM-927:[frontend]feat: add board info failed status ability

* ADM-927:[frontend]refactor: adapt all no cards

* ADM-927:[frontend]refactor: move board info response filter and map to hook

* ADM-927:[frontend]test: fix test

* ADM-927:[frontend]refactor: rename status and remove unnecessary variable

* ADM-927:[frontend]feat: fixed test coverage

* ADM-927:[frontend]fix: fix coverage to 100 by delete useless code

* ADM-927:[frontend]feat: add partial error popup for metrics step

* ADM-927:[frontend]fix: combined two tests using mockImplementation

* ADM-927:[frontend]fix: use and logic for error code mapping

* ADM-927:[frontend]fix: fix code space

* ADM-927:[frontend]refactor: refactor pipeline info request error title

* ADM-927:[frontend]test: add pipeline failed status test

* ADM-927:[frontend]test: rename test

* ADM-927:[frontend]test: rename test

---------

Co-authored-by: PengxiWPix <[email protected]>
Co-authored-by: guzhongren <[email protected]>
3 people authored Apr 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 87705ba0613c72d4d010488b0abb87db77ea645b
8 changes: 4 additions & 4 deletions frontend/__tests__/client/PipelineToolClient.test.ts
Original file line number Diff line number Diff line change
@@ -79,22 +79,22 @@ describe('PipelineToolClient', () => {
},
{
code: HttpStatusCode.BadRequest,
errorTitle: 'Invalid input!',
errorTitle: 'Failed to get Pipeline configuration!',
errorMessage,
},
{
code: HttpStatusCode.Unauthorized,
errorTitle: 'Unauthorized request!',
errorTitle: 'Failed to get Pipeline configuration!',
errorMessage,
},
{
code: HttpStatusCode.Forbidden,
errorTitle: 'Forbidden request!',
errorTitle: 'Failed to get Pipeline configuration!',
errorMessage,
},
{
code: HttpStatusCode.NotFound,
errorTitle: 'Not found!',
errorTitle: 'Failed to get Pipeline configuration!',
errorMessage,
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { render, waitFor } from '@testing-library/react';
import { setupStore } from '@test/utils/setupStoreUtil';
import { Provider } from 'react-redux';

import { PipelineMetricSelection } from '@src/containers/MetricsStep/DeploymentFrequencySettings/PipelineMetricSelection';
import { IPipelineConfig, updateShouldGetPipelineConfig } from '@src/context/Metrics/metricsSlice';
import { addNotification } from '@src/context/notification/NotificationSlice';
import { METRICS_DATA_FAIL_STATUS } from '@src/constants/commons';
import { PIPELINE_SETTING_TYPES } from '@test/fixtures';

const store = setupStore();
let stepFailStatus = METRICS_DATA_FAIL_STATUS.NOT_FAILED;

jest.mock('@src/context/notification/NotificationSlice', () => ({
...jest.requireActual('@src/context/notification/NotificationSlice'),
addNotification: jest.fn().mockReturnValue({ type: 'ADD_NEW_NOTIFICATION' }),
}));

jest.mock('@src/hooks/useGetMetricsStepsEffect', () => ({
...jest.requireActual('@src/hooks/useGetMetricsStepsEffect'),

useGetMetricsStepsEffect: jest.fn().mockImplementation(() => {
return {
stepFailedStatus: stepFailStatus,
};
}),
}));

describe('PipelineMetricSelection', () => {
const deploymentFrequencySetting = {
id: 0,
organization: '',
pipelineName: '',
step: '',
branches: [],
};
const mockHandleClickRemoveButton = jest.fn();
const mockUpdatePipeline = jest.fn();
const mockSetLoadingCompletedNumber = jest.fn();

const setup = async (
deploymentFrequencySetting: IPipelineConfig,
isShowRemoveButton: boolean,
isDuplicated: boolean,
) => {
store.dispatch(updateShouldGetPipelineConfig(true));
return render(
<Provider store={store}>
<PipelineMetricSelection
type={PIPELINE_SETTING_TYPES.DEPLOYMENT_FREQUENCY_SETTINGS_TYPE}
pipelineSetting={deploymentFrequencySetting}
isShowRemoveButton={isShowRemoveButton}
onRemovePipeline={mockHandleClickRemoveButton}
onUpdatePipeline={mockUpdatePipeline}
isDuplicated={isDuplicated}
isInfoLoading={false}
totalPipelineNumber={2}
setLoadingCompletedNumber={mockSetLoadingCompletedNumber}
/>
</Provider>,
);
};

beforeEach(() => {
jest.clearAllMocks();
});

it('should show 4xx popup when call pipeline step to get partial 4xx error', async () => {
stepFailStatus = METRICS_DATA_FAIL_STATUS.PARTIAL_FAILED_4XX;
await setup(deploymentFrequencySetting, true, false);

await waitFor(() => {
expect(addNotification).toHaveBeenCalled();
});
});

it('should show timeout popup when call pipeline step to get partial timeout error', async () => {
stepFailStatus = METRICS_DATA_FAIL_STATUS.PARTIAL_FAILED_TIMEOUT;
await setup(deploymentFrequencySetting, true, false);

await waitFor(() => {
expect(addNotification).toHaveBeenCalled();
});
});
});
31 changes: 30 additions & 1 deletion frontend/__tests__/containers/MetricsStep/MetricsStep.test.tsx
Original file line number Diff line number Diff line change
@@ -195,7 +195,6 @@ describe('MetricsStep', () => {
{ key: 'done', value: { name: 'Done', statuses: ['PRE-DONE,', 'DONE', 'CANCEL'] } },
];

store.dispatch(updateShouldGetBoardConfig(true));
store.dispatch(updateMetrics(REQUIRED_DATA_LIST));
store.dispatch(updateCycleTimeSettings(cycleTimeSettingsWithTwoDoneValue));
store.dispatch(saveDoneColumn(doneColumn));
@@ -286,6 +285,7 @@ describe('MetricsStep', () => {
});

it('should be render no card container when get board card when no data', async () => {
store.dispatch(updateShouldGetBoardConfig(true));
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res, ctx) => {
return res(ctx.status(HttpStatusCode.Ok));
@@ -304,7 +304,35 @@ describe('MetricsStep', () => {
).toBeInTheDocument();
});

it('should be render failed message container when get 4xx error', async () => {
store.dispatch(updateShouldGetBoardConfig(true));
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res, ctx) => {
return res(ctx.status(HttpStatusCode.BadRequest));
}),
);

setup();

await waitFor(() => {
expect(screen.getByText('Failed to get Board configuration!')).toBeInTheDocument();
});
expect(screen.getByText('Please go back to the previous page and check your board info!')).toBeInTheDocument();
});

it('should be render popup when get partial 4xx error', async () => {
store.dispatch(updateShouldGetBoardConfig(true));

setup();

await waitFor(() => {
expect(screen.getByText('Failed to get Board configuration!')).toBeInTheDocument();
});
expect(screen.getByText('Please go back to the previous page and check your board info!')).toBeInTheDocument();
});

it('should be render form container when got board card success', async () => {
store.dispatch(updateShouldGetBoardConfig(true));
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res, ctx) => {
return res(
@@ -374,6 +402,7 @@ describe('MetricsStep', () => {
});

it('should show retry button when call get info timeout', async () => {
store.dispatch(updateShouldGetBoardConfig(true));
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res) => {
return res.networkError('NETWORK_TIMEOUT');
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { render, waitFor } from '@testing-library/react';
import { setupStore } from '../../utils/setupStoreUtil';
import MetricsStep from '@src/containers/MetricsStep';
import { Provider } from 'react-redux';

import { addNotification } from '@src/context/notification/NotificationSlice';
import { METRICS_DATA_FAIL_STATUS } from '@src/constants/commons';

let store = setupStore();
const setup = () =>
render(
<Provider store={store}>
<MetricsStep />
</Provider>,
);

jest.mock('@src/context/notification/NotificationSlice', () => ({
...jest.requireActual('@src/context/notification/NotificationSlice'),
addNotification: jest.fn().mockReturnValue({ type: 'ADD_NEW_NOTIFICATION' }),
}));

let boardInfoFailStatus = METRICS_DATA_FAIL_STATUS.NOT_FAILED;

jest.mock('@src/hooks/useGetBoardInfo', () => ({
...jest.requireActual('@src/hooks/useGetBoardInfo'),

useGetBoardInfoEffect: jest.fn().mockImplementation(() => {
return {
boardInfoFailedStatus: boardInfoFailStatus,
};
}),
}));

describe('MetricsStep', () => {
beforeEach(() => {
store = setupStore();
});

afterEach(() => {
jest.clearAllMocks();
});

it('should show 4xx popup when call get partial 4xx error', async () => {
boardInfoFailStatus = METRICS_DATA_FAIL_STATUS.PARTIAL_FAILED_4XX;
setup();

await waitFor(() => {
expect(addNotification).toHaveBeenCalled();
});
});

it('should show no cards popup when call get partial no cards error', async () => {
boardInfoFailStatus = METRICS_DATA_FAIL_STATUS.PARTIAL_FAILED_NO_CARDS;
setup();

await waitFor(() => {
expect(addNotification).toHaveBeenCalled();
});
});
});
128 changes: 120 additions & 8 deletions frontend/__tests__/hooks/useGetBoardInfo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MOCK_BOARD_INFO_URL, FAKE_TOKEN, FAKE_DATE_EARLIER, FAKE_DATE_LATER } from '@test/fixtures';
import { AXIOS_REQUEST_ERROR_CODE } from '@src/constants/resources';
import { useGetBoardInfoEffect } from '@src/hooks/useGetBoardInfo';
import { renderHook, act, waitFor } from '@testing-library/react';
import { setupServer } from 'msw/node';
@@ -46,23 +47,23 @@ describe('use get board info', () => {
],
[
HttpStatusCode.BadRequest,
'Failed to get the board configuration!',
'Please go back to the previous page to check your board info, or change your time range!',
'Failed to get Board configuration!',
'Please go back to the previous page and check your board info!',
],
[
HttpStatusCode.Unauthorized,
'Failed to get the board configuration!',
'Please go back to the previous page to check your board info, or change your time range!',
'Failed to get Board configuration!',
'Please go back to the previous page and check your board info!',
],
[
HttpStatusCode.Forbidden,
'Failed to get the board configuration!',
'Please go back to the previous page to check your board info, or change your time range!',
'Failed to get Board configuration!',
'Please go back to the previous page and check your board info!',
],
[
HttpStatusCode.NotFound,
'Failed to get the board configuration!',
'Please go back to the previous page to check your board info, or change your time range!',
'Failed to get Board configuration!',
'Please go back to the previous page and check your board info!',
],
])('should got error message when got code is %s', async (code, title, message) => {
server.use(
@@ -81,4 +82,115 @@ describe('use get board info', () => {
});
expect(result.current.errorMessage.message).toEqual(message);
});

it('should get data when mock 4xx error', async () => {
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res, ctx) => {
return res(
ctx.status(HttpStatusCode.BadRequest),
ctx.json({
ignoredTargetFields: [
{
key: 'description',
name: 'Description',
flag: false,
},
],
jiraColumns: [
{
key: 'To Do',
value: {
name: 'TODO',
statuses: ['TODO'],
},
},
],
targetFields: [
{
key: 'issuetype',
name: 'Issue Type',
flag: false,
},
],
users: ['heartbeat user'],
}),
);
}),
);
const { result } = renderHook(() => useGetBoardInfoEffect());
await act(() => {
result.current.getBoardInfo(mockBoardConfig);
});

await waitFor(() => {
expect(result.current.errorMessage.title).toEqual('Failed to get Board configuration!');
});
expect(result.current.errorMessage.message).toEqual(
'Please go back to the previous page and check your board info!',
);
});

it('should get data when mock 3xx error', async () => {
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res, ctx) => {
return res(
ctx.status(HttpStatusCode.Unused),
ctx.json({
code: AXIOS_REQUEST_ERROR_CODE.TIMEOUT,
}),
);
}),
);
const { result } = renderHook(() => useGetBoardInfoEffect());
await act(() => {
result.current.getBoardInfo(mockBoardConfig);
});

await waitFor(() => {
expect(result.current.errorMessage.title).toEqual('Failed to get Board configuration!');
});
expect(result.current.errorMessage.message).toEqual(
'Please go back to the previous page and check your board info!',
);
});

it('should get data when status is OK', async () => {
server.use(
rest.post(MOCK_BOARD_INFO_URL, (_, res, ctx) => {
return res.once(
ctx.status(HttpStatusCode.Ok),
ctx.json({
ignoredTargetFields: [
{
key: 'description',
name: 'Description',
flag: false,
},
],
jiraColumns: [
{
key: 'To Do',
value: {
name: 'TODO',
statuses: ['TODO'],
},
},
],
targetFields: [
{
key: 'issuetype',
name: 'Issue Type',
flag: false,
},
],
users: ['heartbeat user'],
}),
);
}),
);
const { result } = renderHook(() => useGetBoardInfoEffect());
await act(() => {
result.current.getBoardInfo(mockBoardConfig);
});
});
});
Loading