bolt.diy/tests
2025-04-03 10:48:34 -07:00
..
e2e Remove problems UI (#94) 2025-04-03 10:48:34 -07:00
README.md Add playwright 2025-03-12 17:54:44 -07:00

End-to-End Tests

This directory contains end-to-end tests using Playwright.

Running Tests

You can run the tests using the following commands:

# Run all tests
pnpm test:e2e

# Run tests in UI mode
pnpm test:e2e:ui

# Run only Chromium tests
pnpm test:e2e:chromium

Test Structure

  • e2e/ - Contains all end-to-end tests
    • setup/ - Test utilities and helper functions
    • homepage.spec.ts - Tests for the homepage
    • chat.spec.ts - Tests for the chat interface

Adding New Tests

When adding new tests:

  1. Create a new .spec.ts file in the e2e/ directory
  2. Import the necessary utilities from setup/test-utils.ts
  3. Use the test.describe() and test() functions to define test suites and cases

Debugging Tests

You can debug tests by running them in UI mode:

pnpm test:e2e:ui

This will open the Playwright UI, where you can:

  • See test results
  • View screenshots and videos
  • Trace test execution
  • Re-run specific tests

Test Data Attributes

For reliable selectors, we use data attributes in our components:

  • data-testid="chat-interface" - The main chat interface
  • data-testid="message-input" - The message input field
  • data-testid="send-button" - The send message button
  • data-testid="assistant-message" - Messages from the assistant
  • data-testid="model-selector" - The model selection dropdown
  • data-testid="model-option" - Individual model options in the dropdown

Configuration

The Playwright configuration is in playwright.config.ts at the project root.