dynamic-test-engine 0.1.0__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 (33) hide show
  1. dynamic_test_engine-0.1.0/.env.example +145 -0
  2. dynamic_test_engine-0.1.0/LICENSE +21 -0
  3. dynamic_test_engine-0.1.0/MANIFEST.in +3 -0
  4. dynamic_test_engine-0.1.0/PKG-INFO +405 -0
  5. dynamic_test_engine-0.1.0/README.md +363 -0
  6. dynamic_test_engine-0.1.0/automation/__init__.py +0 -0
  7. dynamic_test_engine-0.1.0/automation/config.py +69 -0
  8. dynamic_test_engine-0.1.0/automation/engines/__init__.py +0 -0
  9. dynamic_test_engine-0.1.0/automation/engines/engine_manager.py +382 -0
  10. dynamic_test_engine-0.1.0/automation/engines/uia_engine.py +220 -0
  11. dynamic_test_engine-0.1.0/automation/engines/vision_base.py +30 -0
  12. dynamic_test_engine-0.1.0/automation/engines/vision_engine.py +474 -0
  13. dynamic_test_engine-0.1.0/automation/engines/windows_uia_engine.py +347 -0
  14. dynamic_test_engine-0.1.0/automation/keywords/__init__.py +0 -0
  15. dynamic_test_engine-0.1.0/automation/keywords/automation_keywords.py +83 -0
  16. dynamic_test_engine-0.1.0/automation/utils/__init__.py +0 -0
  17. dynamic_test_engine-0.1.0/automation/utils/adb.py +220 -0
  18. dynamic_test_engine-0.1.0/automation/utils/cache.py +135 -0
  19. dynamic_test_engine-0.1.0/automation/utils/device_interface.py +60 -0
  20. dynamic_test_engine-0.1.0/automation/utils/image_processing.py +258 -0
  21. dynamic_test_engine-0.1.0/automation/utils/scroll_centering.py +48 -0
  22. dynamic_test_engine-0.1.0/automation/utils/spatial.py +63 -0
  23. dynamic_test_engine-0.1.0/automation/utils/windows_host.py +354 -0
  24. dynamic_test_engine-0.1.0/docs/konfiguration.md +91 -0
  25. dynamic_test_engine-0.1.0/docs/tester_windows_poc.md +472 -0
  26. dynamic_test_engine-0.1.0/dynamic_test_engine.egg-info/PKG-INFO +405 -0
  27. dynamic_test_engine-0.1.0/dynamic_test_engine.egg-info/SOURCES.txt +31 -0
  28. dynamic_test_engine-0.1.0/dynamic_test_engine.egg-info/dependency_links.txt +1 -0
  29. dynamic_test_engine-0.1.0/dynamic_test_engine.egg-info/requires.txt +20 -0
  30. dynamic_test_engine-0.1.0/dynamic_test_engine.egg-info/top_level.txt +1 -0
  31. dynamic_test_engine-0.1.0/pyproject.toml +68 -0
  32. dynamic_test_engine-0.1.0/requirements.txt +6 -0
  33. dynamic_test_engine-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,145 @@
1
+ # Android Gerät
2
+ # Device ID ermitteln mit: adb devices
3
+ ANDROID_DEVICE_ID=your_device_id_here
4
+
5
+ # Engine-Konfiguration
6
+ # Optionen: auto | uia | vision
7
+ # leer lassen = Standardwert: auto
8
+ DEFAULT_ENGINE=auto
9
+
10
+ # Custom Element Matching Schwellwert (0.0 – 1.0)
11
+ # leer lassen = Standardwert: 0.9
12
+ CUSTOM_ELEMENT_MATCH_THRESHOLD=0.9
13
+
14
+ # OCR-Sprachen (Tesseract-Format, z.B. deu+eng)
15
+ # leer lassen = Standardwert: deu+eng
16
+ OCR_LANGUAGES=deu+eng
17
+
18
+ # OCR-Seitensegmentierungsmodus (PSM): 11 = spärlicher Text (UI-Elemente), 6 = Textblock, 3 = vollautomatisch
19
+ # leer lassen = Standardwert: 11
20
+ OCR_PSM=11
21
+
22
+ # OCR-Engine-Modus (OEM): 1 = LSTM (Standard), 0 = Legacy
23
+ # leer lassen = Standardwert: 1
24
+ OCR_OEM=1
25
+
26
+ # Bild-Skalierung vor OCR (1.0 = kein Scaling, 0.5 = halbe Auflösung)
27
+ # leer lassen = Standardwert: 1.0
28
+ OCR_SCALE=1.0
29
+
30
+ # Minimaler OCR-Konfidenzwert (0–100); Texte unterhalb werden ignoriert
31
+ # leer lassen = Standardwert: 60
32
+ OCR_CONFIDENCE=60
33
+
34
+ # Timeouts in Sekunden
35
+ # leer lassen = Standardwert: 3
36
+ ADB_TIMEOUT=3
37
+ UIA_TIMEOUT=3
38
+ # Timeout für screencap (Screenshot-Transfer über WLAN/Emulator dauert länger als reguläre ADB-Befehle)
39
+ # leer lassen = Standardwert: 10
40
+ ADB_SCREENSHOT_TIMEOUT=10
41
+
42
+ # Separate Timeouts für Scroll und App-Start
43
+ # leer lassen = Standardwert: 8 (Scroll dauert länger als einfache Element-Suche)
44
+ UIA_SCROLL_TIMEOUT=8
45
+ # leer lassen = Standardwert: 3
46
+ UIA_APP_START_TIMEOUT=3
47
+ # Wartezeit nach waitForIdle in Sekunden (zu niedrig = Animationen werden noch nicht abgeschlossen)
48
+ # leer lassen = Standardwert: 0.5
49
+ UIA_WAIT_IDLE_TIMEOUT=0.5
50
+ # Wartezeit nach dem Leeren eines Eingabefelds (Windows Vision Engine), bevor die Leerung
51
+ # per Lese-Zugriff verifiziert wird
52
+ # leer lassen = Standardwert: 0.1
53
+ WINDOWS_CLEAR_FIELD_DELAY=0.1
54
+
55
+ # Swipe-Dauer in Millisekunden (zu kurz = Gerät reagiert nicht, zu lang = langsam)
56
+ # leer lassen = Standardwert: 300
57
+ ADB_SWIPE_DURATION_MS=150
58
+ # Swipe-Dauer für Vision-Scrolls (scroll_to_text) in Millisekunden, separat von ADB_SWIPE_DURATION_MS
59
+ # leer lassen = Standardwert: 200
60
+ VISION_SCROLL_SWIPE_DURATION_MS=200
61
+ # Swipe-Dauer für die Nachzentrierung nach einem Scroll-Treffer in Millisekunden
62
+ # (bewusst langsam, kein Fling-Impuls)
63
+ # leer lassen = Standardwert: 500
64
+ CENTERING_SWIPE_DURATION_MS=500
65
+
66
+ # Scroll-Verhalten
67
+ # Anzahl Scroll-Schritte pro Richtung (runter + hoch)
68
+ # leer lassen = Standardwert: 3
69
+ SCROLL_RETRIES=3
70
+ # Schrittgröße der Vision-Scrolls als Anteil der Bildschirmhöhe (0.20 = 20%)
71
+ # Wirkt NUR auf die Vision-Engine UIA scrollt über scroll.to() und nutzt den Wert nicht.
72
+ # leer lassen = Standardwert: 0.20
73
+ VISION_SCROLL_STEP_PERCENT=0.20
74
+ # Safe-Area-Rand für die Nachzentrierung nach einem Scroll-Treffer (engine-übergreifend):
75
+ # oberste/unterste 25 % gelten als "zu nah am Rand" und werden minimal nachzentriert.
76
+ # Größerer Wert = Element wird weiter vom Rand zurückgeholt (mehr Tap-Puffer).
77
+ # leer lassen = Standardwert: 0.25
78
+ SCROLL_SAFE_MARGIN_PERCENT=0.25
79
+
80
+ # Maximale Scroll-Schritte für Vision Engine (End-of-List-Schutz)
81
+ # leer lassen = Standardwert: 30
82
+ VISION_SCROLL_MAX=30
83
+ # Mittlerer Pixel-Differenz-Schwellwert für End-of-List-Erkennung der Vision Engine
84
+ # Unterschreitet die Differenz zweier aufeinanderfolgender Screenshots diesen Wert, gilt die Liste als erschöpft
85
+ # Niedrigerer Wert = empfindlicher (mehr Falsch-Positives bei Animationen möglich)
86
+ # leer lassen = Standardwert: 2.0
87
+ VISION_STABLE_THRESHOLD=2.0
88
+ # Maximale Mausrad-Schritte für Windows UIA Engine (End-of-List-Schutz)
89
+ # leer lassen = Standardwert: 30
90
+ UIA_SCROLL_MAX_SWIPES=30
91
+ # Details zu den Mausrad-Werten (auflösungsabhängig, selbst zu justieren): docs/konfiguration.md
92
+ # leer lassen = Standardwert: 10
93
+ WINDOWS_SCROLL_NOTCHES=10
94
+ # leer lassen = Standardwert: 0.15
95
+ WINDOWS_SCROLL_EVENT_DELAY=0.15
96
+
97
+ # Verzeichnisse
98
+ # leer lassen = Standardwert: logs/
99
+ SCREENSHOT_DIR=logs/
100
+ # leer lassen = Standardwert: custom_elements/
101
+ CUSTOM_ELEMENTS_DIR=custom_elements/
102
+ # APK-Pfad für Install App (optional, z.B. apks/MeineApp.apk)
103
+ APK_PATH=
104
+
105
+ # Windows-App: vollständiger Pfad zur .exe für Launch App. Wird direkt per %{WINDOWS_APP_PATH}
106
+ # in der jeweiligen .robot-Datei gelesen, kein Python-Default - beim Wechsel der Zielanwendung
107
+ # hier umstellen oder per CLI überschreiben: robot --variable APP_PATH:"<pfad>" tests/<suite>.robot
108
+ # ClickOnce-Pfade sind versionsabhängig - per
109
+ # Get-CimInstance Win32_Process -Filter "Name='<exe>'" ermittelbar, solange die App bereits läuft.
110
+ WINDOWS_APP_PATH=
111
+
112
+ # Windows-App nach dem Start maximieren (true/false). Details: docs/konfiguration.md
113
+ # leer lassen = Standardwert: false
114
+ WINDOWS_APP_FULLSCREEN=true
115
+
116
+ # JPG-Qualität für Screenshots (0–100)
117
+ # leer lassen = Standardwert: 85
118
+ SCREENSHOT_JPG_QUALITY=85
119
+
120
+ # Caching; Details: docs/konfiguration.md
121
+ # leer lassen = Standardwert: false
122
+ UIA_DUMP_CACHE=false
123
+ # leer lassen = Standardwert: logs/cache/
124
+ UIA_CACHE_DIR=logs/cache/
125
+ # leer lassen = Standardwert: false
126
+ VISION_OCR_CACHE=false
127
+ # leer lassen = Standardwert: logs/cache/vision/
128
+ VISION_CACHE_DIR=logs/cache/vision/
129
+ # leer lassen = Standardwert: 25
130
+ VISION_CROP_PAD=25
131
+
132
+ # Räumliche Relationen (Find Element / Tap Element); Details: docs/konfiguration.md
133
+ # leer lassen = Standardwert: 10
134
+ SPATIAL_OVERLAP_TOLERANCE=10
135
+ # leer lassen = Standardwert: 0
136
+ SPATIAL_NEAR_MAX_DISTANCE=0
137
+
138
+ # Plattform-Name für Benchmark-Ordner (devcontainer | ubuntu | windows)
139
+ # leer lassen = "unknown"
140
+ BENCHMARK_PLATFORM=
141
+
142
+ # Logging-Level für die automation-Bibliothek
143
+ # Optionen: DEBUG | INFO | WARNING | ERROR
144
+ # leer lassen = Standardwert: INFO
145
+ LOG_LEVEL=INFO
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 aitimatic GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include .env.example
2
+ include docs/konfiguration.md
3
+ include docs/tester_windows_poc.md
@@ -0,0 +1,405 @@
1
+ Metadata-Version: 2.4
2
+ Name: dynamic-test-engine
3
+ Version: 0.1.0
4
+ Summary: UI Automation Library for Robot Framework — Android and Windows Desktop
5
+ Author-email: Mohamad Mussa <mohamad.mussa@aitimatic.com>
6
+ Maintainer: aitimatic GmbH
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/aitimatic-GmbH/UI-Automation-Library
9
+ Project-URL: Repository, https://github.com/aitimatic-GmbH/UI-Automation-Library
10
+ Project-URL: Documentation, https://github.com/aitimatic-GmbH/UI-Automation-Library#readme
11
+ Keywords: robot-framework,automation,android,windows,ui-testing,uiautomator2,pywinauto,ocr,computer-vision
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Framework :: Robot Framework
14
+ Classifier: Framework :: Robot Framework :: Library
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Testing
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: uiautomator2==3.5.0
27
+ Requires-Dist: python-dotenv==1.2.2
28
+ Requires-Dist: robotframework==7.4.2
29
+ Requires-Dist: opencv-python==4.13.0.92
30
+ Requires-Dist: pytesseract==0.3.13
31
+ Requires-Dist: numpy==2.2.6
32
+ Provides-Extra: windows
33
+ Requires-Dist: pywinauto>=0.6.9; extra == "windows"
34
+ Requires-Dist: comtypes>=1.4; sys_platform == "win32" and extra == "windows"
35
+ Requires-Dist: pywin32>=306; sys_platform == "win32" and extra == "windows"
36
+ Requires-Dist: Pillow>=10.0; extra == "windows"
37
+ Provides-Extra: remote
38
+ Requires-Dist: robotremoteserver>=1.1; extra == "remote"
39
+ Provides-Extra: dev
40
+ Requires-Dist: ruff>=0.15; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ # UI Automation Library
44
+
45
+ Robot Framework Library für die Automatisierung nativer Apps.
46
+ Primäre Engine: UIAutomator2 (Android) / UI Automation (Windows) — Fallback: OpenCV + Tesseract OCR.
47
+
48
+ > **Status:** In Entwicklung — PoC Phase 1
49
+ > **Plattformen:** Android (produktiv), Windows Desktop (PoC)
50
+
51
+ ## Ziel
52
+
53
+ Ein wiederverwendbares Test-Framework für native legacy Apps (Android und Windows Desktop).
54
+ Das Framework läuft lokal auf einem echten Gerät oder Desktop, deterministisch, debugbar und Cloud-unabhängig.
55
+
56
+ ---
57
+
58
+ ## Funktionsübersicht
59
+
60
+ - **12 Robot Framework Keywords** — direkt in `.robot`-Testdateien nutzbar, keine Python-Kenntnisse nötig
61
+ - **Dual-Engine-Architektur** — UI Automation als primäre Engine, OpenCV + Tesseract OCR als Fallback
62
+ - **Plattformunabhängige Vision-Schicht** — gleiche OCR/Template-Logik auf Android und Windows
63
+ - **Text-Interaktion** — Tippen auf sichtbaren Text, prüfen ob Text vorhanden ist
64
+ - **Icon-Erkennung** — Custom Element Matching findet Icons auch ohne Text-Label
65
+ - **Scrollen mit Retry** — automatisches Scrollen bis ein Element sichtbar wird
66
+ - **App-Management** — APK installieren (Android), App starten per Package-Name
67
+ - **Geräteverbindung** — USB und Wireless (Android 11+), Prozess-Attach (Windows)
68
+ - **Screenshots** — Aufnahme und Speicherung für Debugging und Logs
69
+ - **Cloud-unabhängig** — läuft lokal auf echtem Gerät oder Desktop, keine externe Abhängigkeit
70
+
71
+ ---
72
+
73
+ ## Voraussetzungen
74
+
75
+ - **Python 3.10** — muss vorab installiert sein; auf Ubuntu/Debian zusätzlich: `sudo apt install python3.10-venv`
76
+ - ADB 1.0.41 (Platform Tools 34.0.5) — wird von `run.sh` / `run.ps1` installiert
77
+ - Tesseract OCR 5.4.1 — wird von `run.sh` / `run.ps1` installiert
78
+ - Android-Gerät mit aktiviertem USB-Debugging
79
+
80
+ ### Python installieren
81
+
82
+ | Plattform | Installation |
83
+ |---|---|
84
+ | Windows | `winget install Python.Python.3.10` oder Installer: https://www.python.org/downloads/release/python-31011/ |
85
+ | Ubuntu/Debian | `sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt install python3.10 python3.10-venv` |
86
+ | macOS | `brew install python@3.10` oder Installer: https://www.python.org/downloads/release/python-31011/ |
87
+
88
+ > Python muss **vor** dem ersten Ausführen von `run.sh` / `run.ps1` verfügbar sein.
89
+ > `ADB` und `Tesseract` werden automatisch vom Setup-Script installiert.
90
+
91
+ ## Installation
92
+
93
+ ### 1. System-Dependencies + Python-Umgebung
94
+
95
+ ```bash
96
+ python3 -m venv .venv
97
+ source .venv/bin/activate
98
+ pip install -r requirements.txt
99
+ pip install -e .
100
+ ```
101
+
102
+ Oder mit dem Setup-Script (installiert auch ADB und Tesseract automatisch):
103
+
104
+ ```bash
105
+ # Linux / macOS
106
+ bash run.sh
107
+
108
+ # Windows (PowerShell)
109
+ .\run.ps1
110
+ ```
111
+
112
+ ### 2. UIAutomator2-Server auf Gerät installieren
113
+
114
+ `run.sh` / `run.ps1` führen diesen Schritt automatisch aus, wenn beim Setup ein Gerät verbunden war.
115
+
116
+ War kein Gerät verbunden, einmalig manuell nachholen:
117
+
118
+ ```bash
119
+ source .venv/bin/activate
120
+ python -m uiautomator2 init
121
+ ```
122
+
123
+ ## Gerät verbinden
124
+
125
+ ### Smartphone vorbereiten
126
+
127
+ 1. Einstellungen → Über das Telefon → **Build-Nummer 7× tippen** (Entwickleroptionen aktivieren)
128
+ 2. Einstellungen → Entwickleroptionen → **USB-Debugging** aktivieren
129
+ 3. Einstellungen → Entwickleroptionen → **USB-Debugging (Sicherheitseinstellungen)** aktivieren
130
+
131
+ ### Option A — USB
132
+
133
+ ```bash
134
+ # Kabel verbinden, Erlaubnis am Smartphone bestätigen
135
+ adb devices
136
+ ```
137
+
138
+ Ausgabe:
139
+ ```
140
+ List of devices attached
141
+ R5CR61D4VAX device
142
+ ```
143
+
144
+ Status muss `device` sein. Bei `unauthorized`: Verbindungsdialog am Smartphone bestätigen.
145
+ Bei `offline`: `adb kill-server && adb start-server`, dann neu verbinden.
146
+
147
+ > **Im Devcontainer:** Der Container kommuniziert mit dem ADB-Server des Hosts via TCP.
148
+ > Erst auf dem Host `adb devices` prüfen, dann den Container starten. Details: [docs/usb_debugging_setup.md](docs/usb_debugging_setup.md)
149
+
150
+ ### Option B — Wireless (Android 11+)
151
+
152
+ Einstellungen → Entwickleroptionen → **Wireless Debugging** aktivieren
153
+
154
+ **1. Einmalig koppeln:**
155
+
156
+ Am Smartphone: Wireless Debugging → "Gerät mit Kopplungscode koppeln" → IP, Pairing-Port und Code notieren.
157
+
158
+ ```bash
159
+ adb pair <IP>:<PAIRING_PORT>
160
+ # Beispiel: adb pair 192.168.178.47:46605
161
+ ```
162
+
163
+ **2. Verbinden:**
164
+
165
+ Am Smartphone: Wireless Debugging → "IP-Adresse & Port" (≠ Pairing-Port!) notieren.
166
+
167
+ ```bash
168
+ adb connect <IP>:<CONNECT_PORT>
169
+ # Beispiel: adb connect 192.168.178.47:45547
170
+ ```
171
+
172
+ Nach erfolgreichem Connect erscheint das Gerät in `adb devices` mit `IP:PORT` als ID.
173
+ Dieser Wert wird als `ANDROID_DEVICE_ID` in `.env` eingetragen — **`adb connect` muss vor jedem Framework-Start manuell ausgeführt werden**, da sich der Port bei Neustart von Wireless Debugging ändert.
174
+
175
+ Details und Fehlerbehebung: [docs/wireless_debugging_nutzen.md](docs/wireless_debugging_nutzen.md)
176
+
177
+ ### Device ID in .env eintragen
178
+
179
+ ```bash
180
+ adb devices -l
181
+ ```
182
+
183
+ Die angezeigte ID (z.B. `R5CR61D4VAX` oder `192.168.178.47:45547`) in `.env` eintragen:
184
+
185
+ ```bash
186
+ cp .env.example .env
187
+ # ANDROID_DEVICE_ID=R5CR61D4VAX
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Keywords
193
+
194
+ | Keyword | Beschreibung | engine | Plattform |
195
+ |---|---|---|---|
196
+ | `Connect Device` | Verbindung zum Gerät herstellen (USB, IP oder Windows-Prozess) | — | Android + Windows |
197
+ | `Install App` | App per ADB installieren | — | Android |
198
+ | `Launch App` | App starten (Android: per UIAutomator2; Windows: beendet eine laufende Instanz und startet neu, optional `fullscreen`) | — | Android + Windows |
199
+ | `Tap Text` | Auf sichtbaren Text tippen | `auto` / `uia` / `vision` | Android + Windows |
200
+ | `Input Text` | Text in ein Eingabefeld eingeben; `anchor` disambiguiert bei mehreren Treffern (nur bei `engine=uia` unter Windows relevant) | `auto` / `uia` / `vision` | Android + Windows |
201
+ | `Tap Icon Near Text` | Icon neben bestimmtem Text tippen (`near`-Spezialfall von `Tap Element`) | `auto` / `uia` / `vision` | Android + Windows |
202
+ | `Scroll To Text` | Scrollen bis Text sichtbar wird; `anchor`/`relation` steuern bei `engine=vision` die Scroll-Region | `auto` / `uia` / `vision` | Android + Windows |
203
+ | `Text Should Exist` | Prüfen ob Text auf dem Bildschirm ist | `auto` / `uia` / `vision` | Android + Windows |
204
+ | `Find Element` | Ziel (Text/Icon) relativ zu einem Anker-Text lokalisieren, gibt `(x, y)` zurück | `vision` | Android + Windows |
205
+ | `Tap Element` | Ziel relativ zu einem Anker-Text antippen; `relation` = `near` / `left_of` / `right_of` / `above` / `below` | `vision` | Android + Windows |
206
+ | `Take Screenshot` | Screenshot speichern | — | Android + Windows |
207
+ | `Move Mouse` | Mauszeiger an Position bewegen, ohne zu klicken | — | Windows |
208
+
209
+ | engine | Verhalten |
210
+ |---|---|
211
+ | `auto` *(Standard)* | UIAutomator2 zuerst — bei Fehler Fallback auf Vision |
212
+ | `uia` | Nur UIAutomator2, kein Fallback |
213
+ | `vision` | Nur Vision (OpenCV + Tesseract OCR) |
214
+
215
+ ### Optionaler Cache
216
+
217
+ Die Vision-Engine kann das OCR-Zeilen-Layout je Screen cachen (`VISION_OCR_CACHE=true`, Default
218
+ aus). Ein Treffer überspringt das teure Full-Screen-OCR und verifiziert das Ziel stattdessen
219
+ live per Crop-OCR, Koordinaten bleiben also live. Schlüssel ist die stabile Screen-Identität
220
+ (`package/activity/version/device`), nicht der Pixelinhalt, daher trifft der Cache über Läufe
221
+ hinweg. Hintergrund, Methode und Messungen: [docs/recherche_caching.md](docs/recherche_caching.md).
222
+
223
+ ## Verwendung
224
+
225
+ ### Android
226
+
227
+ ```robot
228
+ *** Settings ***
229
+ Library automation.keywords.automation_keywords.AutomationKeywords
230
+ Suite Setup Connect Device
231
+ Test Setup Launch App com.android.settings
232
+
233
+ *** Test Cases ***
234
+ WLAN öffnen
235
+ Tap Text WLAN
236
+ Text Should Exist WLAN
237
+ Take Screenshot ergebnis
238
+ ```
239
+
240
+ - `Suite Setup Connect Device` — Geräteverbindung einmalig für die gesamte Suite
241
+ - `Test Setup Launch App ...` — App-Neustart vor jedem Testfall: Standard-Muster für Android-UI-Tests (Espresso, UI Automator, Appium). Jeder Test startet aus einem bekannten Zustand, unabhängig davon ob der vorherige Test in eine Unterseite navigiert hat.
242
+
243
+ ### Windows Desktop (PoC)
244
+
245
+ Zwei Betriebsarten: **lokal** (Tests laufen auf derselben Windows-Maschine) oder **remote**
246
+ (die Windows-Maschine ist nur Testziel, der Testtreiber läuft woanders).
247
+
248
+ #### Setup lokal
249
+
250
+ ```powershell
251
+ .\run.ps1
252
+ ```
253
+
254
+ `run.ps1` installiert die Windows-Extras (`.[windows]`) automatisch mit. Bei manueller
255
+ Installation ohne Setup-Script:
256
+
257
+ ```powershell
258
+ pip install -e ".[windows]"
259
+ ```
260
+
261
+ Danach direkt mit `platform=windows` verwenden (Beispiel unten), kein weiterer Schritt nötig —
262
+ für den lokalen PoC-Test wird **kein Remote Server** benötigt. Remote Server (siehe
263
+ "Setup remote" unten) ist nur relevant, wenn die Windows-Maschine reines Testziel ist und der
264
+ Testtreiber woanders läuft.
265
+
266
+ Voraussetzungen und Konfiguration: [docs/konfiguration.md](docs/konfiguration.md).
267
+ Ausführliche Tester-Anleitung für den Windows-PoC: [docs/tester_windows_poc.md](docs/tester_windows_poc.md).
268
+
269
+ #### Setup remote
270
+
271
+ Auf der Windows-Maschine (Testziel):
272
+
273
+ ```powershell
274
+ .\run.ps1 -Remote
275
+ .venv\Scripts\python.exe remote_server.py
276
+ ```
277
+
278
+ `remote_server.py` bindet `0.0.0.0:8270` ohne Authentifizierung und muss in einer interaktiven
279
+ Session laufen, kein Hintergrunddienst. Nur im internen PoC-Netz betreiben, Firewall-Regel auf
280
+ die IP des Testtreibers einschränken.
281
+
282
+ Im Testtreiber-Robot-File ersetzt `Library Remote` die direkte Library-Einbindung, der Rest der
283
+ Suite (`Connect Device`, Testfälle) bleibt identisch:
284
+
285
+ ```robot
286
+ *** Settings ***
287
+ Library Remote http://<windows-ip>:8270
288
+ ```
289
+
290
+ #### Verwendung
291
+
292
+ ```robot
293
+ *** Settings ***
294
+ Library automation.keywords.automation_keywords.AutomationKeywords
295
+ Suite Setup Connect Device legacy-app.exe platform=windows
296
+
297
+ *** Test Cases ***
298
+ Anmeldeseite prüfen
299
+ Text Should Exist Willkommen
300
+ Tap Text Anmelden
301
+ Take Screenshot ergebnis
302
+ ```
303
+
304
+ - `Connect Device` mit `platform=windows` verbindet sich per Prozessname oder Fenstertitel
305
+ - `Install App` ist auf Windows nicht verfügbar, die App muss vorab installiert sein
306
+ - `Launch App` beendet auf Windows eine ggf. laufende Instanz und startet sie neu, damit jeder Testlauf von einem definierten Zustand beginnt
307
+
308
+ #### Bekannte Grenzen des Windows-PoC
309
+
310
+ - PoC-Stand, kein finaler Gesamtumfang
311
+ - 100%-Anzeigeskalierung empfohlen
312
+ - Ein Monitor empfohlen
313
+ - Komplexe Dialog-/Popup-Szenarien nur eingeschränkt unterstützt
314
+ - Scroll in komplexen Custom Controls noch nicht final stabilisiert
315
+ - Android wird separat oben dokumentiert
316
+
317
+ ## Projektstruktur
318
+
319
+ ```
320
+ automation/
321
+ ├── engines/ # UIAutomator2-, Windows-UIA- und Vision-Engine
322
+ ├── keywords/ # Robot Framework Keywords
323
+ ├── utils/ # Geräte-Abstraktionen, ADB-Wrapper, Bildverarbeitung
324
+ └── config.py # Schwellwerte, Timeouts, Pfade
325
+ custom_elements/ # Referenz-Icons für Custom Element Matching
326
+ tests/ # Robot Framework Testfälle
327
+ logs/ # Screenshots und Debug-Logs
328
+ apks/ # APK-Ablage (wird nicht eingecheckt)
329
+ scripts/ # Automatisierte Integrationstests
330
+ devcontainer.example/ # Devcontainer-Vorlage (nach .devcontainer/ kopieren)
331
+ setup_env.py # Plattformübergreifende System-Dependency-Installation
332
+ run.sh # Setup-Einstiegspunkt Linux/macOS
333
+ run.ps1 # Setup-Einstiegspunkt Windows
334
+ system-requirements.txt # Gepinnte Versionen für Tesseract und ADB
335
+ ```
336
+
337
+ ## Testing
338
+
339
+ Testdokumentation und automatisierter Test-Runner:
340
+
341
+ - [docs/testing.md](docs/testing.md) — vollständige Testanleitung (manuell + automatisiert)
342
+ - [docs/custom_elements_erstellen.md](docs/custom_elements_erstellen.md) — Referenz-Icons für Custom Element Matching erstellen
343
+
344
+ **Vision Stack** (adb.py, image_processing.py, vision_engine.py):
345
+ ```bash
346
+ source .venv/bin/activate
347
+ python scripts/run_integration_tests.py <DEVICE_ID>
348
+ # Optional: python scripts/run_integration_tests.py <DEVICE_ID> --threshold 0.85
349
+ ```
350
+ 18 automatisierte Tests.
351
+
352
+ **Core Stack** (uia_engine.py, engine_manager.py):
353
+ ```bash
354
+ source .venv/bin/activate
355
+ python scripts/run_integration_tests_core.py <DEVICE_ID>
356
+ ```
357
+ 15 automatisierte Tests.
358
+
359
+ Benchmark-Anleitung (Config-Matrix, Auswertung, Plattform-Vergleich): [docs/benchmark.md](docs/benchmark.md)
360
+
361
+ ## Performance
362
+
363
+ Gemessen mit [tools/run_benchmark.py](tools/run_benchmark.py), Konfiguration `uia_timeout_3`, je 10 Läufe pro Kombination.
364
+
365
+ **UIA vs. Vision Engine** (Linux Devcontainer):
366
+
367
+ | Keyword | UIA | Vision |
368
+ |---|---|---|
369
+ | Launch App | 2 246 ms | 2 280 ms |
370
+ | Scroll To Text | 3 861 ms | 4 659 ms |
371
+ | Tap Icon Near Text | 4 500 ms | 1 314 ms |
372
+ | Tap Text | 416 ms | 1 083 ms |
373
+ | Text Should Exist | 71 ms | 1 027 ms |
374
+
375
+ **Plattform-Vergleich** (UIA Engine):
376
+
377
+ | Keyword | Ubuntu 24.04 | Linux Devcontainer | Windows 11 |
378
+ |---|---|---|---|
379
+ | Launch App | 2 067 ms | 2 246 ms | 7 254 ms |
380
+ | Scroll To Text | 3 872 ms | 3 861 ms | 3 800 ms |
381
+ | Tap Icon Near Text | 4 437 ms | 4 500 ms | 3 025 ms |
382
+ | Tap Text | 397 ms | 416 ms | 299 ms |
383
+ | Text Should Exist | 71 ms | 71 ms | 55 ms |
384
+
385
+ Alle Messungen über USB-Verbindung (kein WiFi). Windows 11 zeigt bei Launch App
386
+ deutlich höhere Werte — Ursache plattformspezifisch, nicht verbindungsbedingt.
387
+ Vollständige Rohdaten werden über die CI-Pipeline erzeugt und liegen unter `benchmark_results/`.
388
+
389
+ ## Tech-Stack
390
+
391
+ | Komponente | Version |
392
+ |---|---|
393
+ | Python | 3.10 |
394
+ | Robot Framework | 7.4.2 |
395
+ | uiautomator2 | 3.5.0 |
396
+ | opencv-python | 4.13.0.92 |
397
+ | pytesseract | 0.3.13 |
398
+ | numpy | 2.2.6 |
399
+ | python-dotenv | 1.2.2 |
400
+ | Tesseract OCR | 5.4.1 |
401
+ | ADB | 1.0.41 (34.0.5) |
402
+
403
+ ## Lizenz
404
+
405
+ MIT — siehe [LICENSE](LICENSE).