diff --git a/frontend/__tests__/containers/ConfigStep/Board.test.tsx b/frontend/__tests__/containers/ConfigStep/Board.test.tsx
index bd405e5f53..354aabd3bf 100644
--- a/frontend/__tests__/containers/ConfigStep/Board.test.tsx
+++ b/frontend/__tests__/containers/ConfigStep/Board.test.tsx
@@ -10,8 +10,11 @@ import {
FAKE_TOKEN,
} from '../../fixtures';
import { render, screen, waitFor, within } from '@testing-library/react';
+import { AXIOS_REQUEST_ERROR_CODE } from '@src/constants/resources';
+import { boardClient } from '@src/clients/board/BoardClient';
import { Board } from '@src/containers/ConfigStep/Board';
import { setupStore } from '../../utils/setupStoreUtil';
+import { TimeoutError } from '@src/errors/TimeoutError';
import userEvent from '@testing-library/user-event';
import { Provider } from 'react-redux';
import { setupServer } from 'msw/node';
@@ -42,6 +45,8 @@ const mockVerifySuccess = (delay = 0) => {
);
};
+const originalGetVerifyBoard = boardClient.getVerifyBoard;
+
describe('Board', () => {
beforeAll(() => {
server.listen();
@@ -60,6 +65,7 @@ describe('Board', () => {
afterEach(() => {
store = null;
+ boardClient.getVerifyBoard = originalGetVerifyBoard;
});
it('should show board title and fields when render board component ', () => {
@@ -167,6 +173,21 @@ describe('Board', () => {
});
});
+ it('should hidden timeout alert when click reset button', async () => {
+ const { getByTestId, queryByTestId } = setup();
+ await fillBoardFieldsInformation();
+ const mockedError = new TimeoutError('', AXIOS_REQUEST_ERROR_CODE.TIMEOUT);
+ boardClient.getVerifyBoard = jest.fn().mockImplementation(() => Promise.reject(mockedError));
+
+ await userEvent.click(screen.getByText(VERIFY));
+
+ expect(getByTestId('timeoutAlert')).toBeInTheDocument();
+
+ await userEvent.click(screen.getByRole('button', { name: RESET }));
+
+ expect(queryByTestId('timeoutAlert')).not.toBeInTheDocument();
+ });
+
it('should show reset button and verified button when verify succeed ', async () => {
mockVerifySuccess();
setup();
diff --git a/frontend/__tests__/containers/ConfigStep/PipelineTool.test.tsx b/frontend/__tests__/containers/ConfigStep/PipelineTool.test.tsx
index 50acfb1698..21e5f5b8cd 100644
--- a/frontend/__tests__/containers/ConfigStep/PipelineTool.test.tsx
+++ b/frontend/__tests__/containers/ConfigStep/PipelineTool.test.tsx
@@ -11,7 +11,9 @@ import {
FAKE_PIPELINE_TOKEN,
} from '../../fixtures';
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import { pipelineToolClient } from '@src/clients/pipeline/PipelineToolClient';
import { PipelineTool } from '@src/containers/ConfigStep/PipelineTool';
+import { AXIOS_REQUEST_ERROR_CODE } from '@src/constants/resources';
import { setupStore } from '../../utils/setupStoreUtil';
import userEvent from '@testing-library/user-event';
import { Provider } from 'react-redux';
@@ -32,6 +34,8 @@ let store = null;
const server = setupServer(rest.post(MOCK_PIPELINE_VERIFY_URL, (req, res, ctx) => res(ctx.status(204))));
+const originalVerify = pipelineToolClient.verify;
+
describe('PipelineTool', () => {
beforeAll(() => server.listen());
afterAll(() => server.close());
@@ -46,6 +50,7 @@ describe('PipelineTool', () => {
};
afterEach(() => {
store = null;
+ pipelineToolClient.verify = originalVerify;
});
it('should show pipelineTool title and fields when render pipelineTool component ', () => {
@@ -103,6 +108,20 @@ describe('PipelineTool', () => {
expect(queryByRole('button', { name: VERIFY })).toBeDisabled();
});
+ it('should hidden timeout alert when click reset button', async () => {
+ const { getByTestId, queryByTestId } = setup();
+ await fillPipelineToolFieldsInformation();
+ pipelineToolClient.verify = jest.fn().mockResolvedValue({ code: AXIOS_REQUEST_ERROR_CODE.TIMEOUT });
+
+ await userEvent.click(screen.getByText(VERIFY));
+
+ expect(getByTestId('timeoutAlert')).toBeInTheDocument();
+
+ await userEvent.click(screen.getByRole('button', { name: RESET }));
+
+ expect(queryByTestId('timeoutAlert')).not.toBeInTheDocument();
+ });
+
it('should show detail options when click pipelineTool fields', async () => {
const { getByRole } = setup();
await userEvent.click(screen.getByRole('button', { name: 'Pipeline Tool' }));
diff --git a/frontend/__tests__/containers/ConfigStep/SourceControl.test.tsx b/frontend/__tests__/containers/ConfigStep/SourceControl.test.tsx
index 7b305e5779..2ac72968c7 100644
--- a/frontend/__tests__/containers/ConfigStep/SourceControl.test.tsx
+++ b/frontend/__tests__/containers/ConfigStep/SourceControl.test.tsx
@@ -10,9 +10,10 @@ import {
VERIFY,
} from '../../fixtures';
import { initDeploymentFrequencySettings, updateShouldGetPipelineConfig } from '@src/context/Metrics/metricsSlice';
+import { AXIOS_REQUEST_ERROR_CODE, SOURCE_CONTROL_TYPES } from '@src/constants/resources';
+import { sourceControlClient } from '@src/clients/sourceControl/SourceControlClient';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { SourceControl } from '@src/containers/ConfigStep/SourceControl';
-import { SOURCE_CONTROL_TYPES } from '@src/constants/resources';
import { setupStore } from '../../utils/setupStoreUtil';
import userEvent from '@testing-library/user-event';
import { Provider } from 'react-redux';
@@ -36,6 +37,8 @@ let store = null;
const server = setupServer(rest.post(MOCK_SOURCE_CONTROL_VERIFY_TOKEN_URL, (req, res, ctx) => res(ctx.status(204))));
+const originalVerifyToken = sourceControlClient.verifyToken;
+
jest.mock('@src/context/Metrics/metricsSlice', () => ({
...jest.requireActual('@src/context/Metrics/metricsSlice'),
updateShouldGetPipelineConfig: jest.fn().mockReturnValue({ type: 'SHOULD_UPDATE_PIPELINE_CONFIG' }),
@@ -56,6 +59,7 @@ describe('SourceControl', () => {
};
afterEach(() => {
store = null;
+ sourceControlClient.verifyToken = originalVerifyToken;
});
it('should show sourceControl title and fields when render sourceControl component', () => {
@@ -93,6 +97,21 @@ describe('SourceControl', () => {
expect(screen.getByRole('button', { name: VERIFY })).toBeDisabled();
});
+ it('should hidden timeout alert when click reset button', async () => {
+ const { getByTestId, queryByTestId } = setup();
+ await fillSourceControlFieldsInformation();
+ sourceControlClient.verifyToken = jest.fn().mockResolvedValue({
+ code: AXIOS_REQUEST_ERROR_CODE.TIMEOUT,
+ });
+
+ await userEvent.click(screen.getByText(VERIFY));
+ expect(getByTestId('timeoutAlert')).toBeInTheDocument();
+
+ await userEvent.click(screen.getByRole('button', { name: RESET }));
+
+ expect(queryByTestId('timeoutAlert')).not.toBeInTheDocument();
+ });
+
it('should enable verify button when all fields checked correctly given disable verify button', () => {
setup();
const verifyButton = screen.getByRole('button', { name: VERIFY });
diff --git a/frontend/src/containers/ConfigStep/TimeoutAlert/index.tsx b/frontend/src/containers/ConfigStep/TimeoutAlert/index.tsx
index 5ec2e1125f..ae3b314c18 100644
--- a/frontend/src/containers/ConfigStep/TimeoutAlert/index.tsx
+++ b/frontend/src/containers/ConfigStep/TimeoutAlert/index.tsx
@@ -13,6 +13,7 @@ export const TimeoutAlert = ({ isVerifyTimeOut, isShowAlert, setIsShowAlert, mod
<>
{isVerifyTimeOut && isShowAlert && (
}
severity='error'
onClose={() => {
@@ -20,7 +21,7 @@ export const TimeoutAlert = ({ isVerifyTimeOut, isShowAlert, setIsShowAlert, mod
}}
>
- Submission timeout on {moduleType} , please reverify!
+ Submission timeout on {moduleType}, please reverify!
)}