Daniel Volz 98939877db feat: expand Playwright E2E coverage (#155)
* feat: comprehensive Playwright E2E test rewrite

Rewrite all E2E tests with correct CSS selectors, add new spec files,
and implement robust auth handling to work within backend rate limits.

Changes:
- Rewrite fixtures/index.ts with JWT-based /auth/me mock to avoid
  10 req/min rate limit on /auth/me during test runs
- Rewrite auth.setup.ts with offline JWT validity check to reuse
  existing auth state across runs (saves login rate-limit budget)
- Rewrite auth.spec.ts (6 tests) - login page, fields, submit,
  redirect guard, invalid credentials, login/register toggle
- Rewrite dashboard.spec.ts (8 tests) - header, nav tabs,
  navigation, overview/schedules sections, days selector, redirect
- Rewrite medications.spec.ts (8 tests) - form fields, stock
  inventory, package type toggle, intake schedule, save/cancel,
  unsaved changes guard
- Rewrite settings.spec.ts (12 tests) - language, notification
  matrix, thresholds, calculation mode, toggle switch, export/import,
  user menu navigation
- Create planner.spec.ts (9 tests) - form, date inputs, calculate,
  reset, checkbox, submit, tab state, eyebrow heading
- Create schedule.spec.ts (12 tests) - timeline, days selector,
  past/future toggles, day blocks, today highlight, collapse/expand,
  overview table, share button
- Update playwright.config.ts: remove mobile projects, enable
  webServer section for CI
- Add .github/workflows/e2e.yml CI workflow for Playwright tests

Total: 57 E2E tests across 6 spec files, all passing consistently
across 5+ consecutive runs without backend restart.

Closes #154

* feat: add comprehensive E2E data tests with medication CRUD, dashboard, planner, schedule

Add 48 new Playwright E2E tests covering real medication data scenarios:
- medication-crud: 14 tests for create/edit/delete/list via UI form
- dashboard-data: 13 tests for overview table, timeline, dose tracking
- planner-data: 9 tests for demand calculator with results/status chips
- schedule-data: 11 tests for timeline, collapse/expand, dose mark/undo

Infrastructure improvements:
- Add API helpers (createMedicationViaAPI, deleteMedicationViaAPI,
  deleteAllMedicationsViaAPI) with retry logic for rate-limit resilience
- Configure chromium-data project for serial execution with retry:1
- Add /auth/me mock to avoid rate-limit exhaustion on auth endpoint
- Increase navigateTo reliability with networkidle waits
- Increase auth token validity threshold from 2 to 10 minutes
- Make backend rate limit configurable via RATE_LIMIT_MAX env var
- Set RATE_LIMIT_MAX=300 in dev docker-compose for E2E test support

Total suite: 57 empty-state + 48 data tests = 105 tests (chromium)

* test: add E2E tests for medication editing, stock status, and share schedule

- medication-edit.spec.ts: 10 tests covering generic name, notes,
  taken-by add/remove, expiry date, refill, intake schedule editing,
  adding intake rows, reminder toggle, and package type changes
- stock-status.spec.ts: 12 tests verifying dashboard shows correct
  status chips (High/Normal/Warning/Danger) for different stock levels,
  overview table, reorder card, detail modal, and planner integration
- share-schedule.spec.ts: 10 tests for taken-by badges, share button,
  share dialog, link generation, shared schedule page navigation,
  dose tracking on shared page, and notes display
- fixtures/index.ts: add createShareTokenViaAPI, updateSettingsViaAPI
  helpers; expand createMedicationViaAPI with takenBy, notes, expiryDate
- playwright.config.ts: update testMatch/testIgnore for new test files
- docker-compose.dev.yml: increase RATE_LIMIT_MAX to 1000 for E2E tests

* docs: refine release-manager instructions for CLI safety and commit-linked release notes

* fix: resolve PR155 CI failures for frontend lint and e2e proxy

* fix: stabilize auth-related e2e checks in CI
2026-02-12 20:06:11 +01:00
2025-12-19 13:09:53 +01:00
2025-12-19 13:09:53 +01:00

MedAssist-ng Logo

MedAssist-ng

Never run out of your medications again.
A medication tracking and planning app with stock monitoring, intake schedules, and reminder notifications.

React 18 TypeScript Fastify SQLite Docker

Backend Tests 454/454 Frontend Tests 611/611

🤖 AI-Generated Code

This app was 100% coded with Claude Opus 4.5. Use at your own risk.

⚠️ Disclaimer

Your health is your responsibility. This app may contain bugs. Follow your doctor's instructions closely, keep track of your medication supply, and plan ahead for reordering.

Think of this app as a helpful tool, but make all health decisions independently!

Features

MedAssist-ng Dashboard

Screenshots
Dashboard

Overview with stock status, reorder reminders, and upcoming schedules.

Dashboard
Medication Detail

View medication details, stock information, and intake schedule.

Medication Detail Modal
Medications & Edit Form

Manage your medications with the edit form and refill feature.

Medications Edit Form
Demand Calculator (Planner)

Calculate how many pills you need for a specific date range.

Planner - Demand Calculator
Shared Schedule

Share your medication schedule with others via a public link.

Shared Schedule
Mobile Views
Dashboard
Mobile Dashboard
Medications
Mobile Medications
Schedule
Mobile Schedule

Smart Inventory

  • Track exact stock: packs, blisters, bottles, and loose pills
  • Display remaining days of supply
  • Automatic calculation based on intake schedule

Medication Refill

  • One-click refill with pack or loose pill options
  • Complete refill history per medication
  • Automatic stock updates after each refill

Flexible Schedules

  • Daily, weekly, or custom intervals per medication
  • Independent schedules for each medication

Stock Alerts & Reminders

  • Notifications before stock runs out
  • Configurable warning thresholds
  • Intake reminders via push notifications

Trip Planner

  • Calculate how many pills you need for a trip or date range
  • Plan ahead for vacations, business trips, or hospital stays
  • Send demand reports via email or push notification

Multi-Person Support

  • Manage medications for multiple people
  • Share schedules via link. Recipients can mark doses as taken, you see it live

Data Export & Import

  • Export all your data (medications, dose history, settings) as JSON
  • Import previously exported data with automatic ID remapping
  • Choose whether to include sensitive data in exports

Notifications

  • Email via SMTP
  • Push notifications via ntfy, Pushover, Gotify, Telegram, Discord & more (Shoutrrr)
  • Supports both stock warnings and intake reminders

Privacy & Security

  • Fully self-hosted
  • SSO via OIDC (Authelia, Authentik, Pocket ID, Keycloak)
  • Non-root containers
  • Dark mode included 😎

Getting Started

The easiest way to deploy MedAssist-ng is with Docker Compose:

git clone https://github.com/DanielVolz/medassist-ng.git
cd medassist-ng
cp .env.example .env
docker compose up -d

Open http://localhost:4174 and start tracking your medications.

Configuration

All configuration is done via environment variables in .env. Copy .env.example to get started.

General

Variable Default Description
PUID 1000 User ID for container file permissions
PGID 1000 Group ID for container file permissions
PORT 3000 Backend API port
CORS_ORIGINS http://localhost:4174 Allowed origins for CORS
LOG_LEVEL info Log verbosity (debug, info, warn, error)
TZ Europe/Berlin Timezone for scheduled reminders

Authentication

Variable Default Description
AUTH_ENABLED false Enable user authentication
REGISTRATION_ENABLED false Allow new user registrations
JWT_SECRET Access token signing key (required if auth enabled)
REFRESH_SECRET Refresh token signing key (required if auth enabled)
COOKIE_SECRET Cookie signing key (required if auth enabled)
ACCESS_TOKEN_TTL_MINUTES 15 Access token lifetime
REFRESH_TOKEN_TTL_DAYS 7 Refresh token lifetime

Generate secrets with: openssl rand -hex 32

OIDC / SSO

Variable Default Description
OIDC_ENABLED false Enable OIDC authentication
OIDC_ISSUER_URL OIDC provider URL
OIDC_CLIENT_ID Client ID from OIDC provider
OIDC_CLIENT_SECRET Client secret from OIDC provider
OIDC_REDIRECT_URI Callback URL
OIDC_SCOPES openid profile email Scopes to request
OIDC_USERNAME_CLAIM preferred_username Claim for username
OIDC_AUTO_CREATE_USERS true Auto-create users on first SSO login
OIDC_PROVIDER_NAME SSO Name shown on login button

Email (SMTP)

Variable Default Description
SMTP_HOST SMTP server hostname
SMTP_PORT 587 SMTP server port
SMTP_USER SMTP username
SMTP_PASS SMTP password
SMTP_TOKEN OAuth2/App token (takes precedence over password)
SMTP_FROM Sender email address
SMTP_SECURE false Use TLS

Reminders

Variable Default Description
REMINDER_DAYS_BEFORE 7 Days before stock runs out to send reminder
REMINDER_HOUR 6 Hour to send daily reminders (24h format)
REMINDER_MINUTES_BEFORE 15 Minutes before intake to send reminder
EXPIRY_WARNING_DAYS 30 Days before expiry to show warning

Push Notifications (Shoutrrr)

MedAssist uses Shoutrrr for push notifications, supporting many services with a single URL format.

Supported services: ntfy, Pushover, Gotify, Discord, Telegram, Slack, Matrix, and many more.

Configure push notifications in Settings → Push, or set defaults via environment variables:

Variable Default Description
DEFAULT_SHOUTRRR_ENABLED false Enable push notifications by default
DEFAULT_SHOUTRRR_URL Shoutrrr URL (see examples below)
DEFAULT_SHOUTRRR_STOCK_REMINDERS true Send stock warnings via push
DEFAULT_SHOUTRRR_INTAKE_REMINDERS true Send intake reminders via push

Default User Settings

These defaults are applied when a new user is created. Once a user saves settings in the app, their values take precedence.

Variable Default Description
DEFAULT_SHARE_STOCK_STATUS true Show stock status (Normal/Low/Critical) on shared schedule links

URL Examples

ntfy (free, self-hostable):

ntfy://ntfy.sh/your-topic
ntfy://user:password@your-server.com/topic

Pushover (free app for iOS/Android):

pushover://shoutrrr:API_TOKEN@USER_KEY/

Get your keys at pushover.net:

  • User Key: Shown on your dashboard (top right)
  • API Token: Create an application → copy the API Token

Gotify (self-hosted):

gotify://your-server.com/TOKEN

Discord:

discord://TOKEN@WEBHOOK_ID

Telegram:

telegram://TOKEN@telegram?chats=CHAT_ID

For all services and options, see the Shoutrrr documentation.

Development

docker compose -f docker-compose.dev.yml up
  • Frontend: http://localhost:5173 (hot reload)
  • Backend: http://localhost:3000

Acknowledgements

This project was inspired by MedAssist by njic.

Languages
TypeScript 94.4%
CSS 5.4%
Dockerfile 0.1%