pyplaykit 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.
- pyplaykit-0.1.0/MANIFEST.in +3 -0
- pyplaykit-0.1.0/PKG-INFO +340 -0
- pyplaykit-0.1.0/README.md +310 -0
- pyplaykit-0.1.0/config/config.yaml +102 -0
- pyplaykit-0.1.0/config/environments.yaml +11 -0
- pyplaykit-0.1.0/core/__init__.py +0 -0
- pyplaykit-0.1.0/core/base_page.py +94 -0
- pyplaykit-0.1.0/core/base_test.py +27 -0
- pyplaykit-0.1.0/core/browser_factory.py +30 -0
- pyplaykit-0.1.0/core/playwright_manager.py +40 -0
- pyplaykit-0.1.0/dist_pkg/__init__.py +5 -0
- pyplaykit-0.1.0/dist_pkg/distribution.py +51 -0
- pyplaykit-0.1.0/integrations/__init__.py +21 -0
- pyplaykit-0.1.0/integrations/adapters.py +155 -0
- pyplaykit-0.1.0/orchestration/__init__.py +5 -0
- pyplaykit-0.1.0/orchestration/planner.py +137 -0
- pyplaykit-0.1.0/pages/__init__.py +0 -0
- pyplaykit-0.1.0/pages/dashboard_page.py +24 -0
- pyplaykit-0.1.0/pages/login_page.py +31 -0
- pyplaykit-0.1.0/pages/orangehrm_login_page.py +58 -0
- pyplaykit-0.1.0/pages/saucedemo_inventory_page.py +100 -0
- pyplaykit-0.1.0/pages/saucedemo_login_page.py +39 -0
- pyplaykit-0.1.0/plugins/__init__.py +16 -0
- pyplaykit-0.1.0/plugins/api_plugin.py +11 -0
- pyplaykit-0.1.0/plugins/base.py +21 -0
- pyplaykit-0.1.0/plugins/data_plugin.py +11 -0
- pyplaykit-0.1.0/plugins/registry.py +77 -0
- pyplaykit-0.1.0/plugins/security_plugin.py +11 -0
- pyplaykit-0.1.0/pyplaykit.egg-info/PKG-INFO +340 -0
- pyplaykit-0.1.0/pyplaykit.egg-info/SOURCES.txt +59 -0
- pyplaykit-0.1.0/pyplaykit.egg-info/dependency_links.txt +1 -0
- pyplaykit-0.1.0/pyplaykit.egg-info/requires.txt +8 -0
- pyplaykit-0.1.0/pyplaykit.egg-info/top_level.txt +8 -0
- pyplaykit-0.1.0/pyproject.toml +59 -0
- pyplaykit-0.1.0/resilience/__init__.py +5 -0
- pyplaykit-0.1.0/resilience/locator_recovery.py +72 -0
- pyplaykit-0.1.0/setup.cfg +4 -0
- pyplaykit-0.1.0/test_data/api_test_data.json +37 -0
- pyplaykit-0.1.0/test_data/data_validation_test_data.json +89 -0
- pyplaykit-0.1.0/test_data/login_test_data.json +14 -0
- pyplaykit-0.1.0/test_data/orangehrm_login_data.json +10 -0
- pyplaykit-0.1.0/test_data/ui_test_data.json +55 -0
- pyplaykit-0.1.0/tests/test_api_validation.py +342 -0
- pyplaykit-0.1.0/tests/test_dashboard.py +41 -0
- pyplaykit-0.1.0/tests/test_data_validation.py +519 -0
- pyplaykit-0.1.0/tests/test_login.py +46 -0
- pyplaykit-0.1.0/tests/test_orangehrm_login.py +58 -0
- pyplaykit-0.1.0/tests/test_ui_validation.py +467 -0
- pyplaykit-0.1.0/utils/__init__.py +0 -0
- pyplaykit-0.1.0/utils/api_client.py +125 -0
- pyplaykit-0.1.0/utils/assertion_helper.py +21 -0
- pyplaykit-0.1.0/utils/data_loader.py +36 -0
- pyplaykit-0.1.0/utils/data_validator.py +426 -0
- pyplaykit-0.1.0/utils/environment_validator.py +105 -0
- pyplaykit-0.1.0/utils/file_reader.py +35 -0
- pyplaykit-0.1.0/utils/logger.py +36 -0
- pyplaykit-0.1.0/utils/observability.py +164 -0
- pyplaykit-0.1.0/utils/response_validator.py +58 -0
- pyplaykit-0.1.0/utils/screenshot_helper.py +17 -0
- pyplaykit-0.1.0/utils/tdm.py +213 -0
- pyplaykit-0.1.0/utils/yaml_config_reader.py +104 -0
pyplaykit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyplaykit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Enterprise Python + Playwright automation framework
|
|
5
|
+
Author-email: Shan Konduru <shankonduru@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ShanKonduru/pyplaykit
|
|
8
|
+
Project-URL: Repository, https://github.com/ShanKonduru/pyplaykit
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/ShanKonduru/pyplaykit/issues
|
|
10
|
+
Keywords: playwright,pytest,automation,framework,enterprise,testing,page-object-model
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Framework :: Pytest
|
|
16
|
+
Classifier: Topic :: Software Development :: Testing
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: playwright==1.54.0
|
|
23
|
+
Requires-Dist: pytest==8.4.1
|
|
24
|
+
Requires-Dist: pytest-cov==6.2.1
|
|
25
|
+
Requires-Dist: pytest-xdist==3.6.1
|
|
26
|
+
Requires-Dist: pytest-rerunfailures==15.1
|
|
27
|
+
Requires-Dist: pytest-html==4.1.1
|
|
28
|
+
Requires-Dist: allure-pytest==2.13.5
|
|
29
|
+
Requires-Dist: PyYAML==6.0.2
|
|
30
|
+
|
|
31
|
+
# PyPlayKit - Enterprise Test Automation Framework
|
|
32
|
+
|
|
33
|
+
Tagline: A modular, scalable, and CI/CD-ready Python + Playwright framework for enterprise automation.
|
|
34
|
+
|
|
35
|
+
## Overview
|
|
36
|
+
PyPlayKit is a layered and extensible enterprise UI automation framework built with Python, Playwright, and Pytest.
|
|
37
|
+
|
|
38
|
+
It is designed to provide:
|
|
39
|
+
- standardized test automation practices
|
|
40
|
+
- strong separation between framework code and business test logic
|
|
41
|
+
- deterministic execution with reusable browser lifecycle management
|
|
42
|
+
- CI/CD-friendly reporting and diagnostics
|
|
43
|
+
|
|
44
|
+
## Architecture Layers
|
|
45
|
+
- Test Layer: business-readable test flows using Pytest
|
|
46
|
+
- Page Object Layer: encapsulated locators, page actions, and validations
|
|
47
|
+
- Core Engine Layer: Playwright lifecycle and browser/context management
|
|
48
|
+
- Utilities Layer: logging, data loading, assertions, and screenshots
|
|
49
|
+
- API and Data Validation Layer: reusable API client, response validators, and data validators
|
|
50
|
+
- Observability and Readiness Layer: execution metrics, KPI outputs, and environment readiness checks
|
|
51
|
+
- Configuration Layer: externalized YAML configuration and environment mapping
|
|
52
|
+
- Test Data Layer: JSON data sources with environment variable placeholders
|
|
53
|
+
- Reporting and Logging Layer: HTML report output and structured logs
|
|
54
|
+
|
|
55
|
+
## Project Structure
|
|
56
|
+
pyplaykit/
|
|
57
|
+
- config/
|
|
58
|
+
- config.yaml
|
|
59
|
+
- environments.yaml
|
|
60
|
+
- core/
|
|
61
|
+
- base_page.py
|
|
62
|
+
- base_test.py
|
|
63
|
+
- browser_factory.py
|
|
64
|
+
- playwright_manager.py
|
|
65
|
+
- integrations/
|
|
66
|
+
- adapters.py
|
|
67
|
+
- orchestration/
|
|
68
|
+
- planner.py
|
|
69
|
+
- packaging/
|
|
70
|
+
- distribution.py
|
|
71
|
+
- plugins/
|
|
72
|
+
- base.py
|
|
73
|
+
- registry.py
|
|
74
|
+
- api_plugin.py
|
|
75
|
+
- data_plugin.py
|
|
76
|
+
- security_plugin.py
|
|
77
|
+
- resilience/
|
|
78
|
+
- locator_recovery.py
|
|
79
|
+
- pages/
|
|
80
|
+
- login_page.py
|
|
81
|
+
- dashboard_page.py
|
|
82
|
+
- tests/
|
|
83
|
+
- test_login.py
|
|
84
|
+
- test_dashboard.py
|
|
85
|
+
- utils/
|
|
86
|
+
- logger.py
|
|
87
|
+
- data_loader.py
|
|
88
|
+
- assertion_helper.py
|
|
89
|
+
- screenshot_helper.py
|
|
90
|
+
- api_client.py
|
|
91
|
+
- response_validator.py
|
|
92
|
+
- data_validator.py
|
|
93
|
+
- config_reader.py
|
|
94
|
+
- observability.py
|
|
95
|
+
- environment_validator.py
|
|
96
|
+
- tdm.py
|
|
97
|
+
- test_data/
|
|
98
|
+
- login_test_data.json
|
|
99
|
+
- reports/
|
|
100
|
+
- conftest.py
|
|
101
|
+
- pyproject.toml
|
|
102
|
+
- MANIFEST.in
|
|
103
|
+
- pytest.ini
|
|
104
|
+
- requirements.txt
|
|
105
|
+
- README.md
|
|
106
|
+
- .gitignore
|
|
107
|
+
|
|
108
|
+
## Prerequisites
|
|
109
|
+
- Python 3.11 or higher
|
|
110
|
+
- pip
|
|
111
|
+
|
|
112
|
+
## Setup
|
|
113
|
+
1. Create and activate virtual environment.
|
|
114
|
+
|
|
115
|
+
Windows PowerShell:
|
|
116
|
+
```powershell
|
|
117
|
+
python -m venv .venv
|
|
118
|
+
.\.venv\Scripts\Activate.ps1
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
2. Install framework dependencies.
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
pip install -r requirements.txt
|
|
125
|
+
playwright install
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
3. Install dev security tooling.
|
|
129
|
+
|
|
130
|
+
```powershell
|
|
131
|
+
pip install -r requirements-dev.txt
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
4. Set credentials for tests requiring valid login.
|
|
135
|
+
|
|
136
|
+
```powershell
|
|
137
|
+
$env:PYPLAYKIT_TEST_USERNAME="standard_user"
|
|
138
|
+
$env:PYPLAYKIT_TEST_PASSWORD="secret_sauce"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Runtime Configuration
|
|
142
|
+
Primary execution settings are in config/config.yaml.
|
|
143
|
+
|
|
144
|
+
Supported runtime overrides:
|
|
145
|
+
- --pyplaykit-env dev|qa|uat|prod
|
|
146
|
+
- --pyplaykit-browser chromium|firefox|webkit
|
|
147
|
+
- --pyplaykit-headed
|
|
148
|
+
- --pyplaykit-base-url <url>
|
|
149
|
+
- --pyplaykit-readiness-check
|
|
150
|
+
|
|
151
|
+
Examples:
|
|
152
|
+
|
|
153
|
+
```powershell
|
|
154
|
+
pytest --pyplaykit-env qa --pyplaykit-browser chromium
|
|
155
|
+
pytest --pyplaykit-env uat --pyplaykit-browser firefox --pyplaykit-headed
|
|
156
|
+
pytest -m "smoke"
|
|
157
|
+
pytest -m "regression"
|
|
158
|
+
pytest -n 2
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Reporting and Diagnostics
|
|
162
|
+
- HTML report: reports/report.html
|
|
163
|
+
- Framework logs: reports/framework.log
|
|
164
|
+
- Failure screenshots: reports/screenshots/
|
|
165
|
+
- Videos (if enabled): reports/videos/
|
|
166
|
+
- Observability summary: reports/observability/summary.json
|
|
167
|
+
- KPI summary: reports/observability/kpi_summary.json
|
|
168
|
+
- Integration export (Jira): reports/integrations/jira_export.json
|
|
169
|
+
- Integration export (Test Management): reports/integrations/test_management_export.json
|
|
170
|
+
|
|
171
|
+
## Data-Driven Support
|
|
172
|
+
- JSON test data is stored under test_data/.
|
|
173
|
+
- Placeholder values in the form ${ENV_VAR} are resolved from environment variables.
|
|
174
|
+
|
|
175
|
+
## API and Data Validation Support
|
|
176
|
+
- API client utility in utils/api_client.py supports GET/POST requests, retry handling, and normalized response objects.
|
|
177
|
+
- API response validators in utils/response_validator.py support status, response time, key presence, and JSON path value checks.
|
|
178
|
+
- Data validators in utils/data_validator.py support required-field validation, type validation, record comparison, and collection subset checks.
|
|
179
|
+
|
|
180
|
+
## Wave 1 Status (Implemented)
|
|
181
|
+
Wave 1 foundation controls from the enterprise roadmap are now implemented:
|
|
182
|
+
- Observability tracker for execution metrics, failure classification, flaky identification, and KPI summaries.
|
|
183
|
+
- Environment readiness checks for URL availability, API health, and optional DB connectivity.
|
|
184
|
+
- Session-level observability report generation integrated into pytest lifecycle.
|
|
185
|
+
|
|
186
|
+
Execution notes:
|
|
187
|
+
- Readiness checks are optional by default and can be enabled with `--pyplaykit-readiness-check`.
|
|
188
|
+
- Readiness and observability defaults are configured in config/config.yaml.
|
|
189
|
+
|
|
190
|
+
## Wave 2 Status (Implemented)
|
|
191
|
+
Wave 2 includes Test Data Management utilities:
|
|
192
|
+
- Deterministic synthetic data generation by schema/seed
|
|
193
|
+
- Field-level masking utilities for sensitive data
|
|
194
|
+
- Reusable data reset helper for list/dict/callback stores
|
|
195
|
+
- Environment-specific data provisioning helper
|
|
196
|
+
- Config-driven TDM policy wiring with parser and validator integrated into runtime options
|
|
197
|
+
|
|
198
|
+
Wave 2 Multi-level Reporting is now implemented:
|
|
199
|
+
- Engineering report JSON output
|
|
200
|
+
- QA functional report JSON output
|
|
201
|
+
- Leadership KPI summary JSON output
|
|
202
|
+
|
|
203
|
+
Wave 2 Integration Layer has started with file-based adapters:
|
|
204
|
+
- Integration adapter interface contract for enterprise connectors
|
|
205
|
+
- Jira file export adapter
|
|
206
|
+
- Test management file export adapter
|
|
207
|
+
|
|
208
|
+
Wave 2 Integration Layer now also includes API adapters:
|
|
209
|
+
- Jira API export adapter
|
|
210
|
+
- Test management API export adapter
|
|
211
|
+
|
|
212
|
+
## Wave 3 Status (Implemented)
|
|
213
|
+
Wave 3 Plugin Architecture is now implemented:
|
|
214
|
+
- Plugin registry with lifecycle hook dispatch
|
|
215
|
+
- Built-in starter plugins: api_plugin, data_plugin, security_plugin
|
|
216
|
+
- Config-gated plugin enablement to preserve default behavior
|
|
217
|
+
|
|
218
|
+
Wave 3 Orchestration Layer is now implemented:
|
|
219
|
+
- Config-driven suite orchestration contract
|
|
220
|
+
- Dependency-aware execution graph with cycle and schema validation
|
|
221
|
+
- Ordered pipelines with stage-based execution plans
|
|
222
|
+
|
|
223
|
+
## Wave 4 Status (In Progress)
|
|
224
|
+
Wave 4 self-healing implementation is now complete:
|
|
225
|
+
- Optional locator fallback chain support
|
|
226
|
+
- DOM re-evaluation retry support for resilient element resolution
|
|
227
|
+
- Config contract for resilience policy in config/config.yaml
|
|
228
|
+
- Confidence-scored fallback selection based on retries and fallback depth
|
|
229
|
+
- JSONL audit log output for each recovery action when enabled
|
|
230
|
+
|
|
231
|
+
Wave 4 distribution packaging baseline is now implemented:
|
|
232
|
+
- PEP 621 package metadata in pyproject.toml
|
|
233
|
+
- Source and wheel artifact manifest support via MANIFEST.in
|
|
234
|
+
- Internal package build helper and wrappers:
|
|
235
|
+
- scripts/build_internal_package.py
|
|
236
|
+
- scripts/build_internal_package.bat
|
|
237
|
+
- scripts/build_internal_package.sh
|
|
238
|
+
|
|
239
|
+
Remaining for Wave 4:
|
|
240
|
+
- Semantic versioning, release channels, and compatibility matrix governance
|
|
241
|
+
- Automated release notes from conventional commit history
|
|
242
|
+
|
|
243
|
+
## CI/CD Notes
|
|
244
|
+
Framework supports GitHub Actions, Jenkins, and Azure DevOps pipelines through:
|
|
245
|
+
- deterministic command-line execution
|
|
246
|
+
- marker-based selective runs
|
|
247
|
+
- parallel execution with pytest-xdist
|
|
248
|
+
- rerun support for flaky tests via pytest-rerunfailures
|
|
249
|
+
|
|
250
|
+
## Security Scan Reports
|
|
251
|
+
Security scan tooling includes pip-audit, bandit, gitleaks, and sec-report-kit.
|
|
252
|
+
|
|
253
|
+
The security scripts are self-bootstrapping and do the following automatically:
|
|
254
|
+
- create .venv if missing
|
|
255
|
+
- activate the virtual environment
|
|
256
|
+
- upgrade pip
|
|
257
|
+
- install dependencies from requirements.txt and requirements-dev.txt
|
|
258
|
+
- run pip-audit, bandit, gitleaks detect (committed history), and gitleaks dir (working tree) and generate JSON outputs
|
|
259
|
+
- render individual HTML reports and a consolidated HTML report using sec-report-kit
|
|
260
|
+
|
|
261
|
+
Scripts:
|
|
262
|
+
- scripts/run_security_reports.bat
|
|
263
|
+
- scripts/run_security_reports.sh
|
|
264
|
+
|
|
265
|
+
Note:
|
|
266
|
+
- scripts prefer repo-local gitleaks binary if present (for example gitleaks_8.30.1/gitleaks.exe), otherwise they use PATH.
|
|
267
|
+
- the gitleaks dir scan is intentionally limited to tracked project source folders and key files, so third-party package code under .venv is not scanned.
|
|
268
|
+
|
|
269
|
+
Install gitleaks CLI:
|
|
270
|
+
|
|
271
|
+
Windows (winget):
|
|
272
|
+
```powershell
|
|
273
|
+
winget install --id Gitleaks.Gitleaks -e
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Windows (choco):
|
|
277
|
+
```powershell
|
|
278
|
+
choco install gitleaks
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
macOS (brew):
|
|
282
|
+
```bash
|
|
283
|
+
brew install gitleaks
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Linux (Homebrew/Linuxbrew):
|
|
287
|
+
```bash
|
|
288
|
+
brew install gitleaks
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Run on Windows:
|
|
292
|
+
|
|
293
|
+
```powershell
|
|
294
|
+
scripts\run_security_reports.bat
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Run on Linux/macOS:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
bash scripts/run_security_reports.sh
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Outputs:
|
|
304
|
+
- JSON reports: reports/secutiry_reports/json/
|
|
305
|
+
- pip_audit_report.json
|
|
306
|
+
- bandit_report.json
|
|
307
|
+
- gitleaks_git_report.json
|
|
308
|
+
- gitleaks_dir_report.json
|
|
309
|
+
- HTML reports: reports/secutiry_reports/html/
|
|
310
|
+
- pip_audit_report.html
|
|
311
|
+
- bandit_report.html
|
|
312
|
+
- gitleaks_git_report.html
|
|
313
|
+
- gitleaks_dir_report.html
|
|
314
|
+
- Consolidated HTML report: reports/secutiry_reports/html/security_consolidated_report.html
|
|
315
|
+
|
|
316
|
+
## Unit Test Coverage
|
|
317
|
+
Run framework unit tests with coverage metrics.
|
|
318
|
+
|
|
319
|
+
Windows:
|
|
320
|
+
|
|
321
|
+
```powershell
|
|
322
|
+
scripts\run_unit_tests_with_coverage.bat
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Linux/macOS:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
bash scripts/run_unit_tests_with_coverage.sh
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Coverage outputs:
|
|
332
|
+
- Terminal summary with missing lines
|
|
333
|
+
- HTML report: reports/coverage-html/index.html
|
|
334
|
+
- XML report: reports/coverage.xml
|
|
335
|
+
|
|
336
|
+
## Design and Extension Guidance
|
|
337
|
+
- Keep locators in page classes only.
|
|
338
|
+
- Keep tests business-readable and independent.
|
|
339
|
+
- Avoid hardcoded secrets and environment-specific values in test code.
|
|
340
|
+
- Extend under existing layers to preserve maintainability and onboarding simplicity.
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# PyPlayKit - Enterprise Test Automation Framework
|
|
2
|
+
|
|
3
|
+
Tagline: A modular, scalable, and CI/CD-ready Python + Playwright framework for enterprise automation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
PyPlayKit is a layered and extensible enterprise UI automation framework built with Python, Playwright, and Pytest.
|
|
7
|
+
|
|
8
|
+
It is designed to provide:
|
|
9
|
+
- standardized test automation practices
|
|
10
|
+
- strong separation between framework code and business test logic
|
|
11
|
+
- deterministic execution with reusable browser lifecycle management
|
|
12
|
+
- CI/CD-friendly reporting and diagnostics
|
|
13
|
+
|
|
14
|
+
## Architecture Layers
|
|
15
|
+
- Test Layer: business-readable test flows using Pytest
|
|
16
|
+
- Page Object Layer: encapsulated locators, page actions, and validations
|
|
17
|
+
- Core Engine Layer: Playwright lifecycle and browser/context management
|
|
18
|
+
- Utilities Layer: logging, data loading, assertions, and screenshots
|
|
19
|
+
- API and Data Validation Layer: reusable API client, response validators, and data validators
|
|
20
|
+
- Observability and Readiness Layer: execution metrics, KPI outputs, and environment readiness checks
|
|
21
|
+
- Configuration Layer: externalized YAML configuration and environment mapping
|
|
22
|
+
- Test Data Layer: JSON data sources with environment variable placeholders
|
|
23
|
+
- Reporting and Logging Layer: HTML report output and structured logs
|
|
24
|
+
|
|
25
|
+
## Project Structure
|
|
26
|
+
pyplaykit/
|
|
27
|
+
- config/
|
|
28
|
+
- config.yaml
|
|
29
|
+
- environments.yaml
|
|
30
|
+
- core/
|
|
31
|
+
- base_page.py
|
|
32
|
+
- base_test.py
|
|
33
|
+
- browser_factory.py
|
|
34
|
+
- playwright_manager.py
|
|
35
|
+
- integrations/
|
|
36
|
+
- adapters.py
|
|
37
|
+
- orchestration/
|
|
38
|
+
- planner.py
|
|
39
|
+
- packaging/
|
|
40
|
+
- distribution.py
|
|
41
|
+
- plugins/
|
|
42
|
+
- base.py
|
|
43
|
+
- registry.py
|
|
44
|
+
- api_plugin.py
|
|
45
|
+
- data_plugin.py
|
|
46
|
+
- security_plugin.py
|
|
47
|
+
- resilience/
|
|
48
|
+
- locator_recovery.py
|
|
49
|
+
- pages/
|
|
50
|
+
- login_page.py
|
|
51
|
+
- dashboard_page.py
|
|
52
|
+
- tests/
|
|
53
|
+
- test_login.py
|
|
54
|
+
- test_dashboard.py
|
|
55
|
+
- utils/
|
|
56
|
+
- logger.py
|
|
57
|
+
- data_loader.py
|
|
58
|
+
- assertion_helper.py
|
|
59
|
+
- screenshot_helper.py
|
|
60
|
+
- api_client.py
|
|
61
|
+
- response_validator.py
|
|
62
|
+
- data_validator.py
|
|
63
|
+
- config_reader.py
|
|
64
|
+
- observability.py
|
|
65
|
+
- environment_validator.py
|
|
66
|
+
- tdm.py
|
|
67
|
+
- test_data/
|
|
68
|
+
- login_test_data.json
|
|
69
|
+
- reports/
|
|
70
|
+
- conftest.py
|
|
71
|
+
- pyproject.toml
|
|
72
|
+
- MANIFEST.in
|
|
73
|
+
- pytest.ini
|
|
74
|
+
- requirements.txt
|
|
75
|
+
- README.md
|
|
76
|
+
- .gitignore
|
|
77
|
+
|
|
78
|
+
## Prerequisites
|
|
79
|
+
- Python 3.11 or higher
|
|
80
|
+
- pip
|
|
81
|
+
|
|
82
|
+
## Setup
|
|
83
|
+
1. Create and activate virtual environment.
|
|
84
|
+
|
|
85
|
+
Windows PowerShell:
|
|
86
|
+
```powershell
|
|
87
|
+
python -m venv .venv
|
|
88
|
+
.\.venv\Scripts\Activate.ps1
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
2. Install framework dependencies.
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
pip install -r requirements.txt
|
|
95
|
+
playwright install
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
3. Install dev security tooling.
|
|
99
|
+
|
|
100
|
+
```powershell
|
|
101
|
+
pip install -r requirements-dev.txt
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. Set credentials for tests requiring valid login.
|
|
105
|
+
|
|
106
|
+
```powershell
|
|
107
|
+
$env:PYPLAYKIT_TEST_USERNAME="standard_user"
|
|
108
|
+
$env:PYPLAYKIT_TEST_PASSWORD="secret_sauce"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Runtime Configuration
|
|
112
|
+
Primary execution settings are in config/config.yaml.
|
|
113
|
+
|
|
114
|
+
Supported runtime overrides:
|
|
115
|
+
- --pyplaykit-env dev|qa|uat|prod
|
|
116
|
+
- --pyplaykit-browser chromium|firefox|webkit
|
|
117
|
+
- --pyplaykit-headed
|
|
118
|
+
- --pyplaykit-base-url <url>
|
|
119
|
+
- --pyplaykit-readiness-check
|
|
120
|
+
|
|
121
|
+
Examples:
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
pytest --pyplaykit-env qa --pyplaykit-browser chromium
|
|
125
|
+
pytest --pyplaykit-env uat --pyplaykit-browser firefox --pyplaykit-headed
|
|
126
|
+
pytest -m "smoke"
|
|
127
|
+
pytest -m "regression"
|
|
128
|
+
pytest -n 2
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Reporting and Diagnostics
|
|
132
|
+
- HTML report: reports/report.html
|
|
133
|
+
- Framework logs: reports/framework.log
|
|
134
|
+
- Failure screenshots: reports/screenshots/
|
|
135
|
+
- Videos (if enabled): reports/videos/
|
|
136
|
+
- Observability summary: reports/observability/summary.json
|
|
137
|
+
- KPI summary: reports/observability/kpi_summary.json
|
|
138
|
+
- Integration export (Jira): reports/integrations/jira_export.json
|
|
139
|
+
- Integration export (Test Management): reports/integrations/test_management_export.json
|
|
140
|
+
|
|
141
|
+
## Data-Driven Support
|
|
142
|
+
- JSON test data is stored under test_data/.
|
|
143
|
+
- Placeholder values in the form ${ENV_VAR} are resolved from environment variables.
|
|
144
|
+
|
|
145
|
+
## API and Data Validation Support
|
|
146
|
+
- API client utility in utils/api_client.py supports GET/POST requests, retry handling, and normalized response objects.
|
|
147
|
+
- API response validators in utils/response_validator.py support status, response time, key presence, and JSON path value checks.
|
|
148
|
+
- Data validators in utils/data_validator.py support required-field validation, type validation, record comparison, and collection subset checks.
|
|
149
|
+
|
|
150
|
+
## Wave 1 Status (Implemented)
|
|
151
|
+
Wave 1 foundation controls from the enterprise roadmap are now implemented:
|
|
152
|
+
- Observability tracker for execution metrics, failure classification, flaky identification, and KPI summaries.
|
|
153
|
+
- Environment readiness checks for URL availability, API health, and optional DB connectivity.
|
|
154
|
+
- Session-level observability report generation integrated into pytest lifecycle.
|
|
155
|
+
|
|
156
|
+
Execution notes:
|
|
157
|
+
- Readiness checks are optional by default and can be enabled with `--pyplaykit-readiness-check`.
|
|
158
|
+
- Readiness and observability defaults are configured in config/config.yaml.
|
|
159
|
+
|
|
160
|
+
## Wave 2 Status (Implemented)
|
|
161
|
+
Wave 2 includes Test Data Management utilities:
|
|
162
|
+
- Deterministic synthetic data generation by schema/seed
|
|
163
|
+
- Field-level masking utilities for sensitive data
|
|
164
|
+
- Reusable data reset helper for list/dict/callback stores
|
|
165
|
+
- Environment-specific data provisioning helper
|
|
166
|
+
- Config-driven TDM policy wiring with parser and validator integrated into runtime options
|
|
167
|
+
|
|
168
|
+
Wave 2 Multi-level Reporting is now implemented:
|
|
169
|
+
- Engineering report JSON output
|
|
170
|
+
- QA functional report JSON output
|
|
171
|
+
- Leadership KPI summary JSON output
|
|
172
|
+
|
|
173
|
+
Wave 2 Integration Layer has started with file-based adapters:
|
|
174
|
+
- Integration adapter interface contract for enterprise connectors
|
|
175
|
+
- Jira file export adapter
|
|
176
|
+
- Test management file export adapter
|
|
177
|
+
|
|
178
|
+
Wave 2 Integration Layer now also includes API adapters:
|
|
179
|
+
- Jira API export adapter
|
|
180
|
+
- Test management API export adapter
|
|
181
|
+
|
|
182
|
+
## Wave 3 Status (Implemented)
|
|
183
|
+
Wave 3 Plugin Architecture is now implemented:
|
|
184
|
+
- Plugin registry with lifecycle hook dispatch
|
|
185
|
+
- Built-in starter plugins: api_plugin, data_plugin, security_plugin
|
|
186
|
+
- Config-gated plugin enablement to preserve default behavior
|
|
187
|
+
|
|
188
|
+
Wave 3 Orchestration Layer is now implemented:
|
|
189
|
+
- Config-driven suite orchestration contract
|
|
190
|
+
- Dependency-aware execution graph with cycle and schema validation
|
|
191
|
+
- Ordered pipelines with stage-based execution plans
|
|
192
|
+
|
|
193
|
+
## Wave 4 Status (In Progress)
|
|
194
|
+
Wave 4 self-healing implementation is now complete:
|
|
195
|
+
- Optional locator fallback chain support
|
|
196
|
+
- DOM re-evaluation retry support for resilient element resolution
|
|
197
|
+
- Config contract for resilience policy in config/config.yaml
|
|
198
|
+
- Confidence-scored fallback selection based on retries and fallback depth
|
|
199
|
+
- JSONL audit log output for each recovery action when enabled
|
|
200
|
+
|
|
201
|
+
Wave 4 distribution packaging baseline is now implemented:
|
|
202
|
+
- PEP 621 package metadata in pyproject.toml
|
|
203
|
+
- Source and wheel artifact manifest support via MANIFEST.in
|
|
204
|
+
- Internal package build helper and wrappers:
|
|
205
|
+
- scripts/build_internal_package.py
|
|
206
|
+
- scripts/build_internal_package.bat
|
|
207
|
+
- scripts/build_internal_package.sh
|
|
208
|
+
|
|
209
|
+
Remaining for Wave 4:
|
|
210
|
+
- Semantic versioning, release channels, and compatibility matrix governance
|
|
211
|
+
- Automated release notes from conventional commit history
|
|
212
|
+
|
|
213
|
+
## CI/CD Notes
|
|
214
|
+
Framework supports GitHub Actions, Jenkins, and Azure DevOps pipelines through:
|
|
215
|
+
- deterministic command-line execution
|
|
216
|
+
- marker-based selective runs
|
|
217
|
+
- parallel execution with pytest-xdist
|
|
218
|
+
- rerun support for flaky tests via pytest-rerunfailures
|
|
219
|
+
|
|
220
|
+
## Security Scan Reports
|
|
221
|
+
Security scan tooling includes pip-audit, bandit, gitleaks, and sec-report-kit.
|
|
222
|
+
|
|
223
|
+
The security scripts are self-bootstrapping and do the following automatically:
|
|
224
|
+
- create .venv if missing
|
|
225
|
+
- activate the virtual environment
|
|
226
|
+
- upgrade pip
|
|
227
|
+
- install dependencies from requirements.txt and requirements-dev.txt
|
|
228
|
+
- run pip-audit, bandit, gitleaks detect (committed history), and gitleaks dir (working tree) and generate JSON outputs
|
|
229
|
+
- render individual HTML reports and a consolidated HTML report using sec-report-kit
|
|
230
|
+
|
|
231
|
+
Scripts:
|
|
232
|
+
- scripts/run_security_reports.bat
|
|
233
|
+
- scripts/run_security_reports.sh
|
|
234
|
+
|
|
235
|
+
Note:
|
|
236
|
+
- scripts prefer repo-local gitleaks binary if present (for example gitleaks_8.30.1/gitleaks.exe), otherwise they use PATH.
|
|
237
|
+
- the gitleaks dir scan is intentionally limited to tracked project source folders and key files, so third-party package code under .venv is not scanned.
|
|
238
|
+
|
|
239
|
+
Install gitleaks CLI:
|
|
240
|
+
|
|
241
|
+
Windows (winget):
|
|
242
|
+
```powershell
|
|
243
|
+
winget install --id Gitleaks.Gitleaks -e
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Windows (choco):
|
|
247
|
+
```powershell
|
|
248
|
+
choco install gitleaks
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
macOS (brew):
|
|
252
|
+
```bash
|
|
253
|
+
brew install gitleaks
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Linux (Homebrew/Linuxbrew):
|
|
257
|
+
```bash
|
|
258
|
+
brew install gitleaks
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Run on Windows:
|
|
262
|
+
|
|
263
|
+
```powershell
|
|
264
|
+
scripts\run_security_reports.bat
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Run on Linux/macOS:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
bash scripts/run_security_reports.sh
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Outputs:
|
|
274
|
+
- JSON reports: reports/secutiry_reports/json/
|
|
275
|
+
- pip_audit_report.json
|
|
276
|
+
- bandit_report.json
|
|
277
|
+
- gitleaks_git_report.json
|
|
278
|
+
- gitleaks_dir_report.json
|
|
279
|
+
- HTML reports: reports/secutiry_reports/html/
|
|
280
|
+
- pip_audit_report.html
|
|
281
|
+
- bandit_report.html
|
|
282
|
+
- gitleaks_git_report.html
|
|
283
|
+
- gitleaks_dir_report.html
|
|
284
|
+
- Consolidated HTML report: reports/secutiry_reports/html/security_consolidated_report.html
|
|
285
|
+
|
|
286
|
+
## Unit Test Coverage
|
|
287
|
+
Run framework unit tests with coverage metrics.
|
|
288
|
+
|
|
289
|
+
Windows:
|
|
290
|
+
|
|
291
|
+
```powershell
|
|
292
|
+
scripts\run_unit_tests_with_coverage.bat
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Linux/macOS:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
bash scripts/run_unit_tests_with_coverage.sh
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Coverage outputs:
|
|
302
|
+
- Terminal summary with missing lines
|
|
303
|
+
- HTML report: reports/coverage-html/index.html
|
|
304
|
+
- XML report: reports/coverage.xml
|
|
305
|
+
|
|
306
|
+
## Design and Extension Guidance
|
|
307
|
+
- Keep locators in page classes only.
|
|
308
|
+
- Keep tests business-readable and independent.
|
|
309
|
+
- Avoid hardcoded secrets and environment-specific values in test code.
|
|
310
|
+
- Extend under existing layers to preserve maintainability and onboarding simplicity.
|