fusiontest 0.2.25__tar.gz → 0.2.26__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {fusiontest-0.2.25 → fusiontest-0.2.26}/PKG-INFO +1 -1
  2. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/__init__.py +2 -2
  3. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/cli.py +1 -0
  4. fusiontest-0.2.26/fusiontest/core/bugs.py +63 -0
  5. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/promise_checker.py +8 -3
  6. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/reproduce.py +8 -2
  7. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/runner.py +32 -13
  8. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/reporting/reporter.py +1 -1
  9. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/PKG-INFO +1 -1
  10. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/SOURCES.txt +1 -0
  11. {fusiontest-0.2.25 → fusiontest-0.2.26}/pyproject.toml +1 -1
  12. {fusiontest-0.2.25 → fusiontest-0.2.26}/README.md +0 -0
  13. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/__init__.py +0 -0
  14. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/sites/shop/bugs.js +0 -0
  15. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/sites/shop/help.html +0 -0
  16. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/sites/shop/index.html +0 -0
  17. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/suites/shop-bugs.yaml +0 -0
  18. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/suites/shop.yaml +0 -0
  19. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/bench/suites/todomvc.yaml +0 -0
  20. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/__init__.py +0 -0
  21. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/action_model.py +0 -0
  22. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/app_errors.py +0 -0
  23. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/goal_verifier.py +0 -0
  24. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/netguard.py +0 -0
  25. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/replay.py +0 -0
  26. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/screen_parser.py +0 -0
  27. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/secrets.py +0 -0
  28. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/shared_traces.py +0 -0
  29. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/core/tokens.py +0 -0
  30. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/__init__.py +0 -0
  31. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/fusiontest_dashboard.yaml +0 -0
  32. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/github.yaml +0 -0
  33. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/hacker_news.yaml +0 -0
  34. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/httpbin.yaml +0 -0
  35. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/todomvc.yaml +0 -0
  36. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/demos/wikipedia.yaml +0 -0
  37. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/desktop/__init__.py +0 -0
  38. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/desktop/macos_adapter.py +0 -0
  39. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/desktop/playwright_adapter.py +0 -0
  40. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/desktop/windows_adapter.py +0 -0
  41. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/discovery/__init__.py +0 -0
  42. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/discovery/goal_generator.py +0 -0
  43. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/guardrails/__init__.py +0 -0
  44. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/guardrails/engine.py +0 -0
  45. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/mobile/__init__.py +0 -0
  46. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/mobile/android_adapter.py +0 -0
  47. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/mobile/ios_adapter.py +0 -0
  48. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/reporting/__init__.py +0 -0
  49. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/training/__init__.py +0 -0
  50. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/training/data_collector.py +0 -0
  51. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/training/dataset_builder.py +0 -0
  52. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest/training/trainer.py +0 -0
  53. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/dependency_links.txt +0 -0
  54. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/entry_points.txt +0 -0
  55. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/not-zip-safe +0 -0
  56. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/requires.txt +0 -0
  57. {fusiontest-0.2.25 → fusiontest-0.2.26}/fusiontest.egg-info/top_level.txt +0 -0
  58. {fusiontest-0.2.25 → fusiontest-0.2.26}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusiontest
3
- Version: 0.2.25
3
+ Version: 0.2.26
4
4
  Summary: AI-powered UI testing for mobile and desktop — by FusionLeap.io
5
5
  Author-email: FusionLeap <hello@fusionleap.io>
6
6
  License: MIT
@@ -436,7 +436,7 @@ class VariantResult:
436
436
 
437
437
  def score_variant(suite: BugSuite, variant: Variant, run: RunResult) -> VariantResult:
438
438
  planted = [suite.bugs[b] for b in variant.bugs]
439
- reports = [str(r) for r in run.bugs_detected]
439
+ reports = [str(b) for b in run.bugs_detected] # each bug's one-line title
440
440
  evaluated = run.steps and not run.errored
441
441
  classified = [classify_report(r, planted, suite.decoys) for r in reports]
442
442
  return VariantResult(
@@ -444,7 +444,7 @@ def score_variant(suite: BugSuite, variant: Variant, run: RunResult) -> VariantR
444
444
  outcome="run" if evaluated else "error",
445
445
  reports=reports, matches=[bug for bug, _ in classified],
446
446
  decoy_trips=[decoy for _, decoy in classified if decoy],
447
- unconfirmed=[str(r) for r in getattr(run, "unconfirmed_bugs", [])],
447
+ unconfirmed=[str(b) for b in getattr(run, "unconfirmed_bugs", [])],
448
448
  tasks_passed=sum(s.success for s in run.steps), tasks=len(suite.tasks),
449
449
  failed_tasks=[f"{s.goal} — {s.error}" for s in run.steps if not s.success],
450
450
  seconds=round(sum(s.duration_seconds for s in run.steps), 2),
@@ -1145,6 +1145,7 @@ def _upload_report(result) -> str | None:
1145
1145
  "stability_score": result.stability_score,
1146
1146
  "total_duration_seconds": result.total_duration_seconds,
1147
1147
  "steps": [s.to_dict() for s in result.steps],
1148
+ "bugs_detected": [b.to_dict() for b in result.bugs_detected],
1148
1149
  }
1149
1150
 
1150
1151
  try:
@@ -0,0 +1,63 @@
1
+ """
2
+ fusiontest.core.bugs — a bug report a developer can act on (ADR-009 §2).
3
+
4
+ Every reported bug says what kind of bug it is, where, what was expected and
5
+ what happened instead, the screen text that proves it, the steps that lead to
6
+ it, and how many fresh sessions it was reproduced in.
7
+
8
+ kind js_exception | http_error | broken_promise | inconsistency
9
+ title one line, e.g. "Broken promise: … (after tap 'Apply coupon', on /cart)"
10
+ steps from the run's start, in plain words; typed secrets stay {{VAR}}
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from dataclasses import asdict, dataclass, field
16
+
17
+ KINDS = ("js_exception", "http_error", "broken_promise", "inconsistency")
18
+
19
+
20
+ @dataclass
21
+ class Bug:
22
+ kind: str
23
+ title: str
24
+ page: str = ""
25
+ action: str = "" # the action right before the bug showed up
26
+ expected: str = ""
27
+ actual: str = ""
28
+ evidence: list[str] = field(default_factory=list) # screen text, quoted
29
+ steps: list[str] = field(default_factory=list) # to reproduce, from the start
30
+ reproduced: int = 0 # fresh sessions it happened again in (0: not checked)
31
+
32
+ def to_dict(self) -> dict:
33
+ return asdict(self)
34
+
35
+ def __str__(self) -> str:
36
+ return self.title
37
+
38
+
39
+ def from_app_error(error, steps: list[str], redact=lambda s: s) -> Bug:
40
+ """A Bug for an AppError (fusiontest.core.app_errors)."""
41
+ if error.kind == "js_exception":
42
+ kind, expected = "js_exception", "No uncaught JavaScript errors"
43
+ elif error.message.startswith("HTTP 5"):
44
+ kind, expected = "http_error", "The request succeeds"
45
+ else:
46
+ kind, expected = "http_error", "The page opens"
47
+ return Bug(kind=kind, title=redact(error.report()), page=error.page, action=redact(error.after),
48
+ expected=expected, actual=redact(error.message), steps=list(steps))
49
+
50
+
51
+ def from_finding(finding, steps: list[str], redact=lambda s: s) -> Bug:
52
+ """A Bug for a confirmed broken promise or inconsistency (fusiontest.core.promise_checker)."""
53
+ return Bug(kind=finding.kind, title=redact(finding.report()), page=finding.page,
54
+ action=redact(finding.action), expected=redact(finding.expected or ""),
55
+ actual=redact(finding.actual or finding.summary),
56
+ evidence=[redact(e) for e in finding.evidence], steps=list(steps))
57
+
58
+
59
+ def step_text(kind: str, url: str = "", action: str = "") -> str:
60
+ """One step to reproduce, in plain words."""
61
+ if kind in ("start", "navigate"):
62
+ return f"Open {url}"
63
+ return action[:1].upper() + action[1:] if action else ""
@@ -61,6 +61,8 @@ class Finding:
61
61
  evidence: list[str] = field(default_factory=list)
62
62
  confirmation: str = ""
63
63
  at: int = 0 # the transition's position in the run's action log
64
+ expected: str = ""
65
+ actual: str = ""
64
66
 
65
67
  def report(self) -> str:
66
68
  label = "Broken promise" if self.kind == "broken_promise" else "Inconsistent screen"
@@ -85,8 +87,9 @@ _REVIEW_SYSTEM = (
85
87
  "- design choices, wording, layout, or anything you are unsure about\n\n"
86
88
  "Respond with ONLY a JSON object: {\"findings\": [{\"kind\": \"broken_promise\" or "
87
89
  "\"inconsistency\", \"step\": <step number>, \"summary\": \"one sentence: which "
88
- "control or text, what was expected, what the screen shows instead\", \"evidence\": "
89
- "[\"short phrases copied EXACTLY from the screen text\"]}]}. "
90
+ "control or text, what was expected, what the screen shows instead\", \"expected\": "
91
+ "\"what should have happened\", \"actual\": \"what the screen shows instead\", "
92
+ "\"evidence\": [\"short phrases copied EXACTLY from the screen text\"]}]}. "
90
93
  "Use {\"findings\": []} when there are none — that is the usual answer."
91
94
  )
92
95
  _REVIEW = LLMRequest(
@@ -196,7 +199,9 @@ class PromiseChecker:
196
199
  continue
197
200
  findings.append(Finding(kind=kind, summary=summary, step=step, action=transition.action,
198
201
  page=_page(transition.before), evidence=evidence,
199
- at=transition.at))
202
+ at=transition.at,
203
+ expected=str(item.get("expected", "")).strip(),
204
+ actual=str(item.get("actual", "")).strip()))
200
205
  return findings
201
206
 
202
207
  # ── Confirmation ──────────────────────────────────────────────────────────
@@ -18,24 +18,30 @@ from __future__ import annotations
18
18
 
19
19
  from dataclasses import dataclass, field
20
20
 
21
+ from fusiontest.core.bugs import Bug
21
22
  from fusiontest.core.replay import RecordedAction
22
23
 
23
24
 
24
25
  @dataclass
25
26
  class LogEntry:
26
- kind: str # navigate | action
27
+ kind: str # start (not replayed) | navigate | action
27
28
  url: str = ""
28
29
  action: RecordedAction | None = None
30
+ text: str = "" # in plain words, secrets masked: a step to reproduce
29
31
 
30
32
 
31
33
  @dataclass
32
34
  class BugCandidate:
33
- report: str
35
+ bug: Bug
34
36
  signature: tuple[str, str]
35
37
  at: int # log entries replayed before checking
36
38
  app_error: tuple[str, str] | None = None # signature to see again
37
39
  evidence: list[str] = field(default_factory=list) # quotes to see again
38
40
 
41
+ @property
42
+ def report(self) -> str:
43
+ return self.bug.title
44
+
39
45
 
40
46
  @dataclass
41
47
  class Reproduction:
@@ -19,8 +19,10 @@ from collections.abc import Callable
19
19
  from dataclasses import dataclass, field, replace
20
20
  from typing import Protocol, runtime_checkable
21
21
 
22
+ from fusiontest.core import bugs
22
23
  from fusiontest.core.action_model import Action, ActionBackend, ActionModel, LLMUnavailableError
23
24
  from fusiontest.core.app_errors import AppError
25
+ from fusiontest.core.bugs import Bug, step_text
24
26
  from fusiontest.core.goal_verifier import GoalVerifier, VerifierResult
25
27
  from fusiontest.core.promise_checker import Finding, PromiseChecker, Transition
26
28
  from fusiontest.core.replay import (
@@ -113,9 +115,9 @@ class RunResult:
113
115
  url: str = ""
114
116
  steps: list[StepResult] = field(default_factory=list)
115
117
  total_duration_seconds: float = 0.0
116
- bugs_detected: list[str] = field(default_factory=list)
118
+ bugs_detected: list[Bug] = field(default_factory=list)
117
119
  # Suspected bugs that didn't happen again in fresh sessions (not reported).
118
- unconfirmed_bugs: list[str] = field(default_factory=list)
120
+ unconfirmed_bugs: list[Bug] = field(default_factory=list)
119
121
  cancelled: bool = False
120
122
  # Set when the run stopped early because it could not be evaluated
121
123
  # (e.g. no LLM backend available). Remaining goals were not run.
@@ -302,6 +304,9 @@ class FusionTestRunner:
302
304
  reported: set[tuple[str, str]] = set() # bug signatures already suspected
303
305
  candidates: list[BugCandidate] = []
304
306
  self._log = []
307
+ start_url = url or _current_url(self.adapter)
308
+ if start_url: # where a fresh session starts too, so it's not replayed
309
+ self._log.append(LogEntry(kind="start", url=start_url, text=step_text("start", start_url)))
305
310
 
306
311
  for i, (goal, safe_goal) in enumerate(zip(model_goals, goals, strict=True), 1):
307
312
  # Cooperative cancellation check — run before starting the next goal
@@ -424,8 +429,10 @@ class FusionTestRunner:
424
429
 
425
430
  if self.config.detect_bugs and candidates:
426
431
  outcome = self._reproduce(candidates, resolver)
427
- result.bugs_detected = [c.report for c in outcome.confirmed]
428
- result.unconfirmed_bugs = [c.report for c in outcome.unconfirmed]
432
+ for c in outcome.confirmed:
433
+ c.bug.reproduced = outcome.sessions if self.config.fresh_adapter else 0
434
+ result.bugs_detected = [c.bug for c in outcome.confirmed]
435
+ result.unconfirmed_bugs = [c.bug for c in outcome.unconfirmed]
429
436
 
430
437
  result.total_duration_seconds = time.time() - run_start
431
438
  result.llm_calls = self._llm_calls()
@@ -626,7 +633,7 @@ class FusionTestRunner:
626
633
  logger.info(f" Backtracking (step {step_num})")
627
634
  self._backtrack(history)
628
635
  recorded.append(RecordedAction(action_type="back"))
629
- self._log.append(LogEntry(kind="action", action=recorded[-1]))
636
+ self._log.append(LogEntry(kind="action", action=recorded[-1], text="Go back"))
630
637
  break
631
638
 
632
639
  if gr.should_skip:
@@ -651,8 +658,10 @@ class FusionTestRunner:
651
658
  history.append(action_str) # LLM context — real value ok
652
659
  safe_action_str = _redact(action_str)
653
660
  step.actions.append(safe_action_str) # stored — secrets masked
654
- self._log.append(LogEntry(kind="action", action=recorded[-1]))
655
- pending = (_redact(_action_text(gr.action, elements)), screen_text, len(self._log))
661
+ action_text = _redact(_action_text(gr.action, elements))
662
+ self._log.append(LogEntry(kind="action", action=recorded[-1],
663
+ text=step_text("action", action=action_text)))
664
+ pending = (action_text, screen_text, len(self._log))
656
665
  self.guardrails.record_action(gr.action)
657
666
  # Only record screen hash for actions that change the page.
658
667
  # Scroll doesn't change DOM extraction (all elements captured
@@ -750,13 +759,22 @@ class FusionTestRunner:
750
759
  step.app_errors = list(drain())
751
760
  except Exception as exc: # noqa: BLE001 — observation must never fail a run
752
761
  logger.debug("Could not read app errors: %s", exc)
753
- found = [BugCandidate(report=resolver.redact(e.report()), signature=e.signature,
754
- at=len(self._log), app_error=e.signature) for e in step.app_errors]
762
+ def steps_to(at: int) -> list[str]:
763
+ steps: list[str] = []
764
+ for e in self._log[:at]:
765
+ # Opening the page you're already on adds nothing (repeated taps do).
766
+ if e.text and not (e.kind != "action" and steps and steps[-1] == e.text):
767
+ steps.append(e.text)
768
+ return steps
769
+
770
+ found = [BugCandidate(bug=bugs.from_app_error(e, steps_to(len(self._log)), resolver.redact),
771
+ signature=e.signature, at=len(self._log), app_error=e.signature)
772
+ for e in step.app_errors]
755
773
  # A finding about an action that already raised an app error (a dead
756
774
  # link that "didn't open the Help page") is the same bug said twice.
757
775
  errored_actions = {e.after for e in step.app_errors}
758
- found += [BugCandidate(report=resolver.redact(f.report()), signature=(f.kind, f.summary.lower()),
759
- at=f.at, evidence=list(f.evidence))
776
+ found += [BugCandidate(bug=bugs.from_finding(f, steps_to(f.at), resolver.redact),
777
+ signature=(f.kind, f.summary.lower()), at=f.at, evidence=list(f.evidence))
760
778
  for f in step.findings if f.action not in errored_actions]
761
779
  for candidate in found:
762
780
  logger.info(" Suspected bug: %s", candidate.report)
@@ -901,7 +919,8 @@ class FusionTestRunner:
901
919
  if blocked or not self.adapter.execute(exec_action, elements):
902
920
  logger.info(f" Replay: action failed — {action}")
903
921
  return None
904
- self._log.append(LogEntry(kind="action", action=recorded))
922
+ self._log.append(LogEntry(kind="action", action=recorded, text=step_text(
923
+ "action", action=resolver.redact(_action_text(action, elements)))))
905
924
  actions.append(resolver.redact(str(action)))
906
925
  if trace.actions:
907
926
  time.sleep(0.8)
@@ -943,7 +962,7 @@ class FusionTestRunner:
943
962
  def _navigate(self, url: str) -> None:
944
963
  """Open the goal's starting URL (if given and the adapter supports it)."""
945
964
  if url and hasattr(self.adapter, "navigate"):
946
- self._log.append(LogEntry(kind="navigate", url=url))
965
+ self._log.append(LogEntry(kind="navigate", url=url, text=step_text("navigate", url)))
947
966
  try:
948
967
  self.adapter.navigate(url)
949
968
  logger.info(f" Navigated to: {url}")
@@ -88,7 +88,7 @@ class Reporter:
88
88
  "status": result.status,
89
89
  "stability_score": round(result.stability_score, 4),
90
90
  "total_duration_seconds": round(result.total_duration_seconds, 2),
91
- "bugs_detected": result.bugs_detected,
91
+ "bugs_detected": [b.to_dict() for b in result.bugs_detected],
92
92
  "steps": [s.to_dict() for s in result.steps],
93
93
  }
94
94
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusiontest
3
- Version: 0.2.25
3
+ Version: 0.2.26
4
4
  Summary: AI-powered UI testing for mobile and desktop — by FusionLeap.io
5
5
  Author-email: FusionLeap <hello@fusionleap.io>
6
6
  License: MIT
@@ -19,6 +19,7 @@ fusiontest/bench/suites/todomvc.yaml
19
19
  fusiontest/core/__init__.py
20
20
  fusiontest/core/action_model.py
21
21
  fusiontest/core/app_errors.py
22
+ fusiontest/core/bugs.py
22
23
  fusiontest/core/goal_verifier.py
23
24
  fusiontest/core/netguard.py
24
25
  fusiontest/core/promise_checker.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fusiontest"
7
- version = "0.2.25"
7
+ version = "0.2.26"
8
8
  description = "AI-powered UI testing for mobile and desktop — by FusionLeap.io"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes