Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
72 lines
2.0 KiB
TypeScript
72 lines
2.0 KiB
TypeScript
import { test as setup } from '@playwright/test'
|
|
|
|
/**
|
|
* Global setup runs once before all test projects.
|
|
*
|
|
* Use this to:
|
|
* - Seed test data via the API
|
|
* - Create a shared authenticated storage state
|
|
* - Verify the backend is healthy
|
|
*
|
|
* The authenticated state file (.auth/user.json) can be reused by
|
|
* test projects via `storageState` to skip repeated logins.
|
|
*/
|
|
|
|
const AUTH_FILE = 'e2e/.auth/user.json'
|
|
|
|
setup('seed test database and authenticate', async ({ request }) => {
|
|
const apiBase =
|
|
process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000/api'
|
|
const healthCandidates = [
|
|
`${apiBase}/health`,
|
|
`${apiBase.replace(/\/api\/?$/, '')}/health`,
|
|
]
|
|
|
|
// 1. Health check -- make sure the backend is up
|
|
try {
|
|
let healthy = false
|
|
|
|
for (const url of healthCandidates) {
|
|
const health = await request.get(url)
|
|
if (health.ok()) {
|
|
healthy = true
|
|
break
|
|
}
|
|
}
|
|
|
|
if (!healthy) {
|
|
console.warn(
|
|
'Backend health check did not return 200 on any known endpoint. ' +
|
|
'Tests may fail if the API is not running.',
|
|
)
|
|
}
|
|
} catch {
|
|
console.warn(
|
|
'Could not reach backend at ' +
|
|
apiBase +
|
|
'. Make sure it is running before running E2E tests.',
|
|
)
|
|
}
|
|
|
|
// 2. Authenticate a test user and save the storage state.
|
|
// Uncomment the block below once you have a seeded test user.
|
|
|
|
// const loginResponse = await request.post(`${apiBase}/auth/login`, {
|
|
// data: {
|
|
// email: process.env.E2E_USER_EMAIL || 'e2e@gitgram.test',
|
|
// password: process.env.E2E_USER_PASSWORD || 'TestPassword123!',
|
|
// },
|
|
// })
|
|
//
|
|
// if (loginResponse.ok()) {
|
|
// // Save cookies and localStorage to a file for reuse
|
|
// await request.storageState({ path: AUTH_FILE })
|
|
// console.log('Authenticated storage state saved to', AUTH_FILE)
|
|
// } else {
|
|
// console.warn(
|
|
// 'Could not authenticate test user. Status:',
|
|
// loginResponse.status(),
|
|
// )
|
|
// }
|
|
})
|