# Admin UI Regression Pack

This pack protects the production-facing admin shell and the most important operational navigation paths.

## Included suites

- `tests/Feature/Admin/AdminNavigationRegressionTest.php`
  - role-based access
  - workspace cues
  - role-level quick actions
  - no raw translation key leakage on primary pages

- `tests/Feature/Admin/AdminOperationalWorkflowRegressionTest.php`
  - finance workflow pages
  - attendance workflow pages
  - messaging workflow pages
  - no raw translation key leakage on operational pages

- `tests/Feature/Admin/AdminAdmissionsEventsRegressionTest.php`
  - admissions workflow pages
  - event workflow pages
  - event reporting vs management access boundaries
  - no raw translation key leakage on admissions and event pages

- `tests/Feature/Admin/AdminSystemWorkflowRegressionTest.php`
  - settings workflow pages
  - health workflow pages
  - audit workflow pages
  - admin guide workflow entry pages
  - no raw translation key leakage on primary system pages

- `tests/Feature/Admin/AdminSidebarScrollTest.php`
  - sidebar shell
  - topbar quick access
  - workspace action rails
  - shell-level translation key regression

- `tests/Feature/Admin/WhatsAppAccessTest.php`
  - WhatsApp admin pages
  - operational shortcuts
  - no raw translation key leakage on WhatsApp pages

- `tests/Feature/Corporate/CorporateLinksSmokeTest.php`
  - corporate route presence
  - corporate navigation links
  - dashboard and detail shortcuts
  - no raw translation key leakage on primary corporate pages

## Run everything

```powershell
php .\scripts\run-admin-ui-regression.php
```

Or through Composer:

```powershell
composer test:admin-ui-regression
```

## Fast suite without architecture-check

Use this when you want the UI regression suites only and will run architecture checks separately:

```powershell
composer test:admin-ui-fast
```

Both entrypoints now recreate the dedicated testing database before starting the suites. This keeps MySQL `RefreshDatabase` runs isolated and avoids drift from interrupted local runs.

## Windows helper

If you are working locally on Windows and prefer PowerShell output formatting, you can still use:

```powershell
powershell -ExecutionPolicy Bypass -File .\scripts\run-admin-ui-regression.ps1
```

This helper is optional. The canonical cross-platform entrypoint is:

```powershell
php .\scripts\run-admin-ui-regression.php
```

## Run suites individually

```powershell
php scripts/ensure-testing-database.php --fresh
php artisan test tests\Feature\Admin\AdminNavigationRegressionTest.php
php artisan test tests\Feature\Admin\AdminOperationalWorkflowRegressionTest.php
php artisan test tests\Feature\Admin\AdminAdmissionsEventsRegressionTest.php
php artisan test tests\Feature\Admin\AdminSystemWorkflowRegressionTest.php
php artisan test tests\Feature\Admin\AdminSidebarScrollTest.php
php artisan test tests\Feature\Admin\WhatsAppAccessTest.php
php artisan test tests\Feature\Corporate\CorporateLinksSmokeTest.php
php artisan app:architecture-check
```

## Expected architecture-check result

At the current baseline, `php artisan app:architecture-check` should still report:

- `Findings: 22`

These are known legacy findings outside this admin UI regression scope:

- WhatsApp direct cross-module writes
- registration/student tracking side-effects inside Livewire

The regression pack should not add new findings.

## Testing database isolation

The regression pack now targets a dedicated PHPUnit database:

- `DB_DATABASE=ecoinv3_test` in [phpunit.xml](C:/Users/a-djoudi/apps/ecoinv3/phpunit.xml)
- bootstrap creation script: [ensure-testing-database.php](C:/Users/a-djoudi/apps/ecoinv3/scripts/ensure-testing-database.php)
- canonical pack runner: [run-admin-ui-regression.php](C:/Users/a-djoudi/apps/ecoinv3/scripts/run-admin-ui-regression.php)

This avoids running `RefreshDatabase` suites against the local development database `ecoinv3`.

## CI recommendation

Use `composer test:admin-ui-regression` as the canonical entrypoint for:

- pre-release admin shell verification
- navigation smoke checks after UI changes
- role and permission regression checks
- corporate and WhatsApp operational navigation verification

Use `composer test:admin-ui-fast` for quicker local iteration when you only want the test suites and do not need the architecture baseline in the same run.
