html-reporter 9.7.6 → 9.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ <a name="9.8.1"></a>
6
+ ## [9.8.1](https://github.com/gemini-testing/html-reporter/compare/v9.8.0...v9.8.1) (2023-04-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * do not load redux-logger in production env ([8bed4ea](https://github.com/gemini-testing/html-reporter/commit/8bed4ea))
12
+
13
+
14
+
15
+ <a name="9.8.0"></a>
16
+ # [9.8.0](https://github.com/gemini-testing/html-reporter/compare/v9.7.6...v9.8.0) (2023-03-31)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * avoid saved test extension ([574111f](https://github.com/gemini-testing/html-reporter/commit/574111f))
22
+ * change determination logic ([0d29828](https://github.com/gemini-testing/html-reporter/commit/0d29828))
23
+ * dont save equal references ([2f1e800](https://github.com/gemini-testing/html-reporter/commit/2f1e800))
24
+ * support "id" field from test for old hermione versions ([e9f2365](https://github.com/gemini-testing/html-reporter/commit/e9f2365))
25
+ * test objects should be cloned with clone method if exists ([239555b](https://github.com/gemini-testing/html-reporter/commit/239555b))
26
+
27
+
28
+ ### Features
29
+
30
+ * fix: refresh url in meta if host in input was changed ([#465](https://github.com/gemini-testing/html-reporter/issues/465)) ([294625f](https://github.com/gemini-testing/html-reporter/commit/294625f))
31
+ * make urls in meta shorter, add copy-to-clipboard icon ([#464](https://github.com/gemini-testing/html-reporter/issues/464)) ([5c60cfd](https://github.com/gemini-testing/html-reporter/commit/5c60cfd))
32
+ * screenshot-accepter progress bar ([461647c](https://github.com/gemini-testing/html-reporter/commit/461647c))
33
+ * use test object id property instead of id() method ([dd51714](https://github.com/gemini-testing/html-reporter/commit/dd51714))
34
+
35
+
36
+ ### Performance Improvements
37
+
38
+ * increase screenshot-accepter performance ([dfe5b2a](https://github.com/gemini-testing/html-reporter/commit/dfe5b2a))
39
+
40
+
41
+
5
42
  <a name="9.7.6"></a>
6
43
  ## [9.7.6](https://github.com/gemini-testing/html-reporter/compare/v9.7.5...v9.7.6) (2023-01-30)
7
44
 
@@ -58,6 +58,12 @@ exports.isUrl = (str) => {
58
58
  return parsedUrl.host && parsedUrl.protocol;
59
59
  };
60
60
 
61
+ exports.buildUrl = (href, host) => {
62
+ return host
63
+ ? url.format(Object.assign(url.parse(href), {host}))
64
+ : href;
65
+ };
66
+
61
67
  exports.fetchFile = async (url, options) => {
62
68
  try {
63
69
  const {data, status} = await axios.get(url, options);
@@ -1,26 +1,44 @@
1
1
  'use strict';
2
2
 
3
3
  const DB_TYPES = {int: 'INT', text: 'TEXT'};
4
+ const DB_COLUMNS = {
5
+ SUITE_PATH: 'suitePath',
6
+ SUITE_NAME: 'suiteName',
7
+ NAME: 'name',
8
+ SUITE_URL: 'suiteUrl',
9
+ META_INFO: 'metaInfo',
10
+ HISTORY: 'history',
11
+ DESCRIPTION: 'description',
12
+ ERROR: 'error',
13
+ SKIP_REASON: 'skipReason',
14
+ IMAGES_INFO: 'imagesInfo',
15
+ SCREENSHOT: 'screenshot',
16
+ MULTIPLE_TABS: 'multipleTabs',
17
+ STATUS: 'status',
18
+ TIMESTAMP: 'timestamp'
19
+ };
20
+
4
21
  const SUITES_TABLE_COLUMNS = [
5
- {name: 'suitePath', type: DB_TYPES.text},
6
- {name: 'suiteName', type: DB_TYPES.text},
7
- {name: 'name', type: DB_TYPES.text},
8
- {name: 'suiteUrl', type: DB_TYPES.text},
9
- {name: 'metaInfo', type: DB_TYPES.text},
10
- {name: 'history', type: DB_TYPES.text},
11
- {name: 'description', type: DB_TYPES.text},
12
- {name: 'error', type: DB_TYPES.text},
13
- {name: 'skipReason', type: DB_TYPES.text},
14
- {name: 'imagesInfo', type: DB_TYPES.text},
15
- {name: 'screenshot', type: DB_TYPES.int}, //boolean - 0 or 1
16
- {name: 'multipleTabs', type: DB_TYPES.int}, //boolean - 0 or 1
17
- {name: 'status', type: DB_TYPES.text},
18
- {name: 'timestamp', type: DB_TYPES.int}
22
+ {name: DB_COLUMNS.SUITE_PATH, type: DB_TYPES.text},
23
+ {name: DB_COLUMNS.SUITE_NAME, type: DB_TYPES.text},
24
+ {name: DB_COLUMNS.NAME, type: DB_TYPES.text},
25
+ {name: DB_COLUMNS.SUITE_URL, type: DB_TYPES.text},
26
+ {name: DB_COLUMNS.META_INFO, type: DB_TYPES.text},
27
+ {name: DB_COLUMNS.HISTORY, type: DB_TYPES.text},
28
+ {name: DB_COLUMNS.DESCRIPTION, type: DB_TYPES.text},
29
+ {name: DB_COLUMNS.ERROR, type: DB_TYPES.text},
30
+ {name: DB_COLUMNS.SKIP_REASON, type: DB_TYPES.text},
31
+ {name: DB_COLUMNS.IMAGES_INFO, type: DB_TYPES.text},
32
+ {name: DB_COLUMNS.SCREENSHOT, type: DB_TYPES.int}, //boolean - 0 or 1
33
+ {name: DB_COLUMNS.MULTIPLE_TABS, type: DB_TYPES.int}, //boolean - 0 or 1
34
+ {name: DB_COLUMNS.STATUS, type: DB_TYPES.text},
35
+ {name: DB_COLUMNS.TIMESTAMP, type: DB_TYPES.int}
19
36
  ];
20
37
 
21
38
  module.exports = {
22
39
  DB_MAX_AVAILABLE_PAGE_SIZE: 65536, // helps to speed up queries
23
40
  DB_SUITES_TABLE_NAME: 'suites',
41
+ DB_COLUMNS,
24
42
  SUITES_TABLE_COLUMNS,
25
43
  LOCAL_DATABASE_NAME: 'sqlite.db',
26
44
  DATABASE_URLS_JSON_NAME: 'databaseUrls.json',
@@ -170,7 +170,8 @@ module.exports = class ToolRunner {
170
170
  return;
171
171
  }
172
172
 
173
- const testId = formatId(test.id(), browserId);
173
+ // TODO: remove toString after publish major version
174
+ const testId = formatId(test.id.toString(), browserId);
174
175
  this._tests[testId] = _.extend(test, {browserId});
175
176
 
176
177
  test.pending
@@ -193,13 +194,13 @@ module.exports = class ToolRunner {
193
194
  const {browserId, attempt} = test;
194
195
  const fullTitle = mkFullTitle(test);
195
196
  const testId = formatId(getShortMD5(fullTitle), browserId);
196
- const testResult = this._tests[testId];
197
+ const rawTest = this._tests[testId];
197
198
  const {sessionId, url} = test.metaInfo;
198
199
  const assertViewResults = [];
199
200
 
200
201
  const imagesInfo = test.imagesInfo.map((imageInfo) => {
201
202
  const {stateName, actualImg} = imageInfo;
202
- const path = this._hermione.config.browsers[browserId].getScreenshotPath(testResult, stateName);
203
+ const path = this._hermione.config.browsers[browserId].getScreenshotPath(rawTest, stateName);
203
204
  const refImg = {path, size: actualImg.size};
204
205
 
205
206
  assertViewResults.push({stateName, refImg, currImg: actualImg});
@@ -207,7 +208,13 @@ module.exports = class ToolRunner {
207
208
  return _.extend(imageInfo, {expectedImg: refImg});
208
209
  });
209
210
 
210
- return _.merge({}, testResult, {assertViewResults, imagesInfo, sessionId, attempt, origAttempt: attempt, meta: {url}, updated: true});
211
+ const res = _.merge({}, rawTest, {assertViewResults, imagesInfo, sessionId, attempt, origAttempt: attempt, meta: {url}, updated: true});
212
+
213
+ // _.merge can't fully clone test object since hermione@7+
214
+ // TODO: use separate object to represent test results. Do not extend test object with test results
215
+ return rawTest && rawTest.clone
216
+ ? Object.assign(rawTest.clone(), res)
217
+ : res;
211
218
  }
212
219
 
213
220
  _emitUpdateReference({refImg}, state) {
@@ -31,10 +31,10 @@ const getCommandsHistory = (history) => {
31
31
 
32
32
  const traverseCb = (node, depth) => {
33
33
  const offset = '\t'.repeat(depth);
34
- const isStep = node.n === 'runStep';
34
+ const isGroup = Boolean(node.g);
35
35
  const duration = node.d;
36
- const isFailed = !!node.f;
37
- const title = isStep ? node.a[0] : getCommand(node);
36
+ const isFailed = Boolean(node.f);
37
+ const title = isGroup ? node.n : getCommand(node);
38
38
  const formatedDuration = formatDuration(duration);
39
39
 
40
40
  formatedHistory.push(`${offset}${title} ${formatedDuration}\n`);
@@ -38,7 +38,11 @@ module.exports = class StaticReportBuilder {
38
38
 
39
39
  return result instanceof TestAdapter
40
40
  ? result
41
- : TestAdapter.create(result, this._hermione, status);
41
+ : TestAdapter.create(result, {
42
+ hermione: this._hermione,
43
+ sqliteAdapter: this._sqliteAdapter,
44
+ status
45
+ });
42
46
  }
43
47
 
44
48
  async saveStaticFiles() {
@@ -6,6 +6,7 @@ const Database = require('better-sqlite3');
6
6
  const NestedError = require('nested-error-stacks');
7
7
  const debug = require('debug')('html-reporter:sqlite-adapter');
8
8
 
9
+ const {getShortMD5} = require('./gui/tool-runner/utils.js');
9
10
  const {createTablesQuery} = require('./db-utils/server');
10
11
  const {DB_SUITES_TABLE_NAME, SUITES_TABLE_COLUMNS, LOCAL_DATABASE_NAME, DATABASE_URLS_JSON_NAME} = require('./constants/database');
11
12
 
@@ -19,6 +20,7 @@ module.exports = class SqliteAdapter {
19
20
  this._reportPath = reportPath;
20
21
  this._reuse = reuse;
21
22
  this._db = null;
23
+ this._queryCache = new Map();
22
24
  }
23
25
 
24
26
  async init() {
@@ -53,6 +55,42 @@ module.exports = class SqliteAdapter {
53
55
  return this._db.close();
54
56
  }
55
57
 
58
+ /**
59
+ * Query database
60
+ * @param {Object} queryParams
61
+ * @param {string} queryParams.select - `SELECT ${select}`
62
+ * @param {string} queryParams.where - `WHERE ${where}`
63
+ * @param {string} queryParams.orderBy - `ORDER BY ${orderBy}`
64
+ * @param {boolean} queryParams.orderDescending - ASCending / DESCending
65
+ * @param {boolean} queryParams.noCache - disables caching for equal queries
66
+ * @param {...string} queryArgs
67
+ */
68
+ query({select, where, orderBy, orderDescending, noCache = false} = {}, ...queryArgs) {
69
+ const cacheKey = !noCache && getShortMD5(`${select}#${where}#${orderBy}${orderDescending}${queryArgs.join('#')}`);
70
+
71
+ if (!noCache && this._queryCache.has(cacheKey)) {
72
+ return this._queryCache.get(cacheKey);
73
+ }
74
+
75
+ let query = `SELECT ${select || '*'} FROM ${DB_SUITES_TABLE_NAME}`;
76
+
77
+ if (where) {
78
+ query += ` WHERE ${where}`;
79
+ }
80
+
81
+ if (orderBy) {
82
+ query += ` ORDER BY ${orderBy} ${orderDescending ? 'DESC' : 'ASC'}`;
83
+ }
84
+
85
+ const result = this._db.prepare(query).get(...queryArgs);
86
+
87
+ if (!noCache) {
88
+ this._queryCache.set(cacheKey, result);
89
+ }
90
+
91
+ return result;
92
+ }
93
+
56
94
  write(testResult) {
57
95
  const testResultObj = this._parseTestResult(testResult);
58
96
  const values = this._createValuesArray(testResultObj);
@@ -2,10 +2,10 @@ import React, {Component} from 'react';
2
2
  import {connect} from 'react-redux';
3
3
  import {bindActionCreators} from 'redux';
4
4
  import PropTypes from 'prop-types';
5
- import url from 'url';
6
5
  import classNames from 'classnames';
7
6
 
8
7
  import * as actions from '../../../modules/actions';
8
+ import {buildUrl} from '../../../../common-utils';
9
9
 
10
10
  import './index.styl';
11
11
 
@@ -24,12 +24,6 @@ class ViewInBrowser extends Component {
24
24
  this.props.actions.viewInBrowser();
25
25
  }
26
26
 
27
- _buildUrl(href, host) {
28
- return host
29
- ? url.format(Object.assign(url.parse(href), host))
30
- : href;
31
- }
32
-
33
27
  render() {
34
28
  const {suiteUrl, parsedHost, extendClassNames} = this.props;
35
29
  const className = classNames(
@@ -45,7 +39,7 @@ class ViewInBrowser extends Component {
45
39
  return (
46
40
  <a
47
41
  className={className}
48
- href={this._buildUrl(suiteUrl, parsedHost)}
42
+ href={buildUrl(suiteUrl, parsedHost)}
49
43
  onClick={this.onViewInBrowser}
50
44
  title="view in browser"
51
45
  target="_blank"
@@ -3,6 +3,7 @@ import {GlobalHotKeys} from 'react-hotkeys';
3
3
  import PropTypes from 'prop-types';
4
4
  import {uniqBy} from 'lodash';
5
5
 
6
+ import ProgressBar from '../../progress-bar';
6
7
  import Arrow from '../../icons/arrow';
7
8
  import ArrowsClose from '../../icons/arrows-close';
8
9
  import ControlButton from '../../controls/control-button';
@@ -18,6 +19,8 @@ export default class ScreenshotAccepterHeader extends Component {
18
19
  retryIndex: PropTypes.number,
19
20
  activeImageIndex: PropTypes.number,
20
21
  showMeta: PropTypes.bool.isRequired,
22
+ totalImages: PropTypes.number.isRequired,
23
+ acceptedImages: PropTypes.number.isRequired,
21
24
  onClose: PropTypes.func.isRequired,
22
25
  onRetryChange: PropTypes.func.isRequired,
23
26
  onActiveImageChange: PropTypes.func.isRequired,
@@ -94,7 +97,10 @@ export default class ScreenshotAccepterHeader extends Component {
94
97
  }
95
98
 
96
99
  render() {
97
- const {images, stateNameImageIds, retryIndex, showMeta, onClose, onRetryChange, onShowMeta} = this.props;
100
+ const {images, stateNameImageIds, retryIndex,
101
+ showMeta, onClose, onRetryChange, onShowMeta,
102
+ totalImages, acceptedImages
103
+ } = this.props;
98
104
  const resultIds = uniqBy(images, 'id').map((image) => image.parentId);
99
105
  const isArrowControlDisabed = stateNameImageIds.length <= 1;
100
106
 
@@ -152,6 +158,7 @@ export default class ScreenshotAccepterHeader extends Component {
152
158
  extendClassNames="screenshot-accepter__arrows-close-btn"
153
159
  handler={onClose}
154
160
  />
161
+ <ProgressBar done={acceptedImages} total={totalImages}/>
155
162
  </div>
156
163
  </header>
157
164
  </Fragment>
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
3
3
  import {connect} from 'react-redux';
4
4
  import {bindActionCreators} from 'redux';
5
5
  import PropTypes from 'prop-types';
6
- import {isEmpty, isNumber, findIndex} from 'lodash';
6
+ import {isEmpty, isNumber, size, findIndex} from 'lodash';
7
7
 
8
8
  import * as actions from '../../../modules/actions';
9
9
  import ScreenshotAccepterHeader from './header';
@@ -31,34 +31,19 @@ class ScreenshotAccepter extends Component {
31
31
  constructor(props) {
32
32
  super(props);
33
33
 
34
- const {image, activeImageIndex} = this.props;
35
- const images = this._getActiveImages(activeImageIndex);
34
+ const {image, activeImageIndex, stateNameImageIds, imagesByStateName} = this.props;
35
+ const images = this._getActiveImages(activeImageIndex, stateNameImageIds);
36
36
  const retryIndex = findIndex(images, {id: image.id});
37
37
 
38
+ this.delayedTestResults = [];
38
39
  this.state = {
40
+ stateNameImageIds,
39
41
  activeImageIndex,
40
42
  retryIndex,
41
43
  showMeta: false
42
44
  };
43
- }
44
-
45
- componentWillReceiveProps(nextProps) {
46
- if (nextProps.stateNameImageIds.length === this.props.stateNameImageIds.length) {
47
- return;
48
- }
49
45
 
50
- if (isEmpty(nextProps.stateNameImageIds)) {
51
- return this.setState({retryIndex: null, activeImageIndex: null});
52
- }
53
-
54
- if (this.state.activeImageIndex > nextProps.stateNameImageIds.length - 1) {
55
- const activeImageIndex = nextProps.stateNameImageIds.length - 1;
56
- const images = this._getActiveImages(activeImageIndex, nextProps);
57
- return this.setState({retryIndex: images.length - 1, activeImageIndex});
58
- }
59
-
60
- const images = this._getActiveImages(this.state.activeImageIndex, nextProps);
61
- this.setState({retryIndex: images.length - 1});
46
+ this.totalImagesCount = size(imagesByStateName);
62
47
  }
63
48
 
64
49
  componentDidUpdate() {
@@ -75,25 +60,65 @@ class ScreenshotAccepter extends Component {
75
60
  this.setState({retryIndex: images.length - 1, activeImageIndex});
76
61
  }
77
62
 
78
- onScreenshotAccept = (imageId) => {
79
- this.props.actions.acceptTest(imageId);
63
+ onScreenshotAccept = async (imageId) => {
64
+ const updatedData = await this.props.actions.screenshotAccepterAccept(imageId);
65
+
66
+ if (updatedData === null) {
67
+ return;
68
+ }
69
+
70
+ this.delayedTestResults = this.delayedTestResults.concat(updatedData);
71
+
72
+ const stateNameIds = this.state.stateNameImageIds.filter(stateNameImageId => {
73
+ const currImages = this.props.imagesByStateName[stateNameImageId];
74
+
75
+ return !currImages.some(img => img.id === imageId);
76
+ });
77
+
78
+ if (isEmpty(stateNameIds)) {
79
+ return this.setState({
80
+ activeImageIndex: null,
81
+ stateNameImageIds: stateNameIds,
82
+ retryIndex: null
83
+ });
84
+ }
85
+
86
+ const activeImageIndex = Math.min(this.state.activeImageIndex, stateNameIds.length - 1);
87
+ const images = this._getActiveImages(activeImageIndex, stateNameIds);
88
+
89
+ this.setState({
90
+ activeImageIndex,
91
+ stateNameImageIds: stateNameIds,
92
+ retryIndex: images.length - 1
93
+ });
80
94
  }
81
95
 
82
96
  onShowMeta = () => {
83
97
  this.setState({showMeta: !this.state.showMeta});
84
98
  };
85
99
 
86
- _getActiveImages(activeImageIndex = this.state.activeImageIndex, props = this.props) {
87
- const {imagesByStateName, stateNameImageIds} = props;
100
+ onClose = () => {
101
+ if (!isEmpty(this.delayedTestResults)) {
102
+ this.props.actions.applyDelayedTestResults(this.delayedTestResults);
103
+ }
104
+
105
+ this.props.onClose();
106
+ }
88
107
 
89
- return isNumber(activeImageIndex) ? imagesByStateName[stateNameImageIds[activeImageIndex]] : [];
108
+ _getActiveImages(
109
+ activeImageIndex = this.state.activeImageIndex,
110
+ stateNameImageIds = this.state.stateNameImageIds
111
+ ) {
112
+ return isNumber(activeImageIndex)
113
+ ? this.props.imagesByStateName[stateNameImageIds[activeImageIndex]]
114
+ : [];
90
115
  }
91
116
 
92
117
  render() {
93
- const {stateNameImageIds, onClose} = this.props;
94
- const {retryIndex, activeImageIndex, showMeta} = this.state;
118
+ const {retryIndex, stateNameImageIds, activeImageIndex, showMeta} = this.state;
95
119
  const images = this._getActiveImages();
96
120
  const currImage = isNumber(retryIndex) ? images[retryIndex] : null;
121
+ const acceptedImagesCount = this.totalImagesCount - stateNameImageIds.length;
97
122
 
98
123
  return (
99
124
  <Fragment>
@@ -103,7 +128,9 @@ class ScreenshotAccepter extends Component {
103
128
  retryIndex={retryIndex}
104
129
  activeImageIndex={activeImageIndex}
105
130
  showMeta={showMeta}
106
- onClose={onClose}
131
+ onClose={this.onClose}
132
+ totalImages={this.totalImagesCount}
133
+ acceptedImages={acceptedImagesCount}
107
134
  onRetryChange={this.onRetryChange}
108
135
  onActiveImageChange={this.onActiveImageChange}
109
136
  onScreenshotAccept={this.onScreenshotAccept}
@@ -15,6 +15,17 @@
15
15
  background-color: #fff;
16
16
  }
17
17
 
18
+ .screenshot-accepter__controls.state-controls .progress-bar {
19
+ margin-left: auto;
20
+ margin-bottom: 20px;
21
+ }
22
+
23
+ .screenshot-accepter__controls.state-controls .progress-bar::after {
24
+ content: "Accepted: " attr(data-content);
25
+ font-size: 13px;
26
+ line-height: 18px;
27
+ }
28
+
18
29
  .state-controls.screenshot-accepter__controls {
19
30
  display: flex;
20
31
  flex-wrap: wrap;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+
3
+ import './index.styl';
4
+
5
+ export default ({done, total}) => {
6
+ const percent = (done / total).toFixed(2) * 100;
7
+
8
+ return (
9
+ <span className="progress-bar" data-content={`${done}/${total}`}>
10
+ <span className="progress-bar__container" style={{width: `${percent}%`}}/>
11
+ </span>
12
+ );
13
+ };
@@ -0,0 +1,24 @@
1
+ .progress-bar {
2
+ position: relative;
3
+ display: flex;
4
+ outline: 1px solid #ccc;
5
+ border-radius: 5px;
6
+
7
+ &__container {
8
+ position: absolute;
9
+ height: 100%;
10
+ z-index: -1;
11
+ background-color: #fc0;
12
+ transition: width .25s ease-in-out,
13
+ margin-right .25s ease-in-out;
14
+ }
15
+
16
+ &::after {
17
+ box-sizing: border-box;
18
+ width: 100%;
19
+ padding-left: 10px;
20
+ padding-right: 10px;
21
+ text-align: center;
22
+ align-self: center;
23
+ }
24
+ }
@@ -1,12 +1,22 @@
1
1
  import path from 'path';
2
- import React, {Component} from 'react';
2
+ import React, {Component, Fragment} from 'react';
3
3
  import {connect} from 'react-redux';
4
+ import ClipboardButton from 'react-clipboard.js';
4
5
  import PropTypes from 'prop-types';
5
6
  import {map, mapValues, isObject, omitBy, isEmpty} from 'lodash';
6
- import {isUrl} from '../../../../../common-utils';
7
+ import {isUrl, buildUrl} from '../../../../../common-utils';
7
8
 
8
9
  const mkLinkToUrl = (url, text = url) => {
9
- return <a data-suite-view-link={url} className="custom-icon_view-local" target="_blank" href={url}>{text}</a>;
10
+ return <Fragment>
11
+ <a data-suite-view-link={url} className="custom-icon_view-local" target="_blank" href={url}>
12
+ {text}
13
+ </a>
14
+ <ClipboardButton
15
+ className="button custom-icon custom-icon_copy-to-clipboard"
16
+ button-title="copy to clipboard"
17
+ data-clipboard-text={url}>
18
+ </ClipboardButton>
19
+ </Fragment>;
10
20
  };
11
21
 
12
22
  const serializeMetaValues = (metaInfo) => mapValues(metaInfo, (v) => isObject(v) ? JSON.stringify(v) : v);
@@ -39,7 +49,10 @@ const metaToElements = (metaInfo, metaInfoBaseUrls) => {
39
49
  value = value.toString();
40
50
  }
41
51
 
42
- return <div key = {key} className="meta-info__item"><span className="meta-info__item-key">{key}</span>: {value}</div>;
52
+ return <div key={key} className="meta-info__item">
53
+ <span className="meta-info__item-key">{key}: </span>
54
+ <div className="meta-info__item-value">{value}</div>
55
+ </div>;
43
56
  });
44
57
  };
45
58
 
@@ -56,7 +69,8 @@ class MetaInfoContent extends Component {
56
69
  apiValues: PropTypes.shape({
57
70
  extraItems: PropTypes.object.isRequired,
58
71
  metaInfoExtenders: PropTypes.object.isRequired
59
- }).isRequired
72
+ }).isRequired,
73
+ parsedHost: PropTypes.object
60
74
  };
61
75
 
62
76
  getExtraMetaInfo = () => {
@@ -70,14 +84,14 @@ class MetaInfoContent extends Component {
70
84
  }
71
85
 
72
86
  render() {
73
- const {result, metaInfoBaseUrls} = this.props;
87
+ const {result, metaInfoBaseUrls, parsedHost} = this.props;
74
88
 
75
89
  const serializedMetaValues = serializeMetaValues(result.metaInfo);
76
90
  const extraMetaInfo = this.getExtraMetaInfo();
77
91
  const formattedMetaInfo = {
78
92
  ...serializedMetaValues,
79
93
  ...extraMetaInfo,
80
- url: mkLinkToUrl(result.suiteUrl, result.metaInfo.url)
94
+ url: mkLinkToUrl(buildUrl(result.suiteUrl, parsedHost), result.metaInfo.url)
81
95
  };
82
96
 
83
97
  return metaToElements(formattedMetaInfo, metaInfoBaseUrls);
@@ -85,7 +99,7 @@ class MetaInfoContent extends Component {
85
99
  }
86
100
 
87
101
  export default connect(
88
- ({tree, config: {metaInfoBaseUrls}, apiValues}, {resultId}) => {
102
+ ({tree, config: {metaInfoBaseUrls}, apiValues, view}, {resultId}) => {
89
103
  const result = tree.results.byId[resultId];
90
104
  const browser = tree.browsers.byId[result.parentId];
91
105
 
@@ -93,7 +107,8 @@ export default connect(
93
107
  result,
94
108
  testName: browser.parentId,
95
109
  metaInfoBaseUrls,
96
- apiValues
110
+ apiValues,
111
+ parsedHost: view.parsedHost
97
112
  };
98
113
  }
99
114
  )(MetaInfoContent);