-
Notifications
You must be signed in to change notification settings - Fork 68
feat: test retry ui #764
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
base: master
Are you sure you want to change the base?
feat: test retry ui #764
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,10 +160,14 @@ export const start = async (args: ServerArgs): Promise<ServerReadyData> => { | |
| } | ||
| }); | ||
|
|
||
| server.post('/run', (req, res) => { | ||
| server.post('/run', async (req, res) => { | ||
| try { | ||
| const {tests, repeatCount} = req.body; | ||
| // do not wait for completion so that response does not hang and browser does not restart it by timeout | ||
| app.run(req.body); | ||
| for (let i = 0; i < repeatCount; i++) { | ||
| await app.run(tests, {retry: repeatCount === 1}); | ||
|
Member
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. What does passing Also, the comments in code above and codex's are valid IMO. I've tried running slower tests on a large project and the request takes minutes to complete. I'm afraid it will timeout if I tried to run more tests. |
||
| } | ||
|
|
||
| res.sendStatus(OK); | ||
| } catch (e) { | ||
| res.status(INTERNAL_SERVER_ERROR).send(`Error while trying to run tests: ${(e as Error).message}`); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .test-repeater-container { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .test-repeater-input { | ||
| display: flex; | ||
| flex-direction: row; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import React from 'react'; | ||
| import {useDispatch, useSelector} from 'react-redux'; | ||
| import {NumberInput, Button, Icon} from '@gravity-ui/uikit'; | ||
| import {Plus, Minus} from '@gravity-ui/icons'; | ||
| import styles from './index.module.css'; | ||
| import {setRepeatCount} from '@/static/modules/actions'; | ||
| import {ExtensionPointName} from '@/static/new-ui/constants/plugins'; | ||
|
|
||
| const MAX_REPEATER_COUNT = 99; | ||
| const MIN_REPEATER_COUNT = 1; | ||
|
|
||
| const PluginComponent = (): React.ReactNode => { | ||
| const dispatch = useDispatch(); | ||
| const repeatCount = useSelector((state) => state.repeatCount); | ||
|
|
||
| const changeRepeatCount = (newValue: number): void => { | ||
| if (newValue >= MIN_REPEATER_COUNT && newValue < MAX_REPEATER_COUNT) { | ||
|
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.
The guard uses Useful? React with 👍 / 👎. |
||
| dispatch(setRepeatCount(newValue)); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={styles.testRepeaterContainer}> | ||
| <span className="text-header-1">Number of repeats</span> | ||
| <NumberInput | ||
| size='m' | ||
| value={repeatCount} | ||
| style={{maxWidth: '78px'}} | ||
| onChange={(e): void => changeRepeatCount(parseInt(e.target.value, 10))} | ||
| qa='repeat-count' | ||
| hiddenControls | ||
| endContent={( | ||
| <div className={styles.testRepeaterInput}> | ||
| <Button view="flat" size="s" onClick={(): void => changeRepeatCount(repeatCount - 1)}> | ||
| <Icon data={Minus} size={14}/> | ||
| </Button> | ||
| <Button view="flat" size="s" onClick={(): void => changeRepeatCount(repeatCount + 1)}> | ||
| <Icon data={Plus} size={14}/> | ||
| </Button> | ||
| </div> | ||
| )} | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export const TestRepeaterComponent = { | ||
| PluginComponent, | ||
| name: 'Test Repeater', | ||
| position: 'after', | ||
| point: ExtensionPointName.RunTestOptions, | ||
| config: {} | ||
| }; | ||
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.
The
/runhandler now awaits everyapp.runcall before returning200, which turns this endpoint into a long-lived request for the full test duration (and for all repeats). In environments with request timeouts (browser/network/proxy), this can cause the request to be aborted or retried while tests are still executing, leading to duplicate runs or flaky UI behavior; the previous contract in this handler was explicitly fire-and-forget.Useful? React with 👍 / 👎.