From e71515c064a2fb56c5c6f756180cdc04984514bc Mon Sep 17 00:00:00 2001 From: Ivan Kabir Date: Fri, 12 Jul 2024 13:52:08 +0300 Subject: [PATCH] refactor: refactor test body using GravityUI --- lib/static/components/bullet.jsx | 23 +- lib/static/components/controls/menu-bar.jsx | 2 +- lib/static/components/details.jsx | 19 +- lib/static/components/extension-point.jsx | 2 +- .../icons/view-in-browser/index.jsx | 9 +- .../icons/view-in-browser/index.styl | 7 +- lib/static/components/modals/modal.jsx | 20 +- lib/static/components/retry-switcher/item.jsx | 14 +- .../components/section/body/description.jsx | 2 +- .../components/section/body/history/index.jsx | 26 +- .../section/body/history/index.styl | 13 + .../section/body/meta-info/content.jsx | 40 +- .../section/body/meta-info/index.jsx | 2 +- .../section/body/page-screenshot.tsx | 2 +- .../components/section/title/browser.jsx | 11 +- .../components/section/title/simple.jsx | 17 +- lib/static/components/state/error-details.jsx | 2 +- lib/static/components/state/index.jsx | 24 +- .../components/state/state-fail/index.jsx | 29 +- .../components/state/state-fail/index.styl | 14 - lib/static/gui.css | 22 - lib/static/modules/actions.js | 2 +- lib/static/modules/plugins.js | 2 - lib/static/modules/reducers/plugins.js | 2 +- lib/static/modules/web-vitals.js | 1 - lib/static/modules/yandex-metrika.js | 4 +- lib/static/styles.css | 88 +-- .../docker/browser-utils/download-chromium.js | 44 -- .../docker/browser-utils/install-chromium.sh | 6 - .../docker/browser-utils/package-lock.json | 553 ------------------ test/func/docker/browser-utils/package.json | 12 - .../chromium/header.png | Bin 3328 -> 3328 bytes test/func/tests/common-gui/index.testplane.js | 6 +- .../tests/common-tinder/index.testplane.js | 4 +- .../test-results-appearance.testplane.js | 13 +- .../tests/common/tests-details.testplane.js | 4 +- .../screens/0049570/chrome/retry-switcher.png | Bin 517 -> 518 bytes .../screens/07c99c0/chrome/retry-switcher.png | Bin 517 -> 518 bytes .../screens/1361a92/chrome/retry-selector.png | Bin 336 -> 309 bytes .../screens/1bb949f/chrome/retry-switcher.png | Bin 517 -> 518 bytes .../screens/42ea26d/chrome/retry-selector.png | Bin 309 -> 283 bytes .../screens/45b9477/chrome/retry-switcher.png | Bin 493 -> 493 bytes .../screens/5c90021/chrome/basic plugins.png | Bin 24278 -> 22636 bytes .../screens/67cd8d8/chrome/retry-switcher.png | Bin 493 -> 493 bytes .../screens/bdf4a21/chrome/retry-switcher.png | Bin 493 -> 493 bytes .../be4ff5b/chrome/basic plugins clicked.png | Bin 24282 -> 22642 bytes .../c0db305/chrome/details summary.png | Bin 6618 -> 5949 bytes .../d8c5b8a/chrome/redux plugin clicked.png | Bin 24284 -> 22644 bytes .../screens/d90f7de/chrome/retry-selector.png | Bin 305 -> 291 bytes .../screens/ff4deba/chrome/retry-selector.png | Bin 309 -> 283 bytes test/func/tests/utils.js | 2 +- test/unit/lib/static/components/bullet.jsx | 12 +- .../static/components/group-tests/item.jsx | 2 +- .../static/components/retry-switcher/item.jsx | 28 +- .../components/section/body/history.jsx | 29 +- .../section/body/meta-info/content.jsx | 30 +- .../section/title/browser-skipped.jsx | 4 +- .../components/section/title/browser.jsx | 7 +- .../components/section/title/simple.jsx | 2 +- .../lib/static/modules/middlewares/metrika.js | 19 +- .../unit/lib/static/modules/yandex-metrika.js | 2 +- 61 files changed, 252 insertions(+), 926 deletions(-) delete mode 100644 test/func/docker/browser-utils/download-chromium.js delete mode 100755 test/func/docker/browser-utils/install-chromium.sh delete mode 100644 test/func/docker/browser-utils/package-lock.json delete mode 100644 test/func/docker/browser-utils/package.json diff --git a/lib/static/components/bullet.jsx b/lib/static/components/bullet.jsx index 196fe4777..1bb132911 100644 --- a/lib/static/components/bullet.jsx +++ b/lib/static/components/bullet.jsx @@ -1,24 +1,31 @@ import React from 'react'; import classNames from 'classnames'; -import {Checkbox} from 'semantic-ui-react'; import PropTypes from 'prop-types'; import {isCheckboxChecked, isCheckboxIndeterminate} from '../../common-utils'; import {CHECKED, INDETERMINATE, UNCHECKED} from '../../constants/checked-statuses'; import useLocalStorage from '../hooks/useLocalStorage'; +import {Checkbox} from '@gravity-ui/uikit'; +import {ChevronUp} from '@gravity-ui/icons'; const Bullet = ({status, onClick, className}) => { const [isCheckbox] = useLocalStorage('showCheckboxes', false); + const handleClick = React.useCallback((e) => { + e.stopPropagation(); + onClick(e); + }); + if (!isCheckbox) { - return ; + return ; } - return ; + return
+ +
}; Bullet.propTypes = { diff --git a/lib/static/components/controls/menu-bar.jsx b/lib/static/components/controls/menu-bar.jsx index fe634f2c3..1a95e3d2e 100644 --- a/lib/static/components/controls/menu-bar.jsx +++ b/lib/static/components/controls/menu-bar.jsx @@ -6,7 +6,7 @@ import PropTypes from 'prop-types'; import {Dropdown} from 'semantic-ui-react'; import {isEmpty} from 'lodash'; import ExtensionPoint from '../extension-point'; -import plugins from '../../modules/plugins'; +import * as plugins from '../../modules/plugins'; import {MENU_BAR} from '../../../constants/extension-points'; import { Button, DropdownMenu, Icon, Menu } from '@gravity-ui/uikit'; import {Bars} from '@gravity-ui/icons'; diff --git a/lib/static/components/details.jsx b/lib/static/components/details.jsx index f909025bf..25046093a 100644 --- a/lib/static/components/details.jsx +++ b/lib/static/components/details.jsx @@ -8,6 +8,7 @@ import { Card, Disclosure } from '@gravity-ui/uikit'; export default class Details extends Component { static propTypes = { + type: PropTypes.oneOf(['text', 'image']), title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).isRequired, content: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.element, PropTypes.array]).isRequired, extendClassNames: PropTypes.oneOfType([PropTypes.array, PropTypes.string]), @@ -29,6 +30,10 @@ export default class Details extends Component { }); }; + stopPropagation = (e) => { + e.stopPropagation(); + } + _getContent() { const content = this.props.content; @@ -49,7 +54,7 @@ export default class Details extends Component { } render() { - const {title, content, extendClassNames} = this.props; + const {type, title, content, extendClassNames} = this.props; const className = classNames( 'details', extendClassNames @@ -65,12 +70,18 @@ export default class Details extends Component { size='l'> {(props, defaultButton) => ( -
{defaultButton}
{title}
+
+
+ {defaultButton} +
+ {title} +
)}
- + {type == 'image' ? this._renderContent() : + {this._renderContent()} - + } ) ); diff --git a/lib/static/components/extension-point.jsx b/lib/static/components/extension-point.jsx index 76323740e..8baf7ed7a 100644 --- a/lib/static/components/extension-point.jsx +++ b/lib/static/components/extension-point.jsx @@ -1,7 +1,7 @@ import React, {Component, Fragment} from 'react'; import PropTypes from 'prop-types'; import ErrorBoundary from './error-boundary'; -import plugins from '../modules/plugins'; +import * as plugins from '../modules/plugins'; export default class ExtensionPoint extends Component { static propTypes = { diff --git a/lib/static/components/icons/view-in-browser/index.jsx b/lib/static/components/icons/view-in-browser/index.jsx index bd6193d27..cd656b61d 100644 --- a/lib/static/components/icons/view-in-browser/index.jsx +++ b/lib/static/components/icons/view-in-browser/index.jsx @@ -3,6 +3,7 @@ import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +import {Eye, EyeSlash} from '@gravity-ui/icons'; import * as actions from '../../../modules/actions'; import {getUrlWithBase} from '../../../../common-utils'; @@ -27,13 +28,13 @@ class ViewInBrowser extends Component { render() { const {suiteUrl, baseHost, extendClassNames} = this.props; const className = classNames( - 'fa view-in-browser', - suiteUrl ? 'fa-eye view-in-browser_active' : 'fa-eye-slash view-in-browser_disabled', + 'view-in-browser', + suiteUrl ? 'view-in-browser_active' : 'view-in-browser_disabled', extendClassNames ); if (!suiteUrl) { - return