Skip to content

feat(e2e-react): Add offline mock server with REST and DDP emulation - #1420

Open
aryanpatil-07 wants to merge 2 commits into
RocketChat:developfrom
aryanpatil-07:feat/e2e-standalone-mock-server
Open

aryanpatil-07 wants to merge 2 commits into
RocketChat:developfrom
aryanpatil-07:feat/e2e-standalone-mock-server

Conversation

@aryanpatil-07

Copy link
Copy Markdown
Contributor

Fixes #1419

Acceptance Criteria fulfillment

  • Intercept REST API endpoints (/api/v1/login, rooms.info, channels.messages, chat.sendMessage) with valid mock payloads.
  • Emulate the Meteor/DDP WebSocket handshake (connect ➔ connected, sub ➔ ready) and live message broadcasting.
  • Persist mock authentication sessions in localStorage (ec_token) across page reloads.
  • Allow yarn dev in packages/e2e-react to run out-of-the-box in a functional chat playground without network errors.

Description

In packages/e2e-react/src/App.tsx, the default development configuration pointed to https://demo.qa.rocket.chat/. This server is defunct (expired SSL certificate / 404 response), causing the browser to abort requests with Failed to fetch and displaying a connection error toast on login.

This PR adds mockServer.ts into packages/e2e-react to intercept both REST fetch requests and WebSocket DDP connections. Developers can now run and interact with the React test app offline without spinning up a heavy local Rocket.Chat/MongoDB instance.

PR Test Details

  1. Run yarn --cwd packages/e2e-react dev.
  2. Navigate to http://127.0.0.1:5173/.
  3. Observe automatic login as test_acc.
  4. Send messages in the chat input and verify they appear immediately in the message list.

… emulation (RocketChat#1419)

Fixes RocketChat#1419

- Implemented mock REST endpoints for login, room info, message fetching, and message sending
- Emulated Meteor/DDP WebSocket handshake and live message broadcasting
- Enabled session persistence via localStorage (ec_token)
- Pointed default e2e-react configuration away from defunct demo QA server

Signed-off-by: Aryan Patil <aryanpatil0700@gmail.com>
@aryanpatil-07
aryanpatil-07 marked this pull request as ready for review November 12, 2026 15:52
@aryanpatil-07
aryanpatil-07 marked this pull request as draft November 12, 2026 16:04
@aryanpatil-07
aryanpatil-07 marked this pull request as ready for review November 14, 2026 06:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(e2e-react): Add standalone offline mock server with REST and DDP emulation

1 participant