write-e2e-test

A guide for writing end-to-end tests for authgear-server. End-to-end tests check a complete feature across running services, and these tests are written in YAML and stored in the e2e/tests/ directory.

In plain words
What is it for?
Use it when adding or changing end-to-end tests for authentication flows, either one selected test or the complete test suite.
Why use it?
It provides the required setup, teardown, and test commands so the tests run against freshly built services, migrations, and containers.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/authgear/authgear-server/write-e2e-test
Any agent
npx skills add authgear/authgear-server --skill write-e2e-test
Clone the repo
git clone --depth 1 https://github.com/authgear/authgear-server

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,837 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00052 $0.03837
Opus 5 $0.00026 $0.01919
Sonnet 5 $0.00010 $0.00767
Haiku 4.5 $0.00005 $0.00384

Measured 2d ago against content hash 9efa0b5f8f5a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

write-e2e-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/write-e2e-test/SKILL.md · 553 lines

How it starts

The opening of the file, as written. The whole thing — 553 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Follow this guide when writing e2e tests.

E2E Environment Setup

CRITICAL: All make commands must be run from e2e/ directory, not project root.

Standard Workflow

When starting fresh or after code changes:

cd e2e                          # ← MUST be in e2e directory
make teardown && make setup     # ← Tears down old containers, rebuilds binaries, applies migrations

This command:

  • Stops and removes Docker containers (Redis, PostgreSQL, Deno hook server)
  • Rebuilds authgear and authgear-portal binaries with latest code
  • Applies all database migrations
  • Starts services fresh

Running Tests

After setup completes, run tests from the e2e directory:

cd e2e  # ← Must be in e2e directory

# Run a specific test
go test ./pkg/testrunner/ -count 1 -v -timeout 10m -run "TestAuthflow/<folder>/<filename_without_extension>"

# Run all tests
go test ./pkg/testrunner/ -count 1 -v -timeout 10m

When Setup Fails

If make teardown && make setup fails:

  1. Try again - transient Docker issues are common:

    cd e2e && make teardown && make setup
    
  2. Check if containers are stuck:

    docker ps  # Run from any directory to list containers
    
  3. If still failing - ask the user to manually intervene. Do NOT attempt low-level Docker operations (docker-compose down -v, etc.) as these can affect other projects and data.

Always use the Makefile (make teardown && make setup). Do not skip to ./run.sh or other workarounds.

When to Re-setup

Always run make teardown && make setup from e2e/ directory when:

  • You modified server code (rebuilds binaries)
  • Database schema/migrations changed
  • Tests fail with DB schema errors
  • Starting fresh after a long break

Overview

E2e tests are YAML files placed under e2e/tests/<feature>/. The test runner auto-discovers all *.test.yaml files. Each file defines one test case.

Test File Structure

name: Human-readable test name
authgear.yaml:           # Optional: config overrides
  extend: path/to/base.yaml   # Optional base config
  override: |
    fraud_protection:
      enabled: true
before:                  # Optional: setup hooks (run before steps)
  - type: custom_sql
    custom_sql:
      path: fixtures.sql
steps:
  - name: step name      # Optional but recommended
    action: create
    input: |
      {
        "type": "signup",
        "name": "default"
      }
    output:
      result: |
        {
          "action": {
            "type": "identify"
          }
        }

Read the full file on GitHub · 553 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 553 lines · 52 tokens per session scan A 9efa0b5f8f5a

Subscribe to this mod's changes

write-e2e-test is a skill published in the GitHub repository authgear/authgear-server (2,014 stars, last pushed 6d ago), licensed Apache-2.0. It adds 52 tokens to every session and 3,837 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories