Agent Wranglers

End-to-end and browser tests Recommended

Smoke test every deploy

Right after each deploy, run a few fast, read-only tests against the live address. Roll back when one fails.

How to do it

Pick three to five checks that prove the release works for visitors. Load the home page and a key page, sign in with a test account, and search. Never buy, send email or change customer data. Run them from the deploy script after the health check passes, with a total time limit such as two minutes. Treat a failure like a failed health check.

Example

// smoke.spec.js, run with: BASE_URL=https://example.com npx playwright test smoke.spec.js
test('the product page shows a price', async ({ page }) => {
  await page.goto('/products/mug');
  await expect(page.getByText(/€\d/)).toBeVisible();
});
# smoke_test.py, run with: BASE_URL=https://example.com pytest smoke_test.py
def test_the_product_page_answers():
    response = httpx.get(f"{os.environ['BASE_URL']}/products/mug", timeout=10)
    assert response.status_code == 200
    assert "Add to cart" in response.text

How to check

Deploy a release with a broken key page to staging. The smoke tests fail, and the deploy script rolls back and exits with a code other than zero.

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 testing playbook: https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/smoke-test-every-deploy.