Skip to content

Commit 28ddc84

Browse files
committed
fix: apply baseHost to urls that have metaBaseUrls set to auto
1 parent 93d0111 commit 28ddc84

File tree

22 files changed

+52
-13
lines changed

22 files changed

+52
-13
lines changed

lib/adapters/test-result/transformers/db.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {ReporterTestResult} from '../index';
22
import {DbTestResult} from '../../../sqlite-client';
3-
import {getError, getRelativeUrl, getUrlWithBase} from '../../../common-utils';
3+
import {getError, getUrlWithBase} from '../../../common-utils';
44
import _ from 'lodash';
55

66
interface Options {
@@ -18,7 +18,7 @@ export class DbTestResultTransformer {
1818
const suiteUrl = getUrlWithBase(testResult.url, this._options.baseHost);
1919

2020
const metaInfoFull = _.merge(_.cloneDeep(testResult.meta), {
21-
url: getRelativeUrl(suiteUrl) ?? '',
21+
url: testResult.meta?.url ?? suiteUrl ?? '',
2222
file: testResult.file,
2323
sessionId: testResult.sessionId
2424
});

lib/static/components/section/body/meta-info/content.jsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {connect} from 'react-redux';
44
import {DefinitionList} from '@gravity-ui/components';
55
import PropTypes from 'prop-types';
66
import {map, mapValues, isObject, omitBy, isEmpty} from 'lodash';
7-
import {isUrl, getUrlWithBase} from '../../../../../common-utils';
7+
import {isUrl, getUrlWithBase, getRelativeUrl} from '../../../../../common-utils';
88

99
const serializeMetaValues = (metaInfo) => mapValues(metaInfo, (v) => isObject(v) ? JSON.stringify(v) : v);
1010

@@ -32,7 +32,7 @@ const metaToElements = (metaInfo, metaInfoBaseUrls) => {
3232

3333
if (isUrl(value)) {
3434
url = value;
35-
} else if (metaInfoBaseUrls[key]) {
35+
} else if (metaInfoBaseUrls[key] && metaInfoBaseUrls[key] !== 'auto') {
3636
const baseUrl = metaInfoBaseUrls[key];
3737
const link = isUrl(baseUrl) ? resolveUrl(baseUrl, value) : path.join(baseUrl, value);
3838
url = link;
@@ -95,8 +95,19 @@ class MetaInfoContent extends Component {
9595
formattedMetaInfo[key] = {content: formattedMetaInfo[key]};
9696
});
9797

98-
if (result.suiteUrl) {
99-
formattedMetaInfo.url = {content: result.metaInfo.url || result.suiteUrl, url: getUrlWithBase(result.suiteUrl, baseHost)};
98+
for (const [key, value] of Object.entries(formattedMetaInfo)) {
99+
if (isUrl(value.content) && (key === 'url' || metaInfoBaseUrls[key] === 'auto')) {
100+
formattedMetaInfo[key] = {
101+
content: getRelativeUrl(value.content),
102+
url: getUrlWithBase(getRelativeUrl(value.content), baseHost)
103+
};
104+
}
105+
}
106+
if (!formattedMetaInfo.url && result.suiteUrl) {
107+
formattedMetaInfo.url = {
108+
content: getRelativeUrl(result.suiteUrl),
109+
url: getUrlWithBase(getRelativeUrl(result.suiteUrl), baseHost)
110+
};
100111
}
101112

102113
return metaToElements(formattedMetaInfo, metaInfoBaseUrls);

test/func/common.testplane.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ module.exports.getCommonConfig = (projectDir) => ({
99

1010
browsers: {
1111
chrome: {
12+
assertViewOpts: {
13+
ignoreDiffPixelCount: 4
14+
},
1215
windowSize: '1280x1024',
1316
desiredCapabilities: {
1417
browserName: 'chrome',
-336 Bytes
Binary file not shown.
-4 Bytes
Loading
-336 Bytes
Binary file not shown.
-491 Bytes
Binary file not shown.
-310 Bytes
Binary file not shown.
-309 Bytes
Binary file not shown.
-310 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)