Files
AFFiNE/tests/affine-cloud/playwright.config.ts
T
DarkSky ae1bd232db feat(server): add public API parity and cloud E2E cutover for affine-server
Add public-repo API parity to `affine-server` and run the core cloud
Playwright suite against the Rust all-in-one server.

- Add HS256 Bearer access tokens, native session exchange, refresh,
  revoke, and list REST endpoints, login preflight, profile updates,
  WebP avatar transcoding and safe removal, and a distributed-locked
  expired-session cleanup worker with background lease renewal.

- Unify workspace and per-document ACL evaluation (`acl.rs`), split
  REST and GraphQL modules, and add workspace member management,
  ownership transfer with readonly and quota invalidation guards, atomic
  invite links, `createWorkspace(init)` transactional root snapshots,
  `DocType`, `DocPermissions`, `createBlobUpload`, `calendarProviders`,
  and SocketIO realtime workspace access and config rooms.

- Extract reachable blob keys with `y-octo` bounded BFS under
  `REPEATABLE READ` snapshots with pre-merge budgets and bounded caching,
  check per-doc ACL and reserved doc isolation on source-scoped blob
  routes, paginate `readable-blob-manifest/v1` with SQL cursor pushdown,
  and reject legacy blob reads with `403 UNSUPPORTED_CLIENT_VERSION`.

- Keep fresh DB bootstrap on the default v1 sync protocol until
  activated, and accept both absent (v1) and active (v2) lifecycle
  checkpoints on existing databases.

- Add `AFFINE_E2E_RUST_SERVER=1` Playwright support and a
  `cloud-e2e-rust-server` CI job, extend the live parity scenario to
  23 steps, and lower `waitForTimeout` usage from 336 to 312 (ratchet
  from 324 to 316).
2026-11-24 07:59:26 +09:00

108 lines
3.5 KiB
TypeScript

import { testResultDir } from '@affine-test/kit/playwright';
import type {
PlaywrightTestConfig,
PlaywrightWorkerOptions,
} from '@playwright/test';
const useRustServer = process.env.AFFINE_E2E_RUST_SERVER === '1';
const rustServerBin =
process.env.AFFINE_SERVER_BIN ??
'../../packages/backend/target/debug/affine-server';
const backendWebServer = useRustServer
? {
command: `${rustServerBin} --role allinone --port 3010`,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
stdout: 'pipe' as const,
stderr: 'pipe' as const,
env: {
DATABASE_URL:
process.env.DATABASE_URL ??
'postgresql://affine:affine@localhost:5432/affine',
REDIS_URL: process.env.REDIS_URL ?? 'redis://127.0.0.1:6379/0',
AFFINE_SERVER_EXTERNAL_URL:
process.env.AFFINE_SERVER_EXTERNAL_URL ?? 'http://localhost:8080',
MAILER_HOST: process.env.MAILER_HOST ?? '127.0.0.1',
MAILER_PORT: process.env.MAILER_PORT ?? '1025',
MAILER_SENDER: process.env.MAILER_SENDER ?? 'noreply@toeverything.info',
MAILER_USER: process.env.MAILER_USER ?? 'noreply@toeverything.info',
MAILER_PASSWORD: process.env.MAILER_PASSWORD ?? 'affine',
MAILER_IGNORE_TLS: process.env.MAILER_IGNORE_TLS ?? 'true',
},
url: 'http://localhost:3010/healthz',
}
: {
command: 'yarn run -T affine dev -p @affine/server',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
env: {
DATABASE_URL:
process.env.DATABASE_URL ??
'postgresql://affine:affine@localhost:5432/affine',
NODE_ENV: 'test',
AFFINE_ENV: process.env.AFFINE_ENV ?? 'dev',
DEBUG: 'affine:*',
FORCE_COLOR: 'true',
DEBUG_COLORS: 'true',
MAILER_HOST: '0.0.0.0',
MAILER_PORT: '1025',
MAILER_SENDER: 'noreply@toeverything.info',
MAILER_USER: 'noreply@toeverything.info',
MAILER_PASSWORD: 'affine',
},
url: 'http://localhost:3010/graphql',
};
const config: PlaywrightTestConfig = {
testDir: './e2e',
fullyParallel: !process.env.CI,
timeout: 120_000,
outputDir: testResultDir,
use: {
baseURL: 'http://localhost:8080/',
browserName:
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ??
'chromium',
...(process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH
? {
launchOptions: {
executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
},
}
: {}),
permissions: ['clipboard-read', 'clipboard-write'],
viewport: { width: 1440, height: 800 },
actionTimeout: 10 * 1000,
locale: 'en-US',
trace: 'retain-on-failure',
video: 'retain-on-failure',
},
forbidOnly: !!process.env.CI,
workers: process.env.CI && !process.env.COPILOT ? 1 : 4,
retries: process.env.COPILOT || !process.env.CI ? 1 : 3,
reporter: process.env.CI ? 'github' : 'list',
webServer: [
{
// TODO(@forehalo):
// in ci, all the target will be built,
// we could download the builds from archives
// and then run the web with simple http serve, it's will be faster
command: 'yarn run -T affine dev -p @affine/web',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
env: {
COVERAGE: process.env.COVERAGE || 'false',
},
url: 'http://localhost:8080',
},
backendWebServer,
],
};
if (process.env.CI) {
config.retries = 3;
}
export default config;