# Smoke Test Suite

## Purpose
Define a fast, high-signal regression suite that can be run frequently (for example on each commit or before deployment).

Target runtime should remain short (for example <= 5 minutes in CI).

## Smoke Fixtures
Use a minimal subset:
- CE-001 (single timed)
- CE-002 (all-day)
- CE-003 (daily recurring)
- CE-010 (recurring with single-occurrence delete exception)

## Smoke Tests

### SMK-001 Plugin Health
- Plugin activates without fatal errors.
- Calendar admin main menu and sub-entries render:
  - `Users`
  - `Setup`
  - `Diagnostics`

### SMK-002 CRUD Happy Path
- Create CE-001 using write-enabled calendar UI/API.
- Update CE-001 title.
- Delete CE-001.
- Assert expected success feedback and list updates.

### SMK-003 Recurrence Exception Behavior
- Create CE-010.
- Delete single occurrence (`2026-04-17T14:00:00+01:00`).
- Assert sequence remains intact and one exception is recorded.

### SMK-004 Public UI Rendering
- Render shortcode page with CE-002 and CE-003 present.
- Assert no runtime error and event data is visible in default view.
- Sidebar shortcode (`[calendar_sidebar_upcoming]`) renders event date/time in `Europe/London` timezone semantics.

### SMK-005 ICS Endpoint
- Fetch ICS link.
- Assert `200` and `text/calendar`.
- Assert CE-003 appears with recurrence metadata.
- Assert CE-010 exception is represented (no split-series artifact).

### SMK-006 CalDAV Read/Write Gate
- `pending_approval` or unverified user: cannot authenticate.
- `active` user: can discover/read/create/update/delete one event successfully.
- Monthly ordinal recurrence must round-trip for CalDAV writes (`BYDAY=2SA` and `BYSETPOS=-1` cases).
- Thunderbird-style `DESCRIPTION;ALTREP="data:text/html,..."` updates must persist clean plain-text `DESCRIPTION` values without leaking `ALTREP` parameter content into stored descriptions.

### SMK-007 API Smoke (If API Exposed)
- Event create/list/delete basic path.
- User register/verify/admin-approval path.
- One unauthorized request check.

### SMK-008 Security Regression Smoke
- Register and forgot-password responses must not include raw verification/reset tokens.
- Register flow must trigger rate limiting (`429`) under abusive request volume.
- Stored user password hashes must use hardened hash format (not plaintext / not legacy fast hash).
- CalDAV object handling must preserve strict resource filename semantics (UUID-like `.ics` names work; unknown numeric path returns `404`).
- Legacy local harness check is archived at `fixture-tests/fixture_security_smoke.sh`.

### SMK-009 CalDAV Client Discovery Compatibility
- Unauthenticated `GET /caldav/` must return `401` with `WWW-Authenticate: Basic ...`.
- Authenticated `OPTIONS /caldav/` must advertise DAV calendar capability (`DAV: 1, calendar-access`) and discovery methods.
- Authenticated `PROPFIND /caldav/` must expose:
  - `current-user-principal`
  - calendar home set path
  - discoverable calendar collection href
- Authenticated `PROPFIND` on principal must return `calendar-home-set`.
- Authenticated `PROPFIND /caldav/calendars/` must include calendar collection metadata (`<C:calendar/>`) and supported component set (`VEVENT`).
- Authenticated `GET` on calendar collection (`.../calendars/public/`) must return `200` (availability probe compatibility).
- Authenticated `REPORT sync-collection` must succeed for both trailing slash and no-trailing-slash collection URLs.
- No-change `sync-collection` (current token) must return no change entries.
- Legacy local harness check is archived at `fixture-tests/fixture_caldav_client_compat_smoke.sh`.

### SMK-010 Lifecycle Controls (Staging Only)
- Verify Setup exposes `Uninstall Cleanup` setting with:
  - `keep` (default)
  - `remove`
- Verify deactivation does not remove tables/data.
- Verify uninstall behavior follows selected mode (`keep` preserves tables, `remove` drops plugin-owned tables/options).
- Full destructive flow is defined in `tests/lifecycle_test_cases.md`.

## Failure Handling
- Any smoke failure blocks merge/deploy.
- Capture artifact bundle: logs, request/response snippets, and failing fixture payload.

## Suggested Run Schedule
- Per commit: SMK-001..007
- Pre-release: smoke + full E2E + full API suite + SMK-009
- Nightly: full E2E + compatibility checks with target CalDAV/ICS clients

## Remote Runner
- Automated remote API+E2E smoke runner: `./tests/run_remote_tests.sh`
- Optional overrides:
  - `./tests/run_remote_tests.sh --base-url https://chezstephens.org.uk --user <email> --password <password>`
