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
67.33k stars 3.71k forks source link

[Feature] (REST) API Testing Capabilitys Improvement #21930

Open Kranael opened 1 year ago

Kranael commented 1 year ago

Hello Playwright Team,

Let us know what functionality you'd like to see in Playwright and what your use case is.

I'm a SDET and automate some tests in projects. Some projects are without an ui its only some big APIs. I tried native Playwright and for UI its "King of the Hill" but for API testing it's the whole opposite.

I think you reached a great level that even surpassed cypress in some aspects. I think you should now improve the API testing capabilitys of this framework. APIs are the waiter of data exchange so it would make sense to have this option aswell.

I would like to suggest some features as other people as well:

The difficulty in API testing lies in these problems: Authentication Proxy Setup the request -> https://github.com/microsoft/playwright/issues/19839

Inspect/debugging request (get header/body) -> https://github.com/microsoft/playwright/issues/18891, https://github.com/microsoft/playwright/issues/16239, https://github.com/microsoft/playwright/issues/10511

Inspect/debugging response (get header/body) -> https://github.com/microsoft/playwright/issues/18891, https://github.com/microsoft/playwright/issues/10511

validate response to have "key X" and key X deliver value Y

validate the whole response against a contract -> https://github.com/microsoft/playwright/issues/21561

Maybe you could team up with the supertest project -> https://github.com/ladjs/supertest or take insperation from https://rest-assured.io/

Do you think others might benefit from this as well?

Yes API testing will get more attention in the future. If 1 Framework could provide great UI and API testing capabilitys many startups and also migrating companys will evaluate playwright and finally choose it over products like soapUI or not well aged librarys like RestAssured. A one stop shop framework will help to streamline the testing effort and also the toolchain.

I write this because some "Feature Requests" are from 2021 or 2022 and API testing at least for REST will be really important in the future. So pls consider it to make the next effort and next releases in the API testing direction and visualisation of this testing level (maybe you can reuse traces or the new ui mode for api testing? Ofc with some additions and not easy work)

Thank you for this awesome tool and your hard work! Really thank you! :-)

Best regards

Kranael

jaktestowac commented 1 year ago

100% agree with extending API testing. There is no framework what can handle both GUI and API nicely (and probably biggest gap between Playwright and Cypress).

arkjel commented 1 year ago

Supertest's features in Playwright? Would be really nice!

shirink28 commented 1 year ago

What is the status of this issue?

xXDIOCANDE175Xx commented 9 months ago

I don't know if it's in line with the problem but as @Kranael said, you need a way via ApiContextRequest to be able to debug requests made trivially by having access to the url. For example via browserContext this is possible by creating a listener, could it be an "interesting" idea to implement it for the API part as well?