Files
Innei b4b1205ee9 ♻️ refactor(modal): migrate confirm modals to @lobehub/ui/base-ui (Phase 1) (#15259)
* ♻️ refactor(modal): migrate confirm modals to @lobehub/ui/base-ui

Replace all `App.useApp().modal.confirm`, `Modal.confirm` and `AntModal.confirm`
call sites with the headless `confirmModal` from `@lobehub/ui/base-ui`, dropping
antd-only props (`centered`, `type`, `width`, `okButtonProps.type='primary'`,
`okButtonProps.loading`, `classNames.root`) that the base-ui imperative API does
not accept.

- 82 files touched; `modal.confirm`/`Modal.confirm` call sites now zero
- `PageEditor/store/action.ts`: drop `modal` arg from `handleDelete`
- `ResourceManager/useUploadFolder`: replace dynamic `import('antd').Modal`
- `Eval/DatasetsTab`: migrate `modal.success` to `confirmModal`

Part of LOBE-9645 Phase 1.

* ♻️ refactor(ui): migrate select/modal call sites to @lobehub/ui/base-ui

- Convert imperative-modal factories (createXxxModal + Content split) for apikey,
  creds (Create/Edit/View), provider (CreateNewProvider), and messenger LinkModal.
- Switch Select usages to base-ui Select (Messenger AgentSelect, provider sdkType).
- Restructure CreateNewProvider form to vertical layout with manual section titles
  for tighter spacing; drop FormModal/Form group nesting.
- Standardize small ActionIcon sizing via DESKTOP_HEADER_ICON_SMALL_SIZE
  (WideScreenButton, ToggleRightPanelButton, ContextDropdown, AddNewProvider).
- Fix missing title on ResourceManager delete confirm modal so the header
  (title + close X) renders.
- Update react skill and AGENTS.md to require base-ui priority over root @lobehub/ui
  / antd; expand component table and Common Mistakes with explicit base-ui rules.

* ♻️ refactor(ui): swap antd Select to base-ui Select and migrate createStyles to createStaticStyles

*  test: update test mocks for base-ui confirmModal migration

*  test(e2e): switch delete confirm selector to base-ui dialog role
2026-05-28 02:46:27 +08:00
..
2026-01-23 23:57:08 +08:00
2026-01-23 23:57:08 +08:00
2026-01-23 23:57:08 +08:00
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