@sridharkikkeri/playwright-common 1.0.5 ā 1.0.11
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 +46 -20
- package/package.json +1 -1
|
@@ -11,23 +11,38 @@ console.log(`\nš Creating HealthEdge Playwright project: ${projectName}\n`);
|
|
|
11
11
|
|
|
12
12
|
// Create project structure
|
|
13
13
|
const dirs = [
|
|
14
|
+
'src/core/api',
|
|
15
|
+
'src/core/config',
|
|
16
|
+
'src/core/i18n',
|
|
17
|
+
'src/core/pages',
|
|
18
|
+
'src/core/reporting',
|
|
19
|
+
'src/core/selfhealing',
|
|
20
|
+
'src/core/utils',
|
|
21
|
+
'src/core/visual',
|
|
22
|
+
'src/core/wrappers',
|
|
14
23
|
'src/pages',
|
|
15
24
|
'src/tests',
|
|
16
25
|
'src/fixtures',
|
|
17
26
|
'src/i18n',
|
|
18
27
|
'src/utils',
|
|
19
28
|
'allure-results',
|
|
20
|
-
'allure-report'
|
|
29
|
+
'allure-report',
|
|
30
|
+
'api-docs/assets',
|
|
31
|
+
'api-docs/classes',
|
|
32
|
+
'api-docs/interfaces',
|
|
33
|
+
'api-docs/types',
|
|
34
|
+
'api-docs/variables'
|
|
21
35
|
];
|
|
22
36
|
|
|
23
|
-
dirs.forEach(
|
|
24
|
-
fs.mkdirSync(path.join(projectPath,
|
|
37
|
+
dirs.forEach(idr => {
|
|
38
|
+
fs.mkdirSync(path.join(projectPath, idr), { recursive: true });
|
|
25
39
|
});
|
|
26
40
|
|
|
27
41
|
// package.json
|
|
28
42
|
const packageJson = {
|
|
29
43
|
name: projectName,
|
|
30
44
|
version: '1.0.0',
|
|
45
|
+
description: 'HealthEdge Playwright Test Project',
|
|
31
46
|
scripts: {
|
|
32
47
|
'test': 'playwright test',
|
|
33
48
|
'test:dev': 'TEST_ENV=dev playwright test',
|
|
@@ -40,7 +55,7 @@ const packageJson = {
|
|
|
40
55
|
'lint:fix': 'eslint . --fix'
|
|
41
56
|
},
|
|
42
57
|
dependencies: {
|
|
43
|
-
'@sridharkikkeri/playwright-common': '^1.0.
|
|
58
|
+
'@sridharkikkeri/playwright-common': '^1.0.11',
|
|
44
59
|
'@playwright/test': '^1.42.0',
|
|
45
60
|
'allure-playwright': '^3.4.5'
|
|
46
61
|
},
|
|
@@ -57,6 +72,32 @@ fs.writeFileSync(
|
|
|
57
72
|
JSON.stringify(packageJson, null, 2)
|
|
58
73
|
);
|
|
59
74
|
|
|
75
|
+
// Configuration Templates
|
|
76
|
+
const baseConfig = {
|
|
77
|
+
healingEnabled: true,
|
|
78
|
+
environment: 'dev',
|
|
79
|
+
baseUrl: 'https://example.com',
|
|
80
|
+
apiUrl: 'https://api.example.com',
|
|
81
|
+
timeout: 30000,
|
|
82
|
+
retries: 2
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const environments = ['dev', 'qa', 'auto', 'staging', 'prod'];
|
|
86
|
+
|
|
87
|
+
environments.forEach(env => {
|
|
88
|
+
const config = { ...baseConfig, environment: env, baseUrl: `https://${env}.example.com`, apiUrl: `https://api-${env}.example.com` };
|
|
89
|
+
fs.writeFileSync(
|
|
90
|
+
path.join(projectPath, `framework.config.${env}.json`),
|
|
91
|
+
JSON.stringify(config, null, 2)
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Also create the default framework.config.json
|
|
96
|
+
fs.writeFileSync(
|
|
97
|
+
path.join(projectPath, 'framework.config.json'),
|
|
98
|
+
JSON.stringify(baseConfig, null, 2)
|
|
99
|
+
);
|
|
100
|
+
|
|
60
101
|
// playwright.config.ts
|
|
61
102
|
const playwrightConfig = `import { defineConfig } from '@playwright/test';
|
|
62
103
|
|
|
@@ -70,7 +111,6 @@ export default defineConfig({
|
|
|
70
111
|
['allure-playwright', { outputFolder: 'allure-results' }]
|
|
71
112
|
],
|
|
72
113
|
use: {
|
|
73
|
-
baseURL: process.env.BASE_URL || 'https://example.com',
|
|
74
114
|
trace: 'on-first-retry',
|
|
75
115
|
screenshot: 'only-on-failure',
|
|
76
116
|
},
|
|
@@ -79,21 +119,6 @@ export default defineConfig({
|
|
|
79
119
|
|
|
80
120
|
fs.writeFileSync(path.join(projectPath, 'playwright.config.ts'), playwrightConfig);
|
|
81
121
|
|
|
82
|
-
// framework.config.dev.json
|
|
83
|
-
const devConfig = {
|
|
84
|
-
healingEnabled: true,
|
|
85
|
-
environment: 'dev',
|
|
86
|
-
baseUrl: 'https://dev.example.com',
|
|
87
|
-
apiUrl: 'https://api-dev.example.com',
|
|
88
|
-
timeout: 30000,
|
|
89
|
-
retries: 2
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
fs.writeFileSync(
|
|
93
|
-
path.join(projectPath, 'framework.config.dev.json'),
|
|
94
|
-
JSON.stringify(devConfig, null, 2)
|
|
95
|
-
);
|
|
96
|
-
|
|
97
122
|
// New: src/fixtures/fixtures.ts
|
|
98
123
|
const fixturesTs = `import { test as base } from '@sridharkikkeri/playwright-common';
|
|
99
124
|
import { HomePage } from '../pages/HomePage';
|
|
@@ -221,6 +246,7 @@ Add your pages to \`src/pages\` and register them in \`src/fixtures/fixtures.ts\
|
|
|
221
246
|
|
|
222
247
|
\`\`\`bash
|
|
223
248
|
npm run test:dev # Uses framework.config.dev.json
|
|
249
|
+
npm run test:qa # Uses framework.config.qa.json
|
|
224
250
|
npm run test:staging # Uses framework.config.staging.json
|
|
225
251
|
npm run test:prod # Uses framework.config.prod.json
|
|
226
252
|
\`\`\`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sridharkikkeri/playwright-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
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",
|