🖥️

Playwright mCP Server for API Testing

May 13, 2025

Playwright mCP Server API Testing Support Lecture Notes

Introduction

  • Speaker: Karik from isautomation.com
  • Today’s topic: Playwright mCP Server and its new API testing support.
  • Reminder about Model Context Protocol (mCP) related to Cloud Anthropic.

mCP Overview

  • mCP (Model Context Protocol): Open-source standard aimed at enhancing AI assistants by connecting them to systems where relevant data resides.
  • Allows interaction with multiple systems (e.g., Slack, Google Drive, Puppeteer).
  • Karik developed his own Playwright mCP server.

Previous Discussions

  • Earlier demonstrations included UI automation testing (username/password entry, UI interactions).
  • Introduction to the API testing feature in the Playwright mCP server.

New Feature: API Testing

  • Allows users to perform API testing using plain English commands.
  • Demonstration of how to use the Playwright mCP server for API testing.
  • mCP Server Requirement: Users need to have Playwright mCP Server version 0.2.4 or higher.

Demonstration Steps

  1. Setting Up API Test in Cloud Desktop Client

    • Open the Cloud Desktop Client.
    • mCP server functionality visible if correctly integrated.
  2. Performing a POST Operation

    • Example command: Perform a POST operation for a specified URL with a body and verify response properties (created_at, id).
    • Endpoint used for demonstration: A RESTful API available for testing.
    • Expectation: Check for created_at and id properties in the API response.
  3. Verifying Response

    • After sending the command, the mCP server initiates the operation.
    • Verifies that the response includes the expected properties (id, created_at).
    • Response details include status code and content.
  4. Workflow for API Operations

    • Option to perform PUT or PATCH operations requires storing the ID from the POST response.
    • Sequence of operations: POST, GET, PUT, PATCH, DELETE with stored IDs for update purposes.

Classic API Testing Approach

  • Traditional method involves using Postman for API requests.
  • Copying URLs and sending requests manually.
  • Testing outcomes (success/failure) depend on the individual requests made in Postman.

Benefits of Playwright mCP for API Testing

  • Streamlined testing process using plain English commands without manual input for each operation.
  • Easier for manual testers to understand and execute tests.
  • Flexibility in performing various API operations (e.g., create, update, verify).

Example Command Scenarios

  1. Perform POST operation, store ID for future reference.
  2. Perform corresponding GET operation to verify details.
  3. Execute PUT operation to update product details.
  4. Perform PATCH operation to modify specific attributes.

Conclusion

  • Successful execution of all API testing operations using Playwright mCP Server.
  • Future enhancements may include more complex operations and functionalities.
  • Encouragement to utilize Playwright mCP Server for API testing at no cost.

Closing Remarks

  • Thanks for watching, and reminder to check out the Playwright mCP server for API testing.