Skip to content

Commit 3437d0b

Browse files
author
rocketraccoon
committed
feat(visual-checks-retry): visual checks retry button #0
1 parent 47a78cd commit 3437d0b

9 files changed

Lines changed: 35 additions & 25 deletions

File tree

‎lib/static/modules/reducers/tree/index.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ export default ((state, action) => {
327327
switch (action.type) {
328328
case actionNames.TEST_BEGIN: {
329329
[].concat(action.payload).forEach(({result, suites}) => {
330-
addResult(draft.tree, result);
331330
setBrowsersLastRetry(draft.tree, result.parentId);
332331
updateSuitesStatus(draft.tree, suites);
333332
});

‎lib/static/new-ui/components/RunTest/index.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface RunTestProps {
1717
browser: BrowserEntity | null;
1818
}
1919

20-
export function RunTest({showPlayer = true, browser}: RunTestProps): ReactNode {
20+
export const RunTest = ({showPlayer = true, browser}: RunTestProps): ReactNode => {
2121
const isPlayerVisible = useSelector(state => state.ui.suitesPage.isSnapshotsPlayerVisible);
2222
const isRunning = useSelector(state => state.running);
2323

@@ -63,4 +63,4 @@ export function RunTest({showPlayer = true, browser}: RunTestProps): ReactNode {
6363
)}
6464
</div>
6565
);
66-
}
66+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.container {
2+
align-self: stretch;
3+
justify-content: center;
4+
flex-grow: 1;
5+
display: flex;
6+
align-items: center;
7+
color: var(--g-color-private-black-400);
8+
font-weight: 500;
9+
--g-color-line-brand: var(--g-color-private-black-400);
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React, {ReactNode} from 'react';
2+
import {Spin} from '@gravity-ui/uikit';
3+
4+
import styles from './index.module.css';
5+
6+
export const RunTestLoading = (): ReactNode => (
7+
<div className={styles.container}>
8+
<Spin size={'xs'} style={{marginRight: '4px'}} />Test is running
9+
</div>
10+
);

‎lib/static/new-ui/features/suites/components/TestInfo/index.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {Spin} from '@gravity-ui/uikit';
21
import classNames from 'classnames';
32
import React, {ReactNode} from 'react';
43
import {useSelector} from 'react-redux';
@@ -10,6 +9,7 @@ import {getCurrentResult, isTimeTravelPlayerAvailable} from '@/static/new-ui/fea
109
import {getTestSteps} from '@/static/new-ui/features/suites/components/TestSteps/selectors';
1110
import {SnapshotsPlayer} from '@/static/new-ui/features/suites/components/SnapshotsPlayer';
1211
import {ErrorHandler} from '@/static/new-ui/features/error-handling/components/ErrorHandling';
12+
import {RunTestLoading} from '@/static/new-ui/components/RunTestLoading';
1313

1414
import styles from './index.module.css';
1515

@@ -23,22 +23,26 @@ export function TestInfo(): ReactNode {
2323

2424
const shouldShowPlayer = isPlayerAvailable && isPlayerVisible;
2525

26+
if (isRunning) {
27+
return <RunTestLoading />;
28+
}
29+
2630
return <>
2731
<CollapsibleSection id={'actions'} title={'Actions'}>
2832
<div className={styles.stepsContainer}>
2933
{steps.length > 0 ?
3034
<ErrorHandler.Boundary watchFor={[currentResult]} fallback={<ErrorHandler.FallbackDataCorruption />}>
3135
<TestSteps className={styles.stepsListContainer}/>
3236
</ErrorHandler.Boundary> :
33-
<div className={styles.emptyStepsContainer}>{isRunning ? <><Spin size={'xs'} style={{marginRight: '4px'}} />Test is running</> : 'No steps to show'}</div>
37+
<div className={styles.emptyStepsContainer}>No steps to show</div>
3438
}
3539
{isPlayerAvailable && <div className={classNames(styles.sticky, !shouldShowPlayer && styles.hidden)}>
3640
<SnapshotsPlayer/>
3741
</div>}
3842
</div>
3943
</CollapsibleSection>
4044
<CollapsibleSection id={'metadata'} title={'Metadata'}>
41-
{currentResult && <div className={styles['collapsible-section__body']}>
45+
{currentResult && !isRunning && <div className={styles['collapsible-section__body']}>
4246
<MetaInfo resultId={currentResult.id}/>
4347
</div>}
4448
</CollapsibleSection>

‎lib/static/new-ui/features/visual-checks/components/VisualChecksPage/index.module.css‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,3 @@
4141
.current-image {
4242
overflow: auto;
4343
}
44-
45-
.empty-steps-container {
46-
align-self: stretch;
47-
justify-content: center;
48-
flex-grow: 1;
49-
display: flex;
50-
align-items: center;
51-
color: var(--g-color-private-black-400);
52-
font-weight: 500;
53-
--g-color-line-brand: var(--g-color-private-black-400);
54-
}

‎lib/static/new-ui/features/visual-checks/components/VisualChecksPage/index.tsx‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {MIN_SECTION_SIZE_PERCENT} from '@/static/new-ui/features/suites/constant
2525
import {Page} from '@/static/new-ui/types/store';
2626
import {usePage} from '@/static/new-ui/hooks/usePage';
2727
import {useNavigate, useParams} from 'react-router-dom';
28-
import {Spin} from '@gravity-ui/uikit';
28+
import {RunTestLoading} from '@/static/new-ui/components/RunTestLoading';
2929

3030
export function VisualChecksPage(): ReactNode {
3131
const dispatch = useDispatch();
@@ -150,21 +150,19 @@ export function VisualChecksPage(): ReactNode {
150150
/>
151151
)}
152152

153-
{currentImage && (
153+
{currentImage && !isRunning && (
154154
<ErrorHandler.Boundary fallback={<ErrorHandler.FallbackCardCrash recommendedAction={'Try to choose another item'}/>}>
155155
<div className={styles.currentImage}>
156156
<AssertViewResult result={currentImage} />
157157
</div>
158158
</ErrorHandler.Boundary>
159159
)}
160160

161-
{!currentImage && (
161+
{!currentImage && !isRunning && (
162162
<div className={styles.hint}>This run doesn&apos;t have an image with id &quot;{params.imageId}&quot;</div>
163163
)}
164-
{!currentImage && isRunning && (
165-
<div className={styles.emptyStepsContainer}>
166-
<Spin size={'xs'} style={{marginRight: '4px'}} />Test is running
167-
</div>
164+
{isRunning && (
165+
<RunTestLoading />
168166
)}
169167
</>
170168
: <AssertViewResultSkeleton />}
22 Bytes
Loading

‎test/unit/lib/static/modules/reducers/tree/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ describe('lib/static/modules/reducers/tree', () => {
794794
});
795795
});
796796

797-
[actionNames.TEST_BEGIN, actionNames.TEST_RESULT, actionNames.COMMIT_ACCEPTED_IMAGES_TO_TREE].forEach((actionName) => {
797+
[actionNames.TEST_RESULT, actionNames.COMMIT_ACCEPTED_IMAGES_TO_TREE].forEach((actionName) => {
798798
describe(`${actionName} action`, () => {
799799
it('should change "retryIndex" in browser state', () => {
800800
const suitesById = {...mkSuite({id: 's1', browserIds: ['b1']})};

0 commit comments

Comments
 (0)