mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: blob report project suffix (#23212)
This commit is contained in:
parent
5f36a2946e
commit
10b7cb3979
3
.github/workflows/tests_primary.yml
vendored
3
.github/workflows/tests_primary.yml
vendored
@ -53,6 +53,7 @@ jobs:
|
|||||||
- 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_BLOB_REPORT: 1
|
PWTEST_BLOB_REPORT: 1
|
||||||
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||||
- 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()
|
||||||
@ -141,10 +142,12 @@ jobs:
|
|||||||
- run: npm run ttest -- --shard ${{ matrix.shard }}
|
- run: npm run ttest -- --shard ${{ matrix.shard }}
|
||||||
env:
|
env:
|
||||||
PWTEST_BLOB_REPORT: 1
|
PWTEST_BLOB_REPORT: 1
|
||||||
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||||
if: matrix.os != 'ubuntu-latest'
|
if: matrix.os != 'ubuntu-latest'
|
||||||
- run: xvfb-run npm run ttest -- --shard ${{ matrix.shard }}
|
- run: xvfb-run npm run ttest -- --shard ${{ matrix.shard }}
|
||||||
env:
|
env:
|
||||||
PWTEST_BLOB_REPORT: 1
|
PWTEST_BLOB_REPORT: 1
|
||||||
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||||
if: always()
|
if: always()
|
||||||
|
1
.github/workflows/tests_secondary.yml
vendored
1
.github/workflows/tests_secondary.yml
vendored
@ -204,6 +204,7 @@ jobs:
|
|||||||
PWTEST_TRACE: 1
|
PWTEST_TRACE: 1
|
||||||
PWTEST_CHANNEL: ${{ matrix.channel }}
|
PWTEST_CHANNEL: ${{ matrix.channel }}
|
||||||
PWTEST_BLOB_REPORT: 1
|
PWTEST_BLOB_REPORT: 1
|
||||||
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.channel }}"
|
||||||
- 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
|
||||||
|
@ -66,6 +66,11 @@ export class BlobReporter extends TeleReporterEmitter {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override _serializeProjectName(name: string): string {
|
||||||
|
const suffix = process.env.PWTEST_BLOB_SUFFIX;
|
||||||
|
return name + (suffix ? suffix : '');
|
||||||
|
}
|
||||||
|
|
||||||
override _serializeAttachments(attachments: TestResult['attachments']): TestResult['attachments'] {
|
override _serializeAttachments(attachments: TestResult['attachments']): TestResult['attachments'] {
|
||||||
return attachments.map(attachment => {
|
return attachments.map(attachment => {
|
||||||
if (!attachment.path || !fs.statSync(attachment.path).isFile())
|
if (!attachment.path || !fs.statSync(attachment.path).isFile())
|
||||||
|
@ -144,7 +144,7 @@ export class TeleReporterEmitter implements Reporter {
|
|||||||
const report: JsonProject = {
|
const report: JsonProject = {
|
||||||
id: projectIds.get(project)!,
|
id: projectIds.get(project)!,
|
||||||
metadata: project.metadata,
|
metadata: project.metadata,
|
||||||
name: project.name,
|
name: this._serializeProjectName(project.name),
|
||||||
outputDir: this._relativePath(project.outputDir),
|
outputDir: this._relativePath(project.outputDir),
|
||||||
repeatEach: project.repeatEach,
|
repeatEach: project.repeatEach,
|
||||||
retries: project.retries,
|
retries: project.retries,
|
||||||
@ -164,6 +164,10 @@ export class TeleReporterEmitter implements Reporter {
|
|||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_serializeProjectName(name: string): string {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
private _serializeSuite(suite: Suite): JsonSuite {
|
private _serializeSuite(suite: Suite): JsonSuite {
|
||||||
const result = {
|
const result = {
|
||||||
type: suite._type,
|
type: suite._type,
|
||||||
|
@ -227,6 +227,7 @@ export function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|||||||
PW_TEST_REPORTER_WS_ENDPOINT: undefined,
|
PW_TEST_REPORTER_WS_ENDPOINT: undefined,
|
||||||
PW_TEST_SOURCE_TRANSFORM: undefined,
|
PW_TEST_SOURCE_TRANSFORM: undefined,
|
||||||
PW_TEST_SOURCE_TRANSFORM_SCOPE: undefined,
|
PW_TEST_SOURCE_TRANSFORM_SCOPE: undefined,
|
||||||
|
PWTEST_BLOB_SUFFIX: undefined,
|
||||||
TEST_WORKER_INDEX: undefined,
|
TEST_WORKER_INDEX: undefined,
|
||||||
TEST_PARLLEL_INDEX: undefined,
|
TEST_PARLLEL_INDEX: undefined,
|
||||||
NODE_OPTIONS: undefined,
|
NODE_OPTIONS: undefined,
|
||||||
|
@ -899,3 +899,43 @@ test('preserve steps in html report', async ({ runInlineTest, mergeReports, show
|
|||||||
await page.getByText('my step').click();
|
await page.getByText('my step').click();
|
||||||
await expect(page.getByText('expect.toBe')).toBeVisible();
|
await expect(page.getByText('expect.toBe')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('custom project suffix', async ({ runInlineTest, mergeReports }) => {
|
||||||
|
test.slow();
|
||||||
|
const reportDir = test.info().outputPath('blob-report');
|
||||||
|
const files = {
|
||||||
|
'echo-reporter.js': `
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
class EchoReporter {
|
||||||
|
onBegin(config, suite) {
|
||||||
|
const projects = suite.suites.map(s => s.project().name);
|
||||||
|
console.log('projects:', projects);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = EchoReporter;
|
||||||
|
`,
|
||||||
|
'playwright.config.ts': `
|
||||||
|
module.exports = {
|
||||||
|
retries: 1,
|
||||||
|
reporter: 'blob',
|
||||||
|
projects: [
|
||||||
|
{ name: 'foo' },
|
||||||
|
{ name: 'bar' },
|
||||||
|
]
|
||||||
|
};
|
||||||
|
`,
|
||||||
|
'a.test.js': `
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
test('math 1', async ({}) => {
|
||||||
|
expect(1 + 1).toBe(2);
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
|
||||||
|
await runInlineTest(files, undefined, { PWTEST_BLOB_SUFFIX: '-suffix' });
|
||||||
|
|
||||||
|
const { exitCode, output } = await mergeReports(reportDir, {}, { additionalArgs: ['--reporter', test.info().outputPath('echo-reporter.js')] });
|
||||||
|
expect(exitCode).toBe(0);
|
||||||
|
expect(output).toContain(`projects: [ 'foo-suffix', 'bar-suffix' ]`);
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user