mirror of
https://github.com/hanzoai/chat.git
synced 2026-09-30 20:51:17 +00:00
The chrome config pins the environment it measures against — guest chat, the token and message ceilings, the provider key, the OIDC keys — because a geometry gate that reads an ambient value measures a different app on every machine. GUEST_MODEL was the one knob left unstated, and `start-server` loads a developer `.env` into the server, so the header was measured against whatever model that file named. Pinned empty, in the idiom the block already uses two lines down: the server resolves the name (`process.env.GUEST_MODEL || DEFAULT_GUEST_MODEL`), so an empty value restores the free route rather than restating which model it is.
73 lines
2.8 KiB
TypeScript
73 lines
2.8 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
import path from 'path';
|
|
import { getBaseE2EEnv, getE2EBaseURL } from './setup/env';
|
|
|
|
const rootPath = path.resolve(__dirname, '..');
|
|
const serverPath = path.resolve(rootPath, 'e2e/setup/start-server.js');
|
|
const reportPath = path.resolve(rootPath, 'e2e/playwright-report');
|
|
const baseURL = getE2EBaseURL();
|
|
|
|
/**
|
|
* The window chrome, measured against the BUILT client in a real Chromium.
|
|
*
|
|
* It signs nobody in, deliberately. There is no local login route in this fork
|
|
* (IAM OIDC or guest, nothing else), so the UI registration `global-setup` the
|
|
* other configs share cannot complete here — and it does not need to: the
|
|
* chrome is byte-identical for a guest, so this suite runs the guest path and
|
|
* stays a pure geometry gate with no identity to mint or clean up.
|
|
*
|
|
* Run it against a built client:
|
|
* npm run build:packages && (cd client && npm run build)
|
|
* npx playwright test --config=e2e/playwright.config.chrome.ts
|
|
*/
|
|
export default defineConfig({
|
|
testDir: 'specs/chrome/',
|
|
outputDir: 'specs/.test-results',
|
|
fullyParallel: false,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 0,
|
|
workers: 1,
|
|
reporter: process.env.CI
|
|
? [['html', { outputFolder: reportPath, open: 'never' }], ['line']]
|
|
: [['list']],
|
|
use: {
|
|
baseURL,
|
|
trace: 'retain-on-failure',
|
|
headless: true,
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
expect: { timeout: 10000 },
|
|
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
|
webServer: {
|
|
command: `node ${serverPath}`,
|
|
cwd: rootPath,
|
|
url: baseURL,
|
|
stdout: 'pipe',
|
|
timeout: 180_000,
|
|
reuseExistingServer: !process.env.CI,
|
|
env: {
|
|
...getBaseE2EEnv(),
|
|
/* The guest is the whole point: it renders the real chat shell — header,
|
|
composer, panels — with no credential to mint. */
|
|
ALLOW_GUEST_CHAT: 'true',
|
|
GUEST_TOKEN_MAX: '999',
|
|
/* A guest can also ASK here, which is what lets `turn.spec.ts` measure
|
|
the composer's submit and not only the chrome around it. The gateway
|
|
refuses the key and no answer comes back — see that spec's header for
|
|
why the fake model cannot stand in — but the send itself is real. */
|
|
GUEST_MESSAGE_MAX: '99',
|
|
/* The guest's model is the FREE route, which is the default this reads
|
|
when nothing overrides it. It is pinned empty rather than named: the
|
|
server already resolves the name, and `start-server` loads a developer
|
|
`.env` whose own GUEST_MODEL would otherwise decide what the header is
|
|
measured against. */
|
|
GUEST_MODEL: '',
|
|
HANZO_API_KEY: 'e2e-no-provider',
|
|
TITLE_CONVO: 'false',
|
|
OPENID_CLIENT_ID: '',
|
|
OPENID_ISSUER: '',
|
|
ALLOW_SOCIAL_LOGIN: 'false',
|
|
},
|
|
},
|
|
});
|