chore: do not use project id in telereporter (#29776)
This commit is contained in:
parent
bbcc3c1238
commit
ef924c14e7
4
.github/workflows/tests_primary.yml
vendored
4
.github/workflows/tests_primary.yml
vendored
|
|
@ -55,7 +55,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-*
|
||||||
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
if: always()
|
if: always()
|
||||||
|
|
@ -87,7 +87,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps chromium-tip-of-tree
|
- run: npx playwright install --with-deps chromium-tip-of-tree
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium-*
|
||||||
env:
|
env:
|
||||||
PWTEST_CHANNEL: chromium-tip-of-tree
|
PWTEST_CHANNEL: chromium-tip-of-tree
|
||||||
PWTEST_BOT_NAME: "${{ matrix.os }}-chromium-tip-of-tree"
|
PWTEST_BOT_NAME: "${{ matrix.os }}-chromium-tip-of-tree"
|
||||||
|
|
|
||||||
16
.github/workflows/tests_secondary.yml
vendored
16
.github/workflows/tests_secondary.yml
vendored
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-*
|
||||||
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
if: always()
|
if: always()
|
||||||
|
|
@ -75,7 +75,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
||||||
- run: npm run test -- --project=${{ matrix.browser }}
|
- run: npm run test -- --project=${{ matrix.browser }}-*
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
if: always()
|
if: always()
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
@ -106,10 +106,10 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
||||||
- run: npm run test -- --project=${{ matrix.browser }} --workers=1
|
- run: npm run test -- --project=${{ matrix.browser }}-* --workers=1
|
||||||
if: matrix.browser == 'firefox'
|
if: matrix.browser == 'firefox'
|
||||||
shell: bash
|
shell: bash
|
||||||
- run: npm run test -- --project=${{ matrix.browser }}
|
- run: npm run test -- --project=${{ matrix.browser }}-*
|
||||||
if: matrix.browser != 'firefox'
|
if: matrix.browser != 'firefox'
|
||||||
shell: bash
|
shell: bash
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
|
@ -175,9 +175,9 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} --headed
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --headed
|
||||||
if: always() && startsWith(matrix.os, 'ubuntu-')
|
if: always() && startsWith(matrix.os, 'ubuntu-')
|
||||||
- run: npm run test -- --project=${{ matrix.browser }} --headed
|
- run: npm run test -- --project=${{ matrix.browser }}-* --headed
|
||||||
if: always() && !startsWith(matrix.os, 'ubuntu-')
|
if: always() && !startsWith(matrix.os, 'ubuntu-')
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
if: always()
|
if: always()
|
||||||
|
|
@ -247,7 +247,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium ${{ matrix.channel }}
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium ${{ matrix.channel }}
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-*
|
||||||
env:
|
env:
|
||||||
PWTEST_TRACE: 1
|
PWTEST_TRACE: 1
|
||||||
PWTEST_CHANNEL: ${{ matrix.channel }}
|
PWTEST_CHANNEL: ${{ matrix.channel }}
|
||||||
|
|
@ -868,7 +868,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps chromium
|
- run: npx playwright install --with-deps chromium
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium-*
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW: 1
|
PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW: 1
|
||||||
- run: node tests/config/checkCoverage.js chromium
|
- run: node tests/config/checkCoverage.js chromium
|
||||||
|
|
|
||||||
2
.github/workflows/tests_service.yml
vendored
2
.github/workflows/tests_service.yml
vendored
|
|
@ -23,7 +23,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} --workers=10 --retries=0
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --workers=10 --retries=0
|
||||||
env:
|
env:
|
||||||
PWTEST_MODE: service2
|
PWTEST_MODE: service2
|
||||||
PWTEST_TRACE: 1
|
PWTEST_TRACE: 1
|
||||||
|
|
|
||||||
2
.github/workflows/tests_video.yml
vendored
2
.github/workflows/tests_video.yml
vendored
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
||||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-*
|
||||||
env:
|
env:
|
||||||
PWTEST_VIDEO: 1
|
PWTEST_VIDEO: 1
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ctest": "playwright test --config=tests/library/playwright.config.ts --project=chromium",
|
"ctest": "playwright test --config=tests/library/playwright.config.ts --project=chromium-*",
|
||||||
"ftest": "playwright test --config=tests/library/playwright.config.ts --project=firefox",
|
"ftest": "playwright test --config=tests/library/playwright.config.ts --project=firefox-*",
|
||||||
"wtest": "playwright test --config=tests/library/playwright.config.ts --project=webkit",
|
"wtest": "playwright test --config=tests/library/playwright.config.ts --project=webkit-*",
|
||||||
"atest": "playwright test --config=tests/android/playwright.config.ts",
|
"atest": "playwright test --config=tests/android/playwright.config.ts",
|
||||||
"etest": "playwright test --config=tests/electron/playwright.config.ts",
|
"etest": "playwright test --config=tests/electron/playwright.config.ts",
|
||||||
"webview2test": "playwright test --config=tests/webview2/playwright.config.ts",
|
"webview2test": "playwright test --config=tests/webview2/playwright.config.ts",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { testCaseLabels } from './labelUtils';
|
|
||||||
import type { TestCaseSummary } from './types';
|
import type { TestCaseSummary } from './types';
|
||||||
|
|
||||||
export class Filter {
|
export class Filter {
|
||||||
|
|
@ -108,13 +107,13 @@ export class Filter {
|
||||||
if (test.outcome === 'skipped')
|
if (test.outcome === 'skipped')
|
||||||
status = 'skipped';
|
status = 'skipped';
|
||||||
const searchValues: SearchValues = {
|
const searchValues: SearchValues = {
|
||||||
text: (status + ' ' + test.projectName + ' ' + (test.botName || '') + ' ' + test.location.file + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(),
|
text: (status + ' ' + test.projectName + ' ' + test.tags.join(' ') + ' ' + test.location.file + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(),
|
||||||
project: test.projectName.toLowerCase(),
|
project: test.projectName.toLowerCase(),
|
||||||
status: status as any,
|
status: status as any,
|
||||||
file: test.location.file,
|
file: test.location.file,
|
||||||
line: String(test.location.line),
|
line: String(test.location.line),
|
||||||
column: String(test.location.column),
|
column: String(test.location.column),
|
||||||
labels: testCaseLabels(test).map(label => label.toLowerCase()),
|
labels: test.tags.map(tag => tag.toLowerCase()),
|
||||||
};
|
};
|
||||||
(test as any).searchValues = searchValues;
|
(test as any).searchValues = searchValues;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,22 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { TestCaseSummary } from './types';
|
|
||||||
|
|
||||||
const labelsSymbol = Symbol('labels');
|
|
||||||
|
|
||||||
// Note: all labels start with "@"
|
|
||||||
export function testCaseLabels(test: TestCaseSummary): string[] {
|
|
||||||
if (!(test as any)[labelsSymbol]) {
|
|
||||||
const labels: string[] = [];
|
|
||||||
if (test.botName)
|
|
||||||
labels.push('@' + test.botName);
|
|
||||||
labels.push(...test.tags);
|
|
||||||
(test as any)[labelsSymbol] = labels;
|
|
||||||
}
|
|
||||||
return (test as any)[labelsSymbol];
|
|
||||||
}
|
|
||||||
|
|
||||||
// hash string to integer in range [0, 6] for color index, to get same color for same tag
|
// hash string to integer in range [0, 6] for color index, to get same color for same tag
|
||||||
export function hashStringToInt(str: string) {
|
export function hashStringToInt(str: string) {
|
||||||
let hash = 0;
|
let hash = 0;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { ProjectLink } from './links';
|
||||||
import { statusIcon } from './statusIcon';
|
import { statusIcon } from './statusIcon';
|
||||||
import './testCaseView.css';
|
import './testCaseView.css';
|
||||||
import { TestResultView } from './testResultView';
|
import { TestResultView } from './testResultView';
|
||||||
import { hashStringToInt, testCaseLabels } from './labelUtils';
|
import { hashStringToInt } from './labelUtils';
|
||||||
import { msToString } from './uiUtils';
|
import { msToString } from './uiUtils';
|
||||||
|
|
||||||
export const TestCaseView: React.FC<{
|
export const TestCaseView: React.FC<{
|
||||||
|
|
@ -37,7 +37,7 @@ export const TestCaseView: React.FC<{
|
||||||
const labels = React.useMemo(() => {
|
const labels = React.useMemo(() => {
|
||||||
if (!test)
|
if (!test)
|
||||||
return undefined;
|
return undefined;
|
||||||
return testCaseLabels(test);
|
return test.tags;
|
||||||
}, [test]);
|
}, [test]);
|
||||||
|
|
||||||
return <div className='test-case-column vbox'>
|
return <div className='test-case-column vbox'>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { generateTraceUrl, Link, navigate, ProjectLink } from './links';
|
||||||
import { statusIcon } from './statusIcon';
|
import { statusIcon } from './statusIcon';
|
||||||
import './testFileView.css';
|
import './testFileView.css';
|
||||||
import { video, image, trace } from './icons';
|
import { video, image, trace } from './icons';
|
||||||
import { hashStringToInt, testCaseLabels } from './labelUtils';
|
import { hashStringToInt } from './labelUtils';
|
||||||
|
|
||||||
export const TestFileView: React.FC<React.PropsWithChildren<{
|
export const TestFileView: React.FC<React.PropsWithChildren<{
|
||||||
report: HTMLReport;
|
report: HTMLReport;
|
||||||
|
|
@ -52,7 +52,7 @@ export const TestFileView: React.FC<React.PropsWithChildren<{
|
||||||
</Link>
|
</Link>
|
||||||
{report.projectNames.length > 1 && !!test.projectName &&
|
{report.projectNames.length > 1 && !!test.projectName &&
|
||||||
<ProjectLink projectNames={report.projectNames} projectName={test.projectName} />}
|
<ProjectLink projectNames={report.projectNames} projectName={test.projectName} />}
|
||||||
<LabelsClickView labels={testCaseLabels(test)} />
|
<LabelsClickView labels={test.tags} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span data-testid='test-duration' style={{ minWidth: '50px', textAlign: 'right' }}>{msToString(test.duration)}</span>
|
<span data-testid='test-duration' style={{ minWidth: '50px', textAlign: 'right' }}>{msToString(test.duration)}</span>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ export type JsonPattern = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type JsonProject = {
|
export type JsonProject = {
|
||||||
id: string;
|
|
||||||
grep: JsonPattern[];
|
grep: JsonPattern[];
|
||||||
grepInvert: JsonPattern[];
|
grepInvert: JsonPattern[];
|
||||||
metadata: Metadata;
|
metadata: Metadata;
|
||||||
|
|
@ -132,16 +131,18 @@ export class TeleReporterReceiver {
|
||||||
private _rootDir!: string;
|
private _rootDir!: string;
|
||||||
private _listOnly = false;
|
private _listOnly = false;
|
||||||
private _clearPreviousResultsWhenTestBegins: boolean = false;
|
private _clearPreviousResultsWhenTestBegins: boolean = false;
|
||||||
private _reuseTestCases: boolean;
|
private _mergeTestCases: boolean;
|
||||||
|
private _mergeProjects: boolean;
|
||||||
private _reportConfig: MergeReporterConfig | undefined;
|
private _reportConfig: MergeReporterConfig | undefined;
|
||||||
private _config!: reporterTypes.FullConfig;
|
private _config!: reporterTypes.FullConfig;
|
||||||
private _stringPool = new StringInternPool();
|
private _stringPool = new StringInternPool();
|
||||||
|
|
||||||
constructor(pathSeparator: string, reporter: Partial<ReporterV2>, reuseTestCases: boolean, reportConfig?: MergeReporterConfig) {
|
constructor(pathSeparator: string, reporter: Partial<ReporterV2>, mergeProjects: boolean, mergeTestCases: boolean, reportConfig?: MergeReporterConfig) {
|
||||||
this._rootSuite = new TeleSuite('', 'root');
|
this._rootSuite = new TeleSuite('', 'root');
|
||||||
this._pathSeparator = pathSeparator;
|
this._pathSeparator = pathSeparator;
|
||||||
this._reporter = reporter;
|
this._reporter = reporter;
|
||||||
this._reuseTestCases = reuseTestCases;
|
this._mergeProjects = mergeProjects;
|
||||||
|
this._mergeTestCases = mergeTestCases;
|
||||||
this._reportConfig = reportConfig;
|
this._reportConfig = reportConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,7 +202,7 @@ export class TeleReporterReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onProject(project: JsonProject) {
|
private _onProject(project: JsonProject) {
|
||||||
let projectSuite = this._rootSuite.suites.find(suite => suite.project()!.__projectId === project.id);
|
let projectSuite = this._mergeProjects ? this._rootSuite.suites.find(suite => suite.project()!.name === project.name) : undefined;
|
||||||
if (!projectSuite) {
|
if (!projectSuite) {
|
||||||
projectSuite = new TeleSuite(project.name, 'project');
|
projectSuite = new TeleSuite(project.name, 'project');
|
||||||
this._rootSuite.suites.push(projectSuite);
|
this._rootSuite.suites.push(projectSuite);
|
||||||
|
|
@ -331,7 +332,6 @@ export class TeleReporterReceiver {
|
||||||
|
|
||||||
private _parseProject(project: JsonProject): TeleFullProject {
|
private _parseProject(project: JsonProject): TeleFullProject {
|
||||||
return {
|
return {
|
||||||
__projectId: project.id,
|
|
||||||
metadata: project.metadata,
|
metadata: project.metadata,
|
||||||
name: project.name,
|
name: project.name,
|
||||||
outputDir: this._absolutePath(project.outputDir),
|
outputDir: this._absolutePath(project.outputDir),
|
||||||
|
|
@ -375,7 +375,7 @@ export class TeleReporterReceiver {
|
||||||
|
|
||||||
private _mergeTestsInto(jsonTests: JsonTestCase[], parent: TeleSuite) {
|
private _mergeTestsInto(jsonTests: JsonTestCase[], parent: TeleSuite) {
|
||||||
for (const jsonTest of jsonTests) {
|
for (const jsonTest of jsonTests) {
|
||||||
let targetTest = this._reuseTestCases ? parent.tests.find(s => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : undefined;
|
let targetTest = this._mergeTestCases ? parent.tests.find(s => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : undefined;
|
||||||
if (!targetTest) {
|
if (!targetTest) {
|
||||||
targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);
|
targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);
|
||||||
targetTest.parent = parent;
|
targetTest.parent = parent;
|
||||||
|
|
@ -593,7 +593,7 @@ class TeleTestResult implements reporterTypes.TestResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeleFullProject = FullProject & { __projectId: string };
|
export type TeleFullProject = FullProject;
|
||||||
|
|
||||||
export const baseFullConfig: reporterTypes.FullConfig = {
|
export const baseFullConfig: reporterTypes.FullConfig = {
|
||||||
forbidOnly: false,
|
forbidOnly: false,
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ class HtmlBuilder {
|
||||||
}
|
}
|
||||||
const { testFile, testFileSummary } = fileEntry;
|
const { testFile, testFileSummary } = fileEntry;
|
||||||
const testEntries: TestEntry[] = [];
|
const testEntries: TestEntry[] = [];
|
||||||
this._processJsonSuite(fileSuite, fileId, projectSuite.project()!.name, projectSuite.project()!.metadata?.reportName, [], testEntries);
|
this._processJsonSuite(fileSuite, fileId, projectSuite.project()!.name, [], testEntries);
|
||||||
for (const test of testEntries) {
|
for (const test of testEntries) {
|
||||||
testFile.tests.push(test.testCase);
|
testFile.tests.push(test.testCase);
|
||||||
testFileSummary.tests.push(test.testCaseSummary);
|
testFileSummary.tests.push(test.testCaseSummary);
|
||||||
|
|
@ -341,13 +341,13 @@ class HtmlBuilder {
|
||||||
this._dataZipFile.addBuffer(Buffer.from(JSON.stringify(data)), fileName);
|
this._dataZipFile.addBuffer(Buffer.from(JSON.stringify(data)), fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _processJsonSuite(suite: Suite, fileId: string, projectName: string, botName: string | undefined, path: string[], outTests: TestEntry[]) {
|
private _processJsonSuite(suite: Suite, fileId: string, projectName: string, path: string[], outTests: TestEntry[]) {
|
||||||
const newPath = [...path, suite.title];
|
const newPath = [...path, suite.title];
|
||||||
suite.suites.forEach(s => this._processJsonSuite(s, fileId, projectName, botName, newPath, outTests));
|
suite.suites.forEach(s => this._processJsonSuite(s, fileId, projectName, newPath, outTests));
|
||||||
suite.tests.forEach(t => outTests.push(this._createTestEntry(fileId, t, projectName, botName, newPath)));
|
suite.tests.forEach(t => outTests.push(this._createTestEntry(fileId, t, projectName, newPath)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createTestEntry(fileId: string, test: TestCasePublic, projectName: string, botName: string | undefined, path: string[]): TestEntry {
|
private _createTestEntry(fileId: string, test: TestCasePublic, projectName: string, path: string[]): TestEntry {
|
||||||
const duration = test.results.reduce((a, r) => a + r.duration, 0);
|
const duration = test.results.reduce((a, r) => a + r.duration, 0);
|
||||||
const location = this._relativeLocation(test.location)!;
|
const location = this._relativeLocation(test.location)!;
|
||||||
path = path.slice(1);
|
path = path.slice(1);
|
||||||
|
|
@ -363,7 +363,6 @@ class HtmlBuilder {
|
||||||
testId,
|
testId,
|
||||||
title: test.title,
|
title: test.title,
|
||||||
projectName,
|
projectName,
|
||||||
botName,
|
|
||||||
location,
|
location,
|
||||||
duration,
|
duration,
|
||||||
// Annotations can be pushed directly, with a wrong type.
|
// Annotations can be pushed directly, with a wrong type.
|
||||||
|
|
@ -378,7 +377,6 @@ class HtmlBuilder {
|
||||||
testId,
|
testId,
|
||||||
title: test.title,
|
title: test.title,
|
||||||
projectName,
|
projectName,
|
||||||
botName,
|
|
||||||
location,
|
location,
|
||||||
duration,
|
duration,
|
||||||
// Annotations can be pushed directly, with a wrong type.
|
// Annotations can be pushed directly, with a wrong type.
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { TeleReporterReceiver } from '../isomorphic/teleReceiver';
|
||||||
import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';
|
import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';
|
||||||
import { createReporters } from '../runner/reporters';
|
import { createReporters } from '../runner/reporters';
|
||||||
import { Multiplexer } from './multiplexer';
|
import { Multiplexer } from './multiplexer';
|
||||||
import { ZipFile, calculateSha1 } from 'playwright-core/lib/utils';
|
import { ZipFile } from 'playwright-core/lib/utils';
|
||||||
import { currentBlobReportVersion, type BlobReportMetadata } from './blob';
|
import { currentBlobReportVersion, type BlobReportMetadata } from './blob';
|
||||||
import { relativeFilePath } from '../util';
|
import { relativeFilePath } from '../util';
|
||||||
import type { TestError } from '../../types/testReporter';
|
import type { TestError } from '../../types/testReporter';
|
||||||
|
|
@ -53,7 +53,7 @@ export async function createMergedReport(config: FullConfigInternal, dir: string
|
||||||
const eventData = await mergeEvents(dir, shardFiles, stringPool, printStatus, rootDirOverride);
|
const eventData = await mergeEvents(dir, shardFiles, stringPool, printStatus, rootDirOverride);
|
||||||
// If expicit config is provided, use platform path separator, otherwise use the one from the report (if any).
|
// If expicit config is provided, use platform path separator, otherwise use the one from the report (if any).
|
||||||
const pathSep = rootDirOverride ? path.sep : (eventData.pathSeparatorFromMetadata ?? path.sep);
|
const pathSep = rootDirOverride ? path.sep : (eventData.pathSeparatorFromMetadata ?? path.sep);
|
||||||
const receiver = new TeleReporterReceiver(pathSep, multiplexer, false, config.config);
|
const receiver = new TeleReporterReceiver(pathSep, multiplexer, false, false, config.config);
|
||||||
printStatus(`processing test events`);
|
printStatus(`processing test events`);
|
||||||
|
|
||||||
const dispatchEvents = async (events: JsonEvent[]) => {
|
const dispatchEvents = async (events: JsonEvent[]) => {
|
||||||
|
|
@ -183,22 +183,15 @@ async function mergeEvents(dir: string, shardReportFiles: string[], stringPool:
|
||||||
return a.file.localeCompare(b.file);
|
return a.file.localeCompare(b.file);
|
||||||
});
|
});
|
||||||
|
|
||||||
const saltSet = new Set<string>();
|
|
||||||
|
|
||||||
printStatus(`merging events`);
|
printStatus(`merging events`);
|
||||||
|
|
||||||
const reports: ReportData[] = [];
|
const reports: ReportData[] = [];
|
||||||
|
|
||||||
for (const { file, parsedEvents, metadata, localPath } of blobs) {
|
for (let i = 0; i < blobs.length; ++i) {
|
||||||
// Generate unique salt for each blob.
|
// Generate unique salt for each blob.
|
||||||
const sha1 = calculateSha1(metadata.name || path.basename(file)).substring(0, 16);
|
const { parsedEvents, metadata, localPath } = blobs[i];
|
||||||
let salt = sha1;
|
|
||||||
for (let i = 0; saltSet.has(salt); i++)
|
|
||||||
salt = sha1 + '-' + i;
|
|
||||||
saltSet.add(salt);
|
|
||||||
|
|
||||||
const eventPatchers = new JsonEventPatchers();
|
const eventPatchers = new JsonEventPatchers();
|
||||||
eventPatchers.patchers.push(new IdsPatcher(stringPool, metadata.name, salt));
|
eventPatchers.patchers.push(new IdsPatcher(stringPool, metadata.name, String(i)));
|
||||||
// Only patch path separators if we are merging reports with explicit config.
|
// Only patch path separators if we are merging reports with explicit config.
|
||||||
if (rootDirOverride)
|
if (rootDirOverride)
|
||||||
eventPatchers.patchers.push(new PathSeparatorPatcher(metadata.pathSeparator));
|
eventPatchers.patchers.push(new PathSeparatorPatcher(metadata.pathSeparator));
|
||||||
|
|
@ -354,10 +347,14 @@ class UniqueFileNameGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
class IdsPatcher {
|
class IdsPatcher {
|
||||||
constructor(
|
private _stringPool: StringInternPool;
|
||||||
private _stringPool: StringInternPool,
|
private _botName: string | undefined;
|
||||||
private _reportName: string | undefined,
|
private _salt: string;
|
||||||
private _salt: string) {
|
|
||||||
|
constructor(stringPool: StringInternPool, botName: string | undefined, salt: string) {
|
||||||
|
this._stringPool = stringPool;
|
||||||
|
this._botName = botName;
|
||||||
|
this._salt = salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
patchEvent(event: JsonEvent) {
|
patchEvent(event: JsonEvent) {
|
||||||
|
|
@ -380,13 +377,18 @@ class IdsPatcher {
|
||||||
|
|
||||||
private _onProject(project: JsonProject) {
|
private _onProject(project: JsonProject) {
|
||||||
project.metadata = project.metadata ?? {};
|
project.metadata = project.metadata ?? {};
|
||||||
project.metadata.reportName = this._reportName;
|
project.metadata.botName = this._botName;
|
||||||
project.id = this._stringPool.internString(project.id + this._salt);
|
|
||||||
project.suites.forEach(suite => this._updateTestIds(suite));
|
project.suites.forEach(suite => this._updateTestIds(suite));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateTestIds(suite: JsonSuite) {
|
private _updateTestIds(suite: JsonSuite) {
|
||||||
suite.tests.forEach(test => test.testId = this._mapTestId(test.testId));
|
suite.tests.forEach(test => {
|
||||||
|
test.testId = this._mapTestId(test.testId);
|
||||||
|
if (this._botName) {
|
||||||
|
test.tags = test.tags || [];
|
||||||
|
test.tags.unshift('@' + this._botName);
|
||||||
|
}
|
||||||
|
});
|
||||||
suite.suites.forEach(suite => this._updateTestIds(suite));
|
suite.suites.forEach(suite => this._updateTestIds(suite));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { createGuid } from 'playwright-core/lib/utils';
|
import { createGuid } from 'playwright-core/lib/utils';
|
||||||
import type { FullConfig, FullResult, Location, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
|
import type { FullConfig, FullResult, Location, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter';
|
||||||
import { getProjectId } from '../common/config';
|
|
||||||
import type { JsonAttachment, JsonConfig, JsonEvent, JsonFullResult, JsonProject, JsonStdIOType, JsonSuite, JsonTestCase, JsonTestEnd, JsonTestResultEnd, JsonTestResultStart, JsonTestStepEnd, JsonTestStepStart } from '../isomorphic/teleReceiver';
|
import type { JsonAttachment, JsonConfig, JsonEvent, JsonFullResult, JsonProject, JsonStdIOType, JsonSuite, JsonTestCase, JsonTestEnd, JsonTestResultEnd, JsonTestResultStart, JsonTestStepEnd, JsonTestStepStart } from '../isomorphic/teleReceiver';
|
||||||
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
|
import { serializeRegexPatterns } from '../isomorphic/teleReceiver';
|
||||||
import type { ReporterV2 } from './reporterV2';
|
import type { ReporterV2 } from './reporterV2';
|
||||||
|
|
@ -158,7 +157,6 @@ export class TeleReporterEmitter implements ReporterV2 {
|
||||||
private _serializeProject(suite: Suite): JsonProject {
|
private _serializeProject(suite: Suite): JsonProject {
|
||||||
const project = suite.project()!;
|
const project = suite.project()!;
|
||||||
const report: JsonProject = {
|
const report: JsonProject = {
|
||||||
id: getProjectId(project),
|
|
||||||
metadata: project.metadata,
|
metadata: project.metadata,
|
||||||
name: project.name,
|
name: project.name,
|
||||||
outputDir: this._relativePath(project.outputDir),
|
outputDir: this._relativePath(project.outputDir),
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export async function createReporters(config: FullConfigInternal, mode: 'list' |
|
||||||
}
|
}
|
||||||
if (process.env.PW_TEST_REPORTER) {
|
if (process.env.PW_TEST_REPORTER) {
|
||||||
const reporterConstructor = await loadReporter(config, process.env.PW_TEST_REPORTER);
|
const reporterConstructor = await loadReporter(config, process.env.PW_TEST_REPORTER);
|
||||||
reporters.push(wrapReporterAsV2(new reporterConstructor(runOptions)));
|
reporters.push(wrapReporterAsV2(new reporterConstructor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const someReporterPrintsToStdio = reporters.some(r => r.printsToStdio());
|
const someReporterPrintsToStdio = reporters.some(r => r.printsToStdio());
|
||||||
|
|
|
||||||
|
|
@ -654,7 +654,7 @@ const refreshRootSuite = (eraseResults: boolean): Promise<void> => {
|
||||||
lastRunTestCount = suite.allTests().length;
|
lastRunTestCount = suite.allTests().length;
|
||||||
lastRunReceiver = undefined;
|
lastRunReceiver = undefined;
|
||||||
}
|
}
|
||||||
}, false);
|
}, true, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
onBegin: (suite: Suite) => {
|
onBegin: (suite: Suite) => {
|
||||||
|
|
@ -700,7 +700,7 @@ const refreshRootSuite = (eraseResults: boolean): Promise<void> => {
|
||||||
onExit: () => {},
|
onExit: () => {},
|
||||||
onStepBegin: () => {},
|
onStepBegin: () => {},
|
||||||
onStepEnd: () => {},
|
onStepEnd: () => {},
|
||||||
}, true);
|
}, true, true);
|
||||||
receiver._setClearPreviousResultsWhenTestBegins();
|
receiver._setClearPreviousResultsWhenTestBegins();
|
||||||
return sendMessage('list', {});
|
return sendMessage('list', {});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,23 +50,23 @@ const metadata = {
|
||||||
};
|
};
|
||||||
|
|
||||||
config.projects!.push({
|
config.projects!.push({
|
||||||
name: 'android',
|
name: 'android-native',
|
||||||
use: {
|
use: {
|
||||||
loopback: '10.0.2.2',
|
loopback: '10.0.2.2',
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
},
|
},
|
||||||
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}',
|
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-android{ext}',
|
||||||
testDir: path.join(testDir, 'android'),
|
testDir: path.join(testDir, 'android'),
|
||||||
metadata,
|
metadata,
|
||||||
});
|
});
|
||||||
|
|
||||||
config.projects!.push({
|
config.projects!.push({
|
||||||
name: 'android',
|
name: 'android-page',
|
||||||
use: {
|
use: {
|
||||||
loopback: '10.0.2.2',
|
loopback: '10.0.2.2',
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
},
|
},
|
||||||
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}',
|
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-android{ext}',
|
||||||
testDir: path.join(testDir, 'page'),
|
testDir: path.join(testDir, 'page'),
|
||||||
metadata,
|
metadata,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const metadata = {
|
||||||
};
|
};
|
||||||
|
|
||||||
config.projects.push({
|
config.projects.push({
|
||||||
name: 'electron',
|
name: 'electron-api',
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
coverageName: 'electron',
|
coverageName: 'electron',
|
||||||
|
|
@ -61,7 +61,7 @@ config.projects.push({
|
||||||
});
|
});
|
||||||
|
|
||||||
config.projects.push({
|
config.projects.push({
|
||||||
name: 'electron',
|
name: 'electron-page',
|
||||||
// Share screenshots with chromium.
|
// Share screenshots with chromium.
|
||||||
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-chromium{ext}',
|
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-chromium{ext}',
|
||||||
use: {
|
use: {
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,10 @@ for (const browserName of browserNames) {
|
||||||
const testIgnore: RegExp[] = browserNames.filter(b => b !== browserName).map(b => new RegExp(b));
|
const testIgnore: RegExp[] = browserNames.filter(b => b !== browserName).map(b => new RegExp(b));
|
||||||
for (const folder of ['library', 'page']) {
|
for (const folder of ['library', 'page']) {
|
||||||
config.projects.push({
|
config.projects.push({
|
||||||
name: browserName,
|
name: `${browserName}-${folder}`,
|
||||||
testDir: path.join(testDir, folder),
|
testDir: path.join(testDir, folder),
|
||||||
testIgnore,
|
testIgnore,
|
||||||
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}',
|
snapshotPathTemplate: `{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-${browserName}{ext}`,
|
||||||
use: {
|
use: {
|
||||||
mode,
|
mode,
|
||||||
browserName,
|
browserName,
|
||||||
|
|
|
||||||
|
|
@ -1205,9 +1205,9 @@ test('preserve reportName on projects', async ({ runInlineTest, mergeReports })
|
||||||
|
|
||||||
class EchoReporter {
|
class EchoReporter {
|
||||||
onBegin(config, suite) {
|
onBegin(config, suite) {
|
||||||
const projects = suite.suites.map(s => s.project()).sort((a, b) => a.metadata.reportName.localeCompare(b.metadata.reportName));
|
const projects = suite.suites.map(s => s.project()).sort((a, b) => a.metadata.botName.localeCompare(b.metadata.botName));
|
||||||
console.log('projectNames: ' + projects.map(p => p.name));
|
console.log('projectNames: ' + projects.map(p => p.name));
|
||||||
console.log('reportNames: ' + projects.map(p => p.metadata.reportName));
|
console.log('botNames: ' + projects.map(p => p.metadata.botName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = EchoReporter;
|
module.exports = EchoReporter;
|
||||||
|
|
@ -1233,7 +1233,7 @@ test('preserve reportName on projects', async ({ runInlineTest, mergeReports })
|
||||||
const { exitCode, output } = await mergeReports(reportDir, {}, { additionalArgs: ['--reporter', test.info().outputPath('echo-reporter.js')] });
|
const { exitCode, output } = await mergeReports(reportDir, {}, { additionalArgs: ['--reporter', test.info().outputPath('echo-reporter.js')] });
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
expect(output).toContain(`projectNames: foo,foo`);
|
expect(output).toContain(`projectNames: foo,foo`);
|
||||||
expect(output).toContain(`reportNames: first,second`);
|
expect(output).toContain(`botNames: first,second`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('no reports error', async ({ runInlineTest, mergeReports }) => {
|
test('no reports error', async ({ runInlineTest, mergeReports }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue