Skip to content

[Matrix] Testing Environment Setup #787

@alacy-centrl

Description

@alacy-centrl

Overview

Set up a complete local Matrix testing environment for development and testing.

Tasks

  • Install Synapse (Matrix homeserver) via Docker
  • Install Element (Matrix web client)
  • Create test Matrix accounts
  • Configure test rooms
  • Set up federation (optional)
  • Document environment setup steps
  • Create test automation scripts
  • Add environment to docker-compose.yml

Components

Synapse (Homeserver)

  • Docker image: matrixdotorg/synapse
  • Expose ports: 8008 (client API), 8448 (federation)
  • Generate signing keys
  • Create test users via admin API

Element (Web Client)

  • Docker image: vectorim/element-web
  • Expose port: 8080
  • Configure to use local Synapse
  • Create test accounts

Test Accounts

  • @testbot1:localhost - Primary bot account
  • @testbot2:localhost - Secondary account
  • @testuser:localhost - Test user account

Test Rooms

  • Test room 1: Public room for basic testing
  • Test room 2: Private room for access control testing
  • Test room 3: Room with multiple users

Docker Compose Setup

version: '3.8'
services:
  synapse:
    image: matrixdotorg/synapse:latest
    container_name: matrix-synapse
    ports:
      - "8008:8008"
      - "8448:8448"
    volumes:
      - ./test/fixtures/synapse:/data
    environment:
      - SYNAPSE_SERVER_NAME=localhost
      - SYNAPSE_REPORT_STATS=no
      - SYNAPSE_ENABLE_REGISTRATION=yes
  
  element:
    image: vectorim/element-web:latest
    container_name: matrix-element
    ports:
      - "8080:80"
    volumes:
      - ./test/fixtures/element/config.json:/app/config.json
    depends_on:
      - synapse

Setup Steps

  1. Run docker-compose -f docker-compose.matrix.yml up -d
  2. Wait for Synapse to start (~10 seconds)
  3. Create test users:
    curl -XPOST -d '{"username":"testbot1","password":"test123","auth":{"type":"m.login.dummy"}}' "http://localhost:8008/_matrix/client/r0/register"
  4. Get access tokens via Element or API
  5. Create test rooms and invite users
  6. Update opencode-router config with test credentials

Acceptance Criteria

  • Synapse runs and accepts registrations
  • Element can connect to Synapse
  • Can create test accounts
  • Can create rooms and send messages
  • Environment can be reset to clean state
  • Setup documented in README

Estimated Time

1 day

Dependencies

None

Testing

  1. Open Element at http://localhost:8080
  2. Log in as testuser
  3. Send message to test room
  4. Verify bot receives message (check opencode-router logs)
  5. Send reply from bot
  6. Verify message appears in Element

Troubleshooting

  • Synapse won't start: Check logs with docker logs matrix-synapse
  • Can't register: Ensure SYNAPSE_ENABLE_REGISTRATION=yes
  • Element can't connect: Check config.json has correct homeserver URL
  • Access token expired: Re-register or get new token via Element settings

See full plan: https://github.com/users/alacy-centrl/projects/2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions