forked from thoughtworks/HeartBeat
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Adm 793 [frontend] Reduce the time of timeout to 10 minutes #1141
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
e6b9ee1
AMD-793 [frontend] feature: add reverify logic and timeout alert
fc01550
AMD-793 [frontend] refactor: abstract config button component for con…
2354ced
Merge branch 'main' into ADM-793
01ab2ed
AMD-793 [frontend] refactor: abstract timeout alert component for con…
12f8c26
AMD-793 [frontend] feat: add timeout alert component to config page f…
a59dfb5
AMD-793 [frontend] fix: merge main to 793
f619f9c
AMD-793 [frontend] test: add test for timeout alert component
d38f126
AMD-793 [frontend] test: add test for config button group component
4e3917c
Merge branch 'main' into ADM-793
49ff6a8
[ADM-793] style: fix css check
67817c1
AMD-793 [frontend] fix: set HB timeout and timeout alert false in Sou…
e132606
AMD-793 [frontend] fix: fix test for PipelineToolClient.test.ts and S…
c6eb632
[ADM-793] style: fix border css
8bc183b
[ADM-793] test: fix test for useVerifyBoardEffect
3345b5b
AMD-793 [frontend] test: add test of isHBTimeout for useVerifySourceC…
4ac618e
[ADM-793] test: add test for useVerifyPipelineToolEffect
7b7b851
[ADM-793] test: add test for getFieldsWithNoVerifiedError
666654c
AMD-793 [frontend] test: remove not use mock in test file and change …
638dada
ADM-856:[backend]feat: update all feign clients decoder error message…
weiraneve c9640dd
ADM-697:[docx] docx: add docx spike the logic of calculating card rew…
Liughgood 92ffd21
ADM-691: [frontend] feat: add feat about rework settings (#1138)
neomgb 87265f8
ADM-856:[backend]feat: add decode default case error message (#1139)
weiraneve ff5045e
ADM-837:[docs] docs: spike about optimizing generate report backend l…
sqsq5566 5e7a7bf
add test case
guzhongren e3558f4
Merge branch 'main' into ADM-793
6fafbe2
AMD-793 [frontend] style: fix color for reverify button
ae3c971
[ADM-793] fix: revert httpTimeout
09cf8cd
Build(deps): bump softprops/action-gh-release from 1 to 2 (#1136)
dependabot[bot] e0dd764
Merge branch 'main' into ADM-793
lxuebing 575e9bd
AMD-793 [frontend] fix: remove annotation in test file
94899f5
AMD-793 [frontend] fix: update test name for clear
210c6ea
AMD-793 [frontend] fix: update test name use given when then
e06a936
chore: extend the overall timeout of e2e 1 more minute. (#1144)
mrcuriosity-tw 267c51a
ADM-691: [frontend] fix: add request fields (#1143)
neomgb 7683e22
ADM-691: [frontend] fix: fix sonar issue (#1145)
neomgb 7512069
[ADM-793] refactor: rename AXIOS_REQUEST_ERROR_CODE
c5f66ee
Merge branch 'main' into ADM-793
lxuebing 9f0b012
AMD-793 [frontend] fix: update alert position to keep element still
5e626a8
[ADM-793] feat: enhance style for alert
b331d3c
[ADM-793] feat: change moduleType text
76df053
[ADM-793] style: enhance style
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,11 @@ describe('verify sourceControl request', () => { | |
afterAll(() => server.close()); | ||
|
||
it('should return isSourceControlVerify true when sourceControl verify response status is 204', async () => { | ||
const result = await sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS); | ||
const result = await sourceControlClient.verifyToken( | ||
MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS, | ||
jest.fn(), | ||
jest.fn(), | ||
); | ||
|
||
expect(result.code).toEqual(204); | ||
}); | ||
|
@@ -27,7 +31,7 @@ describe('verify sourceControl request', () => { | |
), | ||
); | ||
|
||
sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS).catch((e) => { | ||
sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS, jest.fn(), jest.fn()).catch((e) => { | ||
expect(e).toBeInstanceOf(Error); | ||
expect((e as Error).message).toMatch(VERIFY_ERROR_MESSAGE.BAD_REQUEST); | ||
}); | ||
|
@@ -40,7 +44,7 @@ describe('verify sourceControl request', () => { | |
), | ||
); | ||
|
||
sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS).catch((e) => { | ||
sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS, jest.fn(), jest.fn()).catch((e) => { | ||
expect(e).toBeInstanceOf(Error); | ||
expect((e as Error).message).toMatch(VERIFY_ERROR_MESSAGE.NOT_FOUND); | ||
}); | ||
|
@@ -58,7 +62,7 @@ describe('verify sourceControl request', () => { | |
), | ||
); | ||
|
||
sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS).catch((e) => { | ||
sourceControlClient.verifyToken(MOCK_SOURCE_CONTROL_VERIFY_REQUEST_PARAMS, jest.fn(), jest.fn()).catch((e) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 一样的问题 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 原则:测试不要出现类似try catch的代码 |
||
expect(e).toBeInstanceOf(Error); | ||
expect((e as Error).message).toMatch(VERIFY_ERROR_MESSAGE.INTERNAL_SERVER_ERROR); | ||
}); | ||
|
30 changes: 30 additions & 0 deletions
30
frontend/__tests__/containers/ConfigStep/ConfigButtonGroup.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ConfigButtonGrop } from '@src/containers/ConfigStep/ConfigButton'; | ||
import { render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
describe('ConfigButtonGroup', () => { | ||
const setup = (isVerified: boolean, isLoading: boolean, isVerifyTimeOut: boolean, isDisableVerifyButton: boolean) => { | ||
return render( | ||
<ConfigButtonGrop | ||
isVerifyTimeOut={isVerifyTimeOut} | ||
isVerified={isVerified} | ||
isLoading={isLoading} | ||
isDisableVerifyButton={isDisableVerifyButton} | ||
/>, | ||
); | ||
}; | ||
|
||
it('should render a verified and rest button given isVerified is true and isLoading is false', () => { | ||
setup(true, false, false, false); | ||
|
||
expect(screen.getByText('Verified')).toBeInTheDocument(); | ||
expect(screen.getByText('Reset')).toBeInTheDocument(); | ||
expect(screen.getByText('Verified')).toBeDisabled(); | ||
}); | ||
it('should render a Reverify button given isVerifyTimeOut is true', () => { | ||
setup(false, false, true, false); | ||
|
||
expect(screen.getByText('Reverify')).toBeInTheDocument(); | ||
expect(screen.getByText('Reverify')).toHaveAttribute('type', 'submit'); | ||
}); | ||
}); |
53 changes: 53 additions & 0 deletions
53
frontend/__tests__/containers/ConfigStep/TimeoutAlet.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { TimeoutAlert } from '@src/containers/ConfigStep/TimeoutAlert'; | ||
import { act, render, screen, waitFor } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
|
||
describe('TimeoutAlert', () => { | ||
const setIsShowAlert = jest.fn(); | ||
const setup = ( | ||
setIsShowAlert: (value: boolean) => void, | ||
isShowAlert: boolean, | ||
isVerifyTimeOut: boolean, | ||
moduleType: string, | ||
) => { | ||
return render( | ||
<TimeoutAlert | ||
setIsShowAlert={setIsShowAlert} | ||
isShowAlert={isShowAlert} | ||
isVerifyTimeOut={isVerifyTimeOut} | ||
moduleType={moduleType} | ||
/>, | ||
); | ||
}; | ||
|
||
it('should render board message given moduleType is board', () => { | ||
setup(setIsShowAlert, true, true, 'Board'); | ||
const message = screen.getByText('Board'); | ||
|
||
expect(message).toBeInTheDocument(); | ||
}); | ||
it('should not render the alert given isVerifyTimeOut or isShowAlert is false', () => { | ||
setup(setIsShowAlert, false, true, 'Board'); | ||
|
||
expect(screen.queryByText('Board')).not.toBeInTheDocument(); | ||
|
||
setup(setIsShowAlert, true, false, 'Board'); | ||
|
||
expect(screen.queryByText('Board')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should call setIsShowAlert with false when click the close icon given init value', async () => { | ||
setup(setIsShowAlert, true, true, 'any'); | ||
const closeIcon = screen.getByTestId('CloseIcon'); | ||
|
||
act(() => { | ||
userEvent.click(closeIcon); | ||
}); | ||
|
||
await waitFor(() => { | ||
expect(setIsShowAlert).toHaveBeenCalledTimes(1); | ||
expect(setIsShowAlert).toHaveBeenCalledWith(false); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要用catch接,用reject.throw接错误