A Cypress plugin for mocking WebSocket servers during end-to-end tests. Version 0.1.2 is stable but low-activity. It allows defining a sequence of server and client messages in a JSON fixture file, enabling deterministic testing of WebSocket interactions. The plugin listens on localhost:1999 and enforces ordered message exchanges. Compared to other WebSocket mocking libraries, it integrates directly with Cypress commands and fixtures.
npm install cypress-websocket-serverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows setup: add Cypress command and start mock server, then use cy.setWebsocketWorkflow() with a fixture file defining ordered server/client messages.
Change port by passing options to startMockWsServer (if supported) or kill conflicting processes.
Ensure your application sends exactly the expected messages in the correct order.
Verify cypress/plugins/index.js includes startMockWsServer(config). Restart Cypress.
In cypress/support/index.js, add: import { addCommand } from 'cypress-websocket-server'; addCommand();