simple-playwright-framework 0.0.14 β 0.0.16
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.
- package/README.md +160 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
π₯ Singleβclick Copyable README
|
|
2
|
+
markdown
|
|
3
|
+
# simple-playwright-framework
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
A lightweight, modular automation framework built on top of **Microsoft Playwright**.
|
|
13
|
+
It helps teams quickly bootstrap scalable UI and API test automation projects with **clean architecture, reusable fixtures, and ergonomic onboarding**.
|
|
14
|
+
|
|
15
|
+
Repository: [GitHub](https://github.com/Udayakumarg/simpleplaywrightframework)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## β¨ Key Features
|
|
20
|
+
|
|
21
|
+
- **Playwright-powered automation** for browsers and APIs
|
|
22
|
+
- **Custom fixtures** for authentication, storage state, and reusable contexts
|
|
23
|
+
- **Scenario loader** for environmentβdriven test data (JSON or API/DB integration)
|
|
24
|
+
- **Provider registry** for flexible login flows (username, email, or custom auth)
|
|
25
|
+
- **Environment-aware configuration** with safe defaults (`prod` fallback)
|
|
26
|
+
- **Reusable helpers** for file upload/download, iframe handling, and API clients
|
|
27
|
+
- **Modern reporting** with Playwright HTML, Allure, and TestRail integration
|
|
28
|
+
- **CLI scaffolding** to generate demo projects with recommended structure
|
|
29
|
+
- **CI/CD ready** with parallel safety and isolated test state
|
|
30
|
+
- **Extensible design**: plug in your own providers, loaders, or reporters
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## π¦ Installation
|
|
35
|
+
|
|
36
|
+
### 1. Install Playwright
|
|
37
|
+
```bash
|
|
38
|
+
npm install --save-dev @playwright/test playwright
|
|
39
|
+
2. Install the framework
|
|
40
|
+
bash
|
|
41
|
+
npm install simple-playwright-framework
|
|
42
|
+
π Create a Demo Project
|
|
43
|
+
Use the CLI to scaffold a readyβtoβrun project:
|
|
44
|
+
|
|
45
|
+
bash
|
|
46
|
+
npx init-demo-project
|
|
47
|
+
This generates a demo project with fixtures, config, and sample tests.
|
|
48
|
+
|
|
49
|
+
βΆοΈ Run Tests
|
|
50
|
+
Navigate into the generated project:
|
|
51
|
+
|
|
52
|
+
bash
|
|
53
|
+
cd demo-project
|
|
54
|
+
npx playwright test
|
|
55
|
+
Run with Playwright UI runner:
|
|
56
|
+
|
|
57
|
+
bash
|
|
58
|
+
npx playwright test --ui
|
|
59
|
+
π§ͺ Example Test
|
|
60
|
+
ts
|
|
61
|
+
import { test, expect } from '@playwright/test';
|
|
62
|
+
import { scenarioLoader } from 'simple-playwright-framework';
|
|
63
|
+
|
|
64
|
+
test('login works', async ({ page }) => {
|
|
65
|
+
const data = scenarioLoader(__filename).get("validLogin");
|
|
66
|
+
await page.goto(data.baseUrl);
|
|
67
|
+
await page.fill('#username', data.username);
|
|
68
|
+
await page.fill('#password', data.password);
|
|
69
|
+
await page.click('#login');
|
|
70
|
+
await expect(page).toHaveURL(/dashboard/);
|
|
71
|
+
});
|
|
72
|
+
π Project Structure
|
|
73
|
+
Example demo project:
|
|
74
|
+
|
|
75
|
+
Code
|
|
76
|
+
demo-project
|
|
77
|
+
β
|
|
78
|
+
βββ tests
|
|
79
|
+
β βββ login.spec.ts
|
|
80
|
+
β
|
|
81
|
+
βββ pages
|
|
82
|
+
β βββ login.page.ts
|
|
83
|
+
β
|
|
84
|
+
βββ utils
|
|
85
|
+
β βββ apiClient.ts
|
|
86
|
+
β
|
|
87
|
+
βββ config
|
|
88
|
+
β βββ environments.ts
|
|
89
|
+
β
|
|
90
|
+
βββ auth
|
|
91
|
+
β βββ storageState.json
|
|
92
|
+
β
|
|
93
|
+
βββ playwright.config.ts
|
|
94
|
+
π Environment Configuration
|
|
95
|
+
ts
|
|
96
|
+
export const environments = {
|
|
97
|
+
dev: { baseUrl: "https://dev.example.com" },
|
|
98
|
+
qa: { baseUrl: "https://qa.example.com" },
|
|
99
|
+
prod:{ baseUrl: "https://prod.example.com" }
|
|
100
|
+
};
|
|
101
|
+
Run against different environments without changing test logic.
|
|
102
|
+
|
|
103
|
+
π Reporting
|
|
104
|
+
Supports:
|
|
105
|
+
|
|
106
|
+
Playwright HTML reports
|
|
107
|
+
|
|
108
|
+
Allure reports
|
|
109
|
+
|
|
110
|
+
TestRail integration
|
|
111
|
+
|
|
112
|
+
Generate Playwright report:
|
|
113
|
+
|
|
114
|
+
bash
|
|
115
|
+
npx playwright show-report
|
|
116
|
+
π Challenges & Solutions
|
|
117
|
+
Compiled JS confusion β moved output to dist and enforced rootβlevel exports
|
|
118
|
+
|
|
119
|
+
Demo projects bypassing fixtures β documented imports from framework only
|
|
120
|
+
|
|
121
|
+
Scenario injection limits β iterated scenarios in test bodies, reporting adapted
|
|
122
|
+
|
|
123
|
+
Environment defaults missing β added safe fallback (prod)
|
|
124
|
+
|
|
125
|
+
Dependency resolution issues β onboarding scripts install required packages
|
|
126
|
+
|
|
127
|
+
Report formatting limitations β modernized with inline CSS and branded colors
|
|
128
|
+
|
|
129
|
+
Auth provider rigidity β introduced provider registry for flexible login flows
|
|
130
|
+
|
|
131
|
+
Parallel safety concerns β kept state testβscoped, avoided global mutation
|
|
132
|
+
|
|
133
|
+
Demo project scaffolding risks β added warnings and safe file writes
|
|
134
|
+
|
|
135
|
+
π€ Contributing
|
|
136
|
+
Contributions are welcome.
|
|
137
|
+
|
|
138
|
+
Fork the repository
|
|
139
|
+
|
|
140
|
+
Create a feature branch
|
|
141
|
+
|
|
142
|
+
Commit your changes
|
|
143
|
+
|
|
144
|
+
Submit a pull request
|
|
145
|
+
|
|
146
|
+
Please ensure that code changes include appropriate tests and follow existing coding conventions.
|
|
147
|
+
|
|
148
|
+
π License
|
|
149
|
+
MIT License
|
|
150
|
+
|
|
151
|
+
π€ Author
|
|
152
|
+
Developed by Udayakumar
|
|
153
|
+
GitHub: https://github.com/Udayakumarg
|
|
154
|
+
|
|
155
|
+
Code
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
π Just copy everything above into a file named `README.md` in your repo.
|
|
160
|
+
If youβd like, I can also prepare a **shorter npm landing page version** (featur
|
package/package.json
CHANGED