2026-03-13 05:15:46 +00:00
|
|
|
import { test, expect } from '@playwright/test'
|
|
|
|
|
|
|
|
|
|
test.describe('bot registration flow', () => {
|
|
|
|
|
test('navigate to join page and see login step', async ({ page }) => {
|
|
|
|
|
await page.goto('/join')
|
|
|
|
|
// Should show login options
|
|
|
|
|
await expect(page.getByText(/sign in/i).first()).toBeVisible({ timeout: 10_000 })
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('generate new identity shows choose-mode step', async ({ page }) => {
|
|
|
|
|
await page.goto('/join')
|
|
|
|
|
// Click "Generate New Identity" button
|
|
|
|
|
const genButton = page.getByText(/generate new identity/i)
|
|
|
|
|
await genButton.click()
|
|
|
|
|
|
2026-03-13 12:28:39 +00:00
|
|
|
// Must save nsec first — click "I SAVED IT — CONTINUE"
|
|
|
|
|
await expect(page.getByText(/saved it/i).first()).toBeVisible({ timeout: 5_000 })
|
|
|
|
|
await page.getByText(/saved it/i).first().click()
|
|
|
|
|
|
2026-03-13 05:15:46 +00:00
|
|
|
// Should advance to choose-mode step
|
|
|
|
|
await expect(page.getByText(/I BUILD BOTS/i)).toBeVisible({ timeout: 5_000 })
|
|
|
|
|
await expect(page.getByText(/I FIGHT MYSELF/i)).toBeVisible()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('select bot mode shows archetype picker', async ({ page }) => {
|
|
|
|
|
await page.goto('/join')
|
|
|
|
|
|
|
|
|
|
// Generate identity
|
|
|
|
|
await page.getByText(/generate new identity/i).click()
|
2026-03-13 12:28:39 +00:00
|
|
|
|
|
|
|
|
// Save nsec step
|
|
|
|
|
await expect(page.getByText(/saved it/i).first()).toBeVisible({ timeout: 5_000 })
|
|
|
|
|
await page.getByText(/saved it/i).first().click()
|
|
|
|
|
|
2026-03-13 05:15:46 +00:00
|
|
|
await expect(page.getByText(/I BUILD BOTS/i)).toBeVisible({ timeout: 5_000 })
|
|
|
|
|
|
|
|
|
|
// Choose bot mode
|
|
|
|
|
await page.getByText(/I BUILD BOTS/i).click()
|
|
|
|
|
|
|
|
|
|
// Should show character/archetype picker
|
2026-03-13 12:28:39 +00:00
|
|
|
await expect(page.getByText(/choose your fighter/i).first()).toBeVisible({ timeout: 5_000 })
|
2026-03-13 05:15:46 +00:00
|
|
|
})
|
|
|
|
|
})
|
2026-07-30 22:24:48 -04:00
|
|
|
|
|
|
|
|
test.describe('unified AI bot-setup prompt (BOT-02)', () => {
|
|
|
|
|
test('docs page shows the "give this to your AI" copy affordance', async ({ page }) => {
|
|
|
|
|
await page.goto('/docs')
|
|
|
|
|
await expect(page.getByText(/give this to your ai/i).first()).toBeVisible({ timeout: 10_000 })
|
|
|
|
|
await expect(page.getByText(/copy full prompt/i).first()).toBeVisible({ timeout: 5_000 })
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('GET /api/docs/prompt returns the self-contained prompt an agent could consume', async ({ page }) => {
|
|
|
|
|
await page.goto('/docs')
|
|
|
|
|
const res = await page.request.get('/api/docs/prompt')
|
|
|
|
|
expect(res.status()).toBe(200)
|
|
|
|
|
const body = await res.text()
|
|
|
|
|
expect(body).toContain('/api/bots')
|
|
|
|
|
expect(body).not.toContain('{{ARENA_URL}}')
|
|
|
|
|
})
|
|
|
|
|
})
|