Agent Wranglers

Build, test and deploy Required

Test the real build end to end

Test the real build through its real interface, the way users and other systems reach it.

How to do it

In the test, start the built app and call it from outside, over HTTP or its command line. For a website, fetch every page and file. Check one title and one h1, the canonical link and the description length. Check that JSON-LD parses, and check security headers and CSP hashes. Check status codes, redirects, caching and compression. Check robots.txt, the sitemap (every URL answers 200), Markdown copies, well-known files and feeds. For more depth, see the testing playbook.

Example

import test from 'node:test';
import assert from 'node:assert/strict';
const base = 'http://localhost:8080';

test('every sitemap URL answers 200 with one h1', async () => {
  const xml = await (await fetch(base + '/sitemap.xml')).text();
  for (const [, loc] of xml.matchAll(/<loc>https:\/\/example\.com([^<]*)<\/loc>/g)) {
    const res = await fetch(base + loc);
    assert.equal(res.status, 200, loc);
    assert.ok(res.headers.get('content-security-policy'), loc);
    assert.equal((await res.text()).match(/<h1[\s>]/g)?.length, 1, loc);
  }
});

How to check

The suite runs in the container build and before every deploy. A failure stops both.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/build-test-and-deploy/end-to-end-tests-against-the-built-site.