Skip to main content

Configuration

In brief: Smart Smoke is opt-in per run via environment variables—configure budgets and tags in playwright.config defaults, write related-tests.json for the branch, then run normal Playwright.

Requirements

RequirementNotes
@testchimp/playwright≥ 0.2.20 (smart-smoke selection + skip reason)
TESTCHIMP_API_KEYOn the Playwright runner process (not only MCP)

Install / reporter base setup: Run SmartTests in CI.


Enable a run (required)

Smart Smoke is opt-in per run. Do not hard-enable it in playwright.config as always-on.

export TESTCHIMP_SMART_SMOKE_ENABLED=true # or 1
npx playwright test

Modes

ModeWhenHow
Related-tests-onlyTight PR confidence; safe default for agentsTESTCHIMP_SMART_SMOKE_RELATED_TESTS_ONLY=true
Budgeted smokeBroader ROI within a size capSet a budget

Related-tests-only skips the selection API and runs only locators listed in related-tests.json.


Budget and tags

Environment variables (win over config when set)

VariablePurpose
TESTCHIMP_SMART_SMOKE_ENABLEDtrue / 1 to enable for this run
TESTCHIMP_SMART_SMOKE_RELATED_TESTS_ONLYtrue / 1 → related-tests-only
TESTCHIMP_SMART_SMOKE_MAX_TIME_BUDGET_MINSTime packing (minutes)
TESTCHIMP_SMART_SMOKE_MAX_TESTSCap at N tests
TESTCHIMP_SMART_SMOKE_SUITE_PERCENTAGECap at ~N% of the suite
TESTCHIMP_SMART_SMOKE_INCLUDE_TAGSComma-separated tags (smoke or @smoke)
TESTCHIMP_BRANCH_NAMEBranch used to load plans/smart-smoke/<branch>/related-tests.json

If budgeted mode is on and no size constraint is set, the plugin defaults to suitePercentage = 20 and logs a warning.

When more than one size constraint is set, selection uses the most restrictive effective cap.

Project defaults (playwright.config)

Optional defaults only under use (templates often seed these). Never set enabled / related-only here as always-on:

// playwright.config.js (SmartTests root)
const { defineConfig } = require('@playwright/test');

module.exports = defineConfig({
use: {
// …
testchimpSmartSmoke: {
suitePercentage: 20,
includeTags: ['smoke'],
// maxTests: 40,
// maxTimeBudgetMins: 20,
// relatedTestsOnly: false, // prefer env per run
},
},
reporter: [
['list'],
['@testchimp/playwright/reporter'],
],
});

TypeScript projects use the same use.testchimpSmartSmoke shape.


Tags

Budgeted smoke includes tagged tests as seeds (union with related + newly authored).

  • Use Playwright tag: '@smoke' (and other tags from plans/knowledge/policies/global.policy.mdtags:).
  • Do not use { type: 'group', description: 'smoke' } annotations for suite membership—Playwright CLI and smart-smoke matching use tags, not group annotations.

Example:

test(
'guest can complete checkout',
{
tag: '@smoke',
annotation: [{ type: 'scenario', description: '#TS-42' }],
},
async ({ page }) => {
// …
}
);

Path

plans/smart-smoke/<branch>/related-tests.json
  • <branch> is the current git branch name.
  • If the branch contains / (e.g. feat/checkout), keep path segments literally (nested directories).

Body

Either a JSON array of TestLocators, or an object:

{
"relatedTests": [
{
"folderPath": ["auth"],
"fileName": "login.spec.ts",
"testSuite": [],
"testName": "user can log in"
}
]
}

Also accepted: related_tests, and snake_case locator fields (folder_path, file_name, test_suite, test_name).

Locator rules

FieldMeaning
folderPathPath segments under the mapped tests root — do not prefix tests/
fileNameSpec basename (e.g. login.spec.ts)
testSuiteNested test.describe titles (array; empty if none)
testNameThe test title

Agents produce this file during /testchimp run smart smoke and as Phase 5 of /testchimp test. It is also required at the end of Create tests.


CI examples

# GitHub Actions sketch
- name: Smart Smoke (related only)
working-directory: tests # or your SmartTests root
env:
TESTCHIMP_API_KEY: ${{ secrets.TESTCHIMP_API_KEY }}
TESTCHIMP_SMART_SMOKE_ENABLED: "true"
TESTCHIMP_SMART_SMOKE_RELATED_TESTS_ONLY: "true"
TESTCHIMP_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: npx playwright test

Ensure the job checks out plans/smart-smoke/<branch>/related-tests.json (committed by the agent / prior workflow step) before the run.

Budgeted smoke (20 minutes)

- name: Smart Smoke (budgeted)
working-directory: tests
env:
TESTCHIMP_API_KEY: ${{ secrets.TESTCHIMP_API_KEY }}
TESTCHIMP_SMART_SMOKE_ENABLED: "true"
TESTCHIMP_SMART_SMOKE_MAX_TIME_BUDGET_MINS: "20"
TESTCHIMP_SMART_SMOKE_INCLUDE_TAGS: "smoke"
TESTCHIMP_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: npx playwright test

Honor config reporters—do not pass Playwright CLI --reporter / -r (it replaces reporters and can drop TestChimp ingest).


What you should see

ObservationMeaning
Log: smart-smoke enabled / selection sizePlugin resolved config and selected locators
Tests skipped with reason smart-smokeOutside the selected set (expected)
Warning about default 20% suiteBudgeted mode with no size constraint
Selection API / 401 errorsRe-check TESTCHIMP_API_KEY + backend URL on the runner

Agent workflows

PromptRole
/testchimp run smart smokeStandalone: impact → related-tests → enable → run → fix
/testchimp testComposite: Smart smoke is Phase 5 after Validate
Legacy /testchimp run smart regressionSame workflow — prefer smart smoke going forward

Authoritative product behaviour is this section; the workflow pages are the agent playbooks.

See also