Skip to content

Commit 48a5777

Browse files
committed
PRO-12619 feat: switch to new layout
1 parent 6a057e2 commit 48a5777

58 files changed

Lines changed: 1563 additions & 1051 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

autotests/pageObjects/pages/E2edReportExample/E2edReportExample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class E2edReportExample extends Page<CustomPageParams> {
6565
* List of test runs of retry.
6666
*/
6767
get testRunsList(): Selector {
68-
return locator('column1');
68+
return locator('column-2');
6969
}
7070

7171
/**

src/types/global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ declare global {
5858
class?: string;
5959
}
6060
>;
61+
} & {
62+
button: {popovertarget?: string};
63+
input: {popovertarget?: string};
64+
meta: {charset?: string};
6165
};
6266

6367
/**

src/utils/getDurationWithUnits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Get the duration of time interval in hours, minutes, seconds and milliseconds.
33
* `getDurationWithUnits(1213)` = `'1s 213ms'`.
44
* Should be a pure function without dependencies in the form of a function declaration,
5-
* because it is used in the JS code of HTML report.
5+
* because it is used in the JS client code of HTML report.
66
*/
77
export function getDurationWithUnits(durationInMs: number): string {
88
const msInSecond = 1_000;

src/utils/report/client/clickOnRetry.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@ export function clickOnRetry(element: HTMLElement): void {
1212
retryElement.hidden = retryElement.id !== chosenRetryId;
1313
}
1414

15-
const previousChosenRetryButton = document.querySelector(
16-
'.nav-tabs__button[aria-selected="true"]',
17-
);
15+
const previousChosenRetryButton = document.querySelector('.retry-link[aria-current="true"]');
1816

1917
if (previousChosenRetryButton) {
20-
previousChosenRetryButton.ariaSelected = 'false';
18+
previousChosenRetryButton.ariaCurrent = null;
2119
}
2220

2321
// eslint-disable-next-line no-param-reassign
24-
element.ariaSelected = 'true';
22+
element.ariaCurrent = 'true';
2523

26-
const leftSection = document.querySelector('.main__section._position_left');
24+
const leftSection = document.querySelector('.column-2');
2725

2826
if (leftSection) {
2927
leftSection.ariaLabel = `Retry ${retry}`;

src/utils/report/client/clickOnTestRun.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const chooseTestRun = clientChooseTestRun;
1212
export function clickOnTestRun(element: HTMLElement): void {
1313
const runHash = (element.dataset as {runhash: RunHash}).runhash;
1414

15-
const previousChosenTestRunButton = document.querySelector('.test-button[aria-selected="true"]');
15+
const previousChosenTestRunButton = document.querySelector('.test-link[aria-current="true"]');
1616

1717
if (previousChosenTestRunButton) {
18-
previousChosenTestRunButton.ariaSelected = 'false';
18+
previousChosenTestRunButton.ariaCurrent = null;
1919
}
2020

2121
// eslint-disable-next-line no-param-reassign
22-
element.ariaSelected = 'true';
22+
element.ariaCurrent = 'true';
2323

2424
chooseTestRun(runHash);
2525
}

src/utils/report/client/createJsxRuntime.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,57 @@ export function createJsxRuntime(): JSX.Runtime {
3333
);
3434
const childrenHtml = createSafeHtmlWithoutSanitize`${childrenParts.join('')}`;
3535

36+
const isVoidElement = [
37+
'area',
38+
'base',
39+
'br',
40+
'col',
41+
'embed',
42+
'hr',
43+
'img',
44+
'input',
45+
'link',
46+
'meta',
47+
'source',
48+
'track',
49+
'wbr',
50+
].includes(type);
51+
52+
let closePart = createSafeHtmlWithoutSanitize``;
53+
54+
if (isVoidElement) {
55+
if (childrenHtml.length > 0) {
56+
// eslint-disable-next-line no-console
57+
console.error(`Element <${type}> is void element, but has children`, childrenHtml);
58+
59+
closePart = childrenHtml;
60+
}
61+
} else {
62+
closePart = sanitizeHtml`${childrenHtml}</${type}>`;
63+
}
64+
3665
if (properties == null) {
37-
return sanitizeHtml`<${type}>${childrenHtml}</${type}>`;
66+
return sanitizeHtml`<${type}>${closePart}`;
3867
}
3968

40-
const attributesParts: readonly SafeHtml[] = Object.entries(properties).map(
41-
([key, value]) => sanitizeHtml`${key.toLowerCase()}="${value}"`,
42-
);
43-
const attributesHtml = createSafeHtmlWithoutSanitize`${attributesParts.join('')}`;
69+
const attributesParts: readonly SafeHtml[] = Object.entries(properties)
70+
.filter(([key, value]) => {
71+
if (value == null) {
72+
return false;
73+
}
74+
75+
if (value !== false) {
76+
return true;
77+
}
78+
79+
const lowerCaseKey = key.toLocaleLowerCase();
80+
81+
return lowerCaseKey.startsWith('aria-') || lowerCaseKey.startsWith('data-');
82+
})
83+
.map(([key, value]) => sanitizeHtml`${key.toLowerCase()}="${value}"`);
84+
const attributesHtml = createSafeHtmlWithoutSanitize`${attributesParts.join(' ')}`;
4485

45-
return sanitizeHtml`<${type} ${attributesHtml}>${childrenHtml}</${type}>`;
86+
return sanitizeHtml`<${type} ${attributesHtml}>${closePart}`;
4687
};
4788

4889
const Fragment: JSX.Fragment = (properties) => {

src/utils/report/client/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export {
3232
ApiStatisticsItem,
3333
DatesInterval,
3434
Duration,
35+
List,
3536
MaybeApiStatistics,
37+
SafeHtml,
38+
Screenshot,
3639
Step,
3740
StepContent,
3841
Steps,

src/utils/report/client/initialScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export function initialScript(): void {
3737

3838
Object.assign<ReportClientState, Partial<ReportClientState>>(reportClientState, {locator});
3939

40-
addOnClickOnClass('nav-tabs__button', clickOnRetry);
40+
addOnClickOnClass('retry-link', clickOnRetry);
4141
addOnClickOnClass('step-expanded', clickOnStep);
42-
addOnClickOnClass('test-button', clickOnTestRun);
42+
addOnClickOnClass('test-link', clickOnTestRun);
4343

4444
setReadJsonReportDataObservers();
4545

src/utils/report/client/onFirstJsonReportDataLoad.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function onFirstJsonReportDataLoad(): void {
1717
}
1818

1919
const buttonForFailedTestRun = document.querySelector(
20-
'.retry:not([hidden]) .test-button_status_failed',
20+
'.retry:not([hidden]) .test-link[data-status="failed"]',
2121
);
2222

2323
if (!buttonForFailedTestRun) {

src/utils/report/client/render/ApiStatistics.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import {createSafeHtmlWithoutSanitize as clientCreateSafeHtmlWithoutSanitize} from '../sanitizeHtml';
2-
31
import {ApiStatisticsItem as clientApiStatisticsItem} from './ApiStatisticsItem';
2+
import {List as clientList} from './List';
43

54
import type {
65
ApiStatistics as ApiStatisticsType,
@@ -9,8 +8,8 @@ import type {
98
SafeHtml,
109
} from '../../../../types/internal';
1110

12-
const createSafeHtmlWithoutSanitize = clientCreateSafeHtmlWithoutSanitize;
1311
const ApiStatisticsItem = clientApiStatisticsItem;
12+
const List = clientList;
1413

1514
declare const jsx: JSX.Runtime;
1615

@@ -92,9 +91,7 @@ export const ApiStatistics: JSX.Component<Props> = ({apiStatistics, hash}) => {
9291
<article class="test-details">
9392
<p class="test-details__path"></p>
9493
<h2 class="test-details__title">{header}</h2>
95-
<div role="tabpanel">
96-
<article class="overview">{createSafeHtmlWithoutSanitize`${items.join('')}`}</article>
97-
</div>
94+
<List elements={items} />
9895
</article>
9996
);
10097
};

0 commit comments

Comments
 (0)