Post, Put and Delete Requester | Bondar Academy
Course: Playwright API Testing with TypeScript
Module: Building a Framework
Instructor: Artem Bondar
Lesson Summary
In this lesson, we focused on enhancing our request handler by implementing three additional methods for API operations: post , put , and delete . We also updated our smokeTest.spec.ts with new tests following a refined pattern. Key Concepts Post Request: Similar structure to the get request. Uses method post and includes a request body under the data property. Validates response status and returns the response. Put Request: Follows the same pattern as the post request. Changes the method to put . Delete Request: Simpler than the others; only requires headers. Validates status code, as there is no response body. Testing Enhancements We refactored our tests in smokeTest.spec.ts to include: Creating, updating, and deleting articles. Using a beforeAll hook to obtain a token. Assertions to confirm that articles were created and deleted successfully. Visual Clarity in Tests The new test design allows for better visual separation of steps, making it easier to follow the flow of operations compared to the previous format. In summary, we successfully added the postRequest , putRequest , and deleteRequest methods, and improved our testing framework for better readability and maintainability.