Skip to content

Commit ad29f91

Browse files
authored
Merge pull request #583 from gemini-testing/users/shadowusr/INFRADUTY-27411
fix: do not lose meta.url if it is specified and apply base host to all urls in meta fix: critical bug when suite height wouldn't be updated on resize
2 parents 0c0a39a + 346fdbc commit ad29f91

File tree

25 files changed

+76
-14
lines changed

25 files changed

+76
-14
lines changed

docs/en/html-reporter-setup.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,17 @@ For example:
250250
}
251251
```
252252

253+
When value of any key is set to `auto`, the base url will be set base host specified in the UI or kept intact if there base host isn't specified.
254+
255+
For example, if you have the following `metaInfoBaseUrls` value:
256+
```javascript
257+
{ custom_url: 'auto' }
258+
```
259+
260+
And set `meta.custom_url` field to `https://example.com/some/path` in your tests, you'll see in meta:
261+
- A link to `https://example.com/some/path` when base host is not set in the UI
262+
- A link to `https://another-host.com/some/path` when base host in the UI is set to 'https://another-host.com'
263+
253264
### saveFormat
254265

255266
**DEPRECATED**

docs/ru/html-reporter-setup.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,18 @@ throw err;
250250
}
251251
```
252252

253+
Когда значение любого ключа установлено на `auto`, базовый URL будет установлен на базовый хост, указанный в интерфейсе отчета, или останется неизменным, если базовый хост не указан.
254+
255+
Например, если у вас есть следующее значение `metaInfoBaseUrls`:
256+
257+
```javascript
258+
{ custom_url: 'auto' }
259+
```
260+
261+
И вы установите поле `meta.custom_url` в `https://example.com/some/path` в ваших тестах, вы увидите в мете:
262+
- Ссылку на `https://example.com/some/path`, если базовый хост не установлен в интерфейсе пользователя
263+
- Ссылку на `https://another-host.com/some/path`, если базовый хост в интерфейсе пользователя установлен в `https://another-host.com`
264+
253265
### saveFormat
254266

255267
**Параметр устарел**

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);

lib/static/components/suites.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {getVisibleRootSuiteIds} from '../modules/selectors/tree';
1414
function VirtualizedRow(props) {
1515
const resizeObserverRef = useRef(null);
1616

17-
useResizeObserver(resizeObserverRef, () => props.onResize);
17+
useResizeObserver(resizeObserverRef, props.onResize);
1818

1919
return <div ref={props.onInit} style={props.style} className="virtualized__row">
2020
<div ref={resizeObserverRef}>

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.

0 commit comments

Comments
 (0)