Download automation/README.md from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 11.5 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/automation/README.md
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/automation/README.md
-
curl -L -o README.md https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/automation/README.md
Fusion Playwright automation: P2P, O2C, R2R, A2R (MOCK target only)
Read this first. Every test here runs against
../mock-app, a small fake Fusion-style app (Express, in-memory, reset per test; a shared shell plus one pack per module, see../mock-app/modules/README.md). There is no Oracle Fusion pod in this project. A pass proves the scripts and the mock agree, nothing more. Fusion behaviour, labels, hold names, tolerances and approval rules used by the mock are ASSUMED and must be re-verified on a test pod (never production). No secrets, no real client data: personas are mock cookies/headers, and all values are synthetic.
One command
cd automation
npm run setup # first time only: npm ci, mock-app deps, Chromium (+ OS deps)
npm test # PLAYWRIGHT_MODE=live, RUN_TIERS=P1,P2 -> results/
npm test = node scripts/run.js: starts the mock through Playwright's webServer (port 3100), runs Chromium,
then writes the case map. The exit code is Playwright's.
| Option | Default | Meaning |
|---|---|---|
RUN_TIERS |
P1,P2 |
Tiers to run. Read from each YAML's priority field in ../tests/cases/**/*.yaml (recursive; no hardcoded lists). npm run test:p1 = P1 only. |
RUN_MODULES |
all | Comma list of case-ID prefixes, e.g. RUN_MODULES=O2C or RUN_MODULES=R2R,A2R. A module-filtered run is never promoted to the canonical results. |
PLAYWRIGHT_MODE |
live |
Only live is supported here (real browser against the mock). stub is handled by architecture/p2p_graph.py without calling Playwright; the config throws on any other value. |
PLAYWRIGHT_JSON_OUTPUT_NAME |
results/results.json |
Override the JSON report path (used by the architecture graph). |
MOCK_PORT / BASE_URL |
3100 |
Mock port / URL. |
PW_REUSE_SERVER=1 |
off | Reuse an already-running mock (off by default so stale code is never tested). |
Run one case: npm test -- --grep @P2P-INV-001. One module: RUN_MODULES=A2R npm test (or npm test -- --grep @A2R). One module and tier: RUN_MODULES=O2C RUN_TIERS=P1 npm test. Typecheck: npm run typecheck. Open the report: npm run report.
Settings (team decisions)
retries: 0: the orchestrator owns the single retry.qa/test-strategy.mdstill says retries 1 and trace retain-on-failure; the later team decision overrides it.trace: 'on',screenshot: 'on',video: 'retain-on-failure',workers: 1(shared in-memory mock; every test calls/api/test/reset).- Locators:
getByRoleandgetByLabelfirst,getByTestIdonly for read-only values. No CSS, no XPath, nowaitForTimeout, noforce. - Test title =
<CASE-ID> <YAML title>. Tags:@<CASE-ID>(literal in the spec), thencaseTags(id)adds@<MODULE>(ID prefix),@<priority>, and@stand-inwhen the YAML says so (specs that run a stand-in flow also tag it literally and add an annotation).
Results
Every run, including single-test and --grep runs, writes to its own directory, and no run ever wipes another run's artifacts:
| Path | Content |
|---|---|
results/runs/<YYYYMMDD-HHMMSS-pid>/ |
One per run: artifacts/ (trace.zip, screenshots, video on failure), html-report/, results.pwjson (Playwright JSON), junit.xml, case-map.*, run-info.json |
results/results.json |
Canonical Playwright JSON, consumed by triage/run_triage.py and qa/audit.py. Updated only by a full run |
results/html-report/, results/junit.xml, results/case-map.{json,md} |
Canonical copies from the latest full run |
results/latest-full-run.json |
Which run directory the canonical files came from |
- Full run: every
tests/casesspec whose YAML priority is inRUN_TIERSwas selected,RUN_TIERSincludes P1 and P2,RUN_MODULESis not set, andPLAYWRIGHT_JSON_OUTPUT_NAMEis not set.scripts/promote-reporter.jschecks this. - Attachment paths in
results/results.jsonare absolute and point into that run'sresults/runs/<id>/artifacts/, which later runs never touch. - Per-run JSON is named
.pwjsonso that triage's*.jsonauto-discovery finds only the canonical file. Partial runs therefore can't change the go/no-go input. npm run verify:artifacts [file]checks that every trace and screenshot path in a results file exists.npm testruns this check automatically and exits 1 if any are missing.PW_RUN_ID=<name>sets the run directory name (for example, for mutation checks).
Layout
playwright.config.ts YAML-priority selection, reporters, webServer -> ../mock-app/server.js
src/cases.ts Recursive YAML loader (../tests/cases/**): titles, tags, test_values (tv), RUN_TIERS/RUN_MODULES selection
src/api.ts Mock REST client and P2P data recipes (mock equivalents of tests/data-recipes/DR-*); Persona union of all modules
src/ui.ts P2P page actions (role/label locators); persona labels of all modules
src/modules/<id>/ Per module: labels.ts (the ONE label mapping file), api.ts (recipes), ui.ts (page actions)
src/fixtures.ts ui/api, o2c/o2capi, r2r/r2rapi, a2r/a2rapi fixtures; auto reset before each test
tests/cases/<ID>.spec.ts P2P specs (one per designed case ID)
tests/cases/<id>/<ID>.spec.ts Other modules: tests/cases/o2c/, r2r/, a2r/
tests/smoke/ Mock health smoke test (P2P-SMOKE-001)
fixtures/contracts/ rest-contract.expected.json: HAND-AUTHORED, UNVERIFIED REST contract for P2P-INT-006 (from case YAML payloads + public Oracle docs; not captured from the mock)
fixtures/baselines/ MOCK self-baselines (ISO 20022 structure, ESS params). Not pod baselines.
fixtures/contracts/<id>-rest-contract.expected.json O2C / R2R contracts (HAND-AUTHORED, UNVERIFIED)
scripts/ run.js, promote-reporter.js, case-map.js (per-module, per-tier counts), verify-artifacts.js, capture-baselines.js, check-glossary.js
Adding a module
- Cases: the designer puts YAMLs in
../tests/cases/<id>/with IDs<PREFIX>-<AREA>-<NNN>and labels in../tests/ui-glossary.yamlunder<id>:. The loader is recursive, so they are picked up (and show up as gaps incase-map.md) with no code change. - Mock pack: copy
../mock-app/modules/_template/to../mock-app/modules/<id>/and follow../mock-app/modules/README.md. - Labels: create
src/modules/<id>/labels.tswith<ID>_PERSONA_LABELS,NAV,TASK,FIELD,BUTTON,PARAM,DATA. Every UI name must exist in../tests/ui-glossary.yaml <id>:(no local exception lists; ask the Test Designer to add missing names). Runnpm run check:glossary(exit 1 on any unmapped name; modules without a glossary section are reported, and fail only with--strict). - Recipes and page actions:
src/modules/<id>/api.tsandui.ts(extend the nearest existing UI class). Register the fixtures insrc/fixtures.ts, add the persona type to thePersonaunion insrc/api.tsand the labels toLABELinsrc/ui.ts. - Specs:
tests/cases/<id>/<CASE-ID>.spec.ts; title${CASE-ID} ${caseTitle(id)}; tags['@<CASE-ID>', ...caseTags(id)]. Usetest.fixme(..., reason)when the mock cannot model a case honestly. Never fake a pass. - Run:
RUN_MODULES=<PREFIX> npm testwhile building, then a plainnpm test(all modules) to promote the canonical results.
Label mapping files: src/modules/o2c/labels.ts, src/modules/r2r/labels.ts and src/modules/a2r/labels.ts (P2P labels are still inline in src/ui.ts). All are UNVERIFIED against a pod.
REST contract check (P2P-INT-006)
P2P-INT-006 calls GET <resource>/describe for five resources and compares the result with fixtures/contracts/rest-contract.expected.json. The test fails when:
- an expected attribute is missing;
- an attribute's type has changed; or
- an attribute is mandatory but isn't on that resource's
allowedMandatorylist (fields our integrations already supply).
The contract is hand-authored and marked UNVERIFIED. Replace it with a reviewed pre-patch describe() from a test pod before relying on it.
Stand-ins and fixme
Other modules: O2C-RCP-002 (lockbox file = CSV stand-in), R2R-GL-003 (journal import web service / FBDI stand-in, YAML), and R2R-GL-004 and R2R-CM-001..004 (spreadsheet / bank-file stand-ins) are tagged @stand-in with an annotation. O2C-SEC-005 and O2C-INT-003 are test.fixme with reasons. R2R-SEC-003 and A2R-SEC-002 use ASSUMED role matrices (ROLE_MATRIX in their labels.ts).
P2P-INV-006(YAMLstand_in: rest-import): invoices are imported via REST instead of the ADFdi spreadsheet. Tagged@stand-in.P2P-INT-009: the mock/erpintegrations importBulkDataaccepts base64 CSV, not a real FBDI zip, and there is no UCM upload. Tagged@stand-in.- Cases the mock cannot model honestly are
test.fixmewith a reason (they report as skipped, never as passed). Seeresults/case-map.md.
Mock personas and config (all ASSUMED)
Personas: requester, approver_l1, approver_l2, buyer, po_approver, po_approver_l2, receiver, ap_specialist, ap_supervisor,
invoice_approver, payments_user, gl_accountant, supplier_admin, integration_user, read_only. UI login uses the mock_role cookie, and the API uses the X-Mock-Role header.
Other modules' personas, seeds and rules are documented (as ASSUMED) at the top of each pack's store.js (../mock-app/modules/<id>/store.js). The DATA block in src/modules/<id>/labels.ts mirrors the seed values the specs use. For example, A2R uses STL depreciation with full-month prorate, assets A (2400.00 / 48 months) and B (12000.00 / 60 months), and books ZZ CORP BOOK (MOCK) / ZZ OTHER BOOK (MOCK).
| Setting | Mock value | Notes |
|---|---|---|
| Requisition approval | below 100 auto-approves; from 100 goes to L1; from 1000 goes to L1 then L2 | Self-approval: skip to the next approver |
| PO approval | below 1000 goes straight to OPEN; from 1000 needs po_approver; from 5000 also needs po_approver_l2 | |
| Invoice tolerances | price 5% (hold only above 5%), quantity ordered 0%, quantity received 0% | |
| Tax / withholding / FX | VAT10 = 10%, withholding 2%, EUR rate 1.1 | |
| Periods | two months back and earlier are CLOSED; closed-period invoices are rejected | |
| Payments | insufficient funds stops at proposed payment review; the ISO file is mock pain.001.001.03 (no XSD validation) |
Optional container: see Dockerfile (not built or tested on this box; Docker is not installed here).
HCM / CX execution rule (9 Oct 2026)
- QA asked (18:29 IST) to pause HCM entirely. The Chief of Staff ruling (18:30 IST) overrides that: HCM and CX may run on the local mock with synthetic data, outside the gate, but never against a pod until test-pod masking is confirmed (HCM-Q02 / CX-Q02).
- Guard (
src/cases.tsisMockTarget()/POD_BLOCKED_MODULES,playwright.config.ts): HCM, CX and everyexecution_holdcase are deselected unlessBASE_URLis a loopback host (127.0.0.1 / localhost / ::1).RUN_SUITE=heldwith a non-mockBASE_URLfails at config load. No env override exists. - Held suite default:
HELD_RUN_MODULES=HCM(mock only, results underresults/held/, not go/no-go). CX P1 specs are scripted; CX has no mock pack yet, so it is not in the default held run (HELD_RUN_MODULES=HCM,CXwould select them, mock only). - No scripts were deleted.