with test run details.
* This global client function should not use scope variables (except other global functions).
* @internal
*/
-export function e2edRenderTestRunDetails(testRun: TestRun): string {
+export function e2edRenderTestRunDetails(testRun: TestRun): SafeHtml {
void testRun;
- return '';
+ return e2edSanitizeHtml``;
}
diff --git a/src/package/utils/report/getTestRunsLists.ts b/src/package/utils/report/getTestRunsLists.ts
index 2cc33390..ca49164f 100644
--- a/src/package/utils/report/getTestRunsLists.ts
+++ b/src/package/utils/report/getTestRunsLists.ts
@@ -2,17 +2,23 @@ import {TestRunStatus} from '../../constants/internal';
import {getRunHashUnificator} from './getRunHashUnificator';
-import type {ReportData, RunId, TestRunButtonProps, TestRunsListProps} from '../../types/internal';
+import type {
+ ReportData,
+ RetryProps,
+ RunId,
+ TestRunButtonProps,
+ UtcTimeInMs,
+} from '../../types/internal';
/**
- * Get array of TestRunsListProps (by retries) from report data.
+ * Get array of RetryProps from report data.
* @internal
*/
-export const getTestRunsLists = ({testRunsWithHooks}: ReportData): TestRunsListProps[] => {
+export const getTestRunsLists = ({testRunsWithHooks}: ReportData): RetryProps[] => {
const runHashUnificator = getRunHashUnificator();
const internallyRetriedRunIds: RunId[] = [];
- const testRunsLists: TestRunsListProps[] = [];
+ const retries: RetryProps[] = [];
const testRunButtonsHash: Record = {};
for (const testRunWithHooks of testRunsWithHooks) {
@@ -29,13 +35,11 @@ export const getTestRunsLists = ({testRunsWithHooks}: ReportData): TestRunsListP
endTimeInMs,
} = testRunWithHooks;
- const durationInMs = endTimeInMs - startTimeInMs;
-
if (previousRunId) {
internallyRetriedRunIds.push(previousRunId);
}
- const retry = parseInt((runLabel || 'retry 1').slice(6), 10);
+ const retry = parseInt((runLabel || 'r:1').slice(2), 10);
const {duplicate, runHash} = runHashUnificator(maybeDuplicateRunHash);
@@ -46,7 +50,7 @@ export const getTestRunsLists = ({testRunsWithHooks}: ReportData): TestRunsListP
}
const testRunButtonProps = {
- durationInMs,
+ endTimeInMs,
filePath,
mainParams,
name,
@@ -82,18 +86,24 @@ export const getTestRunsLists = ({testRunsWithHooks}: ReportData): TestRunsListP
return a.startTimeInMs - b.startTimeInMs;
});
+ const startTimes = testRunButtons.map((testRun) => testRun.startTimeInMs);
+ const startTimeInMs = Math.min(...startTimes) as UtcTimeInMs;
+
+ const endTimes = testRunButtons.map((testRun) => testRun.endTimeInMs);
+ const endTimeInMs = Math.max(...endTimes) as UtcTimeInMs;
+
const retry = Number(retryString);
- const testRunsList = {hidden: true, retry, testRunButtons};
+ const testRunsList = {endTimeInMs, hidden: true, retry, startTimeInMs, testRunButtons};
- testRunsLists.push(testRunsList);
+ retries.push(testRunsList);
}
- testRunsLists.sort((a, b) => a.retry - b.retry);
+ retries.sort((a, b) => a.retry - b.retry);
- if (testRunsLists[0]) {
- (testRunsLists[0] as {hidden: boolean}).hidden = false;
+ if (retries[0]) {
+ (retries[0] as {hidden: boolean}).hidden = false;
}
- return testRunsLists;
+ return retries;
};
diff --git a/src/package/utils/report/render/renderListOfTestRuns.ts b/src/package/utils/report/render/renderListOfTestRuns.ts
deleted file mode 100644
index 9a48fab0..00000000
--- a/src/package/utils/report/render/renderListOfTestRuns.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import {e2edCreateSafeHtmlWithoutSanitize} from '../client';
-
-import {renderTestRunButton} from './renderTestRunButton';
-
-import type {SafeHtml, TestRunsListProps} from '../../../types/internal';
-
-/**
- * Render test runs list for one retry.
- * @internal
- */
-export const renderListOfTestRuns = ({
- hidden,
- retry,
- testRunButtons,
-}: TestRunsListProps): SafeHtml => {
- const buttons = testRunButtons.map(renderTestRunButton);
-
- return e2edCreateSafeHtmlWithoutSanitize`
-${buttons.join(
- '',
- )}
`;
-};
diff --git a/src/package/utils/report/render/renderLogo.ts b/src/package/utils/report/render/renderLogo.ts
index 5dd586d0..c89e67cc 100644
--- a/src/package/utils/report/render/renderLogo.ts
+++ b/src/package/utils/report/render/renderLogo.ts
@@ -1,3 +1,8 @@
+import {readFileSync} from 'fs';
+import {join} from 'path';
+
+import {E2ED_PACKAGE_DIRECTORY_PATH, READ_FILE_OPTIONS} from '../../../constants/internal';
+
import {e2edCreateSafeHtmlWithoutSanitize} from '../client';
import type {SafeHtml} from '../../../types/internal';
@@ -6,5 +11,11 @@ import type {SafeHtml} from '../../../types/internal';
* Render SVG logo for report page.
* @internal
*/
-export const renderLogo = (): SafeHtml => e2edCreateSafeHtmlWithoutSanitize`
-`;
+export const renderLogo = (): SafeHtml => {
+ const pathToLogo = join(E2ED_PACKAGE_DIRECTORY_PATH, 'logo.svg');
+
+ const logoString = readFileSync(pathToLogo, READ_FILE_OPTIONS);
+
+ return e2edCreateSafeHtmlWithoutSanitize`
+${logoString}`;
+};
diff --git a/src/package/utils/report/render/renderNavigation.ts b/src/package/utils/report/render/renderNavigation.ts
index e023648c..3b1ef06a 100644
--- a/src/package/utils/report/render/renderNavigation.ts
+++ b/src/package/utils/report/render/renderNavigation.ts
@@ -3,18 +3,16 @@ import {e2edSanitizeHtml} from '../client';
import {renderLogo} from './renderLogo';
import {renderRetriesButtons} from './renderRetriesButtons';
-import type {SafeHtml, TestRunsListProps} from '../../../types/internal';
+import type {RetryProps, SafeHtml} from '../../../types/internal';
/**
* Render tag