-
- {this._addRetrySwitcher()}
- {this._addRetryButton()}
-
-
-
-
+ const {testName} = props;
+ const activeResultId = getActiveResultId();
+
+ const {measure} = useContext(MeasurementContext);
+ const resizeObserverRef = useRef(null);
+ useResizeObserver(resizeObserverRef, () => {
+ measure();
+ });
+
+ return (
+
+
+
+ {addRetrySwitcher()}
+ {addRetryButton()}
+
+
+
- );
- }
+
+ );
}
+Body.propTypes = {
+ browserId: PropTypes.string.isRequired,
+ browserName: PropTypes.string.isRequired,
+ testName: PropTypes.string.isRequired,
+ resultIds: PropTypes.array.isRequired,
+ onResize: PropTypes.func,
+ // from store
+ gui: PropTypes.bool.isRequired,
+ running: PropTypes.bool.isRequired,
+ retryIndex: PropTypes.number,
+ actions: PropTypes.object.isRequired
+};
+
export default connect(
({gui, running, view: {retryIndex: viewRetryIndex}, tree}, {browserId}) => {
const {retryIndex: browserRetryIndex, lastMatchedRetryIndex} = tree.browsers.stateById[browserId] || {};
diff --git a/lib/static/components/section/body/meta-info/content.jsx b/lib/static/components/section/body/meta-info/content.jsx
index cc843208f..77d0291b7 100644
--- a/lib/static/components/section/body/meta-info/content.jsx
+++ b/lib/static/components/section/body/meta-info/content.jsx
@@ -5,6 +5,7 @@ import {DefinitionList} from '@gravity-ui/components';
import PropTypes from 'prop-types';
import {map, mapValues, isObject, omitBy, isEmpty} from 'lodash';
import {isUrl, getUrlWithBase, getRelativeUrl} from '../../../../../common-utils';
+import {Card} from '@gravity-ui/uikit';
const serializeMetaValues = (metaInfo) => mapValues(metaInfo, (v) => isObject(v) ? JSON.stringify(v) : v);
@@ -25,34 +26,36 @@ const resolveUrl = (baseUrl, value) => {
};
const metaToElements = (metaInfo, metaInfoBaseUrls) => {
- return
{
- let url = value.url;
- value = value.content;
-
- if (isUrl(value)) {
- url = value;
- } else if (metaInfoBaseUrls[key] && metaInfoBaseUrls[key] !== 'auto') {
- const baseUrl = metaInfoBaseUrls[key];
- const link = isUrl(baseUrl) ? resolveUrl(baseUrl, value) : path.join(baseUrl, value);
- url = link;
- } else if (typeof value === 'boolean') {
- value = value.toString();
- }
-
- if (url) {
- value =
- {value}
- ;
- }
-
- return {
- name: key,
- content: {value}
,
- copyText: url || value
- };
- })
- }/>;
+ return
+ {
+ let url = value.url;
+ value = value.content;
+
+ if (isUrl(value)) {
+ url = value;
+ } else if (metaInfoBaseUrls[key] && metaInfoBaseUrls[key] !== 'auto') {
+ const baseUrl = metaInfoBaseUrls[key];
+ const link = isUrl(baseUrl) ? resolveUrl(baseUrl, value) : path.join(baseUrl, value);
+ url = link;
+ } else if (typeof value === 'boolean') {
+ value = value.toString();
+ }
+
+ if (url) {
+ value =
+ {value}
+ ;
+ }
+
+ return {
+ name: key,
+ content: {value}
,
+ copyText: url || value
+ };
+ })
+ }/>
+ ;
};
class MetaInfoContent extends Component {
diff --git a/lib/static/components/section/body/meta-info/index.jsx b/lib/static/components/section/body/meta-info/index.jsx
index b5802d460..39e4fd2c6 100644
--- a/lib/static/components/section/body/meta-info/index.jsx
+++ b/lib/static/components/section/body/meta-info/index.jsx
@@ -20,7 +20,6 @@ class MetaInfo extends Component {
const {resultId} = this.props;
return }
onClick={this.onToggleMetaInfo}
diff --git a/lib/static/components/section/body/page-screenshot.tsx b/lib/static/components/section/body/page-screenshot.tsx
index 393e4db0a..374620382 100644
--- a/lib/static/components/section/body/page-screenshot.tsx
+++ b/lib/static/components/section/body/page-screenshot.tsx
@@ -10,7 +10,6 @@ interface PageScreenshotProps {
export class PageScreenshot extends Component {
render(): JSX.Element {
return }
/>;
diff --git a/lib/static/components/section/section-browser.jsx b/lib/static/components/section/section-browser.jsx
index e047ad62a..146efb603 100644
--- a/lib/static/components/section/section-browser.jsx
+++ b/lib/static/components/section/section-browser.jsx
@@ -1,109 +1,112 @@
-import React, {Component, Fragment} from 'react';
+import React, {Fragment, useContext, useLayoutEffect} from 'react';
import {last, isEmpty} from 'lodash';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import Parser from 'html-react-parser';
import PropTypes from 'prop-types';
import * as actions from '../../modules/actions';
-import SectionWrapper from './section-wrapper';
import BrowserTitle from './title/browser';
import BrowserSkippedTitle from './title/browser-skipped';
import Body from './body';
import {isSkippedStatus} from '../../../common-utils';
+import {sectionStatusResolver} from './utils';
+import {MeasurementContext} from '../measurement-context';
-class SectionBrowser extends Component {
- static propTypes = {
- browserId: PropTypes.string.isRequired,
- // from store
- browser: PropTypes.shape({
- id: PropTypes.string.isRequired,
- name: PropTypes.string.isRequired,
- resultIds: PropTypes.arrayOf(PropTypes.string).isRequired,
- parentId: PropTypes.string.isRequired
- }).isRequired,
- lastResult: PropTypes.shape({
- id: PropTypes.string.isRequired,
- status: PropTypes.string.isRequired,
- error: PropTypes.object,
- imageIds: PropTypes.arrayOf(PropTypes.string).isRequired,
- skipReason: PropTypes.string,
- history: PropTypes.arrayOf(PropTypes.string)
- }).isRequired,
- shouldBeShown: PropTypes.bool.isRequired,
- shouldBeOpened: PropTypes.bool.isRequired,
- // from SectionCommonWrapper
- sectionStatusResolver: PropTypes.func.isRequired,
- actions: PropTypes.object.isRequired
- };
-
- onToggleSection = () => {
- const {browserId, shouldBeOpened} = this.props;
+function SectionBrowser(props) {
+ const onToggleSection = () => {
+ const {browserId, shouldBeOpened} = props;
- this.props.actions.toggleBrowserSection({browserId, shouldBeOpened: !shouldBeOpened});
+ props.actions.toggleBrowserSection({browserId, shouldBeOpened: !shouldBeOpened});
};
- _generateSkippedTitle(skipReason) {
+ const generateSkippedTitle = (skipReason) => {
return (
- [skipped] {this.props.browser.name}
+ [skipped] {props.browser.name}
{skipReason && ', reason: '}
{skipReason && Parser(skipReason)}
);
- }
+ };
- render() {
- if (!this.props.shouldBeShown) {
- return null;
- }
+ const {browser, shouldBeOpened, shouldBeShown, lastResult} = props;
+
+ const {measure} = useContext(MeasurementContext);
+
+ useLayoutEffect(() => {
+ measure?.();
+ }, [shouldBeShown, shouldBeOpened]);
+
+ if (!shouldBeShown) {
+ return null;
+ }
- const {browser, shouldBeOpened, lastResult} = this.props;
+ const isSkippedLastResult = isSkippedStatus(lastResult.status);
+ const hasRetries = browser.resultIds.length > 1;
- const isSkippedLastResult = isSkippedStatus(lastResult.status);
- const hasRetries = browser.resultIds.length > 1;
+ const title = isSkippedLastResult
+ ? generateSkippedTitle(lastResult.skipReason)
+ : browser.name;
- const title = isSkippedLastResult
- ? this._generateSkippedTitle(lastResult.skipReason)
- : browser.name;
+ // Detect executed test but failed and skipped
+ const isExecutedResult = hasRetries || !isEmpty(lastResult.history) || lastResult.error || lastResult.imageIds.length > 0;
+ const isSkipped = isSkippedLastResult && !isExecutedResult;
- // Detect executed test but failed and skipped
- const isExecutedResult = hasRetries || !isEmpty(lastResult.history) || lastResult.error || lastResult.imageIds.length > 0;
- const isSkipped = isSkippedLastResult && !isExecutedResult;
+ const body = isSkipped || !shouldBeOpened
+ ? null
+ : (
+
+ );
- const body = isSkipped || !shouldBeOpened
- ? null
- : (
-