@sridharkikkeri/playwright-common 1.0.21 → 1.0.23
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/CLEAN_IMPORTS.md +184 -0
- package/NPM_PUBLISHING.md +213 -0
- package/PUBLISHED.md +153 -0
- package/QUICK_FIX.md +40 -0
- package/api-docs/assets/hierarchy.js +1 -0
- package/api-docs/assets/highlight.css +71 -0
- package/api-docs/assets/icons.js +18 -0
- package/api-docs/assets/icons.svg +1 -0
- package/api-docs/assets/main.js +60 -0
- package/api-docs/assets/navigation.js +1 -0
- package/api-docs/assets/search.js +1 -0
- package/api-docs/assets/style.css +1633 -0
- package/api-docs/classes/ActionOrchestrator.html +9 -0
- package/api-docs/classes/AllureUtil.html +12 -0
- package/api-docs/classes/ApiClient.html +28 -0
- package/api-docs/classes/BasePage.html +14 -0
- package/api-docs/classes/ConfigManager.html +6 -0
- package/api-docs/classes/CookieAuth.html +6 -0
- package/api-docs/classes/ElementProfileStore.html +11 -0
- package/api-docs/classes/ElementWrapper.html +35 -0
- package/api-docs/classes/ErrorUtils.html +7 -0
- package/api-docs/classes/Localization.html +8 -0
- package/api-docs/classes/LocatorHealing.html +14 -0
- package/api-docs/classes/Logger.html +7 -0
- package/api-docs/classes/LoginPage.html +19 -0
- package/api-docs/classes/OAuth2Auth.html +5 -0
- package/api-docs/hierarchy.html +1 -0
- package/api-docs/index.html +85 -0
- package/api-docs/interfaces/ApiRequestOptions.html +14 -0
- package/api-docs/interfaces/ApiResponse.html +13 -0
- package/api-docs/interfaces/AuthStrategy.html +4 -0
- package/api-docs/interfaces/ElementProfile.html +7 -0
- package/api-docs/interfaces/FileAttachment.html +8 -0
- package/api-docs/interfaces/FrameworkConfig.html +4 -0
- package/api-docs/modules.html +1 -0
- package/api-docs/types/FrameworkFixtures.html +12 -0
- package/api-docs/types/HttpMethod.html +2 -0
- package/api-docs/variables/test.html +2 -0
- package/create-healthedge-tests.js +80 -337
- package/package.json +8 -2
- package/src/core/api/ApiClient.ts +289 -0
- package/src/core/api/auth/AuthStrategy.ts +11 -0
- package/src/core/api/auth/CookieAuth.ts +36 -0
- package/src/core/api/auth/OAuth2Auth.ts +46 -0
- package/src/core/config/ConfigManager.ts +72 -0
- package/src/core/i18n/Localization.ts +34 -0
- package/src/core/i18n/en.json +5 -0
- package/src/core/pages/BasePage.ts +47 -0
- package/src/core/reporting/AllureUtil.ts +35 -0
- package/src/core/selfhealing/ActionOrchestrator.ts +117 -0
- package/src/core/selfhealing/ElementProfileStore.ts +76 -0
- package/src/core/selfhealing/LocatorHealing.ts +84 -0
- package/src/core/utils/ErrorUtils.ts +21 -0
- package/src/core/utils/Logger.ts +14 -0
- package/src/core/visual/VisualTesting.ts +95 -0
- package/src/core/wrappers/ElementWrapper.ts +211 -0
- package/src/fixtures/fixtures.ts +90 -0
- package/src/index.ts +17 -0
- package/src/quality/pages/LoginPage.ts +36 -0
- package/src/tests/visual.spec.ts +38 -0
- package/src/tests/visual.spec.ts-snapshots/header-element-darwin.png +0 -0
- package/src/tests/visual.spec.ts-snapshots/playwright-homepage-darwin.png +0 -0
- package/src/tests/visual.spec.ts-snapshots/viewport-masked-darwin.png +0 -0
package/CLEAN_IMPORTS.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Clean Import Guide (v1.0.1+)
|
|
2
|
+
|
|
3
|
+
## ✅ What Changed in v1.0.1
|
|
4
|
+
|
|
5
|
+
**Before (v1.0.0):**
|
|
6
|
+
```typescript
|
|
7
|
+
// ❌ Ugly deep imports
|
|
8
|
+
import { test } from '@sridharkikkeri/playwright-common/dist/com/healthedge/common/fixtures/fixtures';
|
|
9
|
+
import { BasePage } from '@sridharkikkeri/playwright-common/dist/com/healthedge/common/core/pages/BasePage';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**After (v1.0.1):**
|
|
13
|
+
```typescript
|
|
14
|
+
// ✅ Clean barrel imports
|
|
15
|
+
import { test, BasePage, VisualTesting } from '@sridharkikkeri/playwright-common';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Usage Examples
|
|
21
|
+
|
|
22
|
+
### Basic Test
|
|
23
|
+
```typescript
|
|
24
|
+
import { test } from '@sridharkikkeri/playwright-common';
|
|
25
|
+
|
|
26
|
+
test('My test', async ({ page }) => {
|
|
27
|
+
await page.goto('https://example.com');
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Page Object Pattern
|
|
32
|
+
```typescript
|
|
33
|
+
import { BasePage } from '@sridharkikkeri/playwright-common';
|
|
34
|
+
import { Page } from '@playwright/test';
|
|
35
|
+
|
|
36
|
+
export class LoginPage extends BasePage {
|
|
37
|
+
constructor(page: Page) {
|
|
38
|
+
super(page, 'LoginPage');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private readonly username = this.element('#username');
|
|
42
|
+
private readonly loginBtn = this.element('button[type="submit"]');
|
|
43
|
+
|
|
44
|
+
async login(user: string) {
|
|
45
|
+
await this.username.fill(user, 'Enter username');
|
|
46
|
+
await this.loginBtn.click('Click login');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Visual Testing
|
|
52
|
+
```typescript
|
|
53
|
+
import { test, VisualTesting } from '@sridharkikkeri/playwright-common';
|
|
54
|
+
|
|
55
|
+
test('Visual regression', async ({ page }) => {
|
|
56
|
+
const visual = new VisualTesting(page);
|
|
57
|
+
await page.goto('/dashboard');
|
|
58
|
+
await visual.compareFullPage({ name: 'dashboard' });
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### API Testing
|
|
63
|
+
```typescript
|
|
64
|
+
import { test, ApiClient } from '@sridharkikkeri/playwright-common';
|
|
65
|
+
|
|
66
|
+
test('API test', async ({ request }) => {
|
|
67
|
+
const client = new ApiClient(request);
|
|
68
|
+
const response = await client.get('/api/users/1');
|
|
69
|
+
expect(response.status).toBe(200);
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Configuration
|
|
74
|
+
```typescript
|
|
75
|
+
import { ConfigManager } from '@sridharkikkeri/playwright-common';
|
|
76
|
+
|
|
77
|
+
const config = ConfigManager.getConfig();
|
|
78
|
+
console.log(config.healingEnabled); // true
|
|
79
|
+
console.log(config.environment); // 'dev'
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Localization
|
|
83
|
+
```typescript
|
|
84
|
+
import { Localization } from '@sridharkikkeri/playwright-common';
|
|
85
|
+
|
|
86
|
+
const message = Localization.get('welcome_message', 'en');
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Allure Reporting
|
|
90
|
+
```typescript
|
|
91
|
+
import { AllureUtil } from '@sridharkikkeri/playwright-common';
|
|
92
|
+
|
|
93
|
+
await AllureUtil.step('Custom step', async () => {
|
|
94
|
+
// Your logic
|
|
95
|
+
AllureUtil.attachJson('Data', { key: 'value' });
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## All Available Exports
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import {
|
|
105
|
+
// Testing
|
|
106
|
+
test,
|
|
107
|
+
|
|
108
|
+
// Pages
|
|
109
|
+
BasePage,
|
|
110
|
+
LoginPage,
|
|
111
|
+
|
|
112
|
+
// Wrappers
|
|
113
|
+
ElementWrapper,
|
|
114
|
+
|
|
115
|
+
// Self-Healing
|
|
116
|
+
ActionOrchestrator,
|
|
117
|
+
LocatorHealing,
|
|
118
|
+
ElementProfileStore,
|
|
119
|
+
|
|
120
|
+
// API
|
|
121
|
+
ApiClient,
|
|
122
|
+
AuthStrategy,
|
|
123
|
+
CookieAuth,
|
|
124
|
+
OAuth2Auth,
|
|
125
|
+
|
|
126
|
+
// Visual
|
|
127
|
+
VisualTesting,
|
|
128
|
+
|
|
129
|
+
// Config
|
|
130
|
+
ConfigManager,
|
|
131
|
+
|
|
132
|
+
// i18n
|
|
133
|
+
Localization,
|
|
134
|
+
|
|
135
|
+
// Reporting
|
|
136
|
+
AllureUtil,
|
|
137
|
+
|
|
138
|
+
// Utils
|
|
139
|
+
Logger,
|
|
140
|
+
ErrorUtils
|
|
141
|
+
} from '@sridharkikkeri/playwright-common';
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## TypeScript Support
|
|
147
|
+
|
|
148
|
+
Full TypeScript support with auto-completion:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { BasePage } from '@sridharkikkeri/playwright-common';
|
|
152
|
+
// ^
|
|
153
|
+
// VS Code will show type hints and documentation
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Migration from v1.0.0 to v1.0.1
|
|
159
|
+
|
|
160
|
+
**Find and replace in your project:**
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Old pattern
|
|
164
|
+
@sridharkikkeri/playwright-common/dist/com/healthedge/common/
|
|
165
|
+
|
|
166
|
+
# New pattern
|
|
167
|
+
@sridharkikkeri/playwright-common
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Or use this script:**
|
|
171
|
+
```bash
|
|
172
|
+
find . -name "*.ts" -type f -exec sed -i '' \
|
|
173
|
+
's|@sridharkikkeri/playwright-common/dist/com/healthedge/common/[^'"'"']*|@sridharkikkeri/playwright-common|g' {} +
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Installation
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npm install @sridharkikkeri/playwright-common@latest
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Package URL:** https://www.npmjs.com/package/@sridharkikkeri/playwright-common
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# NPM Publishing Guide
|
|
2
|
+
|
|
3
|
+
## Package Information
|
|
4
|
+
- **Name**: `@healthedge/playwright-common`
|
|
5
|
+
- **Version**: `1.0.0`
|
|
6
|
+
- **Size**: ~34 KB (compressed)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Pre-Publish Checklist
|
|
11
|
+
|
|
12
|
+
✅ TypeScript compiled to `dist/`
|
|
13
|
+
✅ Type definitions generated
|
|
14
|
+
✅ Documentation included (README, HEALING_CACHE_STRATEGY, VISUAL_TESTING)
|
|
15
|
+
✅ Project generator script included
|
|
16
|
+
✅ Test files excluded from package
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Publishing Steps
|
|
21
|
+
|
|
22
|
+
### 1. Enable 2FA on NPM Account (Web Interface)
|
|
23
|
+
**NPM no longer supports TOTP via CLI. Use web interface:**
|
|
24
|
+
|
|
25
|
+
1. Go to https://www.npmjs.com/settings/YOUR_USERNAME/tfa
|
|
26
|
+
2. Click "Add 2FA Method"
|
|
27
|
+
3. Choose "Authenticator App" or "Security Key"
|
|
28
|
+
4. Follow setup instructions
|
|
29
|
+
5. Save backup codes
|
|
30
|
+
|
|
31
|
+
**OR use Automation Token (recommended for publishing):**
|
|
32
|
+
1. Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
|
|
33
|
+
2. Click "Generate New Token"
|
|
34
|
+
3. Select **"Automation"** type (bypasses 2FA)
|
|
35
|
+
4. Copy token and save securely
|
|
36
|
+
5. Use token for publishing:
|
|
37
|
+
```bash
|
|
38
|
+
npm config set //registry.npmjs.org/:_authToken YOUR_TOKEN
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Test Package Locally
|
|
42
|
+
```bash
|
|
43
|
+
# Build the package
|
|
44
|
+
npm run build
|
|
45
|
+
|
|
46
|
+
# Test package contents
|
|
47
|
+
npm pack --dry-run
|
|
48
|
+
|
|
49
|
+
# Create tarball for local testing
|
|
50
|
+
npm pack
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Test in Another Project
|
|
54
|
+
```bash
|
|
55
|
+
# In another project directory
|
|
56
|
+
npm install /path/to/healthedge-playwright-common-1.0.0.tgz
|
|
57
|
+
|
|
58
|
+
# Test imports
|
|
59
|
+
import { BasePage, VisualTesting, test } from '@healthedge/playwright-common';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. Login to NPM
|
|
63
|
+
```bash
|
|
64
|
+
# If using automation token, skip this step
|
|
65
|
+
# Token is already configured in step 1
|
|
66
|
+
|
|
67
|
+
# If using 2FA with authenticator app:
|
|
68
|
+
npm login
|
|
69
|
+
# Enter credentials + 2FA code when prompted
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 5. Publish to NPM
|
|
73
|
+
```bash
|
|
74
|
+
# With automation token (no 2FA prompt)
|
|
75
|
+
npm publish --access public
|
|
76
|
+
|
|
77
|
+
# With 2FA authenticator (enter code when prompted)
|
|
78
|
+
npm publish --access public
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 6. Verify Publication
|
|
82
|
+
```bash
|
|
83
|
+
npm view @healthedge/playwright-common
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Installation (After Publishing)
|
|
89
|
+
|
|
90
|
+
### For End Users
|
|
91
|
+
```bash
|
|
92
|
+
# Install the framework
|
|
93
|
+
npm install @healthedge/playwright-common
|
|
94
|
+
|
|
95
|
+
# Create new project
|
|
96
|
+
npx create-healthedge-tests my-project
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Usage
|
|
100
|
+
```typescript
|
|
101
|
+
import { test, BasePage, VisualTesting } from '@healthedge/playwright-common';
|
|
102
|
+
|
|
103
|
+
test('My test', async ({ page }) => {
|
|
104
|
+
// Use framework features
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Version Management
|
|
111
|
+
|
|
112
|
+
### Update Version
|
|
113
|
+
```bash
|
|
114
|
+
# Patch (1.0.0 -> 1.0.1)
|
|
115
|
+
npm version patch
|
|
116
|
+
|
|
117
|
+
# Minor (1.0.0 -> 1.1.0)
|
|
118
|
+
npm version minor
|
|
119
|
+
|
|
120
|
+
# Major (1.0.0 -> 2.0.0)
|
|
121
|
+
npm version major
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Publish Update
|
|
125
|
+
```bash
|
|
126
|
+
npm run build
|
|
127
|
+
npm publish
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## CI/CD Publishing (GitHub Actions)
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
name: Publish to NPM
|
|
136
|
+
|
|
137
|
+
on:
|
|
138
|
+
release:
|
|
139
|
+
types: [created]
|
|
140
|
+
|
|
141
|
+
jobs:
|
|
142
|
+
publish:
|
|
143
|
+
runs-on: ubuntu-latest
|
|
144
|
+
steps:
|
|
145
|
+
- uses: actions/checkout@v3
|
|
146
|
+
- uses: actions/setup-node@v3
|
|
147
|
+
with:
|
|
148
|
+
node-version: '18'
|
|
149
|
+
registry-url: 'https://registry.npmjs.org'
|
|
150
|
+
|
|
151
|
+
- run: npm ci
|
|
152
|
+
- run: npm run build
|
|
153
|
+
- run: npm publish --access public
|
|
154
|
+
env:
|
|
155
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Troubleshooting
|
|
161
|
+
|
|
162
|
+
### Issue: 403 Forbidden - 2FA required
|
|
163
|
+
**Solution**: Use Automation Token (easiest)
|
|
164
|
+
1. Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
|
|
165
|
+
2. Generate "Automation" token
|
|
166
|
+
3. Configure:
|
|
167
|
+
```bash
|
|
168
|
+
npm config set //registry.npmjs.org/:_authToken YOUR_TOKEN
|
|
169
|
+
npm publish --access public
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Issue: TOTP 2FA no longer supported via CLI
|
|
173
|
+
**Solution**: NPM deprecated CLI-based 2FA setup. Use web interface at https://www.npmjs.com/settings/YOUR_USERNAME/tfa or use Automation tokens instead.
|
|
174
|
+
|
|
175
|
+
### Issue: Package name already exists
|
|
176
|
+
**Solution**: Change package name in `package.json` or use scoped name like `@yourorg/playwright-common`
|
|
177
|
+
|
|
178
|
+
### Issue: Build fails
|
|
179
|
+
**Solution**: Run `npm run build` and fix TypeScript errors
|
|
180
|
+
|
|
181
|
+
### Issue: Large package size
|
|
182
|
+
**Solution**: Check `.npmignore` to exclude unnecessary files
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Package Registry Alternatives
|
|
187
|
+
|
|
188
|
+
### GitHub Packages
|
|
189
|
+
```bash
|
|
190
|
+
# Update package.json
|
|
191
|
+
"publishConfig": {
|
|
192
|
+
"registry": "https://npm.pkg.github.com"
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
# Publish
|
|
196
|
+
npm publish
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Private Registry (Artifactory, Verdaccio)
|
|
200
|
+
```bash
|
|
201
|
+
npm config set registry https://your-registry.com
|
|
202
|
+
npm publish
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Post-Publish
|
|
208
|
+
|
|
209
|
+
1. Update README with installation instructions
|
|
210
|
+
2. Create GitHub release with changelog
|
|
211
|
+
3. Announce on team channels
|
|
212
|
+
4. Update documentation site
|
|
213
|
+
5. Monitor npm download stats: `npm view @healthedge/playwright-common`
|
package/PUBLISHED.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# 🎉 Package Published Successfully!
|
|
2
|
+
|
|
3
|
+
## Package Details
|
|
4
|
+
- **Name**: `@sridharkikkeri/playwright-common`
|
|
5
|
+
- **Version**: `1.0.0`
|
|
6
|
+
- **Published**: ✅ Live on NPM
|
|
7
|
+
- **Size**: 131.3 kB (unpacked), 33.9 kB (tarball)
|
|
8
|
+
- **NPM Page**: https://www.npmjs.com/package/@sridharkikkeri/playwright-common
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### For End Users
|
|
15
|
+
```bash
|
|
16
|
+
# Install the framework (use latest for clean imports)
|
|
17
|
+
npm install @sridharkikkeri/playwright-common@latest
|
|
18
|
+
|
|
19
|
+
# Or create new project with generator
|
|
20
|
+
npx create-healthedge-tests my-project
|
|
21
|
+
cd my-project
|
|
22
|
+
npm install
|
|
23
|
+
npm run test:dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Clean Imports (v1.0.1+)
|
|
27
|
+
```typescript
|
|
28
|
+
// ✅ Clean barrel imports
|
|
29
|
+
import { test, BasePage, VisualTesting } from '@sridharkikkeri/playwright-common';
|
|
30
|
+
|
|
31
|
+
// ❌ Don't use deep imports (v1.0.0 style)
|
|
32
|
+
import { test } from '@sridharkikkeri/playwright-common/dist/com/healthedge/common/...';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
See [CLEAN_IMPORTS.md](./CLEAN_IMPORTS.md) for complete usage guide.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Usage Examples
|
|
40
|
+
|
|
41
|
+
### Basic Test
|
|
42
|
+
```typescript
|
|
43
|
+
import { test, BasePage } from '@sridharkikkeri/playwright-common';
|
|
44
|
+
|
|
45
|
+
test('My first test', async ({ page }) => {
|
|
46
|
+
await page.goto('https://example.com');
|
|
47
|
+
// Your test logic
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Visual Regression
|
|
52
|
+
```typescript
|
|
53
|
+
import { test, VisualTesting } from '@sridharkikkeri/playwright-common';
|
|
54
|
+
|
|
55
|
+
test('Visual check', async ({ page }) => {
|
|
56
|
+
const visual = new VisualTesting(page);
|
|
57
|
+
await page.goto('/dashboard');
|
|
58
|
+
await visual.compareFullPage({ name: 'dashboard' });
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Page Object Pattern
|
|
63
|
+
```typescript
|
|
64
|
+
import { BasePage } from '@sridharkikkeri/playwright-common';
|
|
65
|
+
|
|
66
|
+
export class LoginPage extends BasePage {
|
|
67
|
+
constructor(page) {
|
|
68
|
+
super(page, 'LoginPage');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private readonly username = this.element('#username');
|
|
72
|
+
private readonly password = this.element('#password');
|
|
73
|
+
private readonly loginBtn = this.element('button[type="submit"]');
|
|
74
|
+
|
|
75
|
+
async login(user: string, pass: string) {
|
|
76
|
+
await this.username.fill(user, 'Enter username');
|
|
77
|
+
await this.password.fill(pass, 'Enter password');
|
|
78
|
+
await this.loginBtn.click('Click login');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Features Included
|
|
86
|
+
|
|
87
|
+
✅ **AI-Powered Self-Healing** - Automatic locator recovery
|
|
88
|
+
✅ **Visual Regression Testing** - Built-in snapshot comparison
|
|
89
|
+
✅ **Environment Configs** - dev, qa, auto, staging, prod
|
|
90
|
+
✅ **API Testing** - Robust ApiClient with auth strategies
|
|
91
|
+
✅ **Allure Reporting** - Integrated test reporting
|
|
92
|
+
✅ **Localization (i18n)** - Multi-language support
|
|
93
|
+
✅ **Enterprise Fixtures** - Zero-boilerplate test setup
|
|
94
|
+
✅ **Project Generator** - Bootstrap new projects instantly
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Documentation
|
|
99
|
+
|
|
100
|
+
- [README](https://github.com/healthedge/playwright-framework#readme)
|
|
101
|
+
- [Healing Cache Strategy](./HEALING_CACHE_STRATEGY.md)
|
|
102
|
+
- [Visual Testing Guide](./VISUAL_TESTING.md)
|
|
103
|
+
- [NPM Publishing Guide](./NPM_PUBLISHING.md)
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Next Steps
|
|
108
|
+
|
|
109
|
+
### Update Package
|
|
110
|
+
```bash
|
|
111
|
+
# Bump version
|
|
112
|
+
npm version patch # 1.0.0 -> 1.0.1
|
|
113
|
+
npm version minor # 1.0.0 -> 1.1.0
|
|
114
|
+
npm version major # 1.0.0 -> 2.0.0
|
|
115
|
+
|
|
116
|
+
# Rebuild and publish
|
|
117
|
+
npm run build
|
|
118
|
+
npm publish --access public
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Share with Team
|
|
122
|
+
```bash
|
|
123
|
+
# Share installation command
|
|
124
|
+
npm install @sridharkikkeri/playwright-common
|
|
125
|
+
|
|
126
|
+
# Or share project generator
|
|
127
|
+
npx create-healthedge-tests my-project
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Stats & Monitoring
|
|
133
|
+
|
|
134
|
+
**View package stats:**
|
|
135
|
+
- NPM page: https://www.npmjs.com/package/@sridharkikkeri/playwright-common
|
|
136
|
+
- Download stats: https://npm-stat.com/charts.html?package=@sridharkikkeri/playwright-common
|
|
137
|
+
|
|
138
|
+
**Monitor usage:**
|
|
139
|
+
```bash
|
|
140
|
+
npm view @sridharkikkeri/playwright-common
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Support
|
|
146
|
+
|
|
147
|
+
For issues or questions:
|
|
148
|
+
- GitHub Issues: https://github.com/healthedge/playwright-framework/issues
|
|
149
|
+
- Email: sridharkikkeri@gmail.com
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
**Congratulations! Your framework is now available to the world! 🚀**
|
package/QUICK_FIX.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Quick Fix: NPM Token Issue
|
|
2
|
+
|
|
3
|
+
## Steps to Publish
|
|
4
|
+
|
|
5
|
+
1. **Generate NEW Automation Token:**
|
|
6
|
+
- Go to: https://www.npmjs.com/settings/sridharkikkeri/tokens
|
|
7
|
+
- Click "Generate New Token"
|
|
8
|
+
- Select **"Automation"** (NOT Classic or Publish)
|
|
9
|
+
- Copy the token
|
|
10
|
+
|
|
11
|
+
2. **Clear old config and set new token:**
|
|
12
|
+
```bash
|
|
13
|
+
npm config delete //registry.npmjs.org/:_authToken
|
|
14
|
+
npm config set //registry.npmjs.org/:_authToken YOUR_NEW_TOKEN_HERE
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
3. **Verify token works:**
|
|
18
|
+
```bash
|
|
19
|
+
npm whoami
|
|
20
|
+
# Should show: sridharkikkeri
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
4. **Publish:**
|
|
24
|
+
```bash
|
|
25
|
+
npm publish --access public
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Alternative: Use unscoped name (no @ prefix)
|
|
29
|
+
|
|
30
|
+
If token issues persist, change package name to unscoped:
|
|
31
|
+
|
|
32
|
+
In `package.json`:
|
|
33
|
+
```json
|
|
34
|
+
"name": "playwright-common-healthedge"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then publish:
|
|
38
|
+
```bash
|
|
39
|
+
npm publish
|
|
40
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.hierarchyData = "eJyNj7EOgjAQht/l5qIpIiKbuppo4mgcGjigobZJWwdjeHdbDVAHxaVN7r77v/wP0EpZA/mZJoQm6YWAxkpgYbmSbvwA6h/Jrgg57JRqOW5utgECLZcl5DTOCNy0cNtCMGPQzEdq1tircOhr4whrysifRe9BR4AmQbw/OVnNLNb3QRAv017ApUVdscI5QvSrZeD9suGi1Ch9U0Kzi3dngfvgE+OpaiP1T7U0yN8yg0dW46/0npnI/iizWK19F/cFsr2quZyyDdBUla57Ang3sis="
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--light-hl-0: #D73A49;
|
|
3
|
+
--dark-hl-0: #F97583;
|
|
4
|
+
--light-hl-1: #24292E;
|
|
5
|
+
--dark-hl-1: #E1E4E8;
|
|
6
|
+
--light-hl-2: #032F62;
|
|
7
|
+
--dark-hl-2: #9ECBFF;
|
|
8
|
+
--light-hl-3: #6F42C1;
|
|
9
|
+
--dark-hl-3: #B392F0;
|
|
10
|
+
--light-hl-4: #E36209;
|
|
11
|
+
--dark-hl-4: #FFAB70;
|
|
12
|
+
--light-hl-5: #005CC5;
|
|
13
|
+
--dark-hl-5: #79B8FF;
|
|
14
|
+
--light-hl-6: #6A737D;
|
|
15
|
+
--dark-hl-6: #6A737D;
|
|
16
|
+
--light-code-background: #fff;
|
|
17
|
+
--dark-code-background: #24292e;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (prefers-color-scheme: light) { :root {
|
|
21
|
+
--hl-0: var(--light-hl-0);
|
|
22
|
+
--hl-1: var(--light-hl-1);
|
|
23
|
+
--hl-2: var(--light-hl-2);
|
|
24
|
+
--hl-3: var(--light-hl-3);
|
|
25
|
+
--hl-4: var(--light-hl-4);
|
|
26
|
+
--hl-5: var(--light-hl-5);
|
|
27
|
+
--hl-6: var(--light-hl-6);
|
|
28
|
+
--code-background: var(--light-code-background);
|
|
29
|
+
} }
|
|
30
|
+
|
|
31
|
+
@media (prefers-color-scheme: dark) { :root {
|
|
32
|
+
--hl-0: var(--dark-hl-0);
|
|
33
|
+
--hl-1: var(--dark-hl-1);
|
|
34
|
+
--hl-2: var(--dark-hl-2);
|
|
35
|
+
--hl-3: var(--dark-hl-3);
|
|
36
|
+
--hl-4: var(--dark-hl-4);
|
|
37
|
+
--hl-5: var(--dark-hl-5);
|
|
38
|
+
--hl-6: var(--dark-hl-6);
|
|
39
|
+
--code-background: var(--dark-code-background);
|
|
40
|
+
} }
|
|
41
|
+
|
|
42
|
+
:root[data-theme='light'] {
|
|
43
|
+
--hl-0: var(--light-hl-0);
|
|
44
|
+
--hl-1: var(--light-hl-1);
|
|
45
|
+
--hl-2: var(--light-hl-2);
|
|
46
|
+
--hl-3: var(--light-hl-3);
|
|
47
|
+
--hl-4: var(--light-hl-4);
|
|
48
|
+
--hl-5: var(--light-hl-5);
|
|
49
|
+
--hl-6: var(--light-hl-6);
|
|
50
|
+
--code-background: var(--light-code-background);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:root[data-theme='dark'] {
|
|
54
|
+
--hl-0: var(--dark-hl-0);
|
|
55
|
+
--hl-1: var(--dark-hl-1);
|
|
56
|
+
--hl-2: var(--dark-hl-2);
|
|
57
|
+
--hl-3: var(--dark-hl-3);
|
|
58
|
+
--hl-4: var(--dark-hl-4);
|
|
59
|
+
--hl-5: var(--dark-hl-5);
|
|
60
|
+
--hl-6: var(--dark-hl-6);
|
|
61
|
+
--code-background: var(--dark-code-background);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.hl-0 { color: var(--hl-0); }
|
|
65
|
+
.hl-1 { color: var(--hl-1); }
|
|
66
|
+
.hl-2 { color: var(--hl-2); }
|
|
67
|
+
.hl-3 { color: var(--hl-3); }
|
|
68
|
+
.hl-4 { color: var(--hl-4); }
|
|
69
|
+
.hl-5 { color: var(--hl-5); }
|
|
70
|
+
.hl-6 { color: var(--hl-6); }
|
|
71
|
+
pre, code { background: var(--code-background); }
|