mirror of
https://github.com/hanzoai/chat.git
synced 2026-09-30 20:51:17 +00:00
The second half of the same uncommitted 2026-07-27 session. It lets the playwright suite run against fakes instead of a real deployment: an in-process fake model (setup/fake-model.js), fake MCP servers over stdio and HTTP, a tool-approval hook, mock users and fixtures, and specs/mock/ that exercise them. playwright.config.mock.ts wires it together and is the entry point. .generated/chat.e2e.yaml is committed deliberately despite the directory name: it is a credential-free TEMPLATE that playwright.config.mock.ts copies to an ignored runtime path, and the fake model overrides the endpoint every run, so the placeholder baseURL in it is never contacted. It is input to the harness, not output of it — the directory is misleadingly named, which is worth knowing before someone adds it to .gitignore and breaks the mock run. packages/api/src/agents/testHook.ts rides along: it is test-only infrastructure from the same work. Nothing in tracked source imports it (the reference in packages/api/dist/ is from a stale build, and the tracked agents/index.ts does not export it), so it is inert until something opts in. Not run here: this checkout cannot execute the suite — @hanzochat/data-provider is not linked into node_modules, which already breaks tracked tests. Committed so the work stops living only on one disk; whoever has a complete workspace can exercise it. Co-authored-by: Hanzo Dev <[email protected]>
173 lines
5.1 KiB
YAML
173 lines
5.1 KiB
YAML
# Credential-free e2e config template. e2e/playwright.config.mock.ts copies this
|
|
# to an ignored runtime path; the in-process fake model (e2e/setup/fake-model.js)
|
|
# overrides each run, so the placeholder baseURL below is never contacted.
|
|
version: 1.3.4
|
|
cache: true
|
|
|
|
interface:
|
|
# Exercises the cost row in the context usage gauge (off by default).
|
|
# Mock models price at the default rate, so synthetic usage yields a value.
|
|
contextCost: true
|
|
|
|
# Enables the memory feature so the MEMORIES.USE permission is granted and the
|
|
# ephemeral memory badge (inline set_memory/delete_memory tools) is available.
|
|
# memory.spec.ts toggles it via the tools dropdown.
|
|
memory:
|
|
personalize: true
|
|
tokenLimit: 10000
|
|
|
|
mcpSettings:
|
|
# Deliberately excludes 127.0.0.1, so the URL-based `e2e-http` server below is blocked
|
|
# at boot (stored as inspectionFailed). mcp-allowlist-override.spec.ts adds that origin
|
|
# via an admin-panel config override and asserts the server reinitializes — proving the
|
|
# admin override is honored by inspection/connection. stdio servers skip this check.
|
|
allowedDomains:
|
|
- https://allowed.example.com
|
|
|
|
mcpServers:
|
|
e2e-memory:
|
|
type: stdio
|
|
command: node
|
|
args:
|
|
- e2e/setup/fake-mcp-server.js
|
|
title: E2E Memory
|
|
description: Local MCP fixture used by mock end-to-end tests.
|
|
timeout: 30000
|
|
e2e-http:
|
|
type: streamable-http
|
|
url: http://127.0.0.1:8765/mcp
|
|
title: E2E HTTP
|
|
description: Local HTTP MCP fixture for allowlist-override e2e tests.
|
|
timeout: 30000
|
|
|
|
endpoints:
|
|
# Default capabilities plus run_in_background (off by default upstream) so the
|
|
# background tool-call e2e can opt an MCP tool into detached dispatch.
|
|
agents:
|
|
capabilities:
|
|
- deferred_tools
|
|
- execute_code
|
|
- file_search
|
|
- web_search
|
|
- artifacts
|
|
- actions
|
|
- context
|
|
- tools
|
|
- chain
|
|
- ocr
|
|
custom:
|
|
- name: 'Mock Provider A'
|
|
apiKey: 'e2e-mock-key-a'
|
|
baseURL: 'http://127.0.0.1:8889/v1'
|
|
models:
|
|
default:
|
|
- 'mock-model-a'
|
|
fetch: false
|
|
titleConvo: false
|
|
modelDisplayLabel: 'Mock Provider A'
|
|
customParams:
|
|
defaultParamsEndpoint: anthropic
|
|
|
|
- name: 'Mock Provider B'
|
|
apiKey: 'e2e-mock-key-b'
|
|
baseURL: 'http://127.0.0.1:8889/v1'
|
|
models:
|
|
default:
|
|
- 'mock-model-b'
|
|
fetch: false
|
|
titleConvo: false
|
|
modelDisplayLabel: 'Mock Provider B'
|
|
|
|
# No model spec mirrors this endpoint's label, so it stays unambiguous in the
|
|
# selector and gives e2e tests a real ephemeral endpoint → model option.
|
|
- name: 'Mock Provider C'
|
|
apiKey: 'e2e-mock-key-c'
|
|
baseURL: 'http://127.0.0.1:8889/v1'
|
|
models:
|
|
default:
|
|
- 'mock-model-c'
|
|
fetch: false
|
|
titleConvo: false
|
|
modelDisplayLabel: 'Mock Provider C'
|
|
|
|
# Second non-spec endpoint so e2e tests can switch between two real
|
|
# ephemeral endpoints (e.g. MCP selection persistence across switches).
|
|
- name: 'Mock Provider D'
|
|
apiKey: 'e2e-mock-key-d'
|
|
baseURL: 'http://127.0.0.1:8889/v1'
|
|
models:
|
|
default:
|
|
- 'mock-model-d'
|
|
fetch: false
|
|
titleConvo: false
|
|
modelDisplayLabel: 'Mock Provider D'
|
|
|
|
modelSpecs:
|
|
prioritize: true
|
|
# Enforcement would reject sends from the non-spec paths addedEndpoints
|
|
# exposes below (buildEndpointOption requires a spec when enforce is true).
|
|
enforce: false
|
|
# Surfaces the endpoints menu (modelSelect defaults on when addedEndpoints is
|
|
# set) limited to entries that don't collide with the spec labels above.
|
|
addedEndpoints:
|
|
- 'Mock Provider C'
|
|
- 'Mock Provider D'
|
|
- 'agents'
|
|
list:
|
|
- name: 'e2e-mock-provider-a'
|
|
label: 'Mock Provider A'
|
|
preset:
|
|
endpoint: 'Mock Provider A'
|
|
model: 'mock-model-a'
|
|
|
|
- name: 'e2e-mock-provider-b'
|
|
label: 'Mock Provider B'
|
|
preset:
|
|
endpoint: 'Mock Provider B'
|
|
model: 'mock-model-b'
|
|
|
|
- name: 'e2e-icon-spec'
|
|
label: 'E2E Icon Spec'
|
|
iconURL: '/assets/openai.svg'
|
|
preset:
|
|
endpoint: 'Mock Provider A'
|
|
model: 'mock-model-a'
|
|
|
|
- name: 'e2e-skill-scope'
|
|
label: 'E2E Skill Scope'
|
|
preset:
|
|
endpoint: 'Mock Provider A'
|
|
model: 'mock-model-a'
|
|
skills:
|
|
- 'e2e-model-spec-allowed'
|
|
- 'e2e-deployment-skill'
|
|
- 'e2e-model-spec-missing'
|
|
- 'e2e-model-spec-inaccessible'
|
|
|
|
- name: 'e2e-soft-default'
|
|
label: 'E2E Soft Default'
|
|
softDefault: true
|
|
preset:
|
|
endpoint: 'Mock Provider A'
|
|
model: 'mock-model-a'
|
|
|
|
- name: 'e2e-branded'
|
|
label: 'E2E Branded'
|
|
description: '<strong>Branded</strong> answers <img src="/assets/openai.svg" alt="brand icon">'
|
|
showOnLanding: true
|
|
preset:
|
|
endpoint: 'Mock Provider A'
|
|
model: 'mock-model-a'
|
|
|
|
- name: 'e2e-starters'
|
|
label: 'E2E Starters'
|
|
conversation_starters:
|
|
- 'E2E_REPLY:starter'
|
|
- 'Plan my week'
|
|
- 'Third starter prompt'
|
|
- 'Fourth starter prompt'
|
|
- 'Fifth starter beyond the cap'
|
|
preset:
|
|
endpoint: 'Mock Provider A'
|
|
model: 'mock-model-a'
|