Skip to content

SodhanaLibrary/ftmocks-server

Repository files navigation

FtMocks

Overview

FtMocks is a Node.js application that will simplify your maintainance of mock data.

Features

  • Easy maintanance of mock data for test cases
  • Default mock data for all test cases
  • Mock server for the test case

Quickstart with playwright

To quickly set up a new mock project, install Playwright, and clone & start the ftmocks-server, run:

npx ftmocks init-playwright-all

Setup quickly

To quickly set up ftmocks-server, run:

npx ftmocks setup

Documentation

Getting Started

Prerequisites

To run this project, ensure you have the following installed on your machine:

  • Node.js (version 20 or later)
  • npm (usually included with Node.js)

Installation

  1. Clone the repository:

    git clone https://github.com/SodhanaLibrary/ftmocks-server.git
  2. Navigate into the project directory:

    cd ftmocks-server
  3. Install dependencies:

    npm i
  4. Install playwright:

    npx playwright install

Configuration

  1. Create my-project.env file for your project

  2. Create a my-project.env file in the project root.

    MOCK_DIR=./example/my-project/testMockData
    PORT=5000
    PREFERRED_SERVER_PORTS=[4051]

Running the Project

To start the project, use:

npm start my-project

MCP Server

The ftmocks-server includes an MCP (Model Context Protocol) server that exposes test operations as tools for AI assistants (e.g., Cursor).

Tools: getTests, deleteTest, updateTest, createTest

Run standalone:

npm run mcp
# or with env file:
node mcp-server.js --envfile=my-project.env

Cursor integration: Add to .cursor/mcp.json:

{
  "mcpServers": {
    "ftmocks": {
      "command": "node",
      "args": ["/path/to/ftmocks-server/mcp-server.js"],
      "env": { "MOCK_DIR": "/path/to/your/mock/data" }
    }
  }
}

See mcp-config.example.json for a template.

About ftmocks-utils

Refer to the ftmocks-utils for detailed API documentation, usage examples, and advanced configuration. This package is essential for wrighting testcases.

Contributing

Contributions are welcome! Please fork this repository and create a pull request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

About

Mock data manager for Playwright automation tests and React Testing Library

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors