{props.item.images.map((imageEntity, index) => {
const image = (imageEntity as ImageEntityFail).diffImg ?? (imageEntity as ImageEntityFail).actualImg;
diff --git a/lib/static/new-ui/types/store.ts b/lib/static/new-ui/types/store.ts
index 97d217df6..dad16c696 100644
--- a/lib/static/new-ui/types/store.ts
+++ b/lib/static/new-ui/types/store.ts
@@ -70,6 +70,7 @@ export interface ResultEntityCommon {
suitePath: string[];
/** @note Browser Name/ID, e.g. `chrome-desktop` */
name: string;
+ skipReason?: string;
}
export interface ResultEntityError extends ResultEntityCommon {
diff --git a/lib/static/new-ui/utils/index.tsx b/lib/static/new-ui/utils/index.tsx
index 254571cea..de40fc851 100644
--- a/lib/static/new-ui/utils/index.tsx
+++ b/lib/static/new-ui/utils/index.tsx
@@ -8,7 +8,7 @@ import {
CloudCheck
} from '@gravity-ui/icons';
import {Spin} from '@gravity-ui/uikit';
-import React from 'react';
+import React, {ReactNode} from 'react';
import {TestStatus} from '@/constants';
import {ImageFile} from '@/types';
@@ -34,12 +34,6 @@ export const getIconByStatus = (status: TestStatus): React.JSX.Element => {
return
;
};
-export const getFullTitleByTitleParts = (titleParts: string[]): string => {
- const DELIMITER = ' ';
-
- return titleParts.join(DELIMITER).trim();
-};
-
export const getImageDisplayedSize = (image: ImageFile): string => `${image.size.width}×${image.size.height}`;
export const stringify = (value: unknown): string => {
@@ -61,3 +55,35 @@ export const stringify = (value: unknown): string => {
return toString(value);
};
+
+export const makeLinksClickable = (text: string): React.JSX.Element => {
+ const urlRegex = /https?:\/\/[^\s]*/g;
+
+ const parts = text.split(urlRegex);
+ const urls = text.match(urlRegex) || [];
+
+ return <>{
+ parts.reduce((elements, part, index) => {
+ elements.push(part);
+
+ if (urls[index]) {
+ const href = urls[index].startsWith('www.')
+ ? `http://${urls[index]}`
+ : urls[index];
+
+ elements.push(
+
+ {urls[index]}
+
+ );
+ }
+
+ return elements;
+ }, [] as ReactNode[])
+ }>;
+};
diff --git a/test/unit/lib/static/components/section/section-browser.jsx b/test/unit/lib/static/components/section/section-browser.jsx
index 0d3a16959..3cb95f101 100644
--- a/test/unit/lib/static/components/section/section-browser.jsx
+++ b/test/unit/lib/static/components/section/section-browser.jsx
@@ -1,5 +1,6 @@
+import {expect} from 'chai';
import React from 'react';
-import {defaults, set} from 'lodash';
+import {defaults} from 'lodash';
import proxyquire from 'proxyquire';
import {SUCCESS, SKIPPED, ERROR} from 'lib/constants/test-statuses';
import {UNCHECKED} from 'lib/constants/checked-statuses';
@@ -30,7 +31,6 @@ describe('
', () => {
SectionBrowser = proxyquire('lib/static/components/section/section-browser', {
'../../modules/actions': actionsStub,
- './title/browser-skipped': {default: BrowserSkippedTitle},
'./title/browser': {default: BrowserTitle},
'./body': {default: Body}
}).default;
@@ -45,12 +45,9 @@ describe('
', () => {
const resultsById = mkResult({id: 'res', status: SKIPPED});
const tree = mkStateTree({browsersById, browsersStateById, resultsById});
- mkSectionBrowserComponent({browserId: 'yabro-1'}, {tree});
+ const section = mkSectionBrowserComponent({browserId: 'yabro-1'}, {tree});
- assert.calledWithMatch(
- BrowserSkippedTitle,
- set({}, 'title.props.children', [`[${SKIPPED}] `, 'yabro', undefined, undefined])
- );
+ expect(section.getByText(/.*?\[skipped\].*?/)).to.exist;
});
it('should pass skip reason', () => {
@@ -59,12 +56,9 @@ describe('
', () => {
const resultsById = mkResult({id: 'res', status: SKIPPED, skipReason: 'some-reason'});
const tree = mkStateTree({browsersById, browsersStateById, resultsById});
- mkSectionBrowserComponent({browserId: 'yabro-1'}, {tree});
+ const section = mkSectionBrowserComponent({browserId: 'yabro-1'}, {tree});
- assert.calledWithMatch(
- BrowserSkippedTitle,
- set({}, 'title.props.children', [`[${SKIPPED}] `, 'yabro', ', reason: ', 'some-reason'])
- );
+ expect(section.getByText(/.*?reason:\s*some-reason.*?/)).to.exist;
});
it('should not render body even if browser in opened state', () => {
@@ -81,6 +75,13 @@ describe('
', () => {
describe('executed test with fails in retries and skip in result', () => {
it('should render not skipped title', () => {
+ SectionBrowser = proxyquire('lib/static/components/section/section-browser', {
+ '../../modules/actions': actionsStub,
+ './title/browser-skipped': {default: BrowserSkippedTitle},
+ './title/browser': {default: BrowserTitle},
+ './body': {default: Body}
+ }).default;
+
const browsersById = mkBrowser(
{id: 'yabro-1', name: 'yabro', resultIds: ['res-1', 'res-2'], parentId: 'test'}
);
@@ -93,10 +94,28 @@ describe('
', () => {
mkSectionBrowserComponent({browserId: 'yabro-1'}, {tree});
- assert.calledWithMatch(
- BrowserTitle,
- set({}, 'title.props.children', [`[${SKIPPED}] `, 'yabro', ', reason: ', 'some-reason'])
+ assert.notCalled(BrowserSkippedTitle);
+ });
+
+ it('should render title with skip reason', () => {
+ SectionBrowser = proxyquire('lib/static/components/section/section-browser', {
+ '../../modules/actions': actionsStub,
+ './body': {default: Body}
+ }).default;
+
+ const browsersById = mkBrowser(
+ {id: 'yabro-1', name: 'yabro', resultIds: ['res-1', 'res-2'], parentId: 'test'}
);
+ const browsersStateById = {'yabro-1': {shouldBeShown: true, shouldBeOpened: true}};
+ const resultsById = {
+ ...mkResult({id: 'res-1', status: ERROR, error: {}}),
+ ...mkResult({id: 'res-2', status: SKIPPED, skipReason: 'some-reason'})
+ };
+ const tree = mkStateTree({browsersById, browsersStateById, resultsById});
+
+ const section = mkSectionBrowserComponent({browserId: 'yabro-1'}, {tree});
+
+ expect(section.getByText(/.*?reason:\s*some-reason.*?/)).to.exist;
});
it('should render body if browser in opened state', () => {