1fd836368f
Tests de cada agente via Element Web + Playwright: - assistant-bot: saludo DM, pregunta, !help, !ping, E2EE check - asistente-2: saludo, !tools, tool use (que hora es?), !help, E2EE check Assertions flexibles para respuestas LLM (no-deterministicas), estrictas para commands deterministicos (!help, !ping). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
import {
|
|
goToRoom,
|
|
sendMessage,
|
|
waitForBotReply,
|
|
assertNoDecryptionErrors,
|
|
} from "../fixtures/matrix-room";
|
|
|
|
test.describe("assistant-bot", () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto("/");
|
|
|
|
// Esperar a que la sesion este lista
|
|
await expect(
|
|
page.locator('[role="tree"][aria-label="Rooms"]')
|
|
).toBeVisible({ timeout: 30_000 });
|
|
|
|
await goToRoom(page, "Assistant");
|
|
});
|
|
|
|
test("responde a un saludo en DM", async ({ page }) => {
|
|
await sendMessage(page, "Hola, como estas?");
|
|
|
|
const reply = await waitForBotReply(page, {
|
|
timeout: 60_000,
|
|
sender: "Assistant",
|
|
});
|
|
expect(reply).toBeTruthy();
|
|
expect(reply.length).toBeGreaterThan(10);
|
|
});
|
|
|
|
test("responde a una pregunta con contenido coherente", async ({ page }) => {
|
|
await sendMessage(page, "Que es la fotosintesis? Responde en una frase.");
|
|
|
|
const reply = await waitForBotReply(page, {
|
|
timeout: 60_000,
|
|
sender: "Assistant",
|
|
});
|
|
expect(reply).toBeTruthy();
|
|
expect(reply.length).toBeGreaterThan(10);
|
|
});
|
|
|
|
test("!help muestra lista de comandos", async ({ page }) => {
|
|
await sendMessage(page, "!help");
|
|
|
|
const reply = await waitForBotReply(page, {
|
|
timeout: 10_000,
|
|
sender: "Assistant",
|
|
});
|
|
expect(reply).toBeTruthy();
|
|
expect(reply.toLowerCase()).toContain("help");
|
|
expect(reply.toLowerCase()).toContain("ping");
|
|
});
|
|
|
|
test("!ping responde", async ({ page }) => {
|
|
await sendMessage(page, "!ping");
|
|
|
|
const reply = await waitForBotReply(page, {
|
|
timeout: 10_000,
|
|
sender: "Assistant",
|
|
});
|
|
expect(reply).toBeTruthy();
|
|
});
|
|
|
|
test("no hay errores de E2EE en el timeline", async ({ page }) => {
|
|
await assertNoDecryptionErrors(page);
|
|
});
|
|
});
|