Gathering detailed insights and metrics for @jprealini/cypress-mcp
Gathering detailed insights and metrics for @jprealini/cypress-mcp
Gathering detailed insights and metrics for @jprealini/cypress-mcp
Gathering detailed insights and metrics for @jprealini/cypress-mcp
npm install @jprealini/cypress-mcp
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
3 Stars
1 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jul 14, 2025
Latest Version
1.0.12
Package Id
@jprealini/cypress-mcp@1.0.12
Unpacked Size
67.27 kB
Size
12.77 kB
File Count
5
NPM Version
10.9.2
Node Version
22.17.0
Published on
Jun 26, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
This MCP (Model Context Protocol) server automatically generates complete Cypress Page Object classes AND comprehensive test suites for any web page.
The server generates two files:
{ClassName}.ts
)1export class ExampleComLoginPage { 2 // Private elements 3 #elements = { 4 button_login: () => cy.get('#login-button'), 5 input_username: () => cy.get('input[name="username"]'), 6 link_home: () => cy.contains('a', 'Home') 7 } 8 9 // Public getters 10 get ButtonLogin() { return this.#elements.button_login() } 11 get InputUsername() { return this.#elements.input_username() } 12 get LinkHome() { return this.#elements.link_home() } 13 14 // Interaction methods 15 clickButtonLogin() { return this.#elements.button_login().click() } 16 typeInputUsername(text: string) { return this.#elements.input_username().type(text) } 17 clickLinkHome() { return this.#elements.link_home().click() } 18 19 // Workflow methods 20 login(username: string, password: string) { 21 this.typeInputUsername(username) 22 this.typeInputPassword(password) 23 this.clickButtonLogin() 24 return this 25 } 26}
{ClassName}.cy.ts
)1import { ExampleComLoginPage } from './ExampleComLoginPage' 2 3describe('ExampleComLoginPage Tests', () => { 4 let page: ExampleComLoginPage 5 6 beforeEach(() => { 7 cy.visit('https://example.com/login') 8 page = new ExampleComLoginPage() 9 }) 10 11 describe('Element Interactions', () => { 12 it('should click button_login', () => { 13 page.clickButtonLogin() 14 }) 15 16 it('should type in input_username', () => { 17 page.typeInputUsername('test input') 18 page.getInputUsername().should('have.value', 'test input') 19 }) 20 }) 21 22 describe('Login Workflow', () => { 23 it('should login with valid credentials', () => { 24 page.login('validuser@example.com', 'validpassword') 25 cy.url().should('not.include', '/login') 26 }) 27 28 it('should show error with invalid credentials', () => { 29 page.login('invalid@example.com', 'wrongpassword') 30 cy.contains('Invalid credentials').should('be.visible') 31 }) 32 }) 33 34 describe('Error Handling', () => { 35 it('should handle network errors gracefully', () => { 36 cy.intercept('GET', '**', { forceNetworkError: true }) 37 cy.visit('https://example.com/login') 38 }) 39 }) 40})
The server intelligently detects common patterns and generates appropriate tests:
1npm install
Start the server:
1npx tsx main.ts
Use with an MCP client:
The server exposes a generateLocator
tool that accepts a URL parameter.
Example tool call:
1{ 2 "method": "tools/call", 3 "params": { 4 "name": "generateLocator", 5 "arguments": { 6 "url": "https://example.com/login" 7 } 8 } 9}
Response format: The server returns both the Page Object class and test suite:
// ===== PAGE OBJECT CLASS =====
// Save this as: ExampleComLoginPage.ts
export class ExampleComLoginPage { ... }
// ===== CYPRESS TESTS =====
// Save this as: ExampleComLoginPage.cy.ts
describe('ExampleComLoginPage Tests', () => { ... }
1// Use the generated Page Object 2import { ExampleComLoginPage } from './ExampleComLoginPage' 3 4describe('Login Page', () => { 5 const page = new ExampleComLoginPage() 6 7 it('should login successfully', () => { 8 page.login('username', 'password') 9 page.verifyPageLoaded() 10 }) 11}) 12 13// Run the generated test suite 14// npx cypress run --spec "cypress/e2e/ExampleComLoginPage.cy.ts"
@modelcontextprotocol/sdk
: MCP server implementationpuppeteer
: Web scraping and page renderingcheerio
: HTML parsing and element selectionzod
: Schema validationtypescript
: Type safetyThe server includes comprehensive error handling for:
The server uses Puppeteer with the following settings:
To add support for new element types, interaction methods, or test patterns, modify the generatePageObjectClass
and generateCypressTests
functions in main.ts
.
No vulnerabilities found.
No security vulnerabilities found.