@sridharkikkeri/playwright-common 1.0.27 ā 1.0.28
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/create-healthedge-tests.js +36 -44
- package/package.json +1 -1
|
@@ -11,22 +11,19 @@ console.log(`\nš Creating HealthEdge Playwright project: ${projectName}\n`);
|
|
|
11
11
|
|
|
12
12
|
// Recursive Copy Helper
|
|
13
13
|
function copyRecursiveSync(src, dest) {
|
|
14
|
-
|
|
15
|
-
const stats =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
fs.readdirSync(src).forEach((childItemName) => {
|
|
22
|
-
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
|
|
14
|
+
if (!fs.existsSync(src)) return;
|
|
15
|
+
const stats = fs.statSync(src);
|
|
16
|
+
if (stats.isDirectory()) {
|
|
17
|
+
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
18
|
+
fs.readdirSync(src).forEach((child) => {
|
|
19
|
+
copyRecursiveSync(path.join(src, child), path.join(dest, child));
|
|
23
20
|
});
|
|
24
21
|
} else {
|
|
25
22
|
fs.copyFileSync(src, dest);
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
// 1. Create
|
|
26
|
+
// 1. Create Clean Directory Structure
|
|
30
27
|
const baseDirs = [
|
|
31
28
|
'src/core',
|
|
32
29
|
'src/pages',
|
|
@@ -38,54 +35,49 @@ const baseDirs = [
|
|
|
38
35
|
];
|
|
39
36
|
|
|
40
37
|
baseDirs.forEach(d => {
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const fullPath = path.join(projectPath, d);
|
|
39
|
+
if (!fs.existsSync(fullPath)) {
|
|
40
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
43
41
|
}
|
|
44
42
|
});
|
|
45
43
|
|
|
46
|
-
// 2.
|
|
44
|
+
// 2. High-Fidelity Replication ("As It Is")
|
|
47
45
|
const frameworkRootDir = __dirname;
|
|
48
46
|
const frameworkSrc = path.join(frameworkRootDir, 'src');
|
|
49
47
|
const frameworkApiDocs = path.join(frameworkRootDir, 'api-docs');
|
|
50
48
|
|
|
51
|
-
// Copy
|
|
49
|
+
// Copy Source Code
|
|
52
50
|
if (fs.existsSync(frameworkSrc)) {
|
|
53
|
-
console.log('š Copying framework source
|
|
51
|
+
console.log('š Copying framework source logic...');
|
|
54
52
|
copyRecursiveSync(path.join(frameworkSrc, 'core'), path.join(projectPath, 'src/core'));
|
|
55
53
|
copyRecursiveSync(path.join(frameworkSrc, 'fixtures'), path.join(projectPath, 'src/fixtures'));
|
|
56
54
|
if (fs.existsSync(path.join(frameworkSrc, 'quality/pages'))) {
|
|
57
55
|
copyRecursiveSync(path.join(frameworkSrc, 'quality/pages'), path.join(projectPath, 'src/pages'));
|
|
58
56
|
}
|
|
59
|
-
if (fs.existsSync(path.join(frameworkSrc, 'tests'))) {
|
|
60
|
-
copyRecursiveSync(path.join(frameworkSrc, 'tests'), path.join(projectPath, 'src/tests'));
|
|
61
|
-
}
|
|
62
57
|
}
|
|
63
58
|
|
|
64
|
-
// Copy Documentation
|
|
59
|
+
// Copy Documentation Portal
|
|
65
60
|
if (fs.existsSync(frameworkApiDocs)) {
|
|
66
61
|
console.log('š Copying enterprise API documentation...');
|
|
67
62
|
copyRecursiveSync(frameworkApiDocs, path.join(projectPath, 'api-docs'));
|
|
68
63
|
}
|
|
69
64
|
|
|
70
|
-
// Copy
|
|
71
|
-
const
|
|
65
|
+
// Copy Core Strategy Documents
|
|
66
|
+
const strategyFiles = [
|
|
72
67
|
'HEALING_CACHE_STRATEGY.md',
|
|
73
68
|
'VISUAL_TESTING.md',
|
|
74
|
-
'
|
|
75
|
-
'NPM_PUBLISHING.md',
|
|
76
|
-
'PUBLISHED.md',
|
|
77
|
-
'QUICK_FIX.md'
|
|
69
|
+
'README.md'
|
|
78
70
|
];
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
if (fs.existsSync(
|
|
83
|
-
console.log(`š
|
|
84
|
-
fs.copyFileSync(
|
|
72
|
+
strategyFiles.forEach(file => {
|
|
73
|
+
const src = path.join(frameworkRootDir, file);
|
|
74
|
+
if (fs.existsSync(src)) {
|
|
75
|
+
console.log(`š Including ${file}...`);
|
|
76
|
+
fs.copyFileSync(src, path.join(projectPath, file));
|
|
85
77
|
}
|
|
86
78
|
});
|
|
87
79
|
|
|
88
|
-
// 3.
|
|
80
|
+
// 3. Project Configuration
|
|
89
81
|
const packageJson = {
|
|
90
82
|
name: projectName,
|
|
91
83
|
version: '1.0.0',
|
|
@@ -93,11 +85,10 @@ const packageJson = {
|
|
|
93
85
|
scripts: {
|
|
94
86
|
'test': 'playwright test',
|
|
95
87
|
'test:dev': 'TEST_ENV=dev playwright test',
|
|
96
|
-
'report': 'allure generate allure-results --clean -o allure-report && allure open allure-report',
|
|
97
88
|
'lint': 'eslint . --ext .ts'
|
|
98
89
|
},
|
|
99
90
|
dependencies: {
|
|
100
|
-
'@sridharkikkeri/playwright-common': '^1.0.
|
|
91
|
+
'@sridharkikkeri/playwright-common': '^1.0.28',
|
|
101
92
|
'@playwright/test': '^1.42.0',
|
|
102
93
|
'allure-playwright': '^3.4.5'
|
|
103
94
|
},
|
|
@@ -110,11 +101,15 @@ const packageJson = {
|
|
|
110
101
|
};
|
|
111
102
|
fs.writeFileSync(path.join(projectPath, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
112
103
|
|
|
113
|
-
//
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
// Single Framework Config (Strict Rule)
|
|
105
|
+
const config = {
|
|
106
|
+
healingEnabled: true,
|
|
107
|
+
environment: 'dev',
|
|
108
|
+
baseUrl: 'https://example.com',
|
|
109
|
+
apiUrl: 'https://api.example.com',
|
|
110
|
+
timeout: 30000
|
|
111
|
+
};
|
|
112
|
+
fs.writeFileSync(path.join(projectPath, 'framework.config.json'), JSON.stringify(config, null, 2));
|
|
118
113
|
|
|
119
114
|
const playwrightConfig = `import { defineConfig } from '@playwright/test';
|
|
120
115
|
export default defineConfig({
|
|
@@ -126,10 +121,7 @@ export default defineConfig({
|
|
|
126
121
|
fs.writeFileSync(path.join(projectPath, 'playwright.config.ts'), playwrightConfig);
|
|
127
122
|
|
|
128
123
|
const tsConfig = {
|
|
129
|
-
compilerOptions: {
|
|
130
|
-
target: 'ES2020', module: 'commonjs', lib: ['ES2020', 'DOM'],
|
|
131
|
-
strict: true, esModuleInterop: true, skipLibCheck: true, resolveJsonModule: true
|
|
132
|
-
},
|
|
124
|
+
compilerOptions: { target: 'ES2020', module: 'commonjs', lib: ['ES2020', 'DOM'], strict: true, esModuleInterop: true, skipLibCheck: true, resolveJsonModule: true },
|
|
133
125
|
include: ['src/**/*']
|
|
134
126
|
};
|
|
135
127
|
fs.writeFileSync(path.join(projectPath, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2));
|
|
@@ -137,7 +129,7 @@ fs.writeFileSync(path.join(projectPath, 'tsconfig.json'), JSON.stringify(tsConfi
|
|
|
137
129
|
const gitignore = `node_modules/\nallure-results/\nallure-report/\n.env\n*.log\n`;
|
|
138
130
|
fs.writeFileSync(path.join(projectPath, '.gitignore'), gitignore);
|
|
139
131
|
|
|
140
|
-
console.log('\nā
Enterprise Project
|
|
132
|
+
console.log('\nā
Enterprise Project Ready (Streamlined & Clean)');
|
|
141
133
|
console.log('š¦ Installing dependencies...\n');
|
|
142
134
|
|
|
143
135
|
try {
|
|
@@ -147,4 +139,4 @@ try {
|
|
|
147
139
|
console.log('\nā ļø npm install failed. Run manually.');
|
|
148
140
|
}
|
|
149
141
|
|
|
150
|
-
console.log(`\nš
|
|
142
|
+
console.log(`\nš cd ${projectName} && npm run test\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sridharkikkeri/playwright-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "Production-grade Playwright framework with AI-powered self-healing, visual regression, and enterprise features",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|