Skip to content

Add comprehensive E2E test framework with Playwright #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 18, 2025

This PR implements a complete end-to-end testing framework using Playwright to cover both API endpoints and UI functionality as requested in the issue.

🧪 Test Framework Setup

  • Playwright Configuration: Cross-browser testing (Chromium, Firefox, WebKit) with auto-start dev servers
  • Test Structure: Organized in /test/e2e/ with comprehensive coverage
  • npm Integration: npm test command runs all tests from repository root
  • Developer Experience: Added npm run test:headed and npm run test:ui for interactive testing

📋 Test Coverage

API Endpoint Tests (test/e2e/api-*.spec.ts)

  • Document Upload (documents-post.ts): PDF file upload validation, multipart form handling, error cases
  • Document Retrieval (documents-get.ts): File download, 404 handling, content-type validation
  • Chat Streaming (chats-post.ts): NDJSON streaming responses, session management, error handling

UI Tests (test/e2e/ui-chat.spec.ts)

  • Chat interface display and component validation
  • Message sending/receiving workflows
  • Suggestion click handling
  • User ID generation and localStorage persistence
  • New chat functionality

Full E2E Workflows (test/e2e/full-workflow.spec.ts)

  • Complete Integration: Document upload → Chat about uploaded content
  • Multi-document Management: Parallel uploads and retrieval validation
  • Session Continuity: Multiple questions with conversation history

🛠 Infrastructure

  • Linting: Updated XO configuration with test-specific rules
  • Documentation: Comprehensive README in /test/e2e/ with usage instructions
  • Git Ignore: Test artifacts excluded from version control
  • Dependencies: Added @playwright/test with proper TypeScript support

📊 Test Statistics

54 tests across 4 test files providing comprehensive coverage:

  • 8 API endpoint tests
  • 8 UI interaction tests
  • 3 full workflow integration tests
  • Cross-browser multiplication (3 browsers × 18 base tests)

🚀 Usage

# Install Playwright browsers (first time only)
npx playwright install

# Start dev servers
npm run start:api  # Terminal 1
npm run start:webapp  # Terminal 2

# Run tests
npm test

The framework validates both the 2 base scenarios mentioned in the issue:

  1. File Upload: Tests document upload via /api/documents endpoint
  2. Chat UI: Tests chat interface asking questions about indexed documents

Fixes #5.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • functionscdn.azureedge.net
    • Triggering command: node lib/install.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add tests Add comprehensive E2E test framework with Playwright Jul 18, 2025
@Copilot Copilot AI requested a review from sinedied July 18, 2025 12:42
Copilot finished work on behalf of sinedied July 18, 2025 12:42
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.

Add tests
2 participants