# Fixtures (Humand E2E)

Use typed fixtures to expose page objects and keep test files clean.

## Current backoffice pattern

`fixtures/base.fixture.ts` should:

- import `test as base` from `@playwright/test`
- define `BackofficeFixtures`
- register page objects
- export `test` and `expect`

Example shape:

```ts
type BackofficeFixtures = {
  goalsCyclesPage: GoalsCyclesPage;
  cycleWizardPage: CycleWizardPage;
};
```

## Auth setup

- Use `tests/auth.setup.ts` project to generate `auth/backoffice.auth.json`.
- Load credentials from `.env.local`.
- Keep auth flow UI-based for setup, then reuse `storageState` in normal projects.

## Community-aware future

Auth fixtures should be designed to support selecting community in both apps once finalized.

Suggested future extension:

- accept `community` as input (env var or fixture option)
- apply community selection immediately after login
- save storage state per app/community when needed

## Fixture quality rules

- keep fixture creation thin (instantiate and pass objects)
- avoid heavy business logic in fixture factories
- avoid global mutable state between tests

## Benchmark reset guidance

- Preserve shared setup files such as `playwright.config.ts`, `package.json`, and `tests/auth.setup.ts`.
- When resetting a module benchmark, touch only the module-specific page objects, specs, tests, and fixture registrations.
