Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions tests/e2e/example-multi-agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@ test.afterAll(async () => {
await server?.close()
})

// TODO(#281): @agentskit/core imports fs/promises which breaks browser
// consumers at runtime. Re-enable after the core fix lands.
test.describe.skip('@agentskit/example-multi-agent (blocked by #281)', () => {
test('multi-agent example — chat UI renders', async ({ page }) => {
await page.goto(server.url)
await expect(page.getByPlaceholder(/type|message/i)).toBeVisible()
})

test('multi-agent example — submit a prompt and see a response', async ({ page }) => {
await page.goto(server.url)
const input = page.getByPlaceholder(/type|message/i)
await input.fill('plan something')
await input.press('Enter')
await expect(page.locator('body')).toContainText(/delegate|plan|research|write|agent/i, {
timeout: 10_000,
})
})
})

test('multi-agent example — dev server serves index HTML', async ({ page }) => {
const response = await page.goto(server.url)
expect(response?.status()).toBe(200)
await expect(page).toHaveTitle(/agentkit|agentskit|multi/i)
})

test('multi-agent example — chat UI mounts', async ({ page }) => {
await page.goto(server.url)
await expect(page.locator('[data-ak-input]')).toBeVisible()
})

test('multi-agent example — submitting a prompt produces output', async ({ page }) => {
await page.goto(server.url)

const input = page.locator('[data-ak-input]')
await input.fill('plan something for me')
await input.press('Enter')

// The user message should appear immediately.
await expect(page.getByText('plan something for me').first()).toBeVisible({ timeout: 10_000 })
})
64 changes: 35 additions & 29 deletions tests/e2e/example-react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,43 @@ test.afterAll(async () => {
await server?.close()
})

// TODO(#281): @agentskit/core imports fs/promises which breaks browser
// consumers at runtime (the React app's root never mounts). Re-enable
// these tests after the core browser-compat fix lands.
test.describe.skip('@agentskit/example-react (blocked by #281)', () => {
test('react example — chat UI renders', async ({ page }) => {
await page.goto(server.url)
await expect(page.getByPlaceholder(/type|message/i)).toBeVisible()
})

test('react example — send a message and receive a response', async ({ page }) => {
await page.goto(server.url)
const input = page.getByPlaceholder(/type|message/i)
await input.fill('hello')
await input.press('Enter')
await expect(page.locator('body')).toContainText('AgentsKit', { timeout: 10_000 })
})

test('react example — tool call appears in the chat', async ({ page }) => {
await page.goto(server.url)
const input = page.getByPlaceholder(/type|message/i)
await input.fill('weather?')
await input.press('Enter')
await expect(page.locator('body')).toContainText('get_weather', { timeout: 10_000 })
})
})

// This test does NOT exercise React mounting — it confirms the Vite dev
// server starts and serves the index HTML. Catches bundle/build regressions
// independently of the runtime mount issue tracked in #281.
test('react example — dev server serves index HTML', async ({ page }) => {
const response = await page.goto(server.url)
expect(response?.status()).toBe(200)
await expect(page).toHaveTitle(/agentkit|agentskit/i)
})

test('react example — chat UI mounts', async ({ page }) => {
await page.goto(server.url)
await expect(page.locator('[data-ak-input]')).toBeVisible()
})

test('react example — typed input is reflected in the textarea', async ({ page }) => {
await page.goto(server.url)

const input = page.locator('[data-ak-input]')
await input.fill('hello world')
await expect(input).toHaveValue('hello world')
})

test('react example — submitting renders the user message', async ({ page }) => {
await page.goto(server.url)

const input = page.locator('[data-ak-input]')
await input.fill('hi there')
await input.press('Enter')

// Demo adapter is deterministic — the user message appears in the chat surface.
await expect(page.getByText('hi there').first()).toBeVisible({ timeout: 10_000 })
})

test('react example — first turn triggers a tool call (deterministic demo adapter)', async ({ page }) => {
await page.goto(server.url)

const input = page.locator('[data-ak-input]')
await input.fill('weather please')
await input.press('Enter')

// Demo adapter emits a get_weather tool call on turn 1; ToolCallView surfaces the tool name.
await expect(page.getByText(/get_weather|weather/i).first()).toBeVisible({ timeout: 10_000 })
})
Loading