Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runner): hide APIResponse.* calls from results #34909

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Feb 25, 2025

Closes #34840. We weren't hiding APIResponse calls, but they're all read-only so they shouldn't be visible in the test report.

markAsInternalType wasn't available in APIResponse because it's not a channel owner, so I had to add an explicit exclusion.

@Skn0tt Skn0tt requested review from dgozman and Copilot February 25, 2025 07:17
@Skn0tt Skn0tt self-assigned this Feb 25, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

tests/playwright-test/test-step.spec.ts:1451

  • Changing the annotation field from an object to an array might cause compatibility issues if downstream consumers expect an object format. Please ensure all related processing is updated to support an array of annotations.
annotation: [

@@ -1462,6 +1465,11 @@ test('reading network request / response should not be listed as step', {
page.on('response', async response => {
await response.text();
});
await page.route('**/*', async route => {
Copy link
Preview

Copilot AI Feb 25, 2025

Choose a reason for hiding this comment

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

Using a broad route pattern ('**/*') could unintentionally intercept more network requests than intended. Consider narrowing the pattern to target only the requests relevant to the test.

Suggested change
await page.route('**/*', async route => {
await page.route('${server.EMPTY_PAGE}', async route => {

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks copilot, but this is used in tests.

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

7 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node20-1
⚠️ [playwright-test] › tests/ui-mode-test-output.spec.ts:117:5 › should collapse repeated console messages for test @ubuntu-latest-node22-1
⚠️ [webkit-library] › tests/library/browsercontext-clearcookies.spec.ts:72:3 › should remove cookies by name regex @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/browsercontext-clearcookies.spec.ts:146:3 › should remove cookies by name and domain @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/trace-viewer.spec.ts:149:1 › should open simple trace viewer @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

38672 passed, 793 skipped
✔️✔️✔️

Merge workflow run.

@@ -258,7 +258,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
onApiCallBegin: (data: ApiCallData) => {
const testInfo = currentTestInfo();
// Some special calls do not get into steps.
if (!testInfo || data.apiName.includes('setTestIdAttribute') || data.apiName === 'tracing.groupEnd')
if (!testInfo || data.apiName.includes('setTestIdAttribute') || data.apiName === 'tracing.groupEnd' || data.apiName.startsWith('apiResponse.'))
Copy link
Contributor

Choose a reason for hiding this comment

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

The proper way is to wrap all methods of APIResponse class with _wrapApiCall(func, true). That will account for tracing, steps and debug logging.

Copy link
Member Author

@Skn0tt Skn0tt Feb 25, 2025

Choose a reason for hiding this comment

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

That only exists for ChannelOwners though, and APIResponse isn't an interface inside protocol.yml, but only an object

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but you can call it on this._request that is a channel owner.

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.

[Bug]: reponse.* calls still visible in test report
2 participants