testuiux 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.
- testuiux-0.1.0/LICENSE +190 -0
- testuiux-0.1.0/PKG-INFO +108 -0
- testuiux-0.1.0/README.md +84 -0
- testuiux-0.1.0/bughunter/__init__.py +20 -0
- testuiux-0.1.0/bughunter/annotator.py +62 -0
- testuiux-0.1.0/bughunter/cli.py +206 -0
- testuiux-0.1.0/bughunter/crawler.py +111 -0
- testuiux-0.1.0/bughunter/detector.py +168 -0
- testuiux-0.1.0/bughunter/json_reporter.py +11 -0
- testuiux-0.1.0/bughunter/reporter.py +324 -0
- testuiux-0.1.0/bughunter/schema.py +70 -0
- testuiux-0.1.0/bughunter/summarizer.py +90 -0
- testuiux-0.1.0/pyproject.toml +41 -0
- testuiux-0.1.0/setup.cfg +4 -0
- testuiux-0.1.0/testuiux/__init__.py +20 -0
- testuiux-0.1.0/testuiux.egg-info/PKG-INFO +108 -0
- testuiux-0.1.0/testuiux.egg-info/SOURCES.txt +19 -0
- testuiux-0.1.0/testuiux.egg-info/dependency_links.txt +1 -0
- testuiux-0.1.0/testuiux.egg-info/entry_points.txt +3 -0
- testuiux-0.1.0/testuiux.egg-info/requires.txt +5 -0
- testuiux-0.1.0/testuiux.egg-info/top_level.txt +2 -0
testuiux-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or exemplary damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 yanzyuyu
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
testuiux-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testuiux
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous visual UI/UX defect detector and responsive layout verification engine powered by Playwright and Qwen2.5-VL
|
|
5
|
+
Author-email: yanzyuyu <stockrii800@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/yanzyuyu/testuiux
|
|
8
|
+
Project-URL: Repository, https://github.com/yanzyuyu/testuiux.git
|
|
9
|
+
Project-URL: Issues, https://github.com/yanzyuyu/testuiux/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Software Development :: Testing
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: playwright>=1.40.0
|
|
19
|
+
Requires-Dist: pillow>=10.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.0.0
|
|
21
|
+
Requires-Dist: httpx>=0.25.0
|
|
22
|
+
Requires-Dist: rich>=13.0.0
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# testuiux
|
|
26
|
+
|
|
27
|
+
Autonomous visual UI/UX defect detector and responsive layout verification engine powered by Playwright and Qwen2.5-VL. Captures multi-viewport screenshots, recognizes layout bugs, generates structured `report.json`, and triggers a lightweight triage model (SLM) to produce an executive briefing directly consumable by primary coding agents.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **Multi-Viewport Automated Capture**: Uses Playwright to render mobile (`375x812`), tablet (`768x1024`), and desktop (`1440x900`) viewports.
|
|
32
|
+
- **Vision-Language QA Inspection**: Evaluates screenshots with Qwen2.5-VL to spot element collisions, text overlap, truncation, unconstrained horizontal overflows, broken assets, and unreadable color contrast.
|
|
33
|
+
- **Visual Defect Highlighting**: Uses Pillow to render color-coded bounding boxes and severity badges.
|
|
34
|
+
- **Structured JSON Reporting**: Automatically exports `report.json` with coordinate boundaries, severity ratings, and CSS remedies.
|
|
35
|
+
- **Dual-Model Autonomous Triage**: Feeds raw audit data into a compact language model (`qwen2.5:1.5b`) to synthesize an executive briefing (`agent_briefing.txt`) for primary AI coding assistants.
|
|
36
|
+
- **Antigravity Skill Native**: Registered as a persistent skill (`testuiux`) invoked automatically whenever frontend UI changes are implemented.
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
- Python 3.10+
|
|
41
|
+
- Playwright Chromium (`playwright install chromium`)
|
|
42
|
+
- Ollama with `qwen2.5-vl:3b` and `qwen2.5:1.5b` (or `--mode mock` for dry-run verification)
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git clone https://github.com/yanzyuyu/testuiux.git
|
|
48
|
+
cd testuiux
|
|
49
|
+
pip install -r requirements.txt
|
|
50
|
+
playwright install chromium
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
### 1. Test Run on Bundled Demo Fixture
|
|
56
|
+
|
|
57
|
+
Execute a verification run against `demo/buggy_site.html`:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
python -m bughunter.cli demo/buggy_site.html --mode mock --format json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Live Scan with Local AI Models (Ollama)
|
|
64
|
+
|
|
65
|
+
Ensure local Ollama models are running:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ollama run qwen2.5-vl:3b
|
|
69
|
+
ollama run qwen2.5:1.5b
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Run audit against development or staging server:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m bughunter.cli http://localhost:3000 --mode api --format json --notify
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Generate All Artifacts (JSON + HTML Report)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python -m bughunter.cli http://localhost:3000 --mode api --format all --output-dir ./audit_results
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Generated Artifacts
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
audit_results/
|
|
88
|
+
├── report.json # Structured machine-readable defects data
|
|
89
|
+
├── agent_briefing.txt # Executive briefing for primary AI agent
|
|
90
|
+
├── report.html # Standalone side-by-side comparison report
|
|
91
|
+
├── screenshot_mobile.png # Clean capture
|
|
92
|
+
└── annotated_mobile.png # Highlighted defects capture
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Defect Categories
|
|
96
|
+
|
|
97
|
+
| Issue Type | Description |
|
|
98
|
+
| :--- | :--- |
|
|
99
|
+
| `ELEMENT_COLLISION` | Fixed footers, modals, or floating buttons occluding interactive UI |
|
|
100
|
+
| `HORIZONTAL_OVERFLOW` | Containers exceeding screen boundaries causing horizontal scroll |
|
|
101
|
+
| `TEXT_OVERLAP` | Colliding labels or texts rendering over other visual components |
|
|
102
|
+
| `TEXT_TRUNCATION` | Prematurely clipped strings lacking proper CSS ellipsis rules |
|
|
103
|
+
| `BROKEN_ASSET` | Failed image requests and unrendered placeholder graphics |
|
|
104
|
+
| `CONTRAST_LOW` | Text violating accessibility contrast standards against background |
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
testuiux-0.1.0/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# testuiux
|
|
2
|
+
|
|
3
|
+
Autonomous visual UI/UX defect detector and responsive layout verification engine powered by Playwright and Qwen2.5-VL. Captures multi-viewport screenshots, recognizes layout bugs, generates structured `report.json`, and triggers a lightweight triage model (SLM) to produce an executive briefing directly consumable by primary coding agents.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-Viewport Automated Capture**: Uses Playwright to render mobile (`375x812`), tablet (`768x1024`), and desktop (`1440x900`) viewports.
|
|
8
|
+
- **Vision-Language QA Inspection**: Evaluates screenshots with Qwen2.5-VL to spot element collisions, text overlap, truncation, unconstrained horizontal overflows, broken assets, and unreadable color contrast.
|
|
9
|
+
- **Visual Defect Highlighting**: Uses Pillow to render color-coded bounding boxes and severity badges.
|
|
10
|
+
- **Structured JSON Reporting**: Automatically exports `report.json` with coordinate boundaries, severity ratings, and CSS remedies.
|
|
11
|
+
- **Dual-Model Autonomous Triage**: Feeds raw audit data into a compact language model (`qwen2.5:1.5b`) to synthesize an executive briefing (`agent_briefing.txt`) for primary AI coding assistants.
|
|
12
|
+
- **Antigravity Skill Native**: Registered as a persistent skill (`testuiux`) invoked automatically whenever frontend UI changes are implemented.
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- Python 3.10+
|
|
17
|
+
- Playwright Chromium (`playwright install chromium`)
|
|
18
|
+
- Ollama with `qwen2.5-vl:3b` and `qwen2.5:1.5b` (or `--mode mock` for dry-run verification)
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git clone https://github.com/yanzyuyu/testuiux.git
|
|
24
|
+
cd testuiux
|
|
25
|
+
pip install -r requirements.txt
|
|
26
|
+
playwright install chromium
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### 1. Test Run on Bundled Demo Fixture
|
|
32
|
+
|
|
33
|
+
Execute a verification run against `demo/buggy_site.html`:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python -m bughunter.cli demo/buggy_site.html --mode mock --format json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Live Scan with Local AI Models (Ollama)
|
|
40
|
+
|
|
41
|
+
Ensure local Ollama models are running:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
ollama run qwen2.5-vl:3b
|
|
45
|
+
ollama run qwen2.5:1.5b
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Run audit against development or staging server:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m bughunter.cli http://localhost:3000 --mode api --format json --notify
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Generate All Artifacts (JSON + HTML Report)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python -m bughunter.cli http://localhost:3000 --mode api --format all --output-dir ./audit_results
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Generated Artifacts
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
audit_results/
|
|
64
|
+
├── report.json # Structured machine-readable defects data
|
|
65
|
+
├── agent_briefing.txt # Executive briefing for primary AI agent
|
|
66
|
+
├── report.html # Standalone side-by-side comparison report
|
|
67
|
+
├── screenshot_mobile.png # Clean capture
|
|
68
|
+
└── annotated_mobile.png # Highlighted defects capture
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Defect Categories
|
|
72
|
+
|
|
73
|
+
| Issue Type | Description |
|
|
74
|
+
| :--- | :--- |
|
|
75
|
+
| `ELEMENT_COLLISION` | Fixed footers, modals, or floating buttons occluding interactive UI |
|
|
76
|
+
| `HORIZONTAL_OVERFLOW` | Containers exceeding screen boundaries causing horizontal scroll |
|
|
77
|
+
| `TEXT_OVERLAP` | Colliding labels or texts rendering over other visual components |
|
|
78
|
+
| `TEXT_TRUNCATION` | Prematurely clipped strings lacking proper CSS ellipsis rules |
|
|
79
|
+
| `BROKEN_ASSET` | Failed image requests and unrendered placeholder graphics |
|
|
80
|
+
| `CONTRAST_LOW` | Text violating accessibility contrast standards against background |
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from bughunter.schema import BoundingBox, VisualIssue, ViewportResult, AuditReport
|
|
2
|
+
from bughunter.crawler import capture_viewports
|
|
3
|
+
from bughunter.detector import detect_visual_issues
|
|
4
|
+
from bughunter.annotator import annotate_image
|
|
5
|
+
from bughunter.reporter import generate_html_report
|
|
6
|
+
from bughunter.json_reporter import export_json_report
|
|
7
|
+
from bughunter.summarizer import generate_agent_briefing
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"BoundingBox",
|
|
11
|
+
"VisualIssue",
|
|
12
|
+
"ViewportResult",
|
|
13
|
+
"AuditReport",
|
|
14
|
+
"capture_viewports",
|
|
15
|
+
"detect_visual_issues",
|
|
16
|
+
"annotate_image",
|
|
17
|
+
"generate_html_report",
|
|
18
|
+
"export_json_report",
|
|
19
|
+
"generate_agent_briefing",
|
|
20
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
3
|
+
from bughunter.schema import SeverityLevel, VisualIssue
|
|
4
|
+
|
|
5
|
+
SEVERITY_COLORS = {
|
|
6
|
+
SeverityLevel.CRITICAL: {"border": (220, 38, 38, 255), "fill": (220, 38, 38, 40)},
|
|
7
|
+
SeverityLevel.WARNING: {"border": (217, 119, 6, 255), "fill": (217, 119, 6, 40)},
|
|
8
|
+
SeverityLevel.INFO: {"border": (37, 99, 235, 255), "fill": (37, 99, 235, 30)},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_default_font(size: int = 14):
|
|
13
|
+
try:
|
|
14
|
+
return ImageFont.truetype("arial.ttf", size)
|
|
15
|
+
except IOError:
|
|
16
|
+
return ImageFont.load_default()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def annotate_image(
|
|
20
|
+
screenshot_path: Path,
|
|
21
|
+
issues: list[VisualIssue],
|
|
22
|
+
output_path: Path,
|
|
23
|
+
) -> Path:
|
|
24
|
+
base_img = Image.open(screenshot_path).convert("RGBA")
|
|
25
|
+
overlay = Image.new("RGBA", base_img.size, (255, 255, 255, 0))
|
|
26
|
+
draw = ImageDraw.Draw(overlay)
|
|
27
|
+
|
|
28
|
+
img_w, img_h = base_img.size
|
|
29
|
+
font = get_default_font(14)
|
|
30
|
+
badge_font = get_default_font(12)
|
|
31
|
+
|
|
32
|
+
for idx, issue in enumerate(issues, start=1):
|
|
33
|
+
x1 = int((issue.box.xmin / 1000.0) * img_w)
|
|
34
|
+
y1 = int((issue.box.ymin / 1000.0) * img_h)
|
|
35
|
+
x2 = int((issue.box.xmax / 1000.0) * img_w)
|
|
36
|
+
y2 = int((issue.box.ymax / 1000.0) * img_h)
|
|
37
|
+
|
|
38
|
+
x1 = max(0, min(img_w - 1, x1))
|
|
39
|
+
y1 = max(0, min(img_h - 1, y1))
|
|
40
|
+
x2 = max(x1 + 10, min(img_w, x2))
|
|
41
|
+
y2 = max(y1 + 10, min(img_h, y2))
|
|
42
|
+
|
|
43
|
+
scheme = SEVERITY_COLORS.get(issue.severity, SEVERITY_COLORS[SeverityLevel.INFO])
|
|
44
|
+
|
|
45
|
+
draw.rectangle([x1, y1, x2, y2], fill=scheme["fill"], outline=scheme["border"], width=3)
|
|
46
|
+
|
|
47
|
+
badge_text = f"#{idx} [{issue.severity.value}] {issue.type.value}"
|
|
48
|
+
text_bbox = draw.textbbox((x1, y1), badge_text, font=badge_font)
|
|
49
|
+
text_w = text_bbox[2] - text_bbox[0]
|
|
50
|
+
text_h = text_bbox[3] - text_bbox[1]
|
|
51
|
+
|
|
52
|
+
badge_y1 = max(0, y1 - text_h - 8)
|
|
53
|
+
badge_y2 = badge_y1 + text_h + 8
|
|
54
|
+
badge_x2 = min(img_w, x1 + text_w + 12)
|
|
55
|
+
|
|
56
|
+
draw.rectangle([x1, badge_y1, badge_x2, badge_y2], fill=scheme["border"])
|
|
57
|
+
draw.text((x1 + 6, badge_y1 + 4), badge_text, fill=(255, 255, 255, 255), font=badge_font)
|
|
58
|
+
|
|
59
|
+
combined = Image.alpha_composite(base_img, overlay).convert("RGB")
|
|
60
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
61
|
+
combined.save(output_path, "PNG")
|
|
62
|
+
return output_path
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import asyncio
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from rich.console import Console
|
|
6
|
+
from rich.table import Table
|
|
7
|
+
from rich.panel import Panel
|
|
8
|
+
from bughunter.schema import AuditReport
|
|
9
|
+
from bughunter.crawler import capture_viewports
|
|
10
|
+
from bughunter.detector import detect_visual_issues
|
|
11
|
+
from bughunter.annotator import annotate_image
|
|
12
|
+
from bughunter.reporter import generate_html_report
|
|
13
|
+
from bughunter.json_reporter import export_json_report
|
|
14
|
+
from bughunter.summarizer import generate_agent_briefing
|
|
15
|
+
|
|
16
|
+
console = Console()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
async def run_audit(
|
|
20
|
+
target: str,
|
|
21
|
+
viewports: list[str],
|
|
22
|
+
mode: str,
|
|
23
|
+
api_base: str,
|
|
24
|
+
model: str,
|
|
25
|
+
api_key: str,
|
|
26
|
+
output_dir: Path,
|
|
27
|
+
small_model: str,
|
|
28
|
+
notify: bool,
|
|
29
|
+
format_type: str,
|
|
30
|
+
) -> tuple[AuditReport, str]:
|
|
31
|
+
console.print(
|
|
32
|
+
Panel(
|
|
33
|
+
f"[bold cyan]Target:[/bold cyan] {target}\n"
|
|
34
|
+
f"[bold cyan]Mode:[/bold cyan] {mode}\n"
|
|
35
|
+
f"[bold cyan]Vision Model:[/bold cyan] {model if mode == 'api' else 'mock/heuristic'}\n"
|
|
36
|
+
f"[bold cyan]Triage Model:[/bold cyan] {small_model if notify else 'disabled'}\n"
|
|
37
|
+
f"[bold cyan]Format:[/bold cyan] {format_type}",
|
|
38
|
+
title="Visual Bug Hunter",
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
43
|
+
|
|
44
|
+
with console.status("[bold green]Capturing responsive viewports with Playwright..."):
|
|
45
|
+
viewport_results = await capture_viewports(
|
|
46
|
+
target_url=target,
|
|
47
|
+
output_dir=output_dir,
|
|
48
|
+
selected_viewports=viewports,
|
|
49
|
+
full_page=True,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
for vp in viewport_results:
|
|
53
|
+
with console.status(f"[bold yellow]Analyzing visual issues for {vp.viewport_name} viewport..."):
|
|
54
|
+
issues = await detect_visual_issues(
|
|
55
|
+
image_path=Path(vp.screenshot_path),
|
|
56
|
+
viewport_name=vp.viewport_name,
|
|
57
|
+
mode=mode,
|
|
58
|
+
api_base=api_base,
|
|
59
|
+
model=model,
|
|
60
|
+
api_key=api_key,
|
|
61
|
+
)
|
|
62
|
+
vp.issues = issues
|
|
63
|
+
|
|
64
|
+
annotated_filename = f"annotated_{vp.viewport_name}.png"
|
|
65
|
+
annotated_path = output_dir / annotated_filename
|
|
66
|
+
annotate_image(
|
|
67
|
+
screenshot_path=Path(vp.screenshot_path),
|
|
68
|
+
issues=issues,
|
|
69
|
+
output_path=annotated_path,
|
|
70
|
+
)
|
|
71
|
+
vp.annotated_path = str(annotated_path)
|
|
72
|
+
|
|
73
|
+
report = AuditReport(
|
|
74
|
+
target_url=target,
|
|
75
|
+
timestamp=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
76
|
+
viewports=viewport_results,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
json_path = output_dir / "report.json"
|
|
80
|
+
export_json_report(report, json_path)
|
|
81
|
+
|
|
82
|
+
if format_type in ("html", "all"):
|
|
83
|
+
report_html_path = output_dir / "report.html"
|
|
84
|
+
generate_html_report(report, report_html_path)
|
|
85
|
+
|
|
86
|
+
briefing = ""
|
|
87
|
+
if notify:
|
|
88
|
+
with console.status(f"[bold magenta]Generating agent briefing with small model ({small_model})..."):
|
|
89
|
+
briefing = await generate_agent_briefing(
|
|
90
|
+
report=report,
|
|
91
|
+
api_base=api_base,
|
|
92
|
+
model=small_model,
|
|
93
|
+
api_key=api_key,
|
|
94
|
+
use_small_model=(mode == "api"),
|
|
95
|
+
)
|
|
96
|
+
briefing_file = output_dir / "agent_briefing.txt"
|
|
97
|
+
with open(briefing_file, "w", encoding="utf-8") as f:
|
|
98
|
+
f.write(briefing)
|
|
99
|
+
|
|
100
|
+
return report, briefing
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def main():
|
|
104
|
+
parser = argparse.ArgumentParser(description="Autonomous Visual Bug Hunter with Qwen2.5-VL")
|
|
105
|
+
parser.add_argument("target", help="Target URL (e.g. http://localhost:3000) or local HTML file")
|
|
106
|
+
parser.add_argument(
|
|
107
|
+
"--viewports",
|
|
108
|
+
default="mobile,desktop",
|
|
109
|
+
help="Comma-separated viewports: mobile,tablet,desktop (default: mobile,desktop)",
|
|
110
|
+
)
|
|
111
|
+
parser.add_argument(
|
|
112
|
+
"--mode",
|
|
113
|
+
choices=["mock", "api"],
|
|
114
|
+
default="mock",
|
|
115
|
+
help="Detection mode: mock (heuristic demo) or api (Qwen2.5-VL via Ollama/OpenAI)",
|
|
116
|
+
)
|
|
117
|
+
parser.add_argument(
|
|
118
|
+
"--api-base",
|
|
119
|
+
default="http://localhost:11434/v1",
|
|
120
|
+
help="Base URL for model endpoints (default: http://localhost:11434/v1)",
|
|
121
|
+
)
|
|
122
|
+
parser.add_argument(
|
|
123
|
+
"--model",
|
|
124
|
+
default="qwen2.5-vl:3b",
|
|
125
|
+
help="Vision model name (default: qwen2.5-vl:3b)",
|
|
126
|
+
)
|
|
127
|
+
parser.add_argument(
|
|
128
|
+
"--small-model",
|
|
129
|
+
default="qwen2.5:1.5b",
|
|
130
|
+
help="Small triage model for agent notification briefing (default: qwen2.5:1.5b)",
|
|
131
|
+
)
|
|
132
|
+
parser.add_argument(
|
|
133
|
+
"--api-key",
|
|
134
|
+
default="ollama",
|
|
135
|
+
help="API Key for model endpoints",
|
|
136
|
+
)
|
|
137
|
+
parser.add_argument(
|
|
138
|
+
"--output-dir",
|
|
139
|
+
default="./audit_results",
|
|
140
|
+
help="Directory to save artifacts (default: ./audit_results)",
|
|
141
|
+
)
|
|
142
|
+
parser.add_argument(
|
|
143
|
+
"--format",
|
|
144
|
+
choices=["json", "html", "all"],
|
|
145
|
+
default="json",
|
|
146
|
+
help="Report output format: json, html, or all (default: json)",
|
|
147
|
+
)
|
|
148
|
+
parser.add_argument(
|
|
149
|
+
"--notify",
|
|
150
|
+
action="store_true",
|
|
151
|
+
default=True,
|
|
152
|
+
help="Automatically trigger small model triage briefing for main AI agent",
|
|
153
|
+
)
|
|
154
|
+
parser.add_argument(
|
|
155
|
+
"--no-notify",
|
|
156
|
+
dest="notify",
|
|
157
|
+
action="store_false",
|
|
158
|
+
help="Disable triage briefing",
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
args = parser.parse_args()
|
|
162
|
+
selected_viewports = [v.strip() for v in args.viewports.split(",") if v.strip()]
|
|
163
|
+
out_dir = Path(args.output_dir).resolve()
|
|
164
|
+
|
|
165
|
+
report, briefing = asyncio.run(
|
|
166
|
+
run_audit(
|
|
167
|
+
target=args.target,
|
|
168
|
+
viewports=selected_viewports,
|
|
169
|
+
mode=args.mode,
|
|
170
|
+
api_base=args.api_base,
|
|
171
|
+
model=args.model,
|
|
172
|
+
api_key=args.api_key,
|
|
173
|
+
output_dir=out_dir,
|
|
174
|
+
small_model=args.small_model,
|
|
175
|
+
notify=args.notify,
|
|
176
|
+
format_type=args.format,
|
|
177
|
+
)
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
table = Table(title="Visual QA Audit Summary")
|
|
181
|
+
table.add_column("Viewport", style="cyan")
|
|
182
|
+
table.add_column("Dimensions", style="dim")
|
|
183
|
+
table.add_column("Defects Found", justify="right")
|
|
184
|
+
table.add_column("Critical", justify="right", style="red")
|
|
185
|
+
table.add_column("Warning", justify="right", style="yellow")
|
|
186
|
+
|
|
187
|
+
for vp in report.viewports:
|
|
188
|
+
crits = sum(1 for i in vp.issues if i.severity.value == "CRITICAL")
|
|
189
|
+
warns = sum(1 for i in vp.issues if i.severity.value == "WARNING")
|
|
190
|
+
table.add_row(
|
|
191
|
+
vp.viewport_name,
|
|
192
|
+
f"{vp.width}x{vp.height}",
|
|
193
|
+
str(len(vp.issues)),
|
|
194
|
+
str(crits),
|
|
195
|
+
str(warns),
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
console.print(table)
|
|
199
|
+
console.print(f"[bold green]JSON Report saved:[/bold green] {out_dir / 'report.json'}")
|
|
200
|
+
|
|
201
|
+
if briefing:
|
|
202
|
+
console.print(Panel(briefing, title="[bold magenta]AI Agent Executive Briefing (Small Model)[/bold magenta]", border_style="magenta"))
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
if __name__ == "__main__":
|
|
206
|
+
main()
|