mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03: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 }}
|
||||
env:
|
||||
PWTEST_BLOB_REPORT: 1
|
||||
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||
if: always()
|
||||
@ -141,10 +142,12 @@ jobs:
|
||||
- run: npm run ttest -- --shard ${{ matrix.shard }}
|
||||
env:
|
||||
PWTEST_BLOB_REPORT: 1
|
||||
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||
if: matrix.os != 'ubuntu-latest'
|
||||
- run: xvfb-run npm run ttest -- --shard ${{ matrix.shard }}
|
||||
env:
|
||||
PWTEST_BLOB_REPORT: 1
|
||||
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||
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_CHANNEL: ${{ matrix.channel }}
|
||||
PWTEST_BLOB_REPORT: 1
|
||||
PWTEST_BLOB_SUFFIX: "-${{ matrix.channel }}"
|
||||
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
||||
if: always()
|
||||
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'] {
|
||||
return attachments.map(attachment => {
|
||||
if (!attachment.path || !fs.statSync(attachment.path).isFile())
|
||||
|
@ -144,7 +144,7 @@ export class TeleReporterEmitter implements Reporter {
|
||||
const report: JsonProject = {
|
||||
id: projectIds.get(project)!,
|
||||
metadata: project.metadata,
|
||||
name: project.name,
|
||||
name: this._serializeProjectName(project.name),
|
||||
outputDir: this._relativePath(project.outputDir),
|
||||
repeatEach: project.repeatEach,
|
||||
retries: project.retries,
|
||||
@ -164,6 +164,10 @@ export class TeleReporterEmitter implements Reporter {
|
||||
return report;
|
||||
}
|
||||
|
||||
_serializeProjectName(name: string): string {
|
||||
return name;
|
||||
}
|
||||
|
||||
private _serializeSuite(suite: Suite): JsonSuite {
|
||||
const result = {
|
||||
type: suite._type,
|
||||
|
@ -227,6 +227,7 @@ export function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
||||
PW_TEST_REPORTER_WS_ENDPOINT: undefined,
|
||||
PW_TEST_SOURCE_TRANSFORM: undefined,
|
||||
PW_TEST_SOURCE_TRANSFORM_SCOPE: undefined,
|
||||
PWTEST_BLOB_SUFFIX: undefined,
|
||||
TEST_WORKER_INDEX: undefined,
|
||||
TEST_PARLLEL_INDEX: undefined,
|
||||
NODE_OPTIONS: undefined,
|
||||
|
@ -898,4 +898,44 @@ test('preserve steps in html report', async ({ runInlineTest, mergeReports, show
|
||||
await expect(page.getByText('— tests/a.test.js:7')).toBeVisible();
|
||||
await page.getByText('my step').click();
|
||||
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…
Reference in New Issue
Block a user