VTODO skill
This commit is contained in:
293
skills/calendar/TESTING.md
Normal file
293
skills/calendar/TESTING.md
Normal file
@@ -0,0 +1,293 @@
|
||||
# Testing the Calendar Skill
|
||||
|
||||
End-to-end tests for send, reply, todo, calendar sync, and local calendar. All commands use `--dry-run` first, then live.
|
||||
|
||||
```bash
|
||||
SKILL_DIR=~/.openclaw/workspace/skills/calendar
|
||||
|
||||
# Use a date 3 days from now for test events
|
||||
TEST_DATE=$(date -d "+3 days" +%Y-%m-%d)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 1. Dry Run: Send Invite
|
||||
|
||||
Generates the ICS and MIME email without sending. Check that:
|
||||
- ICS has `METHOD:REQUEST`
|
||||
- MIME has `Content-Type: text/calendar; method=REQUEST`
|
||||
- `mail@luyx.org` appears as attendee (auto-added)
|
||||
- Times and timezone look correct
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh send \
|
||||
--to "mail@luyx.org" \
|
||||
--subject "Test Invite" \
|
||||
--summary "Test Event" \
|
||||
--start "${TEST_DATE}T15:00:00" \
|
||||
--end "${TEST_DATE}T16:00:00" \
|
||||
--dry-run
|
||||
```
|
||||
|
||||
## 2. Live Send: Self-Invite
|
||||
|
||||
Send a real invite to `mail@luyx.org` only (no confirmation needed per email rules).
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh send \
|
||||
--to "mail@luyx.org" \
|
||||
--subject "Calendar Skill Test" \
|
||||
--summary "Calendar Skill Test" \
|
||||
--start "${TEST_DATE}T15:00:00" \
|
||||
--end "${TEST_DATE}T16:00:00" \
|
||||
--location "Test Location"
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] Script exits without error
|
||||
- [ ] Email arrives at `mail@luyx.org`
|
||||
- [ ] Email shows Accept/Decline/Tentative buttons (not just an attachment)
|
||||
- [ ] `.ics` file saved to `~/.openclaw/workspace/calendars/home/`
|
||||
|
||||
## 3. Verify Calendar Sync and Local Calendar
|
||||
|
||||
After sending in step 2, check that the event synced and appears locally.
|
||||
|
||||
```bash
|
||||
# Check vdirsyncer sync ran (should have printed "Synced to CalDAV server" in step 2)
|
||||
# If not, run manually:
|
||||
vdirsyncer sync
|
||||
|
||||
# List .ics files in local calendar
|
||||
ls ~/.openclaw/workspace/calendars/home/
|
||||
|
||||
# Check the event shows up in khal
|
||||
khal list "$TEST_DATE"
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] `vdirsyncer sync` completes without errors
|
||||
- [ ] `.ics` file exists in `~/.openclaw/workspace/calendars/home/`
|
||||
- [ ] `khal list` shows "Calendar Skill Test" on the test date
|
||||
|
||||
## 4. Reply: Accept the Self-Invite
|
||||
|
||||
The invite sent in step 2 should be in the inbox. Find it, then accept it. This tests the full reply flow without needing an external sender.
|
||||
|
||||
```bash
|
||||
# Find the test invite in inbox
|
||||
himalaya envelope list
|
||||
|
||||
# Confirm it's the calendar invite
|
||||
himalaya message read <envelope-id>
|
||||
|
||||
# Accept it
|
||||
$SKILL_DIR/scripts/calendar.sh reply \
|
||||
--envelope-id <envelope-id> \
|
||||
--action accept
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] Reply sent to organizer (youlu@luyanxin.com, i.e. ourselves)
|
||||
- [ ] Original invite forwarded to `mail@luyx.org`
|
||||
- [ ] Event still in `~/.openclaw/workspace/calendars/home/`
|
||||
- [ ] `vdirsyncer sync` ran
|
||||
- [ ] `khal list "$TEST_DATE"` still shows the event
|
||||
|
||||
## 5. Reply: Decline an Invite
|
||||
|
||||
Send another self-invite, then decline it. This verifies decline removes the event from local calendar.
|
||||
|
||||
```bash
|
||||
# Send a second test invite
|
||||
$SKILL_DIR/scripts/calendar.sh send \
|
||||
--to "mail@luyx.org" \
|
||||
--subject "Decline Test" \
|
||||
--summary "Decline Test Event" \
|
||||
--start "${TEST_DATE}T17:00:00" \
|
||||
--end "${TEST_DATE}T18:00:00"
|
||||
|
||||
# Find it in inbox
|
||||
himalaya envelope list
|
||||
|
||||
# Decline it
|
||||
$SKILL_DIR/scripts/calendar.sh reply \
|
||||
--envelope-id <envelope-id> \
|
||||
--action decline \
|
||||
--comment "Testing decline flow."
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] Reply sent to organizer with comment
|
||||
- [ ] Event NOT forwarded to `mail@luyx.org`
|
||||
- [ ] Event removed from local calendar
|
||||
- [ ] `khal list "$TEST_DATE"` does NOT show "Decline Test Event"
|
||||
|
||||
## 6. Verify Final Calendar State
|
||||
|
||||
After all tests, confirm the calendar is in a clean state.
|
||||
|
||||
```bash
|
||||
# Sync one more time
|
||||
vdirsyncer sync
|
||||
|
||||
# Only the accepted event should remain
|
||||
khal list "$TEST_DATE"
|
||||
|
||||
# List all upcoming events
|
||||
khal list today 7d
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Dry Run: Add Todo
|
||||
|
||||
Generates the VTODO ICS and MIME email without saving. Check that:
|
||||
- ICS has `BEGIN:VTODO`
|
||||
- ICS has correct `PRIORITY` value (1 for high)
|
||||
- ICS has `STATUS:NEEDS-ACTION`
|
||||
- ICS has `BEGIN:VALARM`
|
||||
- MIME has `Content-Type: text/calendar`
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh todo add \
|
||||
--summary "Test Todo" \
|
||||
--due "$TEST_DATE" \
|
||||
--priority high \
|
||||
--dry-run
|
||||
```
|
||||
|
||||
## 8. Live Add: Create a Todo
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh todo add \
|
||||
--summary "Test Todo" \
|
||||
--due "$TEST_DATE" \
|
||||
--priority medium \
|
||||
--description "Test description"
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] Script exits without error
|
||||
- [ ] `.ics` file created in `~/.openclaw/workspace/calendars/tasks/`
|
||||
- [ ] Email arrives at `mail@luyx.org` with .ics attachment
|
||||
- [ ] `vdirsyncer sync` ran
|
||||
|
||||
## 9. List Todos
|
||||
|
||||
```bash
|
||||
# List pending todos
|
||||
$SKILL_DIR/scripts/calendar.sh todo list
|
||||
|
||||
# List all (including completed)
|
||||
$SKILL_DIR/scripts/calendar.sh todo list --all
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] "Test Todo" appears with correct urgency label
|
||||
- [ ] Priority grouping is correct
|
||||
- [ ] `--all` flag works (same output when none are completed)
|
||||
|
||||
## 10. Complete a Todo
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh todo complete --match "Test Todo"
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] .ics file updated with `STATUS:COMPLETED` and `COMPLETED:` timestamp
|
||||
- [ ] `todo list` — "Test Todo" no longer appears
|
||||
- [ ] `todo list --all` — "Test Todo" appears as completed (with checkmark)
|
||||
- [ ] `vdirsyncer sync` ran
|
||||
|
||||
## 11. Delete a Todo
|
||||
|
||||
Create a second test todo, then delete it.
|
||||
|
||||
```bash
|
||||
# Create
|
||||
$SKILL_DIR/scripts/calendar.sh todo add \
|
||||
--summary "Delete Me Todo" \
|
||||
--due "$TEST_DATE" \
|
||||
--priority low
|
||||
|
||||
# Delete
|
||||
$SKILL_DIR/scripts/calendar.sh todo delete --match "Delete Me"
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] .ics file removed from tasks dir
|
||||
- [ ] `todo list` does not show "Delete Me Todo"
|
||||
- [ ] `vdirsyncer sync` ran
|
||||
|
||||
## 12. Todo Check (Cron Output)
|
||||
|
||||
```bash
|
||||
# Create a test todo
|
||||
$SKILL_DIR/scripts/calendar.sh todo add \
|
||||
--summary "Check Test Todo" \
|
||||
--due "$TEST_DATE"
|
||||
|
||||
# Run check
|
||||
$SKILL_DIR/scripts/calendar.sh todo check
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] Output matches daily digest format (priority groups, urgency labels)
|
||||
- [ ] Complete the todo, run `todo check` again — silent exit (no output)
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh todo complete --match "Check Test"
|
||||
$SKILL_DIR/scripts/calendar.sh todo check
|
||||
# Should produce no output
|
||||
```
|
||||
|
||||
## 13. Regression: Existing Invite Commands
|
||||
|
||||
Verify the rename didn't break VEVENT flow.
|
||||
|
||||
```bash
|
||||
$SKILL_DIR/scripts/calendar.sh send \
|
||||
--to "test@example.com" \
|
||||
--subject "Regression Test" \
|
||||
--summary "Regression Test Event" \
|
||||
--start "${TEST_DATE}T10:00:00" \
|
||||
--end "${TEST_DATE}T11:00:00" \
|
||||
--dry-run
|
||||
```
|
||||
|
||||
**Verify:**
|
||||
- [ ] ICS has `BEGIN:VEVENT`, `METHOD:REQUEST`
|
||||
- [ ] No errors from the renamed script
|
||||
|
||||
---
|
||||
|
||||
## Quick Health Checks
|
||||
|
||||
Run these first if any step fails.
|
||||
|
||||
```bash
|
||||
# icalendar library is available
|
||||
uv run --project $SKILL_DIR python -c "import icalendar; print('ok')"
|
||||
|
||||
# himalaya can list emails
|
||||
himalaya envelope list --page-size 5
|
||||
|
||||
# vdirsyncer can sync
|
||||
vdirsyncer sync
|
||||
|
||||
# khal can read local calendar
|
||||
khal list today 7d
|
||||
```
|
||||
|
||||
## Common Failures
|
||||
|
||||
| Symptom | Likely Cause |
|
||||
|---------|-------------|
|
||||
| `himalaya message send` errors | SMTP config issue, check `~/.config/himalaya/config.toml` |
|
||||
| No `.ics` attachment found | Email doesn't have a calendar invite, or himalaya can't download attachments |
|
||||
| `vdirsyncer sync` fails | Check credentials in `~/.config/vdirsyncer/config`, or server is unreachable |
|
||||
| `ModuleNotFoundError: icalendar` | Run `uv sync --project $SKILL_DIR` to install dependencies |
|
||||
| Invite shows as attachment (no Accept/Decline) | Check MIME `Content-Type` includes `method=REQUEST` |
|
||||
| Event not in `khal list` after sync | Check `.ics` file exists in `~/.openclaw/workspace/calendars/home/` |
|
||||
| Todo not syncing | Check `~/.openclaw/workspace/calendars/tasks/` exists, verify vdirsyncer `cal/tasks` pair |
|
||||
Reference in New Issue
Block a user