microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
65.99k stars 3.6k forks source link

[Feature]: Support attachment for particular test step #32748

Open sttaran opened 1 week ago

sttaran commented 1 week ago

🚀 Feature Request

I heavily use playwright for API tests. I highly appreciate and extremely love that we can see all requests made by APIRequestContext in traces.

However sometimes test scenarios require a lot of API calls so having possibility to see request/response payloads right in the test step in html report would make debugging much easier.

Example

I am not really good at designing but that's a simple option how it would look like

image

Motivation

This feature would make debugging much easier not only for people who write automated tests but also for developers who faced with failed tests and want to reproduce the failure or just to investigate the root cause.

UPD: I provided single use case I want to have the feature to. But I know that some teams do not use APIRequestContext and use some external libraries as http clients. E.g. graphql-codegen for generating api methods on client. In this case it would also help them because they are not going to have network info in traces. However I believe such feature could be helpful not only for logging API calls.

vitalets commented 4 days ago

I raised a similar issue before, there is an interesting point about concurrent steps: https://github.com/microsoft/playwright/issues/29323#issuecomment-1924645277