ego-webqa 0.2.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.
- ego_webqa-0.2.0/LICENSE +22 -0
- ego_webqa-0.2.0/PKG-INFO +244 -0
- ego_webqa-0.2.0/README.md +216 -0
- ego_webqa-0.2.0/pyproject.toml +69 -0
- ego_webqa-0.2.0/setup.cfg +4 -0
- ego_webqa-0.2.0/src/ego_webqa/__init__.py +18 -0
- ego_webqa-0.2.0/src/ego_webqa/__main__.py +5 -0
- ego_webqa-0.2.0/src/ego_webqa/cli.py +178 -0
- ego_webqa-0.2.0/src/ego_webqa/config.py +332 -0
- ego_webqa-0.2.0/src/ego_webqa/engine.py +832 -0
- ego_webqa-0.2.0/src/ego_webqa/models.py +74 -0
- ego_webqa-0.2.0/src/ego_webqa/probes.py +447 -0
- ego_webqa-0.2.0/src/ego_webqa/py.typed +1 -0
- ego_webqa-0.2.0/src/ego_webqa/reporting.py +120 -0
- ego_webqa-0.2.0/src/ego_webqa/server.py +46 -0
- ego_webqa-0.2.0/src/ego_webqa.egg-info/PKG-INFO +244 -0
- ego_webqa-0.2.0/src/ego_webqa.egg-info/SOURCES.txt +28 -0
- ego_webqa-0.2.0/src/ego_webqa.egg-info/dependency_links.txt +1 -0
- ego_webqa-0.2.0/src/ego_webqa.egg-info/entry_points.txt +2 -0
- ego_webqa-0.2.0/src/ego_webqa.egg-info/requires.txt +11 -0
- ego_webqa-0.2.0/src/ego_webqa.egg-info/top_level.txt +1 -0
- ego_webqa-0.2.0/tests/test_action_metadata.py +33 -0
- ego_webqa-0.2.0/tests/test_browser_audit.py +372 -0
- ego_webqa-0.2.0/tests/test_cli.py +48 -0
- ego_webqa-0.2.0/tests/test_cli_runtime.py +80 -0
- ego_webqa-0.2.0/tests/test_config.py +107 -0
- ego_webqa-0.2.0/tests/test_engine_rules.py +190 -0
- ego_webqa-0.2.0/tests/test_models_reporting.py +57 -0
- ego_webqa-0.2.0/tests/test_server.py +31 -0
- ego_webqa-0.2.0/tests/test_standalone.py +27 -0
ego_webqa-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Roy
|
|
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.
|
|
22
|
+
|
ego_webqa-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ego-webqa
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Deterministic delivery QA for AI-generated web pages
|
|
5
|
+
Author-email: Roy <32172310@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: playwright,web-qa,accessibility,ai-generated,delivery
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
13
|
+
Classifier: Topic :: Software Development :: Testing
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: playwright>=1.48
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: black>=24; extra == "dev"
|
|
20
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
21
|
+
Requires-Dist: mypy>=1.11; extra == "dev"
|
|
22
|
+
Requires-Dist: PyYAML>=6; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
25
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
26
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# ego-webqa
|
|
30
|
+
|
|
31
|
+
Deterministic delivery QA for AI-generated web pages, H5 demos, and PWAs.
|
|
32
|
+
|
|
33
|
+
Point it at a URL. It opens the page in a real Chromium browser, checks a
|
|
34
|
+
mobile/tablet/desktop matrix, safely probes the primary call to action, and
|
|
35
|
+
leaves screenshots plus machine-readable evidence behind.
|
|
36
|
+
|
|
37
|
+
## Why
|
|
38
|
+
|
|
39
|
+
Generated pages often pass unit tests while still shipping obvious delivery
|
|
40
|
+
defects: content wider than the phone, invisible buttons, broken images,
|
|
41
|
+
console errors, a call-to-action that does nothing, or a page that shifts while
|
|
42
|
+
the user is trying to tap it.
|
|
43
|
+
|
|
44
|
+
`ego-webqa` turns those into deterministic checks. It is not a visual-regression
|
|
45
|
+
service and does not require writing tests or storing approved screenshots.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
After v0.2.0 is published, install it from PyPI:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python -m pip install ego-webqa
|
|
53
|
+
python -m playwright install chromium
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
To install the current checkout before a release:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/ROY32172310/qa.git
|
|
60
|
+
cd qa
|
|
61
|
+
python -m pip install .
|
|
62
|
+
python -m playwright install chromium
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For development, use `python -m pip install -e '.[dev]'`.
|
|
66
|
+
|
|
67
|
+
Use a system Chrome instead of downloading Chromium:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
ego-webqa https://example.com --browser-channel chrome
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Use
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
ego-webqa https://example.com
|
|
77
|
+
ego-webqa --dir ./dist --file index.html
|
|
78
|
+
ego-webqa http://127.0.0.1:8000 --viewports 390x844,768x1024,1440x900
|
|
79
|
+
ego-webqa https://example.com --ready-selector "#app-ready" --wait-for-network-idle
|
|
80
|
+
ego-webqa https://example.com --smoke-success-selector "#thank-you"
|
|
81
|
+
ego-webqa https://example.com --profile accessibility
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Exit codes:
|
|
85
|
+
|
|
86
|
+
- `0`: pass or warnings only
|
|
87
|
+
- `1`: at least one blocking error
|
|
88
|
+
- `2`: invalid invocation or browser/runtime failure
|
|
89
|
+
|
|
90
|
+
Every run writes:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
webqa-report/
|
|
94
|
+
├── report.json
|
|
95
|
+
├── junit.xml
|
|
96
|
+
├── report.sarif
|
|
97
|
+
└── screenshots/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Add `--fail-on-warn` for CI gates that require a completely clean report.
|
|
101
|
+
|
|
102
|
+
## Checks
|
|
103
|
+
|
|
104
|
+
Blocking errors:
|
|
105
|
+
|
|
106
|
+
- horizontal page overflow
|
|
107
|
+
- JavaScript page errors and `console.error`
|
|
108
|
+
- failed resources and HTTP errors
|
|
109
|
+
- a nearly blank page
|
|
110
|
+
- unreadable text below 10px
|
|
111
|
+
- broken visible images
|
|
112
|
+
- distorted canvas/image/video aspect ratio
|
|
113
|
+
- dead primary CTA
|
|
114
|
+
- severe unexpected layout shift
|
|
115
|
+
|
|
116
|
+
Warnings:
|
|
117
|
+
|
|
118
|
+
- small hit targets below 44px
|
|
119
|
+
- secondary text below 12px
|
|
120
|
+
- oversized fixed overlays
|
|
121
|
+
- slow first contentful paint
|
|
122
|
+
- moderate layout shift
|
|
123
|
+
- excessive first-load bytes or request count
|
|
124
|
+
|
|
125
|
+
The browser probe reports facts. All thresholds and pass/fail decisions live in
|
|
126
|
+
[`src/ego_webqa/config.py`](src/ego_webqa/config.py).
|
|
127
|
+
|
|
128
|
+
### Profiles
|
|
129
|
+
|
|
130
|
+
`baseline` is the default delivery profile. It checks whether the page renders,
|
|
131
|
+
responds, fits the viewport, and lets the primary action work.
|
|
132
|
+
|
|
133
|
+
`accessibility` keeps every baseline check and adds deterministic checks for:
|
|
134
|
+
|
|
135
|
+
- missing document language or page title
|
|
136
|
+
- controls without an accessible name
|
|
137
|
+
- visible images without an `alt` attribute
|
|
138
|
+
- interactive content inside `aria-hidden` containers
|
|
139
|
+
- duplicate IDs and skipped heading levels
|
|
140
|
+
- positive `tabindex` values that override the natural focus order
|
|
141
|
+
|
|
142
|
+
This profile catches common machine-detectable defects. It is not a WCAG
|
|
143
|
+
conformance audit or a replacement for keyboard and assistive-technology
|
|
144
|
+
testing.
|
|
145
|
+
|
|
146
|
+
## Configuration
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ego-webqa https://example.com --config examples/webqa.json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"profile": "accessibility",
|
|
155
|
+
"viewports": ["390x844:mobile", "768x1024:tablet", "1280x800:desktop"],
|
|
156
|
+
"min_tap_target_px": 44,
|
|
157
|
+
"min_font_px": 12,
|
|
158
|
+
"ready_selector": "#app-ready",
|
|
159
|
+
"wait_for_network_idle": true,
|
|
160
|
+
"smoke_mode": "safe",
|
|
161
|
+
"smoke_success_selector": "#thank-you",
|
|
162
|
+
"smoke_success_url_pattern": "/complete$",
|
|
163
|
+
"ignore_selectors": [".third-party-chat-widget"],
|
|
164
|
+
"ignore_console_patterns": ["third-party-widget"],
|
|
165
|
+
"ignore_request_patterns": ["/analytics/"]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Use `--smoke-selector "#checkout"` when the primary action's text is not matched
|
|
170
|
+
by the default CTA vocabulary. Safe smoke aborts HTTP requests and switches the
|
|
171
|
+
isolated browser context offline after the initial load. Use `--smoke-mode live`
|
|
172
|
+
only when real side effects are intended, or `--no-smoke` when even a DOM-only
|
|
173
|
+
click is undesirable.
|
|
174
|
+
|
|
175
|
+
`smoke_success_selector` and `smoke_success_url_pattern` replace the generic
|
|
176
|
+
"something changed" heuristic with an explicit post-click contract. When both
|
|
177
|
+
are configured, both must change from unmatched to matched.
|
|
178
|
+
|
|
179
|
+
Use `ready_selector` for SPA content that appears after the load event. Known
|
|
180
|
+
third-party console and request noise can be excluded with regex patterns
|
|
181
|
+
without hiding DOM-based findings.
|
|
182
|
+
|
|
183
|
+
## GitHub Actions
|
|
184
|
+
|
|
185
|
+
This repository is also a composite GitHub Action. The Action installs the
|
|
186
|
+
package from the Action ref, installs Chromium, runs the audit, and uploads the
|
|
187
|
+
report even when the audit fails:
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
jobs:
|
|
191
|
+
delivery-qa:
|
|
192
|
+
runs-on: ubuntu-latest
|
|
193
|
+
steps:
|
|
194
|
+
- uses: actions/checkout@v4
|
|
195
|
+
- uses: ROY32172310/qa@v0.2.0
|
|
196
|
+
with:
|
|
197
|
+
url: ${{ vars.PREVIEW_URL }}
|
|
198
|
+
profile: accessibility
|
|
199
|
+
fail-on-warn: "true"
|
|
200
|
+
artifact-name: webqa-${{ github.run_id }}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
For a local checkout of this repository, use `uses: ./` after checkout. The
|
|
204
|
+
Action's `safe` smoke mode is the default; set `smoke-mode: live` only when the
|
|
205
|
+
click is intentionally allowed to cause real side effects. See
|
|
206
|
+
[`examples/github-action.yml`](examples/github-action.yml) and
|
|
207
|
+
[`action.yml`](action.yml) for the full input set.
|
|
208
|
+
|
|
209
|
+
The `@v0.2.0` ref becomes available after that tag is pushed. Until the release
|
|
210
|
+
tag exists, consume the current branch or a commit SHA.
|
|
211
|
+
|
|
212
|
+
## Python API
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from ego_webqa import Settings, audit
|
|
216
|
+
|
|
217
|
+
report = audit("https://example.com", settings=Settings(), output_dir="qa")
|
|
218
|
+
print(report.status)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Scope and independence
|
|
222
|
+
|
|
223
|
+
This repository is a standalone extraction of the general-purpose delivery
|
|
224
|
+
checks originally proven inside the ego project. It has no dependency on
|
|
225
|
+
`ego_protocol`, `ego_uri`, ego sharing, deployment, miniapp, or product-shell
|
|
226
|
+
semantics. Product-specific checks belong in plugins, not in the core.
|
|
227
|
+
|
|
228
|
+
## Development
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
python -m pip install -e '.[dev]'
|
|
232
|
+
python -m playwright install chromium
|
|
233
|
+
pytest
|
|
234
|
+
ruff check .
|
|
235
|
+
black --check .
|
|
236
|
+
mypy
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) before adding a rule. Every rule needs a
|
|
240
|
+
positive control and an observed failure mode.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# ego-webqa
|
|
2
|
+
|
|
3
|
+
Deterministic delivery QA for AI-generated web pages, H5 demos, and PWAs.
|
|
4
|
+
|
|
5
|
+
Point it at a URL. It opens the page in a real Chromium browser, checks a
|
|
6
|
+
mobile/tablet/desktop matrix, safely probes the primary call to action, and
|
|
7
|
+
leaves screenshots plus machine-readable evidence behind.
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
Generated pages often pass unit tests while still shipping obvious delivery
|
|
12
|
+
defects: content wider than the phone, invisible buttons, broken images,
|
|
13
|
+
console errors, a call-to-action that does nothing, or a page that shifts while
|
|
14
|
+
the user is trying to tap it.
|
|
15
|
+
|
|
16
|
+
`ego-webqa` turns those into deterministic checks. It is not a visual-regression
|
|
17
|
+
service and does not require writing tests or storing approved screenshots.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
After v0.2.0 is published, install it from PyPI:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m pip install ego-webqa
|
|
25
|
+
python -m playwright install chromium
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To install the current checkout before a release:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/ROY32172310/qa.git
|
|
32
|
+
cd qa
|
|
33
|
+
python -m pip install .
|
|
34
|
+
python -m playwright install chromium
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For development, use `python -m pip install -e '.[dev]'`.
|
|
38
|
+
|
|
39
|
+
Use a system Chrome instead of downloading Chromium:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
ego-webqa https://example.com --browser-channel chrome
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Use
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ego-webqa https://example.com
|
|
49
|
+
ego-webqa --dir ./dist --file index.html
|
|
50
|
+
ego-webqa http://127.0.0.1:8000 --viewports 390x844,768x1024,1440x900
|
|
51
|
+
ego-webqa https://example.com --ready-selector "#app-ready" --wait-for-network-idle
|
|
52
|
+
ego-webqa https://example.com --smoke-success-selector "#thank-you"
|
|
53
|
+
ego-webqa https://example.com --profile accessibility
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Exit codes:
|
|
57
|
+
|
|
58
|
+
- `0`: pass or warnings only
|
|
59
|
+
- `1`: at least one blocking error
|
|
60
|
+
- `2`: invalid invocation or browser/runtime failure
|
|
61
|
+
|
|
62
|
+
Every run writes:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
webqa-report/
|
|
66
|
+
├── report.json
|
|
67
|
+
├── junit.xml
|
|
68
|
+
├── report.sarif
|
|
69
|
+
└── screenshots/
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Add `--fail-on-warn` for CI gates that require a completely clean report.
|
|
73
|
+
|
|
74
|
+
## Checks
|
|
75
|
+
|
|
76
|
+
Blocking errors:
|
|
77
|
+
|
|
78
|
+
- horizontal page overflow
|
|
79
|
+
- JavaScript page errors and `console.error`
|
|
80
|
+
- failed resources and HTTP errors
|
|
81
|
+
- a nearly blank page
|
|
82
|
+
- unreadable text below 10px
|
|
83
|
+
- broken visible images
|
|
84
|
+
- distorted canvas/image/video aspect ratio
|
|
85
|
+
- dead primary CTA
|
|
86
|
+
- severe unexpected layout shift
|
|
87
|
+
|
|
88
|
+
Warnings:
|
|
89
|
+
|
|
90
|
+
- small hit targets below 44px
|
|
91
|
+
- secondary text below 12px
|
|
92
|
+
- oversized fixed overlays
|
|
93
|
+
- slow first contentful paint
|
|
94
|
+
- moderate layout shift
|
|
95
|
+
- excessive first-load bytes or request count
|
|
96
|
+
|
|
97
|
+
The browser probe reports facts. All thresholds and pass/fail decisions live in
|
|
98
|
+
[`src/ego_webqa/config.py`](src/ego_webqa/config.py).
|
|
99
|
+
|
|
100
|
+
### Profiles
|
|
101
|
+
|
|
102
|
+
`baseline` is the default delivery profile. It checks whether the page renders,
|
|
103
|
+
responds, fits the viewport, and lets the primary action work.
|
|
104
|
+
|
|
105
|
+
`accessibility` keeps every baseline check and adds deterministic checks for:
|
|
106
|
+
|
|
107
|
+
- missing document language or page title
|
|
108
|
+
- controls without an accessible name
|
|
109
|
+
- visible images without an `alt` attribute
|
|
110
|
+
- interactive content inside `aria-hidden` containers
|
|
111
|
+
- duplicate IDs and skipped heading levels
|
|
112
|
+
- positive `tabindex` values that override the natural focus order
|
|
113
|
+
|
|
114
|
+
This profile catches common machine-detectable defects. It is not a WCAG
|
|
115
|
+
conformance audit or a replacement for keyboard and assistive-technology
|
|
116
|
+
testing.
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
ego-webqa https://example.com --config examples/webqa.json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"profile": "accessibility",
|
|
127
|
+
"viewports": ["390x844:mobile", "768x1024:tablet", "1280x800:desktop"],
|
|
128
|
+
"min_tap_target_px": 44,
|
|
129
|
+
"min_font_px": 12,
|
|
130
|
+
"ready_selector": "#app-ready",
|
|
131
|
+
"wait_for_network_idle": true,
|
|
132
|
+
"smoke_mode": "safe",
|
|
133
|
+
"smoke_success_selector": "#thank-you",
|
|
134
|
+
"smoke_success_url_pattern": "/complete$",
|
|
135
|
+
"ignore_selectors": [".third-party-chat-widget"],
|
|
136
|
+
"ignore_console_patterns": ["third-party-widget"],
|
|
137
|
+
"ignore_request_patterns": ["/analytics/"]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Use `--smoke-selector "#checkout"` when the primary action's text is not matched
|
|
142
|
+
by the default CTA vocabulary. Safe smoke aborts HTTP requests and switches the
|
|
143
|
+
isolated browser context offline after the initial load. Use `--smoke-mode live`
|
|
144
|
+
only when real side effects are intended, or `--no-smoke` when even a DOM-only
|
|
145
|
+
click is undesirable.
|
|
146
|
+
|
|
147
|
+
`smoke_success_selector` and `smoke_success_url_pattern` replace the generic
|
|
148
|
+
"something changed" heuristic with an explicit post-click contract. When both
|
|
149
|
+
are configured, both must change from unmatched to matched.
|
|
150
|
+
|
|
151
|
+
Use `ready_selector` for SPA content that appears after the load event. Known
|
|
152
|
+
third-party console and request noise can be excluded with regex patterns
|
|
153
|
+
without hiding DOM-based findings.
|
|
154
|
+
|
|
155
|
+
## GitHub Actions
|
|
156
|
+
|
|
157
|
+
This repository is also a composite GitHub Action. The Action installs the
|
|
158
|
+
package from the Action ref, installs Chromium, runs the audit, and uploads the
|
|
159
|
+
report even when the audit fails:
|
|
160
|
+
|
|
161
|
+
```yaml
|
|
162
|
+
jobs:
|
|
163
|
+
delivery-qa:
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
steps:
|
|
166
|
+
- uses: actions/checkout@v4
|
|
167
|
+
- uses: ROY32172310/qa@v0.2.0
|
|
168
|
+
with:
|
|
169
|
+
url: ${{ vars.PREVIEW_URL }}
|
|
170
|
+
profile: accessibility
|
|
171
|
+
fail-on-warn: "true"
|
|
172
|
+
artifact-name: webqa-${{ github.run_id }}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
For a local checkout of this repository, use `uses: ./` after checkout. The
|
|
176
|
+
Action's `safe` smoke mode is the default; set `smoke-mode: live` only when the
|
|
177
|
+
click is intentionally allowed to cause real side effects. See
|
|
178
|
+
[`examples/github-action.yml`](examples/github-action.yml) and
|
|
179
|
+
[`action.yml`](action.yml) for the full input set.
|
|
180
|
+
|
|
181
|
+
The `@v0.2.0` ref becomes available after that tag is pushed. Until the release
|
|
182
|
+
tag exists, consume the current branch or a commit SHA.
|
|
183
|
+
|
|
184
|
+
## Python API
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
from ego_webqa import Settings, audit
|
|
188
|
+
|
|
189
|
+
report = audit("https://example.com", settings=Settings(), output_dir="qa")
|
|
190
|
+
print(report.status)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Scope and independence
|
|
194
|
+
|
|
195
|
+
This repository is a standalone extraction of the general-purpose delivery
|
|
196
|
+
checks originally proven inside the ego project. It has no dependency on
|
|
197
|
+
`ego_protocol`, `ego_uri`, ego sharing, deployment, miniapp, or product-shell
|
|
198
|
+
semantics. Product-specific checks belong in plugins, not in the core.
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python -m pip install -e '.[dev]'
|
|
204
|
+
python -m playwright install chromium
|
|
205
|
+
pytest
|
|
206
|
+
ruff check .
|
|
207
|
+
black --check .
|
|
208
|
+
mypy
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) before adding a rule. Every rule needs a
|
|
212
|
+
positive control and an observed failure mode.
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ego-webqa"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Deterministic delivery QA for AI-generated web pages"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "Roy", email = "32172310@qq.com"}]
|
|
14
|
+
keywords = ["playwright", "web-qa", "accessibility", "ai-generated", "delivery"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
21
|
+
"Topic :: Software Development :: Testing",
|
|
22
|
+
]
|
|
23
|
+
dependencies = ["playwright>=1.48"]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = [
|
|
27
|
+
"black>=24",
|
|
28
|
+
"build>=1.2",
|
|
29
|
+
"mypy>=1.11",
|
|
30
|
+
"PyYAML>=6",
|
|
31
|
+
"pytest>=8",
|
|
32
|
+
"pytest-cov>=5",
|
|
33
|
+
"ruff>=0.6",
|
|
34
|
+
"twine>=5",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
ego-webqa = "ego_webqa.cli:main"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.package-data]
|
|
44
|
+
ego_webqa = ["py.typed"]
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
markers = [
|
|
49
|
+
"browser: requires Playwright and a Chromium-compatible browser",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[tool.coverage.run]
|
|
53
|
+
concurrency = ["greenlet", "thread"]
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
line-length = 100
|
|
57
|
+
target-version = "py310"
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
61
|
+
|
|
62
|
+
[tool.black]
|
|
63
|
+
line-length = 100
|
|
64
|
+
target-version = ["py310"]
|
|
65
|
+
|
|
66
|
+
[tool.mypy]
|
|
67
|
+
python_version = "3.10"
|
|
68
|
+
strict = true
|
|
69
|
+
files = ["src"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Public API for ego-webqa."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .config import Settings, Viewport
|
|
6
|
+
from .engine import AuditRuntimeError, audit
|
|
7
|
+
from .models import AuditReport, Issue
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"AuditReport",
|
|
11
|
+
"AuditRuntimeError",
|
|
12
|
+
"Issue",
|
|
13
|
+
"Settings",
|
|
14
|
+
"Viewport",
|
|
15
|
+
"audit",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
__version__ = "0.2.0"
|