Skip to content

feat(reporter): and printOnlyFailures and --reporter-only-failures - #42766

Open
Devin Rousso (dcrousso) wants to merge 2 commits into
microsoft:mainfrom
dcrousso:fix-42702
Open

Devin Rousso (dcrousso) wants to merge 2 commits into
microsoft:mainfrom
dcrousso:fix-42702

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

passing tests add unnecessary reporter output

allow configuring dot and line to suppress progress while retaining failure details and the final summary

also add a generic --reporter-only-failures that does the same but across all reporters and only for that specific run

fixes #42702

passing tests add unnecessary reporter output

allow `dot` and `line` to suppress progress while retaining failure details and the final summary
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

configDir: string,
_mode?: 'list' | 'test' | 'merge',
_commandHash?: string,
_onlyFailures?: boolean,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can make this public for others to be able to respect the mode

const entry = this.fileDurations.get(fileAndProject) || { duration: 0, workers: new Set() };
entry.duration += result.duration;
entry.workers.add(result.workerIndex);
this.fileDurations.set(fileAndProject, entry);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still want the durations, etc, there probably is a better place to bail later on.

export class BlobReporter extends TeleReporterEmitter {
private readonly _messages: JsonEvent[] = [];
private readonly _attachments: { originalPath: string, zipEntryPath: string }[] = [];
private _messages: JsonEvent[] = [];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think blob report should always get all the data, blob is not a reporter, it is a database that is used to replay and generate actual reports off.

},
};
for (const test of this.suite.allTests())
for (const test of this.suite.allTests().filter(test => !this._onlyFailures || isFailure(test)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this filtration is duped and is tedious, let's unify it across the reporters. i'm thinking filters and filtrating visitors to reuse and keep existing code as much as possible.

this._resultIndex.set(result, index);

if (!this.screen.isTTY)
if (this._printOnlyFailures || !this.screen.isTTY)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List will be hard to implement - we need to what, delay the report of begin?

reporter options must be configured individually

add `--reporter-only-failures` to filter terminal output and final reports

- preserve blob data and complete run accounting
- expose `onlyFailures` for custom reporters
- add `printOnlyFailures` support to `list`
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [installation tests] › playwright-cdn.spec.ts:43 › playwright cdn failover should work (https://cdn.playwright.dev/dbazure/download/playwright) @package-installations-macos-latest
❌ [installation tests] › playwright-cdn.spec.ts:43 › playwright cdn failover should work (https://playwright.download.prss.microsoft.com/dbazure/download/playwright) @package-installations-macos-latest

8 flaky ⚠️ [chromium-library] › library/video.spec.ts:690 › screencast › should capture full viewport `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-page] › page/page-leaks.spec.ts:136 › expect should not leak `@webkit-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:189 › should show snapshots for steps `@windows-latest-node22`

52423 passed, 1250 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 CI is clear — both failures are pre-existing macOS CDN infra noise

Hi, I'm the Playwright bot and I took a look at the failing CI.

The only two failures are the playwright-cdn failover installation tests on package-installations-macos-latest, and the same two tests failed on main pushes and on several unrelated PRs within hours of this run. This PR only touches reporters, which those tests don't exercise. Nothing here to act on.

Details

Pre-existing flake / infra

The other 8 entries in the report are flaky (rescued on retry) across video, cookie, emulation, goto, leaks and ui-mode specs — unrelated to reporters, and not failures.

Triaged by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [firefox] › mcp/cli-devtools.spec.ts:117 › per-part commands extract individual parts @mcp-windows-latest-firefox

8628 passed, 1446 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 CI is clear — the one failure is a known Firefox-on-Windows flake

Hi, I'm the Playwright bot and I took a look at the failing CI.

mcp/cli-devtools.spec.ts:117 › per-part commands extract individual parts has failed with the exact same error on seven unrelated SHAs, always on mcp-windows-latest-firefox. This PR only changes reporter output, which that test doesn't touch. Nothing here to act on.

Details

Pre-existing flake / infra

Why the diff can't reach it

This PR is scoped to printOnlyFailures / --reporter-only-failures: packages/playwright/src/reporters/*, program.ts, configLoader.ts, ipc.ts and the CLI actions. The MCP devtools CLI test asserts on request-headers / request-body / response-* command output, which goes through the MCP tool stack, not the test reporters. The two reporter specs the PR adds (reporter-base.spec.ts, reporter-only-failures.spec.ts) passed.

Triaged by the Playwright bot - agent run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Failures-only terminal reporter (suppress passing test output)

2 participants