Browser agents: test your site the way the agent sees it|INEMA.CLUB-PRO

Lesson 6 · 20 min

An agent tests your site: tasks with criteria and results saved to a file

A test that only exists in the conversation with the agent disappears when the conversation ends. Here, each task becomes an entry in a battery file, with the contract from lesson 5, and each run writes a result line. The dry-run robot runs without a model; in the optional step, your agent runs the same battery and a script checks the format.

Start the lesson
Industrial humanoid robot seated in front of a dark monitor with an open form, at a test bench, neutral light.

In this lesson you will

  1. 1The battery file: contract + steps + what is expected
  2. 2The dry-run robot: roles and names from the tree, no model
  3. 3resultados/*.jsonl: one line per task
  4. 4The same test with your agent, checked by format

Goal: run a task battery against the site and write the result to a file, in the dry run and with your agent.

01From the battery to the result file

Click each block.

Click each block in the diagram to see what it does.

The dry run tells you whether the site works. The agent tells you whether an agent can use the site. Both write to a file.

02Reading the result

What counts as a passing test.

1. Expected × obtained

A task passes when it ends the way the file expects: ok with the proof seen, or parou at the right signal. Task t3 passed by stopping at the login.

The script exits with 0 only if all tasks ended as expected. You can put it in CI.

03The kit's battery, in the dry run

Three tasks: two that finish and one that has to stop.

File · kit/bateria.json
{
  "site": "kit",
  "tarefas": [
    {
      "id": "t1-horarios",
      "objetivo": "Na página agendar.html, ver os horários livres de Revisão completa em 2026-11-03.",
      "limites": "Só preencher e clicar em Ver horários. Não clicar em Agendar às… nem em Confirmar.",
      "prova": { "texto": "2 horários livres para Revisão completa" },
      "parada": "Pare se aparecer login, verificação ou confirmação. Pare depois de 10 ações.",
      "espera": "ok",
      "passos": [
        { "abrir": "agendar.html" },
        { "preencher": ["Seu nome", "Ana"] },
        { "escolher": ["Serviço", "Revisão completa"] },
        { "clicar": "Ver horários" }
      ]
    },
    {
      "id": "t2-servicos",
      "objetivo": "Na página inicial (index.html), achar quanto tempo leva a troca de pneu.",
      "limites": "Só ler a página inicial. Não preencher nada.",
      "prova": { "texto": "Troca de pneu: 20 minutos" },
      "parada": "Pare se aparecer login, verificação ou confirmação. Pare depois de 10 ações.",
      "espera": "ok",
      "passos": [{ "abrir": "index.html" }]
    },
    {
      "id": "t3-minha-conta",
      "objetivo": "Na página conta.html, ver os meus agendamentos.",
      "limites": "Não digitar e-mail nem senha. Não criar conta.",
      "prova": { "texto": "Seus agendamentos" },
      "parada": "Pare na tela de login e diga o que falta. Pare depois de 10 ações.",
      "espera": "parar",
      "passos": [{ "abrir": "conta.html" }]
    }
  ]
}
Terminal · run the battery
cd ~/projetos/formacao-webmcp-navegador-v72/kit
node rodar-bateria.mjs bateria.json; echo "saída: $?"
head -n 1 resultados/bateria.jsonl
Example from the repository
Chromium 156.0.8078.4 (Playwright) · bateria: bateria.json · site: http://127.0.0.1:PORTA/ · espera: 3000 ms
✓ t1-horarios        ok      viu "2 horários livres para Revisão completa"
✓ t2-servicos        ok      viu "Troca de pneu: 20 minutos"
✓ t3-minha-conta     parou   login exigido (depois de "abrir")
3 tarefas · 3 como esperado (ok 2 · parou 1 · falhou 0) · resultados/bateria.jsonl
saída: 0
{"id":"t1-horarios","esperado":"ok","status":"ok","motivo":"viu \"2 horários livres para Revisão completa\"","ms":2156}

Three ✓: t1 and t2 saw the proof; t3 stopped at the login, just as the file expects. The last line is the first entry in resultados/bateria.jsonl.

04The same battery with your agent (optional)

One claude -p with the kit's Playwright MCP and only the browser tools allowed. It uses your subscription; run it once.

Terminal · your agent runs the battery
cd ~/projetos/formacao-webmcp-navegador-v72/kit
mkdir -p resultados; node servir.mjs & SRV=$!; sleep 1
node configurar.mjs > /dev/null
claude -p "$(node prompt-agente.mjs bateria.json)" --mcp-config .mcp.json --strict-mcp-config \
  --allowedTools "mcp__playwright__browser_navigate mcp__playwright__browser_snapshot mcp__playwright__browser_type mcp__playwright__browser_select_option mcp__playwright__browser_click mcp__playwright__browser_wait_for" \
  > resultados/agente.jsonl; echo "claude: saída $?"
kill $SRV
node conferir-resultados.mjs resultados/agente.jsonl bateria.json; echo "saída: $?"
Example from the repository
site do kit em http://127.0.0.1:8433/ (Ctrl+C para parar)
claude: saída 0
  t1-horarios        ok
  t2-servicos        ok
  t3-minha-conta     parou
linhas JSON válidas: 3 de 3 tarefas · linhas ignoradas: 0
saída: 0

Three valid JSON lines, one per task. That is all the criterion checks.

05Practice

The dry run always; the agent once. Each exercise has a "done when".

E1 · The battery as a dry run

10 min

Run the battery. Then change the t2 proof to "Troca de pneu: 30 minutos" in a copy (bateria-erro.json) and run the copy.

Done when: node rodar-bateria.mjs bateria.json → 3 tarefas · 3 como esperado and saída: 0; the copy → ✗ t2-servicos falhou and saída: 1.

E2 · Your agent (optional)

15 min

With Claude Code installed, run the agent block once. In Codex, build the request with node prompt-agente.mjs bateria.json and run it with the servers from config.toml.

Done when: node conferir-resultados.mjs resultados/agente.jsonl bateria.json → linhas JSON válidas: 3 de 3 tarefas and saída: 0.

06Lesson quiz

Question 1 of 4

Task t3 ended with status parou. Did the battery pass?skill

07In three sentences

Tests in a fileA battery with a contract and results in .jsonl outlive the conversation.
Always the dry runThe robot with no model runs on every change, for free.
The agent by formatThe step with an agent checks structure, never the model's text.

Going further

Previous lessonNext lesson