Skip to content

Commit

Permalink
feat: implement show basic test info in new ui
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowusr committed Aug 30, 2024
1 parent 1c2ee81 commit c9176ea
Show file tree
Hide file tree
Showing 73 changed files with 992 additions and 557 deletions.
6 changes: 5 additions & 1 deletion lib/common-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const statusPriority: TestStatus[] = [
export const logger = pick(console, ['log', 'warn', 'error']);

export const isSuccessStatus = (status: TestStatus): boolean => status === SUCCESS;
export const isFailStatus = (status: TestStatus): boolean => status === FAIL;
export const isFailStatus = (status: TestStatus): status is TestStatus.FAIL => status === FAIL;
export const isIdleStatus = (status: TestStatus): boolean => status === IDLE;
export const isRunningStatus = (status: TestStatus): boolean => status === RUNNING;
export const isErrorStatus = (status: TestStatus): boolean => status === ERROR;
Expand Down Expand Up @@ -83,6 +83,10 @@ export const getUrlWithBase = (url: string | undefined, base: string | undefined
userUrl.port = baseUrl.port;
userUrl.username = baseUrl.username;
userUrl.password = baseUrl.password;

for (const [key, value] of baseUrl.searchParams) {
userUrl.searchParams.append(key, value);
}
}

return userUrl.href;
Expand Down
5 changes: 4 additions & 1 deletion lib/constants/test-statuses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export enum TestStatus {
/**
* @note used in new UI only for rendering icons
*/
RETRY = 'retry'
RETRY = 'retry',
/** @note used to display tests that have both failed screenshots and errors */
FAIL_ERROR = 'fail_error',
}

export const IDLE = TestStatus.IDLE;
Expand All @@ -29,6 +31,7 @@ export const FAIL = TestStatus.FAIL;
export const ERROR = TestStatus.ERROR;
export const SKIPPED = TestStatus.SKIPPED;
export const UPDATED = TestStatus.UPDATED;
export const FAIL_ERROR = TestStatus.FAIL_ERROR;
/**
* @note used by staticImageAccepter only
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/static/components/modals/screenshot-accepter/meta.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Component, Fragment} from 'react';
import PropTypes from 'prop-types';

import MetaInfoContent from '../../section/body/meta-info/content';
import {MetaInfo as MetaInfoContent} from '@/static/new-ui/components/MetaInfo';

export default class ScreenshotAccepterMeta extends Component {
static propTypes = {
Expand Down
4 changes: 2 additions & 2 deletions lib/static/components/retry-switcher/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import RetrySwitcherItem from './item';
import {AttemptPickerItem} from '@/static/new-ui/components/AttemptPickerItem';

export default class RetrySwitcher extends Component {
static propTypes = {
Expand All @@ -22,7 +22,7 @@ export default class RetrySwitcher extends Component {
{resultIds.map((resultId, ind) => {
const isActive = ind === retryIndex;

return <RetrySwitcherItem
return <AttemptPickerItem
key={resultId}
resultId={resultId}
isActive={isActive}
Expand Down
85 changes: 0 additions & 85 deletions lib/static/components/retry-switcher/item.jsx

This file was deleted.

133 changes: 0 additions & 133 deletions lib/static/components/section/body/meta-info/content.jsx

This file was deleted.

8 changes: 5 additions & 3 deletions lib/static/components/section/body/meta-info/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {Card} from '@gravity-ui/uikit';
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import PropTypes from 'prop-types';
import MetaInfoContent from './content';

import {MetaInfo as MetaInfoContent} from '@/static/new-ui/components/MetaInfo';
import * as actions from '../../../../modules/actions';
import Details from '../../../details';

Expand All @@ -21,7 +23,7 @@ class MetaInfo extends Component {

return <Details
title='Meta'
content={<MetaInfoContent resultId={resultId}/>}
content={<Card className='details__card' view='filled'><MetaInfoContent resultId={resultId}/></Card>}
onClick={this.onToggleMetaInfo}
/>;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/static/modules/action-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ export default {
UPDATE_BOTTOM_PROGRESS_BAR: 'UPDATE_BOTTOM_PROGRESS_BAR',
GROUP_TESTS_BY_KEY: 'GROUP_TESTS_BY_KEY',
TOGGLE_BROWSER_CHECKBOX: 'TOGGLE_BROWSER_CHECKBOX',
SUITES_PAGE_SET_CURRENT_SUITE: 'SUITES_PAGE_SET_CURRENT_SUITE'
SUITES_PAGE_SET_CURRENT_SUITE: 'SUITES_PAGE_SET_CURRENT_SUITE',
SUITES_PAGE_SET_SECTION_EXPANDED: 'SUITES_PAGE_SET_SECTION_EXPANDED'
} as const;
2 changes: 1 addition & 1 deletion lib/static/modules/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import performanceMarks from '../../../constants/performance-marks';

export * from './static-accepter';
export * from './suites-page';
export * from './suites';

export const createNotification = (id, status, message, props = {}) => {
const notificationProps = {
Expand Down Expand Up @@ -235,7 +236,6 @@ export const suiteBegin = (suite) => ({type: actionNames.SUITE_BEGIN, payload: s
export const testBegin = (test) => ({type: actionNames.TEST_BEGIN, payload: test});
export const testResult = (result) => ({type: actionNames.TEST_RESULT, payload: result});
export const toggleStateResult = (result) => ({type: actionNames.TOGGLE_STATE_RESULT, payload: result});
export const changeTestRetry = (result) => ({type: actionNames.CHANGE_TEST_RETRY, payload: result});
export const toggleLoading = (payload) => ({type: actionNames.TOGGLE_LOADING, payload});
export const closeSections = (payload) => ({type: actionNames.CLOSE_SECTIONS, payload});
export const runFailed = () => ({type: actionNames.RUN_FAILED_TESTS});
Expand Down
20 changes: 18 additions & 2 deletions lib/static/modules/actions/suites-page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import actionNames from '../action-names';
import {SuitesPageSetCurrentSuiteAction} from '@/static/modules/reducers/suites-page';
import actionNames from '@/static/modules/action-names';
import {Action} from '@/static/modules/actions/types';

export type SuitesPageSetCurrentSuiteAction = Action<typeof actionNames.SUITES_PAGE_SET_CURRENT_SUITE, {
suiteId: string;
}>;

export const suitesPageSetCurrentSuite = (suiteId: string): SuitesPageSetCurrentSuiteAction => {
return {type: actionNames.SUITES_PAGE_SET_CURRENT_SUITE, payload: {suiteId}};
};

type SetSectionExpandedStateAction = Action<typeof actionNames.SUITES_PAGE_SET_SECTION_EXPANDED, {
sectionId: string;
isExpanded: boolean;
}>;

export const setSectionExpandedState = (payload: SetSectionExpandedStateAction['payload']): SetSectionExpandedStateAction =>
({type: actionNames.SUITES_PAGE_SET_SECTION_EXPANDED, payload});

export type SuitesPageAction =
| SuitesPageSetCurrentSuiteAction
| SetSectionExpandedStateAction;
10 changes: 10 additions & 0 deletions lib/static/modules/actions/suites.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import actionNames from '@/static/modules/action-names';
import {Action} from '@/static/modules/actions/types';

interface ChangeTestRetryPayload {
browserId: string;
retryIndex: number;
}

export const changeTestRetry = (result: ChangeTestRetryPayload): Action<typeof actionNames.CHANGE_TEST_RETRY, ChangeTestRetryPayload> =>
({type: actionNames.CHANGE_TEST_RETRY, payload: result});
9 changes: 8 additions & 1 deletion lib/static/modules/default-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export default Object.assign({config: configDefaults}, {
apiValues: {
toolName: ToolName.Testplane,
extraItems: {},
metaInfoExtenders: {}
metaInfoExtenders: {},
imagesSaver: {saveImg: () => ''},
reportsSaver: {saveReportData: () => ''}
},
loading: {},
modals: [],
Expand Down Expand Up @@ -93,5 +95,10 @@ export default Object.assign({config: configDefaults}, {
app: {
isInitialized: false,
currentSuiteId: null
},
ui: {
suitesPage: {
expandedSectionsById: {}
}
}
}) satisfies State;
2 changes: 1 addition & 1 deletion lib/static/modules/reducers/grouped-tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function handleActiveResults({tree = {}, viewMode = ViewMode.ALL, filtere
const browser = tree.browsers.byId[result.parentId];
const testName = browser.parentId;

if (!isTestNameMatchFilters(testName, testNameFilter, strictMatchFilter)) {
if (!isTestNameMatchFilters(testName, browser.name, testNameFilter, strictMatchFilter)) {
continue;
}

Expand Down
Loading

0 comments on commit c9176ea

Please sign in to comment.