EnergyVenom commited on
Commit
85ce2ca
·
verified ·
1 Parent(s): 4a5368c

Deploy Patch Testing Co-worker

Browse files
automation/playwright.config.ts CHANGED
@@ -50,7 +50,7 @@ const SLOW_MO = process.env.FPT_LIVE_VIEW_DIR ? Math.max(0, Math.min(3000, Numbe
50
 
51
  export default defineConfig({
52
  testDir: './tests',
53
- testIgnore: [...deselected.map((f) => `**/cases/${f}`), ...(suite !== 'gate' ? ['**/smoke/**'] : [])],
54
  outputDir: path.join(RUN_DIR, 'artifacts'), // per-test trace.zip, screenshots, videos (per run; never shared)
55
  fullyParallel: false,
56
  workers: 1, // the mock keeps state in memory and each test resets it
 
50
 
51
  export default defineConfig({
52
  testDir: './tests',
53
+ testIgnore: [...deselected.map((f) => `**/cases/${f}`), ...(suite !== 'gate' ? ['**/smoke/**'] : []), '**/fusion/**'], // tests/fusion: real pods only (playwright.fusion.config.ts)
54
  outputDir: path.join(RUN_DIR, 'artifacts'), // per-test trace.zip, screenshots, videos (per run; never shared)
55
  fullyParallel: false,
56
  workers: 1, // the mock keeps state in memory and each test resets it
automation/playwright.fusion.config.ts ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig, devices } from '@playwright/test';
2
+ import * as path from 'path';
3
+
4
+ /*
5
+ * Runs against a REAL Oracle Fusion pod (tests/fusion). The pod address and its test user come from the environment
6
+ * (FUSION_BASE_URL, FUSION_USERNAME, FUSION_PASSWORD), set by the co-worker from the pod registration and its vault.
7
+ * Fusion pages are slow, so timeouts are far longer than for the practice pod. One test at a time.
8
+ */
9
+ if (!process.env.PW_RUN_ID) {
10
+ const d = new Date(); const p2 = (n: number) => String(n).padStart(2, '0');
11
+ process.env.PW_RUN_ID = `fusion-${d.getFullYear()}${p2(d.getMonth() + 1)}${p2(d.getDate())}-${p2(d.getHours())}${p2(d.getMinutes())}${p2(d.getSeconds())}`;
12
+ }
13
+ const RUN_DIR = path.join(__dirname, 'results', 'runs', process.env.PW_RUN_ID);
14
+ const SLOW_MO = process.env.FPT_LIVE_VIEW_DIR ? Math.max(0, Math.min(3000, Number(process.env.FPT_BROWSER_SLOWMO_MS) || 0)) : 0;
15
+
16
+ export default defineConfig({
17
+ testDir: './tests/fusion',
18
+ outputDir: path.join(RUN_DIR, 'artifacts'),
19
+ fullyParallel: false,
20
+ workers: 1,
21
+ retries: 0, // the co-worker owns the single retry
22
+ timeout: 600_000 + SLOW_MO * 400,
23
+ expect: { timeout: 30_000 },
24
+ metadata: { target: `Oracle Fusion pod ${process.env.FUSION_BASE_URL || '(not set)'}`, runId: process.env.PW_RUN_ID },
25
+ reporter: [
26
+ ['list'],
27
+ ['json', { outputFile: process.env.PLAYWRIGHT_JSON_OUTPUT_NAME || path.join(RUN_DIR, 'results.pwjson') }],
28
+ ],
29
+ use: {
30
+ trace: 'on',
31
+ screenshot: 'on',
32
+ video: 'retain-on-failure',
33
+ actionTimeout: 60_000,
34
+ navigationTimeout: 120_000,
35
+ viewport: { width: 1440, height: 900 },
36
+ launchOptions: { slowMo: SLOW_MO },
37
+ },
38
+ projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 900 } } }],
39
+ });
automation/src/fusion/fixtures.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { test as base, expect } from '@playwright/test';
2
+ import { beginLiveStatus, liveViewDir, startLiveView } from '../live-view';
3
+ import { FusionUi } from './ui';
4
+
5
+ /** Fixtures for tests against a real Oracle Fusion pod: the Fusion steps plus the same live view as mock runs. */
6
+ export const test = base.extend<{ fusion: FusionUi; liveStatus: void }>({
7
+ page: async ({ page }, use, testInfo) => {
8
+ const stopLive = liveViewDir() ? await startLiveView(page, testInfo) : null;
9
+ await use(page);
10
+ if (stopLive) await stopLive();
11
+ },
12
+ fusion: async ({ page }, use) => { await use(new FusionUi(page)); },
13
+ liveStatus: [async ({}, use, testInfo) => { const done = liveViewDir() ? beginLiveStatus(testInfo) : null; await use(); if (done) done(); }, { auto: true }],
14
+ });
15
+ export { expect };
automation/src/fusion/ui.ts ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, type Locator, type Page } from '@playwright/test';
2
+
3
+ /** Where the tests run and as whom. Set by the co-worker from the pod registration and its vault (never in code). */
4
+ export const fusionEnv = () => ({
5
+ baseUrl: (process.env.FUSION_BASE_URL || '').replace(/\/$/, ''),
6
+ username: process.env.FUSION_USERNAME || '',
7
+ password: process.env.FUSION_PASSWORD || '',
8
+ });
9
+
10
+ /** Payables test data for this pod: discovered by the Scout, overridable per pod. */
11
+ export const apData = () => ({
12
+ businessUnit: process.env.FUSION_AP_BU || 'ATP US Business Unit',
13
+ supplier: process.env.FUSION_AP_SUPPLIER || 'DP_Main_Supplier',
14
+ account: process.env.FUSION_AP_ACCOUNT || '1000-1000-2207000',
15
+ });
16
+
17
+ /** Fusion's date fields on this pod take dd.mm.yyyy. */
18
+ export const fusionDate = (d = new Date()) => `${String(d.getDate()).padStart(2, '0')}.${String(d.getMonth() + 1).padStart(2, '0')}.${d.getFullYear()}`;
19
+
20
+ /** A test document number nobody else will use: FPT-<tag>-<MMDDhhmmss>. */
21
+ export const testNumber = (tag: string) => `FPT-${tag}-${new Date().toISOString().replace(/\D/g, '').slice(4, 14)}`;
22
+
23
+ /**
24
+ * The user-level steps on Oracle Fusion screens, proven on a real pod. Fusion pages are slow and recalculate defaults
25
+ * after each field, so every step waits for the page to settle instead of a fixed short timeout.
26
+ */
27
+ export class FusionUi {
28
+ constructor(readonly page: Page) {}
29
+
30
+ /** Wait until Fusion's page framework (Oracle ADF) has finished its round trip to the server. Fusion keeps
31
+ * background requests going, so "network idle" never comes; ADF's own flag is the reliable signal. */
32
+ async settle(extraMs = 800) {
33
+ await this.page.waitForLoadState('domcontentloaded').catch(() => {});
34
+ await this.page.waitForFunction(() => {
35
+ const adf = (window as unknown as { AdfPage?: { PAGE?: { isSynchronizedWithServer?: () => boolean } } }).AdfPage;
36
+ return !adf?.PAGE?.isSynchronizedWithServer || adf.PAGE.isSynchronizedWithServer();
37
+ }, undefined, { timeout: 60_000, polling: 250 }).catch(() => {});
38
+ await this.page.waitForTimeout(extraMs);
39
+ }
40
+
41
+ async signIn() {
42
+ const { baseUrl, username, password } = fusionEnv();
43
+ if (!baseUrl || !username || !password) throw new Error('FUSION_BASE_URL, FUSION_USERNAME and FUSION_PASSWORD must be set for a Fusion run');
44
+ await this.page.goto(`${baseUrl}/`, { waitUntil: 'domcontentloaded' });
45
+ const user = this.page.locator('[id="idcs-signin-basic-signin-form-username|input"]');
46
+ const pass = this.page.locator('[id="idcs-signin-basic-signin-form-password|input"]');
47
+ await user.fill(username);
48
+ await pass.fill(password);
49
+ await pass.press('Enter');
50
+ await this.page.waitForURL(/AtkHomePageWelcome|FuseWelcome/, { timeout: 120_000 });
51
+ }
52
+
53
+ /** Navigator-style path: a work area link on the springboard, then a page, then a task from the Tasks panel. */
54
+ async openTask(area: string, page: string, task: string) {
55
+ const { baseUrl } = fusionEnv();
56
+ await this.page.goto(`${baseUrl}/fscmUI/faces/FuseWelcome`, { waitUntil: 'domcontentloaded' });
57
+ await this.settle(4000);
58
+ await this.page.getByRole('link', { name: area, exact: true }).first().click();
59
+ await this.settle(3000);
60
+ await this.page.getByRole('link', { name: page, exact: true }).first().click();
61
+ await this.settle(6000);
62
+ await this.page.locator('div[title="Item: Tasks"]').first().click();
63
+ await this.settle(2000);
64
+ await this.page.getByRole('link', { name: task, exact: true }).first().click();
65
+ await this.settle(8000);
66
+ }
67
+
68
+ /** A form field by its visible label; Fusion adds "(Required)" to the label of required fields. */
69
+ field(label: string): Locator {
70
+ return this.page.getByLabel(new RegExp(`^\\s*${label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\s*\\(Required\\))?\\s*$`)).first();
71
+ }
72
+
73
+ /** Type a value and leave the field, so Fusion runs its own logic (look-ups, defaults) as it does for a user. */
74
+ async put(label: string, value: string) {
75
+ const f = this.field(label);
76
+ await f.click();
77
+ await f.fill(value);
78
+ await f.press('Tab');
79
+ await this.settle();
80
+ }
81
+
82
+ async value(label: string): Promise<string> {
83
+ return (await this.field(label).inputValue().catch(() => '')).trim();
84
+ }
85
+
86
+ async expectFilled(label: string) {
87
+ await expect.poll(() => this.value(label), { message: `${label} should be filled in by Fusion`, timeout: 30_000 }).not.toBe('');
88
+ }
89
+ }
automation/tests/fusion/AP-FUS-001.spec.ts ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // AP-FUS-001 (YAML: tests/cases/AP-FUS-001.yaml). Runs against a REAL Oracle Fusion pod (playwright.fusion.config.ts).
2
+ import { test, expect } from '../../src/fusion/fixtures';
3
+ import { apData, fusionDate, testNumber } from '../../src/fusion/ui';
4
+
5
+ // Real Oracle Fusion pod. Saves nothing: the invoice is cancelled before it is ever saved.
6
+ test('AP-FUS-001 Invoice header takes the supplier defaults', { tag: ['@AP-FUS-001', '@AP', '@P1'] }, async ({ fusion, page }) => {
7
+ const d = apData();
8
+ await test.step('Sign in as the Payables test user', () => fusion.signIn());
9
+ await test.step('Open Payables > Invoices > Create Invoice', async () => {
10
+ await fusion.openTask('Payables', 'Invoices', 'Create Invoice');
11
+ await expect(page).toHaveTitle(/Create Invoice/);
12
+ });
13
+ await test.step('Enter business unit and supplier', async () => {
14
+ await fusion.put('Business Unit', d.businessUnit);
15
+ await fusion.put('Supplier', d.supplier);
16
+ });
17
+ await test.step('Fusion fills the supplier site, legal entity, payment terms and currency', async () => {
18
+ for (const f of ['Supplier Site', 'Legal Entity', 'Payment Terms', 'Terms Date']) await fusion.expectFilled(f);
19
+ });
20
+ await test.step('Enter number, amount and date', async () => {
21
+ await fusion.put('Number', testNumber('UI'));
22
+ await fusion.put('Amount', '100');
23
+ await fusion.put('Date', fusionDate());
24
+ expect(await fusion.value('Amount')).toBe('100.00');
25
+ });
26
+ await test.step('Cancel without saving', async () => {
27
+ await page.getByRole('button', { name: 'Cancel', exact: true }).first().click();
28
+ await fusion.settle(3000);
29
+ const yes = page.getByRole('button', { name: /^(Yes|OK)$/ });
30
+ if (await yes.count()) await yes.first().click();
31
+ await fusion.settle(3000);
32
+ });
33
+ });
coworker/__main__.py CHANGED
@@ -386,6 +386,22 @@ def cmd_llm_ping(a) -> int:
386
  return 0
387
 
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  def cmd_web_dev(a) -> int:
390
  return _sh([NPM, "run", "dev"], cwd=ROOT / "web", check=False)
391
 
@@ -434,6 +450,7 @@ def main(argv=None) -> int:
434
  s = sp.add_parser("kill"); s.add_argument("--reason"); s.set_defaults(fn=cmd_kill)
435
  sp.add_parser("unkill").set_defaults(fn=cmd_unkill)
436
  sp.add_parser("research-fixtures").set_defaults(fn=cmd_research_fixtures)
 
437
  s = sp.add_parser("llm-ping"); s.add_argument("--provider", choices=["stub", "ollama"], default="stub"); s.set_defaults(fn=cmd_llm_ping)
438
  sp.add_parser("web-dev").set_defaults(fn=cmd_web_dev)
439
  sp.add_parser("desktop").set_defaults(fn=cmd_desktop)
 
386
  return 0
387
 
388
 
389
+ def cmd_fusion_discover(a) -> int:
390
+ """Read-only look at a real Fusion pod: what the Scout would learn. Credentials from FUSION_USERNAME / FUSION_PASSWORD."""
391
+ import os
392
+
393
+ from .graph.services import build_services
394
+ from .platform.pod import FusionPodClient
395
+ svc = build_services(get_settings())
396
+ pod = FusionPodClient(svc.egress, a.url, (os.environ.get("FUSION_USERNAME", ""), os.environ.get("FUSION_PASSWORD", "")))
397
+ out = {"about": pod.about(), "areas": []}
398
+ for m in pod.modules():
399
+ out["areas"].append({"area": m["name"], "usage": {r: pod.count(r, m["personas"][0]) for r in m["resources"]},
400
+ "setup": pod.module_config(m["id"], m["personas"][0])})
401
+ print(json.dumps(out, indent=1, default=str))
402
+ return 0
403
+
404
+
405
  def cmd_web_dev(a) -> int:
406
  return _sh([NPM, "run", "dev"], cwd=ROOT / "web", check=False)
407
 
 
450
  s = sp.add_parser("kill"); s.add_argument("--reason"); s.set_defaults(fn=cmd_kill)
451
  sp.add_parser("unkill").set_defaults(fn=cmd_unkill)
452
  sp.add_parser("research-fixtures").set_defaults(fn=cmd_research_fixtures)
453
+ s = sp.add_parser("fusion-discover"); s.add_argument("url"); s.set_defaults(fn=cmd_fusion_discover)
454
  s = sp.add_parser("llm-ping"); s.add_argument("--provider", choices=["stub", "ollama"], default="stub"); s.set_defaults(fn=cmd_llm_ping)
455
  sp.add_parser("web-dev").set_defaults(fn=cmd_web_dev)
456
  sp.add_parser("desktop").set_defaults(fn=cmd_desktop)
coworker/adapters/playwright.py CHANGED
@@ -58,8 +58,8 @@ def grep_for(ids: list[str]) -> str:
58
  return "(?:" + "|".join("@" + re.escape(i) for i in ids) + ")(?![\\w-])"
59
 
60
 
61
- def command(ids: list[str]) -> list[str]:
62
- return ["node", str(PW_CLI), "test", "--config", "playwright.agent.config.ts", "--retries=0", "--reporter=json",
63
  "--grep", grep_for(ids)]
64
 
65
 
@@ -87,7 +87,8 @@ def ensure_mock(egress, base_url: str, log_dir: Path) -> subprocess.Popen | None
87
  def run_attempt(*, run_id: str, ids: list[str], attempt: int, mode: str, out_file: Path, stub_knobs: dict | None = None,
88
  drafts_dir: Path | None = None, overrides_file: Path | None = None, cred_env: dict | None = None,
89
  backend: str = "local", timeout_s: int = 3600, log_dir: Path | None = None, tag: str = "",
90
- poll=None, poll_s: float = 5.0, live_dir: Path | None = None, live_meta: dict | None = None) -> dict:
 
91
  """poll(progress: dict) is called every poll_s seconds while Playwright runs (heartbeats); if it raises, the
92
  Playwright process tree is killed and the exception propagates (cancellation / kill switch)."""
93
  out_file.parent.mkdir(parents=True, exist_ok=True)
@@ -122,7 +123,7 @@ def run_attempt(*, run_id: str, ids: list[str], attempt: int, mode: str, out_fil
122
  ov = json.loads(Path(overrides_file).read_text(encoding="utf-8") or "{}")
123
  if ov:
124
  env["PW_LOCATOR_OVERRIDES"] = json.dumps(ov)
125
- cmd = command(ids)
126
  if sys.platform != "win32":
127
  cmd = ["node", str(PW_CLI), *cmd[2:]]
128
  log_dir = log_dir or out_file.parent
 
58
  return "(?:" + "|".join("@" + re.escape(i) for i in ids) + ")(?![\\w-])"
59
 
60
 
61
+ def command(ids: list[str], config: str = "playwright.agent.config.ts") -> list[str]:
62
+ return ["node", str(PW_CLI), "test", "--config", config, "--retries=0", "--reporter=json",
63
  "--grep", grep_for(ids)]
64
 
65
 
 
87
  def run_attempt(*, run_id: str, ids: list[str], attempt: int, mode: str, out_file: Path, stub_knobs: dict | None = None,
88
  drafts_dir: Path | None = None, overrides_file: Path | None = None, cred_env: dict | None = None,
89
  backend: str = "local", timeout_s: int = 3600, log_dir: Path | None = None, tag: str = "",
90
+ poll=None, poll_s: float = 5.0, live_dir: Path | None = None, live_meta: dict | None = None,
91
+ config: str = "playwright.agent.config.ts") -> dict:
92
  """poll(progress: dict) is called every poll_s seconds while Playwright runs (heartbeats); if it raises, the
93
  Playwright process tree is killed and the exception propagates (cancellation / kill switch)."""
94
  out_file.parent.mkdir(parents=True, exist_ok=True)
 
123
  ov = json.loads(Path(overrides_file).read_text(encoding="utf-8") or "{}")
124
  if ov:
125
  env["PW_LOCATOR_OVERRIDES"] = json.dumps(ov)
126
+ cmd = command(ids, config)
127
  if sys.platform != "win32":
128
  cmd = ["node", str(PW_CLI), *cmd[2:]]
129
  log_dir = log_dir or out_file.parent
coworker/api/routes/runs.py CHANGED
@@ -8,7 +8,6 @@ from pathlib import Path
8
  from fastapi import APIRouter, Depends, Query, Request
9
  from fastapi.responses import FileResponse, Response, StreamingResponse
10
 
11
- from ...config import MOCK_BANNER
12
  from ...graph.build import GRAPH_SPEC
13
  from ...platform.killswitch import KillSwitchEngaged
14
  from .. import actions
@@ -64,7 +63,7 @@ def run_detail(run_id: str, request: Request, user: Principal = Depends(require(
64
  calls = st.get("llm_calls") or []
65
  return {**r, "include_p2": bool(r.get("include_p2")), "live_view": bool(st["live_view"] if "live_view" in st else (r.get("inputs") or {}).get("live_view") if isinstance(r.get("inputs"), dict) else False), "counts": st.get("counts") or r.get("counts") or {},
66
  "report_paths": st.get("report_paths") or {}, "errors": st.get("errors") or [], "retry_count": st.get("retry_count", 0),
67
- "llm_calls_count": len(calls), "llm_calls": calls, "target": MOCK_BANNER,
68
  "decisions": st.get("decisions") or r["decisions"], "decision": st.get("decision", r.get("decision"))}
69
 
70
 
@@ -146,7 +145,7 @@ def run_research(run_id: str, request: Request, user: Principal = Depends(requir
146
  _run(svc, run_id)
147
  st = runs.state(run_id)
148
  return {"pod_profile": st.get("pod_profile"), "research": st.get("research") or [], "coverage_map": st.get("coverage_map"),
149
- "research_modules": st.get("research_modules") or [], "target": MOCK_BANNER}
150
 
151
 
152
  @router.get("/runs/{run_id}/cases")
@@ -201,7 +200,7 @@ def run_report(run_id: str, request: Request, user: Principal = Depends(require(
201
  files = {m: {k: bool(v and Path(v).exists()) for k, v in p.items()} for m, p in paths.items()}
202
  return {"decisions": st.get("decisions") or {}, "decision": st.get("decision"), "decision_source": "reports/generate_report.py",
203
  "criteria": criteria, "gaps": gaps, "counts": counts, "executive_summary": summaries, "files": files,
204
- "run_mode": (st.get("run_results") or {}).get("mode"), "target": MOCK_BANNER}
205
 
206
 
207
  FMT = {"md": ("md", "text/markdown; charset=utf-8"), "html": ("html", "text/html; charset=utf-8"),
 
8
  from fastapi import APIRouter, Depends, Query, Request
9
  from fastapi.responses import FileResponse, Response, StreamingResponse
10
 
 
11
  from ...graph.build import GRAPH_SPEC
12
  from ...platform.killswitch import KillSwitchEngaged
13
  from .. import actions
 
63
  calls = st.get("llm_calls") or []
64
  return {**r, "include_p2": bool(r.get("include_p2")), "live_view": bool(st["live_view"] if "live_view" in st else (r.get("inputs") or {}).get("live_view") if isinstance(r.get("inputs"), dict) else False), "counts": st.get("counts") or r.get("counts") or {},
65
  "report_paths": st.get("report_paths") or {}, "errors": st.get("errors") or [], "retry_count": st.get("retry_count", 0),
66
+ "llm_calls_count": len(calls), "llm_calls": calls, "target": svc.target(run_id),
67
  "decisions": st.get("decisions") or r["decisions"], "decision": st.get("decision", r.get("decision"))}
68
 
69
 
 
145
  _run(svc, run_id)
146
  st = runs.state(run_id)
147
  return {"pod_profile": st.get("pod_profile"), "research": st.get("research") or [], "coverage_map": st.get("coverage_map"),
148
+ "research_modules": st.get("research_modules") or [], "target": svc.target(run_id)}
149
 
150
 
151
  @router.get("/runs/{run_id}/cases")
 
200
  files = {m: {k: bool(v and Path(v).exists()) for k, v in p.items()} for m, p in paths.items()}
201
  return {"decisions": st.get("decisions") or {}, "decision": st.get("decision"), "decision_source": "reports/generate_report.py",
202
  "criteria": criteria, "gaps": gaps, "counts": counts, "executive_summary": summaries, "files": files,
203
+ "run_mode": (st.get("run_results") or {}).get("mode"), "target": svc.target(run_id)}
204
 
205
 
206
  FMT = {"md": ("md", "text/markdown; charset=utf-8"), "html": ("html", "text/html; charset=utf-8"),
coworker/graph/nodes/execute.py CHANGED
@@ -70,7 +70,13 @@ def plan_attempt(state, svc, clean: bool = True) -> dict:
70
  for m in mods:
71
  cred_env.update(svc.vault.executor_env(m))
72
  live_on, _why = liveview.availability(svc.cfg, mode=mode, wanted=bool(state.get("live_view")), modules=mods)
73
- return {"run_id": run_id, "attempt": attempt, "ids": ids, "mode": mode, "files": files, "run_dir": str(run_dir),
 
 
 
 
 
 
74
  "live_dir": str(liveview.live_dir(svc.cfg, run_id)) if live_on and ids else None,
75
  "out_file": str(run_dir / f"attempt-{attempt}.json"), "stub_knobs": state.get("stub_knobs"),
76
  "drafts_dir": str(svc.cfg.path("staging", "specs", run_id)),
@@ -80,8 +86,10 @@ def plan_attempt(state, svc, clean: bool = True) -> dict:
80
 
81
  def run_planned(plan: dict, svc, **extra) -> dict:
82
  """Default runner: one Playwright invocation for the whole attempt (LangGraph path)."""
83
- if plan["mode"] == "live":
84
  pw.ensure_mock(svc.egress, svc.cfg.pod_base_url, svc.cfg.path("logs"))
 
 
85
  return pw.run_attempt(run_id=plan["run_id"], ids=plan["ids"], attempt=plan["attempt"], mode=plan["mode"],
86
  out_file=Path(plan["out_file"]), stub_knobs=plan["stub_knobs"], drafts_dir=Path(plan["drafts_dir"]),
87
  overrides_file=Path(plan["overrides"]) if plan["overrides"] else None, cred_env=plan["cred_env"],
 
70
  for m in mods:
71
  cred_env.update(svc.vault.executor_env(m))
72
  live_on, _why = liveview.availability(svc.cfg, mode=mode, wanted=bool(state.get("live_view")), modules=mods)
73
+ fusion_pod = svc.fusion_pod_id(run_id)
74
+ config = None
75
+ if fusion_pod is not None and mode == "live": # a real Fusion pod: its own test set, its test user from the vault
76
+ from ...platform.pods import PodRegistry
77
+ cred_env.update(PodRegistry(svc.db, svc.vault, svc.cfg, svc.egress, svc.audit).executor_env(fusion_pod) or {})
78
+ config = "playwright.fusion.config.ts"
79
+ return {"run_id": run_id, "attempt": attempt, "ids": ids, "mode": mode, "files": files, "run_dir": str(run_dir), "config": config,
80
  "live_dir": str(liveview.live_dir(svc.cfg, run_id)) if live_on and ids else None,
81
  "out_file": str(run_dir / f"attempt-{attempt}.json"), "stub_knobs": state.get("stub_knobs"),
82
  "drafts_dir": str(svc.cfg.path("staging", "specs", run_id)),
 
86
 
87
  def run_planned(plan: dict, svc, **extra) -> dict:
88
  """Default runner: one Playwright invocation for the whole attempt (LangGraph path)."""
89
+ if plan["mode"] == "live" and not plan.get("config"):
90
  pw.ensure_mock(svc.egress, svc.cfg.pod_base_url, svc.cfg.path("logs"))
91
+ if plan.get("config"):
92
+ extra.setdefault("config", plan["config"])
93
  return pw.run_attempt(run_id=plan["run_id"], ids=plan["ids"], attempt=plan["attempt"], mode=plan["mode"],
94
  out_file=Path(plan["out_file"]), stub_knobs=plan["stub_knobs"], drafts_dir=Path(plan["drafts_dir"]),
95
  overrides_file=Path(plan["overrides"]) if plan["overrides"] else None, cred_env=plan["cred_env"],
coworker/graph/nodes/triage.py CHANGED
@@ -33,7 +33,8 @@ def run_triage(state, svc) -> tuple[dict, Path, Path]:
33
  merged = Path(state["run_results"]["merged_path"])
34
  tri = triage_rule.triage(merged, root / "tests" / "cases")
35
  live = (state.get("playwright_mode") or svc.cfg.playwright_mode) == "live"
36
- tri["run_mode"] = "live (mock-app)" if live else "STUB RUN - synthetic results, not a browser, not Fusion"
 
37
  path = triage_rule.write(tri, run_dir / "triage.json")
38
  return tri, path, root
39
 
@@ -111,7 +112,7 @@ def ticket(state, config, svc) -> dict:
111
  "priority": c.get("priority"), "patch_id": state.get("patch_id"), "category": v.get("category"),
112
  "confidence": v.get("confidence"), "evidence": v.get("evidence", [])[:10], "error": v.get("message", "")[:2000],
113
  "confirmed_by": actor, "created_by": actor, "waiver": r.get("waiver"),
114
- "target": "Mock app, not Oracle Fusion"}
115
  res = svc.tickets.create(draft)
116
  svc.audit.append("ticket.created", actor=actor, run_id=run_id, node="ticket", summary=f"{res['ticket_id']} {cid}")
117
  out.append({"ticket_id": res["ticket_id"], "case_id": cid, "sink": svc.tickets.name, "external_ref": res.get("external_ref")})
 
33
  merged = Path(state["run_results"]["merged_path"])
34
  tri = triage_rule.triage(merged, root / "tests" / "cases")
35
  live = (state.get("playwright_mode") or svc.cfg.playwright_mode) == "live"
36
+ fusion = svc.fusion_pod_id(state["run_id"]) is not None
37
+ tri["run_mode"] = ("live (Oracle Fusion pod)" if fusion else "live (mock-app)") if live else "STUB RUN - synthetic results, not a browser, not Fusion"
38
  path = triage_rule.write(tri, run_dir / "triage.json")
39
  return tri, path, root
40
 
 
112
  "priority": c.get("priority"), "patch_id": state.get("patch_id"), "category": v.get("category"),
113
  "confidence": v.get("confidence"), "evidence": v.get("evidence", [])[:10], "error": v.get("message", "")[:2000],
114
  "confirmed_by": actor, "created_by": actor, "waiver": r.get("waiver"),
115
+ "target": svc.target(run_id)}
116
  res = svc.tickets.create(draft)
117
  svc.audit.append("ticket.created", actor=actor, run_id=run_id, node="ticket", summary=f"{res['ticket_id']} {cid}")
118
  out.append({"ticket_id": res["ticket_id"], "case_id": cid, "sink": svc.tickets.name, "external_ref": res.get("external_ref")})
coworker/graph/services.py CHANGED
@@ -44,9 +44,29 @@ class Services:
44
  users: UserStore
45
  extra: dict = field(default_factory=dict)
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  def pod(self, run_id: str | None = None):
48
- if self.cfg.pod_kind == "fusion":
49
- return FusionPodClient()
 
 
 
 
50
  return MockPodClient(self.egress, self.cfg.pod_rest_base, run_id=run_id)
51
 
52
  def run_dir(self, run_id: str) -> Path:
 
44
  users: UserStore
45
  extra: dict = field(default_factory=dict)
46
 
47
+ def fusion_pod_id(self, run_id: str | None) -> int | None:
48
+ """The registered Fusion pod this run targets, or None when it runs against the practice pod."""
49
+ run = self.db.get_run(run_id) if run_id else None
50
+ if not run or not run.get("pod_id"):
51
+ return None
52
+ row = self.db.one("SELECT kind FROM pods WHERE id=?", (run["pod_id"],))
53
+ return run["pod_id"] if row and row["kind"] == "fusion" else None
54
+
55
+ def target(self, run_id: str | None) -> str:
56
+ """What a run tested, in words for reports and screens."""
57
+ pid = self.fusion_pod_id(run_id)
58
+ if pid is None:
59
+ return "Mock app, not Oracle Fusion"
60
+ row = self.db.one("SELECT name, base_url FROM pods WHERE id=?", (pid,))
61
+ return f"Oracle Fusion pod: {row['name']} ({row['base_url']})"
62
+
63
  def pod(self, run_id: str | None = None):
64
+ pid = self.fusion_pod_id(run_id)
65
+ if pid is not None:
66
+ from ..platform.pods import PodRegistry
67
+ reg = PodRegistry(self.db, self.vault, self.cfg, self.egress, self.audit)
68
+ p = reg.get(pid)
69
+ return FusionPodClient(self.egress, p["base_url"], reg.fusion_auth(pid) or ("", ""), environment=p["environment"], run_id=run_id)
70
  return MockPodClient(self.egress, self.cfg.pod_rest_base, run_id=run_id)
71
 
72
  def run_dir(self, run_id: str) -> Path:
coworker/platform/egress.py CHANGED
@@ -115,6 +115,29 @@ class EgressGate:
115
  self._log_resp("pod_probe", url, r, run_id)
116
  return r
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  # ------------------------------------------------------------ named external service (identity provider, file storage)
119
  def service_request(self, kind: str, method: str, url: str, *, allowed_base: str, headers: dict | None = None,
120
  json_body: dict | None = None, content: bytes | None = None, log_body: Any = None,
 
115
  self._log_resp("pod_probe", url, r, run_id)
116
  return r
117
 
118
+ def fusion_request(self, base_url: str, method: Literal["GET", "POST"], path: str, *, auth: tuple[str, str],
119
+ params: dict | None = None, json_body: dict | None = None, purpose: Literal["read", "seed"] = "read",
120
+ run_id: str | None = None, timeout: float = 60.0) -> httpx.Response:
121
+ """One call to a registered Oracle Fusion pod's REST services (platform/pods.py refuses production pods).
122
+ https only, the pod's own host only, no redirects. GET is always allowed; POST only for purpose='seed' with
123
+ SEED_ALLOWED=1 (creating test data the client agreed to). The password is never logged."""
124
+ self.kill.check("egress.fusion")
125
+ b = urlparse(base_url)
126
+ url = base_url.rstrip("/") + "/" + path.lstrip("/")
127
+ u = urlparse(url)
128
+ if u.scheme != "https" or (u.scheme, u.hostname, u.port) != (b.scheme, b.hostname, b.port):
129
+ self._deny("fusion", f"host {u.hostname} is not the registered Fusion pod {b.hostname} (https only)", url, run_id)
130
+ if method == "POST" and (purpose != "seed" or not self.cfg.seed_allowed):
131
+ self._deny("fusion", "POST to a Fusion pod needs purpose=seed and SEED_ALLOWED=1", url, run_id)
132
+ if method not in ("GET", "POST"):
133
+ self._deny("fusion", f"method {method} not allowed", url, run_id)
134
+ self._log_req("fusion", method, url.split("?", 1)[0], json_body, run_id, {"params": params, "purpose": purpose, "user": auth[0]})
135
+ with self._client(timeout=timeout) as c:
136
+ r = c.request(method, url, params=params, json=json_body, auth=auth,
137
+ headers={"Accept": "application/json", "REST-Framework-Version": "4"})
138
+ self._log_resp("fusion", url.split("?", 1)[0], r, run_id)
139
+ return r
140
+
141
  # ------------------------------------------------------------ named external service (identity provider, file storage)
142
  def service_request(self, kind: str, method: str, url: str, *, allowed_base: str, headers: dict | None = None,
143
  json_body: dict | None = None, content: bytes | None = None, log_body: Any = None,
coworker/platform/pod.py CHANGED
@@ -71,8 +71,66 @@ class MockPodClient:
71
 
72
 
73
  class FusionPodClient:
74
- """STUB: a real Oracle Fusion pod client (REST + BIP, least-privilege user from the vault)."""
 
 
75
  kind = "fusion"
 
 
 
 
76
 
77
- def __init__(self, *_, **__):
78
- raise NotAvailable("no Fusion pod in this project")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
 
73
  class FusionPodClient:
74
+ """A real Oracle Fusion pod, read through its REST services with the pod's test user (credentials from the vault or
75
+ FUSION_USERNAME / FUSION_PASSWORD). Read-only: discovery never creates anything. Payables is the first business
76
+ area covered; the module list grows as each area gets real scripts."""
77
  kind = "fusion"
78
+ FSCM = "/fscmRestApi/resources/11.13.18.05"
79
+ # business area -> the REST resources whose record counts say whether it is in use on this pod
80
+ AREAS = [{"id": "payables", "idPrefix": "AP", "name": "Payables", "resources": ["invoices", "suppliers"],
81
+ "processes": ["Invoice entry", "Invoice validation and holds", "Payments"]}]
82
 
83
+ def __init__(self, egress, base_url: str, auth: tuple[str, str], environment: str = "test", run_id: str | None = None):
84
+ if not auth or not auth[0] or not auth[1]:
85
+ raise NotAvailable("no credentials for this Fusion pod: set them on the Test environments page")
86
+ self.egress, self.base, self.auth, self.environment, self.run_id = egress, base_url.rstrip("/"), auth, environment, run_id
87
+
88
+ def _get(self, path: str, params: dict | None = None):
89
+ return self.egress.fusion_request(self.base, "GET", path, auth=self.auth, params=params, run_id=self.run_id)
90
+
91
+ def _items(self, resource: str, params: dict | None = None) -> list[dict]:
92
+ r = self._get(f"{self.FSCM}/{resource}", {"onlyData": "true", **(params or {})})
93
+ return r.json().get("items", []) if r.status_code == 200 else []
94
+
95
+ def about(self) -> dict:
96
+ r = self._get(f"{self.FSCM}/invoices", {"limit": 1, "onlyData": "true", "fields": "InvoiceId"})
97
+ if r.status_code == 401:
98
+ raise NotAvailable("the Fusion pod refused the test user's credentials (HTTP 401)")
99
+ r.raise_for_status()
100
+ # Fusion has no "environment" flag over REST: the registration says test (production pods cannot be registered).
101
+ return {"release": r.headers.get("REST-Framework-Version") and "Oracle Fusion Cloud" or "Oracle Fusion Cloud",
102
+ "environment": self.environment, "is_mock": False, "source": f"{self.base} REST"}
103
+
104
+ def modules(self) -> list[dict]:
105
+ return [{**a, "personas": [self.auth[0]]} for a in self.AREAS]
106
+
107
+ def personas(self, pack_id: str) -> list[str]:
108
+ return [self.auth[0]]
109
+
110
+ def describe(self, resource: str, persona: str) -> dict:
111
+ r = self._get(f"{self.FSCM}/{resource}/describe")
112
+ return r.json() if r.status_code == 200 else {"error": r.status_code}
113
+
114
+ def count(self, resource_path: str, persona: str) -> int | None:
115
+ r = self._get(f"{self.FSCM}/{resource_path}", {"limit": 1, "totalResults": "true", "onlyData": "true"})
116
+ if r.status_code != 200:
117
+ return None
118
+ d = r.json()
119
+ return d["totalResults"] if isinstance(d.get("totalResults"), int) else len(d.get("items", []))
120
+
121
+ def module_config(self, pack_id: str, persona: str) -> dict | None:
122
+ """What the tests need to know about the pod's Payables setup: where invoices are entered and with what."""
123
+ if pack_id != "payables":
124
+ return None
125
+ recent = self._items("invoices", {"limit": 25, "orderBy": "InvoiceId:desc",
126
+ "fields": "BusinessUnit,Supplier,SupplierSite,InvoiceCurrency,PaymentTerms,InvoiceType,ValidationStatus"})
127
+ def top(key: str) -> list[str]:
128
+ seen: dict[str, int] = {}
129
+ for i in recent:
130
+ if i.get(key):
131
+ seen[i[key]] = seen.get(i[key], 0) + 1
132
+ return [k for k, _ in sorted(seen.items(), key=lambda kv: -kv[1])][:5]
133
+ return {"business_units": top("BusinessUnit"), "suppliers": top("Supplier"), "supplier_sites": top("SupplierSite"),
134
+ "currencies": top("InvoiceCurrency"), "payment_terms": top("PaymentTerms"), "invoice_types": top("InvoiceType"),
135
+ "validation_statuses": top("ValidationStatus"), "sampled_invoices": len(recent),
136
+ "ledgers": [x.get("Name") for x in self._items("ledgersLOV", {"limit": 10, "fields": "Name"})]}
coworker/platform/pods.py CHANGED
@@ -85,8 +85,9 @@ class PodRegistry:
85
  if not r["enabled"]:
86
  return False, "This pod is disabled."
87
  if r["kind"] == "fusion":
88
- return False, ("Oracle Fusion pods can be registered and connection-tested, but runs against a real Fusion pod "
89
- "are not enabled in this pilot (no Fusion client yet). Use the local mock pod.")
 
90
  if norm_url(r["base_url"]) != norm_url(self.cfg.pod_base_url):
91
  return False, f"This server runs tests against the mock at {self.cfg.pod_base_url}; this pod points elsewhere."
92
  return True, None
@@ -132,6 +133,27 @@ class PodRegistry:
132
  self.audit.append("pod.credential_set", actor=actor, summary=f"pod {pod_id} {module}", payload={"pod_id": pod_id, "module": module})
133
  return self.get(pod_id)
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  # ------------------------------------------------------------ connection test (read-only)
136
  def test_connection(self, pod_id: int, actor: str) -> dict:
137
  p = self.get(pod_id)
 
85
  if not r["enabled"]:
86
  return False, "This pod is disabled."
87
  if r["kind"] == "fusion":
88
+ if not self.db.one("SELECT 1 AS x FROM pod_credentials WHERE pod_id=?", (r["id"],)):
89
+ return False, "Set the test user for this Fusion pod first (Credentials on this page)."
90
+ return True, None
91
  if norm_url(r["base_url"]) != norm_url(self.cfg.pod_base_url):
92
  return False, f"This server runs tests against the mock at {self.cfg.pod_base_url}; this pod points elsewhere."
93
  return True, None
 
133
  self.audit.append("pod.credential_set", actor=actor, summary=f"pod {pod_id} {module}", payload={"pod_id": pod_id, "module": module})
134
  return self.get(pod_id)
135
 
136
+ def fusion_auth(self, pod_id: int) -> tuple[str, str] | None:
137
+ """The test user of a Fusion pod, from the vault: the Payables credential if set, else the first one."""
138
+ rows = self.db.q("SELECT module FROM pod_credentials WHERE pod_id=? ORDER BY CASE WHEN module IN ('AP','PAYABLES','ALL') THEN 0 ELSE 1 END, module", (pod_id,))
139
+ for r in rows:
140
+ raw = self.vault.get(f"pods.{pod_id}.{r['module'].lower()}")
141
+ if raw:
142
+ d = json.loads(raw)
143
+ if d.get("username") and d.get("password"):
144
+ return d["username"], d["password"]
145
+ return None
146
+
147
+ def executor_env(self, pod_id: int) -> dict | None:
148
+ """What the Fusion test run needs to reach the pod (None for the mock pod). Passed to Playwright only."""
149
+ p = self.get(pod_id)
150
+ if p["kind"] != "fusion":
151
+ return None
152
+ auth = self.fusion_auth(pod_id)
153
+ if not auth:
154
+ raise PodError("NO_CREDENTIALS", "set the test user for this Fusion pod on the Test environments page first", 409)
155
+ return {"FUSION_BASE_URL": p["base_url"], "FUSION_USERNAME": auth[0], "FUSION_PASSWORD": auth[1]}
156
+
157
  # ------------------------------------------------------------ connection test (read-only)
158
  def test_connection(self, pod_id: int, actor: str) -> dict:
159
  p = self.get(pod_id)
coworker/platform/readiness.py CHANGED
@@ -371,4 +371,4 @@ def run_readiness(svc, runs_mgr, run_id: str) -> dict:
371
  gate = runs_mgr.gate_payload(run_id) if r.get("pending_gate") else None
372
  mods = r.get("modules") or sorted({c["module"] for c in st.get("test_cases") or []}) or ["P2P"]
373
  return {"run_id": run_id, "patch_id": st.get("patch_id") or r.get("patch_id"), "modules": [module_readiness(m, r, st, gate) for m in mods],
374
- "target": "Mock app, not Oracle Fusion"}
 
371
  gate = runs_mgr.gate_payload(run_id) if r.get("pending_gate") else None
372
  mods = r.get("modules") or sorted({c["module"] for c in st.get("test_cases") or []}) or ["P2P"]
373
  return {"run_id": run_id, "patch_id": st.get("patch_id") or r.get("patch_id"), "modules": [module_readiness(m, r, st, gate) for m in mods],
374
+ "target": svc.target(run_id)}
coworker/tests/test_pods.py CHANGED
@@ -41,8 +41,8 @@ class TestPods(unittest.TestCase):
41
  self.assertEqual(r.status_code, 201, r.text)
42
  pod = r.json()
43
  self.assertEqual(pod["modules"], ["P2P"])
44
- self.assertFalse(pod["runnable"])
45
- self.assertIn("not enabled in this pilot", pod["not_runnable_reason"])
46
  secret = "S3cret-pod-password!"
47
  r = self.c.post(f"/api/pods/{pod['id']}/credentials", json={"module": "P2P", "username": "zz.buyer", "password": secret},
48
  headers=self.h["admin"])
@@ -53,9 +53,13 @@ class TestPods(unittest.TestCase):
53
  audit = self.c.get("/api/audit?limit=500", headers=self.h["admin"]).text
54
  self.assertNotIn(secret, audit)
55
  self.assertIn(secret, self.svc.vault.get(f"pods.{pod['id']}.p2p") or "") # only the vault holds it
56
- # a run on the Fusion pod is refused with a clear reason, never queued
57
- r = self.c.post("/api/runs", json={"modules": ["P2P"], "playwright_mode": "stub", "pod_id": pod["id"]}, headers=self.h["consultant"])
58
- self.assertEqual((r.status_code, r.json()["code"]), (409, "POD_NOT_RUNNABLE"))
 
 
 
 
59
 
60
  def test_connection_test_is_read_only_and_audited(self):
61
  default = [p for p in self.pods() if p["is_default"]][0]
 
41
  self.assertEqual(r.status_code, 201, r.text)
42
  pod = r.json()
43
  self.assertEqual(pod["modules"], ["P2P"])
44
+ self.assertFalse(pod["runnable"]) # no test user yet
45
+ self.assertIn("Set the test user", pod["not_runnable_reason"])
46
  secret = "S3cret-pod-password!"
47
  r = self.c.post(f"/api/pods/{pod['id']}/credentials", json={"module": "P2P", "username": "zz.buyer", "password": secret},
48
  headers=self.h["admin"])
 
53
  audit = self.c.get("/api/audit?limit=500", headers=self.h["admin"]).text
54
  self.assertNotIn(secret, audit)
55
  self.assertIn(secret, self.svc.vault.get(f"pods.{pod['id']}.p2p") or "") # only the vault holds it
56
+ # with a test user the Fusion pod can run; the executor gets the address and user, the password only from the vault
57
+ pod = next(p for p in self.pods() if p["id"] == pod["id"])
58
+ self.assertTrue(pod["runnable"], pod["not_runnable_reason"])
59
+ from coworker.platform.pods import PodRegistry
60
+ env = PodRegistry(self.svc.db, self.svc.vault, self.svc.cfg, self.svc.egress, self.svc.audit).executor_env(pod["id"])
61
+ self.assertEqual((env["FUSION_BASE_URL"], env["FUSION_USERNAME"], env["FUSION_PASSWORD"]),
62
+ ("https://acme-test.fa.ocs.oraclecloud.com", "zz.buyer", secret))
63
 
64
  def test_connection_test_is_read_only_and_audited(self):
65
  default = [p for p in self.pods() if p["is_default"]][0]
tests/cases/AP-FUS-001.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Oracle Fusion Payables test case, scripted on a real pod (automation/tests/fusion/AP-FUS-001.spec.ts). Saves nothing.
2
+ id: AP-FUS-001
3
+ title: "Invoice header takes the supplier defaults"
4
+ process: Invoice entry
5
+ priority: P1
6
+ priority_rationale: "Every invoice starts here. If a patch breaks the supplier defaults, invoice entry stops for all users."
7
+ map_ids: []
8
+ verification: VERIFIED on a real Fusion pod (eiiv-dev2, Payables)
9
+ approval_status: draft - pending consultant approval (architecture approval gate)
10
+ type: happy
11
+ tags:
12
+ - payables
13
+ - invoice-entry
14
+ - fusion
15
+ roles:
16
+ - payables_user
17
+ preconditions:
18
+ - The test user can create Payables invoices in the business unit.
19
+ - The supplier has an active site in that business unit.
20
+ data_recipes: []
21
+ test_values:
22
+ business_unit: "{{pod.ap.business_unit}}"
23
+ supplier: "{{pod.ap.supplier}}"
24
+ amount: 100.00
25
+ steps:
26
+ - n: 1
27
+ action: sign_in
28
+ expected: The Fusion home page opens for the test user.
29
+ - n: 2
30
+ action: open_task
31
+ value: Payables > Invoices > Create Invoice
32
+ expected: The Create Invoice page opens.
33
+ - n: 3
34
+ action: enter
35
+ value: Business Unit and Supplier
36
+ expected: Fusion fills in the supplier site, legal entity, payment terms and terms date by itself.
37
+ - n: 4
38
+ action: enter
39
+ value: Number, Amount 100, Date today
40
+ expected: The amount shows as 100.00 in the invoice currency.
41
+ - n: 5
42
+ action: cancel
43
+ expected: The invoice is discarded; nothing is saved.
44
+ expected_result: The invoice header is filled with the supplier's defaults, and cancelling saves nothing.