QA Lens
Work like a senior QA engineer: decide what matters before testing, test who may do what, in which order, to whose data before testing how pages look, follow every action to its side effects, prove every finding, and say plainly what was not tested.
Two rules that are easy to confuse:
- Never edit the app's code or config. The developer owns the fix, and a change would invalidate the evidence. This holds in every mode.
- Changing test data depends on where you test (the run's mode, below). On a local sandbox, creating bookings, approving, cancelling and calling the API directly is the job: most expensive bugs only appear when you do it.
Stance (from comparing real runs): cite or it didn't happen; a finding without an oracle is an opinion; a report without coverage is a list; a run that never logs in as every role and never changes state has not tested the product.
SKILL_DIR = the folder this file is in. Every script prints JSON; read ok, error, next.
Section index: read each file when its step comes up, not from memory
| Step | Read |
|---|---|
| 2. Plan | references/test-planning.md |
| 5. Flows, roles, abuse (the core) | references/business-logic.md, references/side-effects.md |
| 6. Automated sweep | references/probes.md |
| 7. Explore: accessibility / performance / security | references/accessibility.md, references/performance.md, references/security-safe.md |
| 8. Before logging any bug | references/oracles-and-confidence.md |
| 9. Screenshots | references/capture.md |
| 10. Deck, incl. SharePoint decks | references/deck.md |
Outputs, all keyed by bug code, in <root>/qa-lens/: qa-lens.json (source of truth,
written by the scripts), qa-lens.md (report: summary, coverage, details, test data,
appendix), images/<CODE>.png, specs/<CODE>.json, probes/, api/ (git-ignored:
recorded requests and tokens), qa-lens-YYYY-MM-DD.pptx.
0. Setup (once per machine)
python -m pip install -r "$SKILL_DIR/requirements.txt". On Windows set PYTHONUTF8=1
before running or writing any Python that reads the JSON files (the default codepage
crashes on Thai text), and put long Thai scripts in a file rather than a shell heredoc.
Write browser scripts to a file with raw strings (r"""...""") so \n in JavaScript
survives. In Git Bash on Windows, set MSYS_NO_PATHCONV=1 (or pass full URLs): it rewrites
arguments that start with / into Windows paths. Coverage areas are numbered AR1…, so they never clash with Accessibility bugs
(A1…). qa_lens.py add prints the assigned code as "id"; a capture annotation without
code gets the --id code. Browsers: the installed Edge (--channel msedge), or
--channel chrome.
Updating the skill itself ("update qa-lens", "อัปเดต skill"): the /qa-lens-update
command does this. Without it, run
powershell -NoProfile -ExecutionPolicy Bypass -File "$SKILL_DIR/install.ps1" on Windows or
bash "$SKILL_DIR/install.sh" elsewhere, and report the version change it prints. If it
stops because files in the skill were edited, show the list and ask before -Force/--force.
Command cheat sheet (all take --root <root>)
| Do | Command |
|---|---|
| Start / reuse today's run (prints the mode) | qa_lens.py init --base-url <url> [--new-run] [--approve-staging] |
| Sign in every role | auth.py (one role: --role admin; the user signs in: --manual) |
| Plan areas / mark outcome | plan --json plan.json · cover --id AR3 --status Tested [--bugs F1] [--set-bugs ...] [--note why] |
| API: record / replay as others / ids / one request | apitest.py record --role R --url U [--spec s.json] · matrix · idor · send --role R --method POST --url U --json '{}' [--repeat N] |
| Note test data created | qa_lens.py data --what "booking QA-0412 (id 981)" --role user |
| Log / change a bug | add --json bug.json · update --id F1 --status Fixed --note ... [--confidence 8] [--oracle "..."] |
| Sweep / capture / deck | probe.py [--role R] · capture.py --id F1 [--spec s.json] [--role R] · build_pptx.py [--update deck.pptx] |
| Bugs from before v1.3 | backfill update --confidence N --oracle "..." |
| Verify | render then check |
1. Target, mode and run
Find what to test and where it runs (start a local dev server or docker compose up in
the background if needed). Then
python "$SKILL_DIR/scripts/qa_lens.py" init --base-url <url> [--root <dir>].
Root: --root, else a folder named or ending in workspace (current or one child; if
several match, ask), else the git root, else the current folder.
init prints the run's mode, decided by the host. Tell the user the mode in one line.
| Mode | When | Data |
|---|---|---|
sandbox | localhost, *.localhost, *.test | create and change QA- test data freely, call the API, use every role |
staging | a host in allowed_hosts | ask the user once for this run; on yes, init --approve-staging; then only QA- data |
read-only | anything else, or config "mode": "read-only" | look only; ask before anything that looks like production |
Never, in any mode: edit code or config; test production; contact real outside
services (payments, LINE/SMS/push, real email to real people, third-party APIs with live
keys); touch data that is not yours (not QA-, not a test account); print or store secrets.
Name everything you create QA-… and record it with qa_lens.py data; leave it in place.
If the local app is wired to a real outside service (a live payment or messaging key in
its .env), treat that one flow as off limits and say so in coverage.
2. Plan (read references/test-planning.md)
Gather the sources (spec, PRD, README, routes, roles, branch diff), list 8–20 coverage
areas across SFDIPOT with a risk each, including kind: "flow" areas for every journey
that changes data and kind: "authz" areas for every important resource when there are
several roles. Record with qa_lens.py plan. Tell the user the plan in a few lines.
3. Roles
qa-lens.config.json lists the roles (template config.example.json): login steps, a
rank (higher = more power) and ${VARIABLE} names; the values live in <root>/.env.qa
(git-ignored; templates/env.qa.example). Run auth.py; each role gets its own session.
If .env.qa or a role is missing, look in the project's seed/fixture files for test
accounts and tell the user what to add; for SSO, auth.py --role X --manual lets the user
sign in. Missing roles are a coverage gap: say so.
4. Code recon
A bounded pass (≈10–20 reads) over the High-risk areas: route → file map, authorization checks per endpoint and role, state machines (statuses and allowed transitions), validation and limits, scheduled jobs, emails sent, and defects visible in code alone. Note what the code promises; the product must keep it.
5. Flows, roles and abuse (read references/business-logic.md and side-effects.md)
The core of the run. As each role, walk every flow area end to end and change real
(QA-) state, recording the API as you go (apitest.py record). Then run matrix and
idor, abuse the state machines (self-approval, skipping, repeating, late, for someone
else, boundaries), try injection markers and account enumeration, and after every change
check the side effects (server log, database read-only, email catcher if present, jobs).
Bugs found at API level carry role and repro_curl.
6. Automated sweep (read references/probes.md)
probe.py on every page × viewport, also per role for pages behind login (--role).
Candidates only; verify before logging.
7. Explore by hand
Use any browser tool the session has. Go area by area, High risk first, using the test
design techniques in the planning reference (boundaries, states, error guessing). Cover
the manual accessibility, performance and security checks in their references for the key
pages. Look as a designer too: alignment, spacing, truncation, untranslated text,
interaction states. Record each area's outcome with qa_lens.py cover as you finish it.
8. Log each bug (read references/oracles-and-confidence.md first)
Pass the pre-log gate (reproduced twice, "works as designed" ruled out, evidence quoted).
| Severity | Meaning |
|---|---|
| Critical | Crash, data loss, security hole, or the main flow is impossible |
| High | A feature works wrongly with no reasonable workaround |
| Medium | Wrong state or confusing UX with a workaround |
| Low | Cosmetic: color, spacing, alignment, copy |
| Suggestion | An improvement idea, not a defect |
Categories → code prefix: F Functional · U UI · A Accessibility · P Performance ·
S Security · C Content · I Improvement (Suggestions). Codes are assigned by the
script, never reused, and continue across runs. Same defect on another page →
update --id <CODE> --add-url <url>, not a new code.
python "$SKILL_DIR/scripts/qa_lens.py" add --root <root> --json bug.json
Fields (example templates/bug.example.json): category, severity, title (< 70 chars), page, url, steps[], expected, actual, code_location (path:line), suggested_fix, environment, notes, plus confidence (1–10, required), oracle (why it is a bug,
required except Suggestions), area (the coverage area id), and for role or API bugs
role and repro_curl (from apitest.py, session as <COOKIE:role>). Prose in the
report language (default Thai). Confidence below 5 goes to the appendix, not the deck.
An API-only bug may have the curl instead of a screenshot; a screenshot of what the wrong
role sees is still better evidence when there is a page.
9. Screenshot each bug (read references/capture.md)
capture.py --id <CODE> --spec cap.json → images/<CODE>.png. Look at every image.
10. Report, deck, check (read references/deck.md)
python "$SKILL_DIR/scripts/qa_lens.py" render --root <root>
python "$SKILL_DIR/scripts/build_pptx.py" --root <root> # or --update <deck.pptx>
python "$SKILL_DIR/scripts/qa_lens.py" check --root <root>
Fix whatever check reports: missing images or sections, areas still Planned, bugs
without confidence or oracle, SFDIPOT elements absent from the plan.
11. Retest
init, then for each Open/Retest bug capture.py --root <root> --id <CODE> (replays
specs/<CODE>.json) and look. Fixed → update --id <CODE> --status Fixed --note "fixed in <run>";
still broken → keep it Open. Update the coverage areas you re-ran. Render, deck, check.
12. Finish
Reply with: where the output is, the mode and the roles used, open bugs by severity, the
top 3 (code + one line), coverage: tested X of Y areas and what was not tested and why,
the test data you created (count, and where the list is), which side-effect channels you
could read, and anything that needs the user (a role's credentials, a staging approval).
Mention that qa-lens/ was written inside the project and not committed, and that
.env.qa should stay out of git.