Brief Summary
This video demonstrates how to use Execute Automation's Playwright MCP server to automate complex API testing, including authentication. It covers the new features in version 1.0.6, such as file uploading and improved text parsing. The video shows how to test APIs with authentication using a swagger.json schema and AI-refined prompts, highlighting the server's ability to perform comprehensive API tests and generate detailed reports.
- Automate complex API testing with Playwright MCP server.
- Utilize swagger.json schema for comprehensive API testing.
- Refine prompts with AI for better test execution.
- Generate detailed test reports.
Introduction to Playwright MCP Server for API Automation
The video introduces the use of Execute Automation's Playwright MCP server for automating complex APIs, contrasting it with simpler API testing methods demonstrated in earlier videos. The new release of the Playwright MCP server, version 1.0.6, includes features like file uploading, improved visible text parsing with character limits, updated hover functionality, and enhanced browser support. The demonstration focuses on the complex API testing feature.
Exploring the EA API Swagger Documentation
The video explores the EA API, accessible via EA API.somi.com/swagger/index.html
, which includes both GraphQL and REST endpoints. It demonstrates the API's authentication process and capabilities for creating, deleting, and managing products. The initial attempt to access a product endpoint results in an unauthorized exception, highlighting the need for a bearer token in the header for authentication. The authentication API is used to obtain a bearer token by providing a username (Karthik) and password (123456). This token is then used to authorize subsequent API calls, allowing successful retrieval of product details.
Setting Up Playwright MCP Server
The video guides viewers on downloading and installing the Execute Automation's Playwright MCP server, referencing previous videos for detailed instructions. It explains how to configure the cloud desktop to run the Playwright MCP server, ensuring it is up and running. The latest version, 1.0.6, is highlighted as the version to use for the demonstrated functionalities.
Automating API Testing with AI-Refined Prompts
The video details the process of automating API testing using the Playwright MCP server and AI-refined prompts. The swagger.json file URL, which serves as the schema for the entire API, is copied. An initial prompt is created to instruct the AI to understand the swagger documentation, perform authentication, and conduct API tests for all endpoints in the schema. The initial prompt is refined using Gemini to improve clarity and comprehensiveness, resulting in a more descriptive prompt that includes instructions for authentication and testing all available endpoints.
Executing API Tests and Analyzing Results
The refined prompt is executed within the cloud desktop environment, where the Playwright MCP server is configured. The server fetches the swagger documentation, authenticates, and begins testing various endpoints. The process involves multiple playright_get
tool calls to perform get operations and post operations to obtain the bearer token. The video shows how the server adapts to unauthorized exceptions by including the bearer token in subsequent requests. A comprehensive report summary is generated, detailing the status of each endpoint.
Refining Prompts for Accurate Testing
A new chat is initiated to refine the prompt further, specifically instructing the AI to include the bearer token in the header for all requests. The updated prompt ensures that the authentication token is correctly passed, leading to successful test executions across all endpoints. The video concludes by highlighting the power of using Execute Automation's Playwright MCP server in conjunction with AI models to automate and enhance API testing, making it accessible even for complex APIs hosted in various environments.