qalprit 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 (45) hide show
  1. qalprit-0.1.0/LICENSE +21 -0
  2. qalprit-0.1.0/PKG-INFO +238 -0
  3. qalprit-0.1.0/README.md +201 -0
  4. qalprit-0.1.0/pyproject.toml +63 -0
  5. qalprit-0.1.0/setup.cfg +4 -0
  6. qalprit-0.1.0/src/qalprit/__init__.py +3 -0
  7. qalprit-0.1.0/src/qalprit/appium_manager.py +179 -0
  8. qalprit-0.1.0/src/qalprit/cli.py +340 -0
  9. qalprit-0.1.0/src/qalprit/config_loader.py +230 -0
  10. qalprit-0.1.0/src/qalprit/devices.py +121 -0
  11. qalprit-0.1.0/src/qalprit/doctor.py +331 -0
  12. qalprit-0.1.0/src/qalprit/driver_factory.py +215 -0
  13. qalprit-0.1.0/src/qalprit/env_loader.py +212 -0
  14. qalprit-0.1.0/src/qalprit/evidence.py +215 -0
  15. qalprit-0.1.0/src/qalprit/inspector.py +120 -0
  16. qalprit-0.1.0/src/qalprit/report/__init__.py +5 -0
  17. qalprit-0.1.0/src/qalprit/report/generator.py +152 -0
  18. qalprit-0.1.0/src/qalprit/report/templates/report.html.j2 +530 -0
  19. qalprit-0.1.0/src/qalprit/results.py +116 -0
  20. qalprit-0.1.0/src/qalprit/runner.py +431 -0
  21. qalprit-0.1.0/src/qalprit/spec_loader.py +288 -0
  22. qalprit-0.1.0/src/qalprit/steps/__init__.py +60 -0
  23. qalprit-0.1.0/src/qalprit/steps/app_steps.py +28 -0
  24. qalprit-0.1.0/src/qalprit/steps/base.py +183 -0
  25. qalprit-0.1.0/src/qalprit/steps/device_steps.py +34 -0
  26. qalprit-0.1.0/src/qalprit/steps/interaction_steps.py +127 -0
  27. qalprit-0.1.0/src/qalprit/steps/media_steps.py +11 -0
  28. qalprit-0.1.0/src/qalprit/steps/wait_assert_steps.py +66 -0
  29. qalprit-0.1.0/src/qalprit/ui/index.html +207 -0
  30. qalprit-0.1.0/src/qalprit/ui/qalprit-icon.svg +51 -0
  31. qalprit-0.1.0/src/qalprit/ui_server.py +202 -0
  32. qalprit-0.1.0/src/qalprit/validator.py +484 -0
  33. qalprit-0.1.0/src/qalprit.egg-info/PKG-INFO +238 -0
  34. qalprit-0.1.0/src/qalprit.egg-info/SOURCES.txt +43 -0
  35. qalprit-0.1.0/src/qalprit.egg-info/dependency_links.txt +1 -0
  36. qalprit-0.1.0/src/qalprit.egg-info/entry_points.txt +2 -0
  37. qalprit-0.1.0/src/qalprit.egg-info/requires.txt +10 -0
  38. qalprit-0.1.0/src/qalprit.egg-info/top_level.txt +1 -0
  39. qalprit-0.1.0/tests/test_appium_manager.py +31 -0
  40. qalprit-0.1.0/tests/test_env_and_totp.py +59 -0
  41. qalprit-0.1.0/tests/test_evidence_redaction.py +92 -0
  42. qalprit-0.1.0/tests/test_inspector_and_cli.py +44 -0
  43. qalprit-0.1.0/tests/test_runner_and_steps.py +318 -0
  44. qalprit-0.1.0/tests/test_ui_server.py +83 -0
  45. qalprit-0.1.0/tests/test_validator.py +123 -0
qalprit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Srivatsan Sridhar (vattitude-me)
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.
qalprit-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.4
2
+ Name: qalprit
3
+ Version: 0.1.0
4
+ Summary: Mobile QA. Bugs caught with proof. Deterministic Markdown/YAML mobile UI test automation powered by Appium 2.
5
+ Author-email: Srivatsan Sridhar <vatsakrish@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/vattitude-me/QAlprit
8
+ Project-URL: Repository, https://github.com/vattitude-me/QAlprit
9
+ Project-URL: Issues, https://github.com/vattitude-me/QAlprit/issues
10
+ Project-URL: Documentation, https://github.com/vattitude-me/QAlprit#readme
11
+ Keywords: mobile,qa,appium,android,ios,testing,automation,redaction
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
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: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: Appium-Python-Client>=4.0.0
28
+ Requires-Dist: PyYAML>=6.0.1
29
+ Requires-Dist: python-frontmatter>=1.1.0
30
+ Requires-Dist: Jinja2>=3.1.3
31
+ Requires-Dist: pydantic>=2.6.0
32
+ Requires-Dist: click>=8.1.7
33
+ Requires-Dist: Pillow>=10.2.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ <p align="center">
39
+ <img src="docs/logo/qalprit-logo.png" alt="QAlprit — Mobile QA. Bugs caught with proof." width="200" />
40
+ </p>
41
+
42
+ <h1 align="center">QAlprit (<code>qalprit</code>)</h1>
43
+
44
+ <p align="center">
45
+ <strong>Mobile QA. Bugs caught with proof.</strong>
46
+ </p>
47
+
48
+ <p align="center">
49
+ <a href="https://pypi.org/project/qalprit/"><img src="https://img.shields.io/pypi/v/qalprit?color=5B3DF5&label=pypi" alt="PyPI" /></a>
50
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+" /></a>
51
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License: MIT" /></a>
52
+ <a href="https://appium.io/"><img src="https://img.shields.io/badge/Appium-2.x-662d91.svg" alt="Powered by Appium 2" /></a>
53
+ </p>
54
+
55
+ **QAlprit** is a deterministic, Markdown-driven mobile UI test automation framework for native **Android** and **iOS** applications powered by **Appium 2**.
56
+
57
+ Every test run produces verifiable visual and structural proof—step-by-step screenshots, masked failure XML dumps, Appium logs, and self-contained HTML reports—with **zero LLM calls at runtime** and **in-memory secret redaction** before any image touches disk.
58
+
59
+ ---
60
+
61
+ ## Why QAlprit?
62
+
63
+ - **100% Deterministic Execution** — Zero runtime LLM calls or flaky AI guesswork. Test steps compile directly into Appium 2 actions with automatic element readiness polling.
64
+ - **QA-Friendly Markdown Specs** — Author tests as Markdown files with YAML front matter under `specs/`, compose 1-level reusable `flows/`, and keep shared cross-platform locators in `screens/screens.yaml`.
65
+ - **Security-First Evidence Pipeline** — `.env` substitution and RFC 6238 `${TOTP:VAR}` generation run purely in Python stdlib. Secrets are masked across logs, JSON, XML, and HTML reports, while Pillow black-fills `secret: true` and `sensitive: true` bounding boxes **in memory** (scaled to Retina/device pixels) before writing PNGs to disk.
66
+ - **Self-Contained Proof Reports & Workbench UI** — Generates a single portable `report.html` (Pillow-compressed WebP/JPEG screenshots with interactive lightbox, or `--external-assets`), `summary.md` for PR comments, `results.json`, and includes a local `qalprit ui` workbench plus a static Web UI in `web/` ready for Vercel.
67
+ - **Guaranteed Cleanup & Target Gating** — `teardown:` steps execute even after mid-test failures; simulator-only steps like `biometric` are cleanly skipped on real devices.
68
+
69
+ ---
70
+
71
+ ## Architecture
72
+
73
+ Editable Draw.io source: [`docs/architecture.drawio`](docs/architecture.drawio)
74
+
75
+ ![QAlprit System Architecture](docs/architecture.svg)
76
+
77
+ ### Layer-by-Layer Breakdown
78
+
79
+ 1. **Authoring & Configuration**
80
+ - `specs/**/*.md`: Test cases written in Markdown with YAML front matter (`id`, `title`, `platforms`, `targets`, `reset`, `steps`, `teardown`, `expected`).
81
+ - `flows/**/*.md`: Reusable **1-level-deep** step sequences invoked via `run_flow` with `${param}` interpolation (nested flows are rejected at validation time).
82
+ - `screens/screens.yaml`: Logical `<screen>.<element>` locator catalog supporting shared `accessibility_id`, per-platform `android`/`ios` overrides, parameterized `{name}` templates, and `sensitive: true` screenshot redaction markers.
83
+ - `config/` & `.env`: `devices.yaml` profiles, `environments.yaml` app package/bundle IDs & timeouts, plus local `.env` secrets and RFC 6238 `${TOTP:VAR}` authenticator codes.
84
+ 2. **Deterministic Execution Core (`src/qalprit/`)**
85
+ - `cli.py`: Click CLI (`doctor`, `devices`, `inspect`, `validate`, `run`, `report`, `ui`).
86
+ - `validator.py`: Fail-fast pre-flight validation of step vocabulary, 1-level flows, locator targets, template parameters, and environment variables—no device required.
87
+ - `runner.py` & `steps/`: Reuses one Appium 2 session across compatible tests, applies `reinstall` / `clear_data` / `none` reset strategies, polls for element readiness, tracks `--retries` / `flaky` status, and guarantees `teardown:`.
88
+ - `appium_manager.py`: Auto-starts and stops a local Appium 2 subprocess (auto-detecting `ANDROID_HOME`, `JAVA_HOME`, and free ports) or attaches to an existing server via `--appium-url`.
89
+ 3. **Appium 2 & Native Targets**
90
+ - Drives **Android** emulators/devices (`UiAutomator2`, `.apk`, `adb shell pm clear`) and **iOS** simulators/devices on macOS (`XCUITest`, `.app`/`.ipa`, `xcrun simctl`).
91
+ 4. **In-Memory Evidence Redaction & Reporting**
92
+ - `evidence.py`: Captures raw PNG bytes in memory, scales Appium element bounds by `screenshot_width / window_width`, black-fills sensitive fields via Pillow, scrubs strings via `SecretMasker`, and flags embedded WebViews (`C8`).
93
+ - `report/generator.py` & `ui_server.py`: Renders `report.html`, `summary.md`, and powers the local `qalprit ui` workbench server.
94
+
95
+ ---
96
+
97
+ ## Quick Start
98
+
99
+ ### Install
100
+
101
+ ```bash
102
+ pip install qalprit
103
+ ```
104
+
105
+ Or install from source for local development:
106
+
107
+ ```bash
108
+ git clone https://github.com/vattitude-me/QAlprit.git
109
+ cd QAlprit
110
+ python3 -m venv .venv
111
+ source .venv/bin/activate
112
+ pip install -e ".[dev]"
113
+ ```
114
+
115
+ ### Validate & Run
116
+
117
+ ```bash
118
+ # 1. Copy sample environment variables (never commit .env)
119
+ cp config/env.example .env
120
+
121
+ # 2. Check OS prerequisites (Node, Appium 2, drivers, JDK 17+, Android SDK, Xcode on macOS)
122
+ qalprit doctor
123
+
124
+ # 3. List connected Android devices/AVDs and iOS simulators
125
+ qalprit devices
126
+
127
+ # 4. Validate specs, flows, locators, and env vars without needing a device
128
+ qalprit validate --suite mda --env mda
129
+
130
+ # 5. Run a suite against an Android APK (Appium 2 auto-started and stopped)
131
+ qalprit run --platform android --device android_emulator --app /path/to/app.apk --env mda --suite mda
132
+
133
+ # 6. Open the local Workbench UI to browse runs, proof reports, specs, and sensitive locators
134
+ qalprit ui
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Sample Output & End-to-End MDA Process
140
+
141
+ Want to see what a real run produces before connecting a device? Explore the published sample run from the **Sauce Labs My Demo App** (`mda` suite, **5/5 passed** on Android 15):
142
+
143
+ - **[Sample Proof Report Directory](examples/mda-sample-run/README.md)** — Contains [`summary.md`](examples/mda-sample-run/summary.md), sanitized [`results.json`](examples/mda-sample-run/results.json), and self-contained [`report.html`](examples/mda-sample-run/report.html) (download & open in any browser, or browse live at `/sample-report` on the Vercel site).
144
+
145
+ <table>
146
+ <tr>
147
+ <td align="center" width="50%">
148
+ <img src="examples/mda-sample-run/previews/mda_02_locked_out.jpg" alt="MDA-002 locked out user with redacted password field" width="260" /><br />
149
+ <sub><strong>MDA-002</strong> — Password field black-filled in memory before save; locked-out banner verified.</sub>
150
+ </td>
151
+ <td align="center" width="50%">
152
+ <img src="examples/mda-sample-run/previews/mda_04_payment_redacted.jpg" alt="MDA-004 checkout payment form with card number and CVV redacted" width="260" /><br />
153
+ <sub><strong>MDA-004</strong> — Card Number &amp; Security Code (<code>sensitive: true</code>) black-filled in memory; cardholder &amp; expiry kept readable.</sub>
154
+ </td>
155
+ </tr>
156
+ </table>
157
+
158
+ ### Step-by-Step Process for Any App Under Test
159
+
160
+ 1. **Install & Verify Tooling**: Run `pip install qalprit && qalprit doctor` to confirm Node, Appium 2 (`uiautomator2` / `xcuitest`), Java, and Android/iOS SDKs.
161
+ 2. **Add App Binary Locally**: Place your `.apk` or `.app`/`.ipa` inside `apps/` (ignored by git). For the sample suite, download `mda-2.3.0-27.apk` from [Sauce Labs My Demo App Android](https://github.com/saucelabs/my-demo-app-android/releases).
162
+ 3. **Configure Secrets (`config/env.example` -> `.env`)**: Copy `config/env.example` to `.env` so `${VAR}` credentials and `${TOTP:VAR}` secrets resolve at runtime without ever touching git or logs.
163
+ 4. **Inspect & Map Screens**: Run `qalprit inspect --platform android` against a live screen (or `--from-xml`) to populate `screens/screens.yaml` and mark PII/payment/password fields with `sensitive: true`.
164
+ 5. **Author Specs & Validate Offline**: Write Markdown specs under `specs/<suite>/` and shared 1-level flows under `flows/`, then run `qalprit validate --suite mda --env mda` to catch missing locators, params, or env vars in under a second.
165
+ 6. **Execute & Inspect Proof**: Run `qalprit run --platform android --device android_emulator --app apps/mda-2.3.0-27.apk --env mda --suite mda`, then review `results/<run-id>/report.html`, paste `summary.md` into PRs, or launch `qalprit ui`.
166
+
167
+ ---
168
+
169
+ ## CLI Commands
170
+
171
+ | Command | Purpose |
172
+ |---|---|
173
+ | `qalprit doctor [--json-output]` | OS-aware prerequisite check (skips Xcode on Linux/Windows). |
174
+ | `qalprit devices` | List connected Android `adb` devices, AVDs, and iOS simulators. |
175
+ | `qalprit inspect --platform android\|ios [--device <profile>] [--from-xml <file>]` | Dump addressable UI elements, flag WebViews, and emit starter `screens.yaml`. |
176
+ | `qalprit validate [--suite <name>] [--env <name>] [--platform android\|ios] [--tag <tag>]` | Fail-fast schema, flow, locator, template param, and env var validation. |
177
+ | `qalprit run --platform android\|ios --device <profile> --app <path> [options]` | Execute specs (`--env`, `--suite`, `--tags`, `--retries`, `--appium-url`, `--external-assets`). |
178
+ | `qalprit report <results-dir> [--external-assets]` | Regenerate `report.html` and `summary.md` from an existing `results.json`. |
179
+ | `qalprit ui [--port 8765] [--results-dir results] [--no-open]` | Launch the local QAlprit Workbench web UI. |
180
+
181
+ ---
182
+
183
+ ## User Interfaces
184
+
185
+ 1. **Self-Contained Proof Report (`report.html`)** — Generated per run in `results/<run-id>/report.html` with KPI cards, status/tag/text filters, expanded flow badges, failure XML inspection, and a modal screenshot lightbox.
186
+ 2. **Local Workbench (`qalprit ui`)** — Zero-dependency Python HTTP server for browsing historical runs, opening proof reports, and auditing `sensitive: true` screen locators.
187
+ 3. **Web Showcase & Interactive Demo (`web/`)** — Static web application configured via [`vercel.json`](vercel.json) for instant Vercel deployment with an interactive Proof Report Viewer and Spec Studio.
188
+
189
+ ---
190
+
191
+ ## Repository Structure
192
+
193
+ ```text
194
+ QAlprit/
195
+ ├── config/
196
+ │ ├── devices.yaml # Named Android/iOS emulator & device profiles
197
+ │ ├── environments.yaml # Per-env package/bundle IDs and timeouts
198
+ │ └── env.example # Sample .env variables (copy to .env locally)
199
+ ├── docs/
200
+ │ ├── architecture.drawio # Editable Draw.io architecture diagram
201
+ │ ├── architecture.svg # Exported architecture vector diagram
202
+ │ ├── authoring-guide.md # QA step vocabulary, worked examples & iOS Keychain note
203
+ │ ├── copilot-conversion-prompt.md
204
+ │ └── logo/
205
+ │ ├── qalprit-logo.png # Raster brand logo (1024x1024 PNG)
206
+ │ └── qalprit-logo.svg # Vector brand logo SVG
207
+ ├── examples/
208
+ │ └── mda-sample-run/ # Published 5/5 Sauce Labs MDA sample report, JSON & previews
209
+ ├── flows/ # 1-level reusable Markdown flows
210
+ ├── screens/
211
+ │ └── screens.yaml # Logical locators & sensitive: true redaction markers
212
+ ├── specs/ # Test suites (mda/, regression/)
213
+ ├── src/qalprit/ # Core Python package, steps, evidence, report & UI server
214
+ ├── tests/ # Unit tests (FakeDriver, Pillow redaction, validator, UI)
215
+ ├── web/ # Vercel-ready web showcase & interactive proof demo
216
+ ├── pyproject.toml
217
+ └── vercel.json
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Documentation & Community
223
+
224
+ - [QA Authoring Guide](docs/authoring-guide.md) — Complete step vocabulary, worked examples, locator strategy, and iOS Keychain reset caveat.
225
+ - [Copilot Confluence Conversion Prompt](docs/copilot-conversion-prompt.md) — Prompt template and review checklist for converting manual test plans.
226
+ - [Contributing Guide](CONTRIBUTING.md)
227
+ - [Security Policy](SECURITY.md)
228
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
229
+
230
+ ## Running Tests
231
+
232
+ ```bash
233
+ pytest -v
234
+ ```
235
+
236
+ ## License
237
+
238
+ Released under the [MIT License](LICENSE).
@@ -0,0 +1,201 @@
1
+ <p align="center">
2
+ <img src="docs/logo/qalprit-logo.png" alt="QAlprit — Mobile QA. Bugs caught with proof." width="200" />
3
+ </p>
4
+
5
+ <h1 align="center">QAlprit (<code>qalprit</code>)</h1>
6
+
7
+ <p align="center">
8
+ <strong>Mobile QA. Bugs caught with proof.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://pypi.org/project/qalprit/"><img src="https://img.shields.io/pypi/v/qalprit?color=5B3DF5&label=pypi" alt="PyPI" /></a>
13
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+" /></a>
14
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License: MIT" /></a>
15
+ <a href="https://appium.io/"><img src="https://img.shields.io/badge/Appium-2.x-662d91.svg" alt="Powered by Appium 2" /></a>
16
+ </p>
17
+
18
+ **QAlprit** is a deterministic, Markdown-driven mobile UI test automation framework for native **Android** and **iOS** applications powered by **Appium 2**.
19
+
20
+ Every test run produces verifiable visual and structural proof—step-by-step screenshots, masked failure XML dumps, Appium logs, and self-contained HTML reports—with **zero LLM calls at runtime** and **in-memory secret redaction** before any image touches disk.
21
+
22
+ ---
23
+
24
+ ## Why QAlprit?
25
+
26
+ - **100% Deterministic Execution** — Zero runtime LLM calls or flaky AI guesswork. Test steps compile directly into Appium 2 actions with automatic element readiness polling.
27
+ - **QA-Friendly Markdown Specs** — Author tests as Markdown files with YAML front matter under `specs/`, compose 1-level reusable `flows/`, and keep shared cross-platform locators in `screens/screens.yaml`.
28
+ - **Security-First Evidence Pipeline** — `.env` substitution and RFC 6238 `${TOTP:VAR}` generation run purely in Python stdlib. Secrets are masked across logs, JSON, XML, and HTML reports, while Pillow black-fills `secret: true` and `sensitive: true` bounding boxes **in memory** (scaled to Retina/device pixels) before writing PNGs to disk.
29
+ - **Self-Contained Proof Reports & Workbench UI** — Generates a single portable `report.html` (Pillow-compressed WebP/JPEG screenshots with interactive lightbox, or `--external-assets`), `summary.md` for PR comments, `results.json`, and includes a local `qalprit ui` workbench plus a static Web UI in `web/` ready for Vercel.
30
+ - **Guaranteed Cleanup & Target Gating** — `teardown:` steps execute even after mid-test failures; simulator-only steps like `biometric` are cleanly skipped on real devices.
31
+
32
+ ---
33
+
34
+ ## Architecture
35
+
36
+ Editable Draw.io source: [`docs/architecture.drawio`](docs/architecture.drawio)
37
+
38
+ ![QAlprit System Architecture](docs/architecture.svg)
39
+
40
+ ### Layer-by-Layer Breakdown
41
+
42
+ 1. **Authoring & Configuration**
43
+ - `specs/**/*.md`: Test cases written in Markdown with YAML front matter (`id`, `title`, `platforms`, `targets`, `reset`, `steps`, `teardown`, `expected`).
44
+ - `flows/**/*.md`: Reusable **1-level-deep** step sequences invoked via `run_flow` with `${param}` interpolation (nested flows are rejected at validation time).
45
+ - `screens/screens.yaml`: Logical `<screen>.<element>` locator catalog supporting shared `accessibility_id`, per-platform `android`/`ios` overrides, parameterized `{name}` templates, and `sensitive: true` screenshot redaction markers.
46
+ - `config/` & `.env`: `devices.yaml` profiles, `environments.yaml` app package/bundle IDs & timeouts, plus local `.env` secrets and RFC 6238 `${TOTP:VAR}` authenticator codes.
47
+ 2. **Deterministic Execution Core (`src/qalprit/`)**
48
+ - `cli.py`: Click CLI (`doctor`, `devices`, `inspect`, `validate`, `run`, `report`, `ui`).
49
+ - `validator.py`: Fail-fast pre-flight validation of step vocabulary, 1-level flows, locator targets, template parameters, and environment variables—no device required.
50
+ - `runner.py` & `steps/`: Reuses one Appium 2 session across compatible tests, applies `reinstall` / `clear_data` / `none` reset strategies, polls for element readiness, tracks `--retries` / `flaky` status, and guarantees `teardown:`.
51
+ - `appium_manager.py`: Auto-starts and stops a local Appium 2 subprocess (auto-detecting `ANDROID_HOME`, `JAVA_HOME`, and free ports) or attaches to an existing server via `--appium-url`.
52
+ 3. **Appium 2 & Native Targets**
53
+ - Drives **Android** emulators/devices (`UiAutomator2`, `.apk`, `adb shell pm clear`) and **iOS** simulators/devices on macOS (`XCUITest`, `.app`/`.ipa`, `xcrun simctl`).
54
+ 4. **In-Memory Evidence Redaction & Reporting**
55
+ - `evidence.py`: Captures raw PNG bytes in memory, scales Appium element bounds by `screenshot_width / window_width`, black-fills sensitive fields via Pillow, scrubs strings via `SecretMasker`, and flags embedded WebViews (`C8`).
56
+ - `report/generator.py` & `ui_server.py`: Renders `report.html`, `summary.md`, and powers the local `qalprit ui` workbench server.
57
+
58
+ ---
59
+
60
+ ## Quick Start
61
+
62
+ ### Install
63
+
64
+ ```bash
65
+ pip install qalprit
66
+ ```
67
+
68
+ Or install from source for local development:
69
+
70
+ ```bash
71
+ git clone https://github.com/vattitude-me/QAlprit.git
72
+ cd QAlprit
73
+ python3 -m venv .venv
74
+ source .venv/bin/activate
75
+ pip install -e ".[dev]"
76
+ ```
77
+
78
+ ### Validate & Run
79
+
80
+ ```bash
81
+ # 1. Copy sample environment variables (never commit .env)
82
+ cp config/env.example .env
83
+
84
+ # 2. Check OS prerequisites (Node, Appium 2, drivers, JDK 17+, Android SDK, Xcode on macOS)
85
+ qalprit doctor
86
+
87
+ # 3. List connected Android devices/AVDs and iOS simulators
88
+ qalprit devices
89
+
90
+ # 4. Validate specs, flows, locators, and env vars without needing a device
91
+ qalprit validate --suite mda --env mda
92
+
93
+ # 5. Run a suite against an Android APK (Appium 2 auto-started and stopped)
94
+ qalprit run --platform android --device android_emulator --app /path/to/app.apk --env mda --suite mda
95
+
96
+ # 6. Open the local Workbench UI to browse runs, proof reports, specs, and sensitive locators
97
+ qalprit ui
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Sample Output & End-to-End MDA Process
103
+
104
+ Want to see what a real run produces before connecting a device? Explore the published sample run from the **Sauce Labs My Demo App** (`mda` suite, **5/5 passed** on Android 15):
105
+
106
+ - **[Sample Proof Report Directory](examples/mda-sample-run/README.md)** — Contains [`summary.md`](examples/mda-sample-run/summary.md), sanitized [`results.json`](examples/mda-sample-run/results.json), and self-contained [`report.html`](examples/mda-sample-run/report.html) (download & open in any browser, or browse live at `/sample-report` on the Vercel site).
107
+
108
+ <table>
109
+ <tr>
110
+ <td align="center" width="50%">
111
+ <img src="examples/mda-sample-run/previews/mda_02_locked_out.jpg" alt="MDA-002 locked out user with redacted password field" width="260" /><br />
112
+ <sub><strong>MDA-002</strong> — Password field black-filled in memory before save; locked-out banner verified.</sub>
113
+ </td>
114
+ <td align="center" width="50%">
115
+ <img src="examples/mda-sample-run/previews/mda_04_payment_redacted.jpg" alt="MDA-004 checkout payment form with card number and CVV redacted" width="260" /><br />
116
+ <sub><strong>MDA-004</strong> — Card Number &amp; Security Code (<code>sensitive: true</code>) black-filled in memory; cardholder &amp; expiry kept readable.</sub>
117
+ </td>
118
+ </tr>
119
+ </table>
120
+
121
+ ### Step-by-Step Process for Any App Under Test
122
+
123
+ 1. **Install & Verify Tooling**: Run `pip install qalprit && qalprit doctor` to confirm Node, Appium 2 (`uiautomator2` / `xcuitest`), Java, and Android/iOS SDKs.
124
+ 2. **Add App Binary Locally**: Place your `.apk` or `.app`/`.ipa` inside `apps/` (ignored by git). For the sample suite, download `mda-2.3.0-27.apk` from [Sauce Labs My Demo App Android](https://github.com/saucelabs/my-demo-app-android/releases).
125
+ 3. **Configure Secrets (`config/env.example` -> `.env`)**: Copy `config/env.example` to `.env` so `${VAR}` credentials and `${TOTP:VAR}` secrets resolve at runtime without ever touching git or logs.
126
+ 4. **Inspect & Map Screens**: Run `qalprit inspect --platform android` against a live screen (or `--from-xml`) to populate `screens/screens.yaml` and mark PII/payment/password fields with `sensitive: true`.
127
+ 5. **Author Specs & Validate Offline**: Write Markdown specs under `specs/<suite>/` and shared 1-level flows under `flows/`, then run `qalprit validate --suite mda --env mda` to catch missing locators, params, or env vars in under a second.
128
+ 6. **Execute & Inspect Proof**: Run `qalprit run --platform android --device android_emulator --app apps/mda-2.3.0-27.apk --env mda --suite mda`, then review `results/<run-id>/report.html`, paste `summary.md` into PRs, or launch `qalprit ui`.
129
+
130
+ ---
131
+
132
+ ## CLI Commands
133
+
134
+ | Command | Purpose |
135
+ |---|---|
136
+ | `qalprit doctor [--json-output]` | OS-aware prerequisite check (skips Xcode on Linux/Windows). |
137
+ | `qalprit devices` | List connected Android `adb` devices, AVDs, and iOS simulators. |
138
+ | `qalprit inspect --platform android\|ios [--device <profile>] [--from-xml <file>]` | Dump addressable UI elements, flag WebViews, and emit starter `screens.yaml`. |
139
+ | `qalprit validate [--suite <name>] [--env <name>] [--platform android\|ios] [--tag <tag>]` | Fail-fast schema, flow, locator, template param, and env var validation. |
140
+ | `qalprit run --platform android\|ios --device <profile> --app <path> [options]` | Execute specs (`--env`, `--suite`, `--tags`, `--retries`, `--appium-url`, `--external-assets`). |
141
+ | `qalprit report <results-dir> [--external-assets]` | Regenerate `report.html` and `summary.md` from an existing `results.json`. |
142
+ | `qalprit ui [--port 8765] [--results-dir results] [--no-open]` | Launch the local QAlprit Workbench web UI. |
143
+
144
+ ---
145
+
146
+ ## User Interfaces
147
+
148
+ 1. **Self-Contained Proof Report (`report.html`)** — Generated per run in `results/<run-id>/report.html` with KPI cards, status/tag/text filters, expanded flow badges, failure XML inspection, and a modal screenshot lightbox.
149
+ 2. **Local Workbench (`qalprit ui`)** — Zero-dependency Python HTTP server for browsing historical runs, opening proof reports, and auditing `sensitive: true` screen locators.
150
+ 3. **Web Showcase & Interactive Demo (`web/`)** — Static web application configured via [`vercel.json`](vercel.json) for instant Vercel deployment with an interactive Proof Report Viewer and Spec Studio.
151
+
152
+ ---
153
+
154
+ ## Repository Structure
155
+
156
+ ```text
157
+ QAlprit/
158
+ ├── config/
159
+ │ ├── devices.yaml # Named Android/iOS emulator & device profiles
160
+ │ ├── environments.yaml # Per-env package/bundle IDs and timeouts
161
+ │ └── env.example # Sample .env variables (copy to .env locally)
162
+ ├── docs/
163
+ │ ├── architecture.drawio # Editable Draw.io architecture diagram
164
+ │ ├── architecture.svg # Exported architecture vector diagram
165
+ │ ├── authoring-guide.md # QA step vocabulary, worked examples & iOS Keychain note
166
+ │ ├── copilot-conversion-prompt.md
167
+ │ └── logo/
168
+ │ ├── qalprit-logo.png # Raster brand logo (1024x1024 PNG)
169
+ │ └── qalprit-logo.svg # Vector brand logo SVG
170
+ ├── examples/
171
+ │ └── mda-sample-run/ # Published 5/5 Sauce Labs MDA sample report, JSON & previews
172
+ ├── flows/ # 1-level reusable Markdown flows
173
+ ├── screens/
174
+ │ └── screens.yaml # Logical locators & sensitive: true redaction markers
175
+ ├── specs/ # Test suites (mda/, regression/)
176
+ ├── src/qalprit/ # Core Python package, steps, evidence, report & UI server
177
+ ├── tests/ # Unit tests (FakeDriver, Pillow redaction, validator, UI)
178
+ ├── web/ # Vercel-ready web showcase & interactive proof demo
179
+ ├── pyproject.toml
180
+ └── vercel.json
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Documentation & Community
186
+
187
+ - [QA Authoring Guide](docs/authoring-guide.md) — Complete step vocabulary, worked examples, locator strategy, and iOS Keychain reset caveat.
188
+ - [Copilot Confluence Conversion Prompt](docs/copilot-conversion-prompt.md) — Prompt template and review checklist for converting manual test plans.
189
+ - [Contributing Guide](CONTRIBUTING.md)
190
+ - [Security Policy](SECURITY.md)
191
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
192
+
193
+ ## Running Tests
194
+
195
+ ```bash
196
+ pytest -v
197
+ ```
198
+
199
+ ## License
200
+
201
+ Released under the [MIT License](LICENSE).
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "qalprit"
7
+ version = "0.1.0"
8
+ description = "Mobile QA. Bugs caught with proof. Deterministic Markdown/YAML mobile UI test automation powered by Appium 2."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ {name = "Srivatsan Sridhar", email = "vatsakrish@gmail.com"},
14
+ ]
15
+ requires-python = ">=3.10"
16
+ keywords = ["mobile", "qa", "appium", "android", "ios", "testing", "automation", "redaction"]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Environment :: Console",
20
+ "Intended Audience :: Developers",
21
+ "Intended Audience :: Information Technology",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Topic :: Software Development :: Quality Assurance",
29
+ "Topic :: Software Development :: Testing",
30
+ ]
31
+ dependencies = [
32
+ "Appium-Python-Client>=4.0.0",
33
+ "PyYAML>=6.0.1",
34
+ "python-frontmatter>=1.1.0",
35
+ "Jinja2>=3.1.3",
36
+ "pydantic>=2.6.0",
37
+ "click>=8.1.7",
38
+ "Pillow>=10.2.0",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ dev = [
43
+ "pytest>=8.0.0",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/vattitude-me/QAlprit"
48
+ Repository = "https://github.com/vattitude-me/QAlprit"
49
+ Issues = "https://github.com/vattitude-me/QAlprit/issues"
50
+ Documentation = "https://github.com/vattitude-me/QAlprit#readme"
51
+
52
+ [project.scripts]
53
+ qalprit = "qalprit.cli:main"
54
+
55
+ [tool.setuptools.packages.find]
56
+ where = ["src"]
57
+
58
+ [tool.setuptools.package-data]
59
+ qalprit = ["report/templates/*.j2", "ui/*.html", "ui/*.svg"]
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests"]
63
+ pythonpath = ["src", "."]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """QAlprit (qalprit) — Mobile QA. Bugs caught with proof."""
2
+
3
+ __version__ = "0.1.0"