fusiontest 0.2.33__tar.gz → 0.2.35__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.33 → fusiontest-0.2.35}/PKG-INFO +1 -1
  2. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/action_model.py +5 -36
  3. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/goal_verifier.py +3 -1
  4. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/runner.py +43 -0
  5. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/PKG-INFO +1 -1
  6. {fusiontest-0.2.33 → fusiontest-0.2.35}/pyproject.toml +1 -1
  7. {fusiontest-0.2.33 → fusiontest-0.2.35}/README.md +0 -0
  8. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/__init__.py +0 -0
  9. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/__init__.py +0 -0
  10. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/sites/shop/bugs.js +0 -0
  11. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/sites/shop/help.html +0 -0
  12. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/sites/shop/index.html +0 -0
  13. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/suites/shop-bugs.yaml +0 -0
  14. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/suites/shop.yaml +0 -0
  15. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/bench/suites/todomvc.yaml +0 -0
  16. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/cli.py +0 -0
  17. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/__init__.py +0 -0
  18. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/app_errors.py +0 -0
  19. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/bugs.py +0 -0
  20. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/netguard.py +0 -0
  21. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/promise_checker.py +0 -0
  22. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/replay.py +0 -0
  23. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/reproduce.py +0 -0
  24. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/screen_parser.py +0 -0
  25. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/secrets.py +0 -0
  26. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/shared_traces.py +0 -0
  27. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/core/tokens.py +0 -0
  28. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/__init__.py +0 -0
  29. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/fusiontest_dashboard.yaml +0 -0
  30. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/github.yaml +0 -0
  31. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/hacker_news.yaml +0 -0
  32. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/httpbin.yaml +0 -0
  33. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/todomvc.yaml +0 -0
  34. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/demos/wikipedia.yaml +0 -0
  35. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/desktop/__init__.py +0 -0
  36. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/desktop/macos_adapter.py +0 -0
  37. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/desktop/playwright_adapter.py +0 -0
  38. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/desktop/windows_adapter.py +0 -0
  39. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/discovery/__init__.py +0 -0
  40. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/discovery/goal_generator.py +0 -0
  41. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/guardrails/__init__.py +0 -0
  42. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/guardrails/engine.py +0 -0
  43. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/mobile/__init__.py +0 -0
  44. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/mobile/android_adapter.py +0 -0
  45. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/mobile/ios_adapter.py +0 -0
  46. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/reporting/__init__.py +0 -0
  47. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/reporting/reporter.py +0 -0
  48. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/training/__init__.py +0 -0
  49. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/training/data_collector.py +0 -0
  50. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/training/dataset_builder.py +0 -0
  51. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest/training/trainer.py +0 -0
  52. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/SOURCES.txt +0 -0
  53. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/dependency_links.txt +0 -0
  54. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/entry_points.txt +0 -0
  55. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/not-zip-safe +0 -0
  56. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/requires.txt +0 -0
  57. {fusiontest-0.2.33 → fusiontest-0.2.35}/fusiontest.egg-info/top_level.txt +0 -0
  58. {fusiontest-0.2.33 → fusiontest-0.2.35}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusiontest
3
- Version: 0.2.33
3
+ Version: 0.2.35
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
@@ -162,9 +162,6 @@ _cooldowns_lock = threading.Lock()
162
162
  _RATE_LIMIT_COOLDOWN_SECONDS = 60.0 # when the provider gives no retry hint
163
163
  _BACKEND_ERROR_COOLDOWN_SECONDS = 300.0 # retired model / rejected key
164
164
  _MAX_COOLDOWN_SECONDS = 3600.0
165
- # When every backend is cooling down, wait this long at most for one to recover
166
- # (a per-minute token limit resets within a minute) rather than fail the call.
167
- _MAX_COOLDOWN_WAIT_SECONDS = 30.0
168
165
 
169
166
  _RETRY_IN_RE = re.compile(
170
167
  r"try again in\s+(?:(?P<h>\d+)h)?(?:(?P<m>\d+)m(?!s))?(?:(?P<s>[\d.]+)s)?(?:(?P<ms>[\d.]+)ms)?",
@@ -278,12 +275,6 @@ LLM_MAX_OUTPUT_TOKENS = 1024
278
275
  # chain retries or falls through to the next backend.
279
276
  LLM_REQUEST_TIMEOUT_SECONDS = 120
280
277
 
281
- # SDK-level retries are off: the OpenAI/Anthropic SDKs otherwise retry a 429
282
- # twice, sleeping out its retry-after inside the call (measured: 28–45s per
283
- # Groq call on an 8k tokens/minute tier), so the fallback chain never sees the
284
- # rate limit and can't switch backend. LLMCaller does its own retries.
285
- LLM_SDK_MAX_RETRIES = 0
286
-
287
278
 
288
279
  # Page text the action model sees per step (ADR-007 cost work). It needs every
289
280
  # clickable element but only the gist of the page — the verifier, which judges
@@ -577,8 +568,7 @@ class LLMCaller:
577
568
  "OPENAI_API_KEY is not set. Add it to your .env file or run: "
578
569
  "export OPENAI_API_KEY=sk-..."
579
570
  )
580
- client = OpenAI(api_key=api_key, timeout=LLM_REQUEST_TIMEOUT_SECONDS,
581
- max_retries=LLM_SDK_MAX_RETRIES)
571
+ client = OpenAI(api_key=api_key, timeout=LLM_REQUEST_TIMEOUT_SECONDS)
582
572
 
583
573
  elif backend == "claude":
584
574
  try:
@@ -591,8 +581,7 @@ class LLMCaller:
591
581
  "ANTHROPIC_API_KEY is not set. Add it to your .env file or run: "
592
582
  "export ANTHROPIC_API_KEY=sk-ant-..."
593
583
  )
594
- client = anthropic.Anthropic(api_key=api_key, timeout=LLM_REQUEST_TIMEOUT_SECONDS,
595
- max_retries=LLM_SDK_MAX_RETRIES)
584
+ client = anthropic.Anthropic(api_key=api_key, timeout=LLM_REQUEST_TIMEOUT_SECONDS)
596
585
 
597
586
  elif backend == "ollama":
598
587
  try:
@@ -602,8 +591,7 @@ class LLMCaller:
602
591
  "Ollama backend requires the openai SDK: pip install openai"
603
592
  ) from err
604
593
  base_url = os.getenv("OLLAMA_HOST", "http://localhost:11434") + "/v1"
605
- client = OpenAI(base_url=base_url, api_key="ollama", timeout=LLM_REQUEST_TIMEOUT_SECONDS,
606
- max_retries=LLM_SDK_MAX_RETRIES)
594
+ client = OpenAI(base_url=base_url, api_key="ollama", timeout=LLM_REQUEST_TIMEOUT_SECONDS)
607
595
 
608
596
  elif backend == "groq":
609
597
  try:
@@ -617,7 +605,7 @@ class LLMCaller:
617
605
  "then: export GROQ_API_KEY=gsk_..."
618
606
  )
619
607
  client = OpenAI(base_url="https://api.groq.com/openai/v1", api_key=api_key,
620
- timeout=LLM_REQUEST_TIMEOUT_SECONDS, max_retries=LLM_SDK_MAX_RETRIES)
608
+ timeout=LLM_REQUEST_TIMEOUT_SECONDS)
621
609
 
622
610
  elif backend == "gemini":
623
611
  try:
@@ -666,28 +654,8 @@ class LLMCaller:
666
654
  fall through without a cooldown — smaller requests still fit.
667
655
  - On other non-transient errors (bad request): raise immediately.
668
656
 
669
- When no entry could answer but one comes off a short cooldown soon (a
670
- per-minute token limit, typically), waits for it once and tries again.
671
-
672
657
  Raises LLMUnavailableError when no entry could answer.
673
658
  """
674
- try:
675
- return self._call_chain(prompt, request)
676
- except LLMUnavailableError:
677
- wait = self._soonest_cooldown()
678
- if not 0 < wait <= _MAX_COOLDOWN_WAIT_SECONDS:
679
- raise
680
- logger.warning("All LLM backends rate-limited — waiting %.0fs for the first to recover.", wait)
681
- time.sleep(wait)
682
- return self._call_chain(prompt, request)
683
-
684
- def _soonest_cooldown(self) -> float:
685
- """Seconds until the first cooling-down entry in the chain is usable again."""
686
- waits = [_cooldown_remaining(b, m) for b, m in self.fallback_chain if not _key_rejected(b)]
687
- return min(waits, default=0.0)
688
-
689
- def _call_chain(self, prompt: str, request: LLMRequest) -> tuple[str, TokenUsage]:
690
- """One pass over the fallback chain (see _call_llm)."""
691
659
  if not self.fallback_chain:
692
660
  raise RuntimeError("LLM fallback chain is empty")
693
661
 
@@ -1081,6 +1049,7 @@ class ActionModel(LLMCaller):
1081
1049
  "- If the goal is purely about VERIFYING or CHECKING that something is visible, and the relevant content IS already visible on screen, use action_type 'done' with a reasoning explaining what you see.",
1082
1050
  "- If the goal cannot be satisfied with the current screen (wrong page, required control missing, blocker, etc.), use action_type 'fail' with a short reasoning. NEVER use 'done' for failure or 'not achievable' outcomes.",
1083
1051
  "- If the goal requires navigation or interaction, use the appropriate action.",
1052
+ "- Each action taken so far notes what it changed on screen (→ …). That is what you observed: once those notes show what the goal asks you to verify, use 'done' rather than repeating actions to check again.",
1084
1053
  "- Match elements FLEXIBLY: if the goal says 'click Visitor Identification' but you see a link like 'Anonymous Visitors Unknown' or a link with href containing 'visitor-identification', those are the same thing. Use the element that's actually on screen.",
1085
1054
  "- When the goal says 'navigate back', use the 'back' action type, not look for a back button.",
1086
1055
  "- 'type' replaces the field's whole content (value \"\" clears it) and only fills it. To submit it (search boxes, add-item inputs, forms without a visible submit button), next use 'press' with value 'Enter' on the same element. 'press' also takes Escape, Tab, ArrowDown, ArrowUp.",
@@ -217,7 +217,9 @@ class GoalVerifier:
217
217
  parts += ["", "ACTIONS TAKEN:", *[f" - {a}" for a in history[-5:]]]
218
218
  parts += [
219
219
  "",
220
- "Has the goal been achieved based on what is currently visible on screen?",
220
+ "Has the goal been achieved, judging by what is visible on screen now and by "
221
+ "what the actions above changed (each \"→\" note is what was observed on "
222
+ "screen right after that action)?",
221
223
  ]
222
224
  return "\n".join(parts)
223
225
 
@@ -13,6 +13,7 @@ The FusionTest main runner — orchestrates the full test loop:
13
13
  from __future__ import annotations
14
14
 
15
15
  import logging
16
+ import re
16
17
  import threading
17
18
  import time
18
19
  from collections.abc import Callable
@@ -513,6 +514,7 @@ class FusionTestRunner:
513
514
  prev_screen: str | None = None # screen at the previous step
514
515
  stalled = 0 # consecutive steps with an unchanged screen
515
516
  last_typed = False # the previous step typed into a field
517
+ acted = False # the previous step executed an action
516
518
  # Each executed action with the screens before and after it, for the
517
519
  # broken-promise check (ADR-009). pending: an action awaiting its "after".
518
520
  transitions: list[Transition] = []
@@ -551,8 +553,16 @@ class FusionTestRunner:
551
553
  history[-1] += _NO_EFFECT_NOTE
552
554
  else:
553
555
  stalled = 0
556
+ # Say what the last action changed. The model sees only the
557
+ # current screen, so without this a goal like "verify each tab
558
+ # updates the content" has no record of the updates it caused,
559
+ # and it keeps re-clicking to check (seen: Phase 0 ↔ Phase 1 for
560
+ # 10 steps on fusionleap.io/how-we-work).
561
+ if acted and prev_screen is not None and history:
562
+ history[-1] += _change_note(prev_screen, screen_text)
554
563
  prev_screen = screen_text
555
564
  last_typed = False
565
+ acted = False
556
566
  if stalled >= self.config.max_stalled_steps:
557
567
  logger.info(f" No progress for {stalled} steps — stopping this goal")
558
568
  self._last_chance_verify(
@@ -684,6 +694,7 @@ class FusionTestRunner:
684
694
  success = self.adapter.execute(exec_action, elements)
685
695
  if success:
686
696
  last_typed = gr.action.action_type == "type"
697
+ acted = True
687
698
  recorded.append(record_action(gr.action, elements)) # placeholders, not values
688
699
  last_action_screen = screen_text
689
700
  # Which row the control was in ("Remove" near "Notebook × 1"):
@@ -1214,6 +1225,38 @@ class FusionTestRunner:
1214
1225
  # Appended to the model's history entry for an action that changed nothing.
1215
1226
  _NO_EFFECT_NOTE = " → no visible change on screen"
1216
1227
 
1228
+ _ELEMENT_INDEX_RE = re.compile(r"^\s*\[\d+\]\s*")
1229
+ _STATE_WORDS = (" selected", " expanded", " checked", " pressed")
1230
+ _CHANGE_NOTE_ITEMS = 3
1231
+ _CHANGE_NOTE_ITEM_CHARS = 70
1232
+
1233
+
1234
+ def _change_note(before: str, after: str) -> str:
1235
+ """What an action changed on screen, for the model's history entry: up to a
1236
+ few lines that are new on `after` — elements that became selected/expanded
1237
+ first, then headings, then other text. Element indexes are ignored, since a
1238
+ re-render renumbers every element without anything visibly changing."""
1239
+ def lines(screen: str) -> list[str]:
1240
+ return [_ELEMENT_INDEX_RE.sub("", line).strip() for line in screen.splitlines()]
1241
+
1242
+ seen = set(lines(before))
1243
+ # An element that only lost its state (the tab that's no longer selected) isn't news.
1244
+ added = [line for line in dict.fromkeys(lines(after))
1245
+ if line and line not in seen and not line.startswith("-- ")
1246
+ and not any(line + w in seen for w in _STATE_WORDS)]
1247
+ if not added:
1248
+ return _NO_EFFECT_NOTE
1249
+
1250
+ def rank(line: str) -> int:
1251
+ if any(line.endswith(w) or f"{w} " in line for w in _STATE_WORDS):
1252
+ return 0
1253
+ return 1 if line.startswith("heading:") else 2
1254
+
1255
+ picked = sorted(added, key=rank)[:_CHANGE_NOTE_ITEMS]
1256
+ shown = [line if len(line) <= _CHANGE_NOTE_ITEM_CHARS else line[:_CHANGE_NOTE_ITEM_CHARS] + "…"
1257
+ for line in picked]
1258
+ return " → screen changed, now shows: " + "; ".join(shown)
1259
+
1217
1260
  # Recorded actions that are dropped from a trace when they didn't change the screen.
1218
1261
  _PRUNABLE_ACTIONS = {"tap", "scroll", "swipe", "wait"}
1219
1262
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusiontest
3
- Version: 0.2.33
3
+ Version: 0.2.35
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fusiontest"
7
- version = "0.2.33"
7
+ version = "0.2.35"
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