lobehub/e2e
Rdmclin2 965fc929e1
feat: add unified messaging tool for cross-platform communication (#13296)
*  feat: add cross-platform message tool for AI bot channel operations

Implement a unified message tool (`lobe-message`) that provides AI with
messaging capabilities across Discord, Telegram, Slack, Google Chat,
and IRC through a single interface with platform-specific extensions.

Core APIs: sendMessage, readMessages, editMessage, deleteMessage,
searchMessages, reactToMessage, getReactions, pin/unpin management,
channel/member info, thread operations, and polls.

Architecture follows the established builtin-tool pattern:
- Package: @lobechat/builtin-tool-message (manifest, types, executor,
  ExecutionRuntime, client components)
- Registry: registered in builtin-tools (renders, inspectors,
  interventions, streamings)
- Server runtime: stub service ready for platform adapter integration

https://claude.ai/code/session_011sHc6R7V4cSYKere9RY1QM

* feat: implement platform specific message service

* chore: add wechat platform

* chore: update wechat api service

* chore: update protocol implementation

* chore: optimize  platform api test

* fix: lark domain error

* feat: support bot message cli

* chore: refactor adapter to service

* chore: optimize bot status fetch

* fix: bot status

* fix: channel nav ignore

* feat: message tool support bot manage

* feat: add lobe-message runtime

* feat: support direct message

* feat: add history limit

* chore: update const limit

* feat: optimize  server id message history limit

* chore: optimize system role & inject platform environment info

* chore: update  readMessages vibe

* fix: form body width 50%

* chore: optimize tool prompt

* chore: update i18n files

* chore: optimize read message system role and update bot message lh

* updage readMessage api rate limit

* chore: comatible for readMessages

* fix: feishu readMessage implementation error

* fix: test case

* chore: update i18n files

* fix: lint error

* chore: add timeout for conversaction case

* fix: message test case

* fix: vite gzip error

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-31 00:26:32 +08:00
..
docs feat: remove NextAuth (#11732) 2026-01-23 23:57:08 +08:00
scripts feat: remove NextAuth (#11732) 2026-01-23 23:57:08 +08:00
src feat: add unified messaging tool for cross-platform communication (#13296) 2026-03-31 00:26:32 +08:00
.gitignore test: agent e2e case for user journey (#11063) 2025-12-31 10:10:40 +08:00
CLAUDE.md feat: remove NextAuth (#11732) 2026-01-23 23:57:08 +08:00
cucumber.config.js test: add page e2e testing (#11423) 2026-01-12 15:41:02 +08:00
package.json ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
README.md 📝 docs: Polishing and improving product documentation (#12612) 2026-03-03 16:01:41 +08:00
tsconfig.json 👷 build: nodejs 24 (#10003) 2025-11-03 12:56:15 +08:00

E2E Tests for LobeHub

This directory contains end-to-end (E2E) tests for LobeHub using Cucumber (BDD) and Playwright.

Directory Structure

e2e/
├── src/               # Source files
│   ├── features/      # Gherkin feature files
│   │   └── discover/  # Discover page tests
│   ├── steps/         # Step definitions
│   │   ├── common/    # Reusable step definitions
│   │   └── discover/  # Discover-specific steps
│   └── support/       # Test support files
│       └── world.ts   # Custom World context
├── reports/           # Test reports (generated)
├── cucumber.config.js # Cucumber configuration
├── tsconfig.json      # TypeScript configuration
└── package.json       # Dependencies and scripts

## Prerequisites

- Node.js 20, 22, or >=24
- Dev server running on `http://localhost:3010` (or set `BASE_URL` env var)

## Installation

Install dependencies:

```bash
cd e2e
pnpm install

Install Playwright browsers:

npx playwright install chromium

Running Tests

Run all tests:

npm test

Run tests in headed mode (see browser):

npm run test:headed

Run only smoke tests:

npm run test:smoke

Run discover tests:

npm run test:discover

Environment Variables

  • BASE_URL: Base URL for the application (default: http://localhost:3010)
  • PORT: Port number (default: 3010)
  • HEADLESS: Run browser in headless mode (default: true, set to false to see browser)

Example:

HEADLESS=false BASE_URL=http://localhost:3000 npm run test:smoke

Writing Tests

Feature Files

Feature files are written in Gherkin syntax and placed in the src/features/ directory:

@community @smoke
Feature: Community Smoke Tests
  Critical path tests to ensure the community module is functional

  @COMMUNITY-SMOKE-001 @P0
  Scenario: Load community assistant list page
    Given I navigate to "/community/agent"
    Then the page should load without errors
    And I should see the page body
    And I should see the search bar
    And I should see assistant cards

Step Definitions

Step definitions are TypeScript files in the src/steps/ directory that implement the steps from feature files:

import { Given, Then } from '@cucumber/cucumber';
import { expect } from '@playwright/test';

import { CustomWorld } from '../../support/world';

Given('I navigate to {string}', async function (this: CustomWorld, path: string) {
  await this.page.goto(path);
  await this.page.waitForLoadState('domcontentloaded');
});

Test Reports

After running tests, HTML and JSON reports are generated in the reports/ directory:

  • reports/cucumber-report.html - Human-readable HTML report
  • reports/cucumber-report.json - Machine-readable JSON report

Troubleshooting

Browser not found

If you see errors about missing browser executables:

npx playwright install chromium

Port already in use

Make sure the dev server is running on the expected port (3010 by default), or set PORT or BASE_URL environment variable.

Test timeout

Increase timeout in cucumber.config.js or src/steps/hooks.ts:

setDefaultTimeout(120000); // 2 minutes