Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,43 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm build

e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Build for E2E
run: VITE_E2E_MODE=true pnpm build
- name: Install Playwright Chromium browser
run: pnpm playwright:install:ci
- name: Run E2E tests
run: pnpm test:e2e:ci
- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: playwright-report
path: playwright-report/
if-no-files-found: ignore
retention-days: 14
- name: Upload test traces on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: test-results
path: test-results/
if-no-files-found: ignore
retention-days: 14

python-test:
runs-on: ubuntu-latest
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Example / Template — このファイルは実際の playtest 実行結果ではなく、記録フォーマットのサンプルです。実際の証跡は CI artifact として別途保存されます。

# Playtest Session: Movement + Projectile Smoke (E2E)

> **IMPORTANT**: Automatic E2E results are NOT UX validity evidence.
> This session confirms integration correctness only.
> Human playtesting is required to evaluate feel and UX.

```yaml
session_id: "PT-YYYYMMDD-XXX"
date: "<FILL_IN_FROM_CI>"
build_ref: "<FILL_IN_FROM_CI>"
session_mode: "browser_automation"
tester_profile: "playwright-ci"
environment: "automated-ci"
privacy:
pii_reviewed: true
raw_recording_committed: false

automation:
execution:
actor_id: "playwright-ci"
trigger: "ci"
agent_profile: ""
random_seed: null
reproduction_command: "pnpm test:e2e --project=chromium"
metrics:
computed_by: "ci_scripts"
source: "playwright_trace"
sample_unit: "runs"
runs: "<FILL_IN_FROM_CI>"
success_count: "<FILL_IN_FROM_CI>"
failure_count: "<FILL_IN_FROM_CI>"
success_rate: "<FILL_IN_FROM_CI>"
death_count: 0
death_rate: null
duration:
p50: 0
p95: 0
unit: "ms"
input_count_total: 0
collision_count_total: 0
artifacts:
storage_class: "local_git"
artifact_contains: ["dom_snapshot"]
public_repo_safe: false
metrics_json: ""
trace_ref: "<FILL_IN_FROM_CI>"
replay_ref: ""
input_script_ref: "tests/e2e/movement-projectile.spec.ts"
raw_artifact_committed: false
artifact_sensitivity: "none"
redaction_status: "not_applicable"
trace_redacted: true
human_review_required: false

playtest_entries:
- entry_id: "PTE-001"
task_id: "TASK-E2E-SMOKE"
hypothesis_id: "HYP-E2E-FOUNDATION"
observed_behavior: >
Playwright smoke test: canvas visible, WASD movement verified, pointer-down
projectile generation verified, simulation tick advancing confirmed.
player_quote_redacted: ""
emotional_signal: "n/a"
developer_interpretation: >
E2E foundation confirms movement + projectile integration is wired correctly
in the browser. Does not verify UX quality or feel.
player_suggested_fix: ""

observable_signal: "E2E test pass/fail count"
collection_method: "automated_telemetry"
success_failure_assessment: "success"
misread_notes: >
browser_automation cannot confirm UX quality. Human playtest required for
feel / responsiveness evaluation.
tunable_parameter: ""
retest_target: false

affected_requirements:
- "REQ-MOVEMENT-001"
- "REQ-PROJECTILE-001"
classification: "bug"
severity: "low"
confidence: "high"
decision: "no_action"
proposed_spec_delta: ""
linked_issue: "#447"
validation_method: "browser_automation"
```
61 changes: 61 additions & 0 deletions docs/product/playtest-sessions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Playtest Sessions

This directory stores individual playtest session records.

## Schema

Session records follow the schema defined in `../playtest-log.md`.
See that file for the full YAML schema, field definitions, and policies.

## Session Modes

| mode | description |
|---|---|
| `human_internal` | Developer self-test, direct gameplay observation |
| `browser_automation` | Playwright E2E automated test run |
| `ai_simulation` | Agent-driven simulation (not yet implemented) |

## Naming Convention

```
PT-YYYYMMDD-NNN-<short-slug>.md
```

Example: `PT-20260529-001-movement-projectile-smoke.md`

## Important Policies

- **Automatic E2E results are NOT UX validity evidence.**
`browser_automation` sessions confirm integration correctness only.
Human playtesting is required to evaluate feel, responsiveness, and UX.
(Ref: `playtest-log.md` policy `ai_result_is_ux_evidence: false`)
- Do NOT commit raw recordings, video, or PII (`raw_recording_committed: false`).
- `session_mode: browser_automation` sessions with `classification: design hypothesis invalidated`
or `decision: spec_delta_issue` MUST set `automation.human_review_required: true`.

## Running E2E Playwright Tests

```bash
# Install Chromium (first time)
pnpm playwright:install

# Run headless (CI mode)
pnpm test:e2e

# Run with headed browser (visual confirmation)
pnpm test:e2e:headed

# Interactive UI mode (debug / step through)
pnpm test:e2e:ui

# Debug mode (pause on test)
pnpm test:e2e:debug
```

Failure artifacts (trace + report) are saved to:
- `test-results/` — trace files (retain-on-failure)
- `playwright-report/` — HTML report

## Sample Session Files

- `PT-20260529-001-movement-projectile-smoke.md` — minimal browser_automation sample
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@
"type": "module",
"scripts": {
"dev": "vite",
"test": "vitest run",
"test": "vitest run --exclude 'tests/e2e/**'",
"typecheck": "tsc --noEmit",
"lint": "eslint .",
"build": "tsc && vite build",
"preview": "vite preview",
"test:e2e": "VITE_E2E_MODE=true pnpm build && playwright test",
"test:e2e:ci": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:debug": "playwright test --debug",
"test:e2e:headed": "playwright test --headed",
"playwright:install": "playwright install",
"playwright:install:ci": "playwright install --with-deps chromium",
"policy:check:secret": "uv run --locked python .claude/scripts/check_secret_policy.py docs/dev/secret-policy.md",
"policy:check:session": "uv run --locked python .claude/scripts/check_session_recording_policy.py docs/dev/session-recording-policy.md",
"policy:check": "pnpm run policy:check:secret && pnpm run policy:check:session",
"manifest:check": "node scripts/check-agent-session-manifests.mjs"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.60.0",
"ajv": "^8",
"ajv-formats": "^3",
"eslint": "^10.3.0",
Expand Down
54 changes: 54 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { defineConfig, devices } from '@playwright/test'

/**
* Playwright E2E configuration for LOOP_PROTOCOL.
*
* - Uses Vite preview server (started by webServer) — not the dev server.
* Run `pnpm test:e2e` for local (includes build), `pnpm test:e2e:ci` for CI (build done separately).
* - VITE_E2E_MODE=true enables the read-only window.__LOOP_E2E__ observability hook.
* - trace: 'retain-on-failure' ensures trace files are saved on any first failure
* (AC6: first-run failures are captured without requiring retries).
*/
export default defineConfig({
testDir: './tests/e2e',
/* Run tests in files in parallel */
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 1 : 0,
/* One worker for consistent simulation timing */
workers: 1,
/* Reporter to use. */
reporter: [['html', { open: 'never' }], ['list']],
use: {
/* Base URL — matches the preview server port */
baseURL: 'http://127.0.0.1:4173',
/* Collect trace on failure (AC6) */
trace: 'retain-on-failure',
/* Screenshot on failure */
screenshot: 'only-on-failure',
/* Viewport matches default arena */
viewport: { width: 1280, height: 720 },
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],

/* Start the Vite preview server before running tests.
* Uses preview (not dev) so the build is deterministic.
* VITE_E2E_MODE=true enables the read-only __LOOP_E2E__ hook. */
webServer: {
command:
'VITE_E2E_MODE=true pnpm exec vite preview --host 127.0.0.1 --port 4173 --strictPort',
url: 'http://127.0.0.1:4173',
reuseExistingServer: !process.env.CI,
timeout: 120_000,
stdout: 'pipe',
stderr: 'pipe',
},
})
38 changes: 38 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading