Files
silverbullet-icalendar/conductor/tracks/testing_infrastructure_20260219/spec.md

2.2 KiB

Specification: Testing Infrastructure (Playwright & Docker)

Overview

Our current testing strategy relies on manual mocks that don't capture the complexity of real-world iCalendar data (specifically from Outlook/Office 365). This has led to multiple regressions where object-type RRULE properties cause the plug to fail. This track implements a full E2E and integration testing suite using Docker, Playwright, and real .ics samples.

Functional Requirements

  • Dockerized Environment: A docker-compose.test.yml that spins up:
    • SilverBullet: A clean instance for plug installation.
    • Mock ICS Server: A simple web server serving files from a test_data/ directory.
  • Playwright E2E Suite:
    • Automation: Automates logging into SilverBullet, installing the freshly built icalendar.plug.js, and triggering a sync.
    • Console Monitoring: Automatically fails the test if any Error or TypeError is detected in the browser console.
    • Index Verification: Uses SilverBullet syscalls (via Playwright evaluate) or UI queries to verify that the expected number of ical-event objects exist in the index.
  • Real-Data Integration Tests: Deno unit tests that parse actual .ics files (e.g. mock_calendar.ics) using the real ts-ics parser before calling expandRecurrences.

Implementation Steps

  1. Environment Setup: Create docker-compose.test.yml and a test_data/ directory with at least one problematic Outlook .ics file.
  2. Mock Server: Configure a lightweight container (e.g., Nginx or Python) to serve the test_data/.
  3. Playwright Scaffolding: Initialize Playwright and create a tests/sync.spec.ts that handles authentication and plug installation.
  4. Verification Logic: Implement the console-listener and index-counting logic in the test suite.
  5. Smoke Test: Fix the known WORKWEEKSTART error and verify that the new infrastructure catches it if the fix is reverted.

Acceptance Criteria

  • A single command (e.g., make test-e2e) builds the plug, starts the containers, and runs the Playwright suite.
  • The E2E suite successfully identifies the WORKWEEKSTART error when run against the current (buggy) code.
  • The E2E suite passes after the WORKWEEKSTART fix is applied.