mk-qa-master 0.5.0__py3-none-any.whl
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.
- mk_qa_master/__init__.py +3 -0
- mk_qa_master/config.py +64 -0
- mk_qa_master/reporters/__init__.py +3 -0
- mk_qa_master/reporters/html.py +716 -0
- mk_qa_master/resources/__init__.py +3 -0
- mk_qa_master/resources/reports.py +22 -0
- mk_qa_master/runners/__init__.py +31 -0
- mk_qa_master/runners/base.py +43 -0
- mk_qa_master/runners/cypress.py +99 -0
- mk_qa_master/runners/go_test.py +111 -0
- mk_qa_master/runners/jest.py +79 -0
- mk_qa_master/runners/maestro.py +829 -0
- mk_qa_master/runners/pytest_playwright.py +505 -0
- mk_qa_master/security.py +132 -0
- mk_qa_master/server.py +820 -0
- mk_qa_master/tools/__init__.py +6 -0
- mk_qa_master/tools/analyzer.py +746 -0
- mk_qa_master/tools/generator.py +40 -0
- mk_qa_master/tools/optimizer.py +444 -0
- mk_qa_master/tools/qa_context.py +461 -0
- mk_qa_master/tools/reporter.py +13 -0
- mk_qa_master/tools/runner.py +17 -0
- mk_qa_master/tools/telemetry.py +89 -0
- mk_qa_master-0.5.0.dist-info/METADATA +671 -0
- mk_qa_master-0.5.0.dist-info/RECORD +29 -0
- mk_qa_master-0.5.0.dist-info/WHEEL +4 -0
- mk_qa_master-0.5.0.dist-info/entry_points.txt +2 -0
- mk_qa_master-0.5.0.dist-info/licenses/LICENSE +21 -0
- mk_qa_master-0.5.0.dist-info/licenses/LICENSE.zh-TW.md +28 -0
mk_qa_master/__init__.py
ADDED
mk_qa_master/config.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import os
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
|
|
6
|
+
PROJECT_ROOT = Path(os.getenv("QA_PROJECT_ROOT", "./tests_project")).resolve()
|
|
7
|
+
|
|
8
|
+
RUNNER_NAME = os.getenv("QA_RUNNER", "pytest").lower()
|
|
9
|
+
|
|
10
|
+
REPORT_PATH = PROJECT_ROOT / "report.json"
|
|
11
|
+
JUNIT_PATH = PROJECT_ROOT / "junit.xml"
|
|
12
|
+
ARTIFACTS_DIR = PROJECT_ROOT / "test-results"
|
|
13
|
+
HISTORY_DIR = ARTIFACTS_DIR / "history"
|
|
14
|
+
TELEMETRY_DIR = ARTIFACTS_DIR / "telemetry"
|
|
15
|
+
TOOL_USAGE_LOG = TELEMETRY_DIR / "tool-usage.jsonl"
|
|
16
|
+
GENERATION_LOG = TELEMETRY_DIR / "generation-log.jsonl"
|
|
17
|
+
MODULES_LOG = TELEMETRY_DIR / "discovered-modules.jsonl"
|
|
18
|
+
OPTIMIZATION_PATH = PROJECT_ROOT / "optimization-plan.md"
|
|
19
|
+
# Business / domain knowledge file — drives "real QA" generation, escaping
|
|
20
|
+
# the rule-based monkey-testing default. Override via QA_KNOWLEDGE_FILE env.
|
|
21
|
+
QA_KNOWLEDGE_PATH = Path(
|
|
22
|
+
os.getenv("QA_KNOWLEDGE_FILE", str(PROJECT_ROOT / "qa-knowledge.md"))
|
|
23
|
+
).resolve()
|
|
24
|
+
|
|
25
|
+
# Optional remote-ADB endpoint (BlueStacks / Genymotion / Nox / LDPlayer /
|
|
26
|
+
# WSA / cloud farms). When set, runners auto-run `adb connect <host>`
|
|
27
|
+
# before invoking Maestro so `adb devices` actually lists the instance.
|
|
28
|
+
# Example: QA_ANDROID_HOST=127.0.0.1:5555 (BlueStacks default).
|
|
29
|
+
ANDROID_HOST = os.getenv("QA_ANDROID_HOST", "").strip()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def connect_android_host(timeout_s: float = 10.0) -> tuple[bool, str]:
|
|
33
|
+
"""Ensure the configured remote-ADB endpoint is paired before Maestro runs.
|
|
34
|
+
|
|
35
|
+
BlueStacks / Genymotion expose Android over TCP rather than auto-discovery;
|
|
36
|
+
Maestro can't see them until `adb connect host:port` has succeeded once
|
|
37
|
+
per session. `adb connect` is idempotent (returns "already connected"
|
|
38
|
+
on repeat calls), so wiring this at the runner boundary costs nothing
|
|
39
|
+
when the endpoint is already paired.
|
|
40
|
+
|
|
41
|
+
Returns (ok, message). When QA_ANDROID_HOST is unset, returns
|
|
42
|
+
(True, "") — callers can skip surfacing anything in that case.
|
|
43
|
+
"""
|
|
44
|
+
if not ANDROID_HOST:
|
|
45
|
+
return True, ""
|
|
46
|
+
if not shutil.which("adb"):
|
|
47
|
+
return (
|
|
48
|
+
False,
|
|
49
|
+
"QA_ANDROID_HOST is set but `adb` is not on PATH — install Android Platform-Tools",
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
result = subprocess.run(
|
|
53
|
+
["adb", "connect", ANDROID_HOST],
|
|
54
|
+
capture_output=True,
|
|
55
|
+
text=True,
|
|
56
|
+
timeout=timeout_s,
|
|
57
|
+
)
|
|
58
|
+
except (OSError, subprocess.TimeoutExpired) as e:
|
|
59
|
+
return False, f"adb connect {ANDROID_HOST} failed: {type(e).__name__}: {e}"
|
|
60
|
+
out = (result.stdout + result.stderr).strip()
|
|
61
|
+
low = out.lower()
|
|
62
|
+
if "connected to" in low or "already connected" in low:
|
|
63
|
+
return True, out
|
|
64
|
+
return False, out or f"adb connect {ANDROID_HOST} returned no output"
|