@sridharkikkeri/playwright-common 1.0.16 ā 1.0.18
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 +288 -85
- package/package.json +1 -1
|
@@ -9,9 +9,9 @@ const projectPath = path.join(process.cwd(), projectName);
|
|
|
9
9
|
|
|
10
10
|
console.log(`\nš Creating HealthEdge Playwright project: ${projectName}\n`);
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// Comprehensive Directory Structure
|
|
13
13
|
const dirs = [
|
|
14
|
-
'src/core/api',
|
|
14
|
+
'src/core/api/auth',
|
|
15
15
|
'src/core/config',
|
|
16
16
|
'src/core/i18n',
|
|
17
17
|
'src/core/pages',
|
|
@@ -38,11 +38,11 @@ dirs.forEach(idr => {
|
|
|
38
38
|
fs.mkdirSync(path.join(projectPath, idr), { recursive: true });
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
// package.json
|
|
41
|
+
// package.json for the NEW project
|
|
42
42
|
const packageJson = {
|
|
43
43
|
name: projectName,
|
|
44
44
|
version: '1.0.0',
|
|
45
|
-
description: 'HealthEdge Playwright Test Project',
|
|
45
|
+
description: 'HealthEdge Enterprise Playwright Test Project',
|
|
46
46
|
scripts: {
|
|
47
47
|
'test': 'playwright test',
|
|
48
48
|
'test:dev': 'TEST_ENV=dev playwright test',
|
|
@@ -50,12 +50,13 @@ const packageJson = {
|
|
|
50
50
|
'test:auto': 'TEST_ENV=auto playwright test',
|
|
51
51
|
'test:staging': 'TEST_ENV=staging playwright test',
|
|
52
52
|
'test:prod': 'TEST_ENV=prod playwright test',
|
|
53
|
+
'test:visual': 'playwright test src/tests/visual.spec.ts',
|
|
53
54
|
'report': 'allure generate allure-results --clean -o allure-report && allure open allure-report',
|
|
54
55
|
'lint': 'eslint .',
|
|
55
56
|
'lint:fix': 'eslint . --fix'
|
|
56
57
|
},
|
|
57
58
|
dependencies: {
|
|
58
|
-
'@sridharkikkeri/playwright-common': '^1.0.
|
|
59
|
+
'@sridharkikkeri/playwright-common': '^1.0.18',
|
|
59
60
|
'@playwright/test': '^1.42.0',
|
|
60
61
|
'allure-playwright': '^3.4.5'
|
|
61
62
|
},
|
|
@@ -69,132 +70,334 @@ const packageJson = {
|
|
|
69
70
|
|
|
70
71
|
fs.writeFileSync(path.join(projectPath, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
71
72
|
|
|
72
|
-
// ---
|
|
73
|
+
// --- ENHANCED CORE EXTENSION BOILERPLATE ---
|
|
73
74
|
|
|
74
|
-
const
|
|
75
|
-
export class BaseApiClient extends ApiClient {
|
|
76
|
-
constructor(baseUrl: string) { super(baseUrl); }
|
|
77
|
-
}`;
|
|
78
|
-
fs.writeFileSync(path.join(projectPath, 'src/core/api/BaseApiClient.ts'), baseApiClientTs);
|
|
75
|
+
const apiClientTs = `import { ApiClient as CommonApiClient } from '@sridharkikkeri/playwright-common';
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Enterprise API Client.
|
|
79
|
+
* Use this class to add project-specific headers,
|
|
80
|
+
* authentication tokens, or shared response validation.
|
|
81
|
+
*/
|
|
82
|
+
export class ApiClient extends CommonApiClient {
|
|
83
|
+
constructor(baseUrl: string) {
|
|
84
|
+
super(baseUrl);
|
|
85
|
+
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
87
|
+
async getWithAuth(endpoint: string) {
|
|
88
|
+
const token = 'YOUR_AUTH_TOKEN'; // Replace with real auth logic
|
|
89
|
+
return this.get(endpoint, {
|
|
90
|
+
headers: { 'Authorization': \`Bearer \${token}\` }
|
|
91
|
+
});
|
|
92
|
+
}
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export abstract class BaseComponent extends BasePage {
|
|
95
|
-
constructor(page: Page, orchestrator?: ActionOrchestrator) {
|
|
96
|
-
super(page, { pageName: 'BaseComponent', orchestrator });
|
|
94
|
+
async postData(endpoint: string, data: any) {
|
|
95
|
+
return this.post(endpoint, data);
|
|
97
96
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/api/ApiClient.ts'), apiClientTs);
|
|
100
100
|
|
|
101
|
-
const
|
|
102
|
-
export class ProjectReporter {
|
|
103
|
-
static async logStep(name: string) { console.log(\`[STEP] \${name}\`); }
|
|
104
|
-
}`;
|
|
105
|
-
fs.writeFileSync(path.join(projectPath, 'src/core/reporting/ProjectReporter.ts'), reporterTs);
|
|
101
|
+
const authStrategyTs = `import { CookieAuth, AuthStrategy as CommonAuthStrategy } from '@sridharkikkeri/playwright-common';
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
export class AuthStrategy extends CommonAuthStrategy {
|
|
104
|
+
async login(credentials: any): Promise<void> {
|
|
105
|
+
// Implement project-specific login logic here
|
|
106
|
+
await this.page.goto('/login');
|
|
107
|
+
await this.page.fill('#username', credentials.username);
|
|
108
|
+
await this.page.fill('#password', credentials.password);
|
|
109
|
+
await this.page.click('#login-btn');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/api/auth/AuthStrategy.ts'), authStrategyTs);
|
|
112
114
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
const configManagerTs = `import { ConfigManager as CommonConfigManager } from '@sridharkikkeri/playwright-common';
|
|
116
|
+
|
|
117
|
+
export class ConfigManager extends CommonConfigManager {
|
|
118
|
+
static getEnvironmentConfig() {
|
|
119
|
+
return this.getConfig();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static isSelfHealingEnabled() {
|
|
123
|
+
return this.getConfig().healingEnabled ?? true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
127
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/config/ConfigManager.ts'), configManagerTs);
|
|
128
|
+
|
|
129
|
+
const localizationTs = `import { Localization as CommonLocalization } from '@sridharkikkeri/playwright-common';
|
|
130
|
+
|
|
131
|
+
export class Localization extends CommonLocalization {
|
|
132
|
+
static getTranslate(key: string) {
|
|
133
|
+
return this.t(key);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/i18n/Localization.ts'), localizationTs);
|
|
118
138
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
const basePageTs = `import { Page } from '@playwright/test';
|
|
140
|
+
import { BasePage as CommonBasePage, ActionOrchestrator } from '@sridharkikkeri/playwright-common';
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Global Base Page for all project Page Objects.
|
|
144
|
+
*/
|
|
145
|
+
export abstract class BasePage extends CommonBasePage {
|
|
146
|
+
constructor(page: Page, options?: { pageName: string; orchestrator?: ActionOrchestrator }) {
|
|
147
|
+
super(page, options);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async waitForLoadingFinished() {
|
|
151
|
+
await this.page.waitForSelector('.loading-spinner', { state: 'hidden' });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/pages/BasePage.ts'), basePageTs);
|
|
156
|
+
|
|
157
|
+
const allureUtilTs = `import { AllureUtil as CommonAllureUtil } from '@sridharkikkeri/playwright-common';
|
|
158
|
+
|
|
159
|
+
export class AllureUtil extends CommonAllureUtil {
|
|
160
|
+
static async captureStep(name: string, body: () => Promise<void>) {
|
|
161
|
+
await this.step(name, body);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/reporting/AllureUtil.ts'), allureUtilTs);
|
|
166
|
+
|
|
167
|
+
const locatorHealingTs = `import { LocatorHealing as CommonLocatorHealing } from '@sridharkikkeri/playwright-common';
|
|
168
|
+
|
|
169
|
+
export class LocatorHealing extends CommonLocatorHealing {
|
|
170
|
+
// Add project-specific healing logic or custom heuristics here
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/selfhealing/LocatorHealing.ts'), locatorHealingTs);
|
|
174
|
+
|
|
175
|
+
const actionOrchestratorTs = `import { ActionOrchestrator as CommonActionOrchestrator } from '@sridharkikkeri/playwright-common';
|
|
176
|
+
|
|
177
|
+
export class ActionOrchestrator extends CommonActionOrchestrator {
|
|
178
|
+
// Extend orchestration logic here
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/selfhealing/ActionOrchestrator.ts'), actionOrchestratorTs);
|
|
182
|
+
|
|
183
|
+
const visualTestingTs = `import { VisualTesting as CommonVisualTesting } from '@sridharkikkeri/playwright-common';
|
|
184
|
+
|
|
185
|
+
export class VisualTesting extends CommonVisualTesting {
|
|
186
|
+
static async verifyFullPage(name: string) {
|
|
187
|
+
// Custom full page screenshot logic
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/visual/VisualTesting.ts'), visualTestingTs);
|
|
192
|
+
|
|
193
|
+
const elementWrapperTs = `import { ElementWrapper as CommonElementWrapper } from '@sridharkikkeri/playwright-common';
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Enterprise Element Wrapper.
|
|
197
|
+
* Extend this class to add project-specific element interactions.
|
|
198
|
+
*/
|
|
199
|
+
export class ElementWrapper extends CommonElementWrapper {
|
|
200
|
+
async clickAndLog(stepDescription?: string): Promise<void> {
|
|
201
|
+
console.log(\`[AUTO-LOG] Clicking element: \${stepDescription || 'unknown'}\`);
|
|
202
|
+
await this.click(stepDescription);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async forceFill(value: string, stepDescription?: string): Promise<void> {
|
|
206
|
+
await this.locator.fill(value, { force: true });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/wrappers/ElementWrapper.ts'), elementWrapperTs);
|
|
211
|
+
|
|
212
|
+
const loggerTs = `import { Logger as CommonLogger } from '@sridharkikkeri/playwright-common';
|
|
213
|
+
|
|
214
|
+
export class Logger extends CommonLogger {
|
|
215
|
+
static info(message: string) {
|
|
216
|
+
console.log(\`[INFO] \${message}\`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`;
|
|
220
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/utils/Logger.ts'), loggerTs);
|
|
221
|
+
|
|
222
|
+
const errorUtilsTs = `import { ErrorUtils as CommonErrorUtils } from '@sridharkikkeri/playwright-common';
|
|
223
|
+
|
|
224
|
+
export class ErrorUtils extends CommonErrorUtils {
|
|
225
|
+
// Project-specific error handling
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
fs.writeFileSync(path.join(projectPath, 'src/core/utils/ErrorUtils.ts'), errorUtilsTs);
|
|
229
|
+
|
|
230
|
+
// --- UTILS & I18N POPULATION ---
|
|
231
|
+
const stringUtilsTs = `export class StringUtils {
|
|
232
|
+
static capitalize(str: string) { return str.charAt(0).toUpperCase() + str.slice(1); }
|
|
233
|
+
static mask(str: string) { return str.replace(/./g, '*'); }
|
|
122
234
|
}`;
|
|
123
|
-
fs.writeFileSync(path.join(projectPath, 'src/
|
|
235
|
+
fs.writeFileSync(path.join(projectPath, 'src/utils/StringUtils.ts'), stringUtilsTs);
|
|
124
236
|
|
|
125
|
-
const
|
|
126
|
-
static
|
|
237
|
+
const dateUtilsTs = `export class DateUtils {
|
|
238
|
+
static now() { return new Date().toISOString(); }
|
|
239
|
+
static format(date: Date) { return date.toLocaleDateString(); }
|
|
127
240
|
}`;
|
|
128
|
-
fs.writeFileSync(path.join(projectPath, 'src/
|
|
241
|
+
fs.writeFileSync(path.join(projectPath, 'src/utils/DateUtils.ts'), dateUtilsTs);
|
|
242
|
+
|
|
243
|
+
fs.writeFileSync(path.join(projectPath, 'src/i18n/en.json'), JSON.stringify({ "welcome": "Welcome to HealthEdge" }, null, 2));
|
|
244
|
+
fs.writeFileSync(path.join(projectPath, 'src/i18n/fr.json'), JSON.stringify({ "welcome": "Bienvenue chez HealthEdge" }, null, 2));
|
|
129
245
|
|
|
130
|
-
|
|
246
|
+
// --- DOCUMENTATION ---
|
|
247
|
+
fs.writeFileSync(path.join(projectPath, 'api-docs/assets/style.css'), 'body { font-family: sans-serif; padding: 20px; line-height: 1.6; }');
|
|
248
|
+
fs.writeFileSync(path.join(projectPath, 'api-docs/index.html'), \`
|
|
249
|
+
<html>
|
|
250
|
+
<head>
|
|
251
|
+
<title>\${projectName} API Docs</title>
|
|
252
|
+
<link rel="stylesheet" href="assets/style.css">
|
|
253
|
+
</head>
|
|
254
|
+
<body>
|
|
255
|
+
<h1>\${projectName} - Enterprise API Documentation</h1>
|
|
256
|
+
<p>Welcome to the central documentation hub for your Playwright testing project.</p>
|
|
257
|
+
<ul>
|
|
258
|
+
<li><a href="classes/README.md">Class References</a></li>
|
|
259
|
+
<li><a href="interfaces/README.md">Interfaces</a></li>
|
|
260
|
+
</ul>
|
|
261
|
+
</body>
|
|
262
|
+
</html>\`);
|
|
131
263
|
|
|
132
|
-
|
|
264
|
+
['classes', 'interfaces', 'types', 'variables'].forEach(fold => {
|
|
265
|
+
fs.writeFileSync(path.join(projectPath, \`api-docs/\${fold}/README.md\`), \`# \${fold.toUpperCase()}\\nDetailed documentation for \${fold} in project \${projectName}.\`);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// --- STANDARD CONFIG & EXAMPLES ---
|
|
133
269
|
const baseConfig = { healingEnabled: true, environment: 'dev', baseUrl: 'https://example.com', apiUrl: 'https://api.example.com', timeout: 30000, retries: 2 };
|
|
134
270
|
const environments = ['dev', 'qa', 'auto', 'staging', 'prod'];
|
|
135
|
-
|
|
136
271
|
environments.forEach(env => {
|
|
137
|
-
const config = {
|
|
138
|
-
|
|
139
|
-
environment: env,
|
|
140
|
-
baseUrl: `https://${env}.example.com`,
|
|
141
|
-
apiUrl: `https://api-${env}.example.com`
|
|
142
|
-
};
|
|
143
|
-
fs.writeFileSync(path.join(projectPath, `framework.config.${env}.json`), JSON.stringify(config, null, 2));
|
|
272
|
+
const config = { ...baseConfig, environment: env, baseUrl: \`https://\${env}.example.com\`, apiUrl: \`https://api-\${env}.example.com\` };
|
|
273
|
+
fs.writeFileSync(path.join(projectPath, \`framework.config.\${env}.json\`), JSON.stringify(config, null, 2));
|
|
144
274
|
});
|
|
145
275
|
fs.writeFileSync(path.join(projectPath, 'framework.config.json'), JSON.stringify(baseConfig, null, 2));
|
|
146
276
|
|
|
147
|
-
const playwrightConfig =
|
|
277
|
+
const playwrightConfig = \`import { defineConfig } from '@playwright/test';
|
|
148
278
|
export default defineConfig({
|
|
149
|
-
testDir: './src/tests',
|
|
279
|
+
testDir: './src/tests',
|
|
280
|
+
timeout: 30000,
|
|
281
|
+
retries: process.env.CI ? 2 : 0,
|
|
150
282
|
reporter: [['html'], ['allure-playwright', { outputFolder: 'allure-results' }]],
|
|
151
283
|
use: { trace: 'on-first-retry', screenshot: 'only-on-failure' }
|
|
152
|
-
})
|
|
284
|
+
});\`;
|
|
153
285
|
fs.writeFileSync(path.join(projectPath, 'playwright.config.ts'), playwrightConfig);
|
|
154
286
|
|
|
155
|
-
const fixturesTs =
|
|
287
|
+
const fixturesTs = \`import { test as base } from '@sridharkikkeri/playwright-common';
|
|
156
288
|
import { HomePage } from '../pages/HomePage';
|
|
157
|
-
|
|
289
|
+
import { LoginPage } from '../pages/LoginPage';
|
|
290
|
+
|
|
291
|
+
export const test = base.extend<{ homePage: HomePage; loginPage: LoginPage }>({
|
|
158
292
|
homePage: async ({ page, orchestrator }, use) => { await use(new HomePage(page, orchestrator)); },
|
|
293
|
+
loginPage: async ({ page, orchestrator }, use) => { await use(new LoginPage(page, orchestrator)); },
|
|
159
294
|
});
|
|
160
|
-
|
|
295
|
+
|
|
296
|
+
export { expect } from '@playwright/test';\`;
|
|
161
297
|
fs.writeFileSync(path.join(projectPath, 'src/fixtures/fixtures.ts'), fixturesTs);
|
|
162
298
|
|
|
163
|
-
const
|
|
164
|
-
import { BasePage
|
|
299
|
+
const homePageTs = \`import { Page } from '@playwright/test';
|
|
300
|
+
import { BasePage } from '../core/pages/BasePage';
|
|
301
|
+
import { ActionOrchestrator } from '../core/selfhealing/ActionOrchestrator';
|
|
302
|
+
|
|
165
303
|
export class HomePage extends BasePage {
|
|
166
|
-
constructor(page: Page, orchestrator?: ActionOrchestrator) {
|
|
304
|
+
constructor(page: Page, orchestrator?: ActionOrchestrator) {
|
|
305
|
+
super(page, { pageName: 'HomePage', orchestrator });
|
|
306
|
+
}
|
|
167
307
|
private readonly searchBtn = this.element('button[type="submit"]');
|
|
168
|
-
async clickSearch() { await this.searchBtn.click('Click Search'); }
|
|
169
|
-
}
|
|
170
|
-
|
|
308
|
+
async clickSearch() { await this.searchBtn.click('Click Search Button'); }
|
|
309
|
+
}
|
|
310
|
+
\`;
|
|
311
|
+
fs.writeFileSync(path.join(projectPath, 'src/pages/HomePage.ts'), homePageTs);
|
|
312
|
+
|
|
313
|
+
const loginPageTs = \`import { Page } from '@playwright/test';
|
|
314
|
+
import { BasePage } from '../core/pages/BasePage';
|
|
315
|
+
import { ActionOrchestrator } from '../core/selfhealing/ActionOrchestrator';
|
|
316
|
+
|
|
317
|
+
export class LoginPage extends BasePage {
|
|
318
|
+
constructor(page: Page, orchestrator?: ActionOrchestrator) {
|
|
319
|
+
super(page, { pageName: 'LoginPage', orchestrator });
|
|
320
|
+
}
|
|
321
|
+
private readonly userField = this.element('#user');
|
|
322
|
+
private readonly passField = this.element('#pass');
|
|
323
|
+
private readonly loginBtn = this.element('#login');
|
|
324
|
+
|
|
325
|
+
async login(u: string, p: string) {
|
|
326
|
+
await this.userField.fill(u, 'Enter username');
|
|
327
|
+
await this.passField.fill(p, 'Enter password');
|
|
328
|
+
await this.loginBtn.click('Click Login');
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
\`;
|
|
332
|
+
fs.writeFileSync(path.join(projectPath, 'src/pages/LoginPage.ts'), loginPageTs);
|
|
333
|
+
|
|
334
|
+
const visualTest = \`import { test, expect } from '../fixtures/fixtures';
|
|
171
335
|
|
|
172
|
-
|
|
173
|
-
test('
|
|
336
|
+
test.describe('Enterprise Visual Regression', () => {
|
|
337
|
+
test('HP Visual Verification', async ({ page }) => {
|
|
338
|
+
await page.goto('https://playwright.dev');
|
|
339
|
+
await expect(page).toHaveScreenshot('homepage.png', {
|
|
340
|
+
mask: [page.locator('.navbar')],
|
|
341
|
+
threshold: 0.1
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
});\`;
|
|
345
|
+
fs.writeFileSync(path.join(projectPath, 'src/tests/visual.spec.ts'), visualTest);
|
|
346
|
+
|
|
347
|
+
const sampleTest = \`import { test, expect } from '../fixtures/fixtures';
|
|
348
|
+
|
|
349
|
+
test('Standard Smoke Test', async ({ page, loginPage }) => {
|
|
174
350
|
await page.goto('https://playwright.dev');
|
|
175
351
|
await expect(page).toHaveTitle(/Playwright/);
|
|
176
|
-
})
|
|
352
|
+
});\`;
|
|
177
353
|
fs.writeFileSync(path.join(projectPath, 'src/tests/sample.spec.ts'), sampleTest);
|
|
178
354
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
355
|
+
const tsConfig = {
|
|
356
|
+
compilerOptions: {
|
|
357
|
+
target: 'ES2020', module: 'commonjs', lib: ['ES2020', 'DOM'],
|
|
358
|
+
strict: true, esModuleInterop: true, skipLibCheck: true, resolveJsonModule: true
|
|
359
|
+
},
|
|
360
|
+
include: ['src/**/*']
|
|
361
|
+
};
|
|
182
362
|
fs.writeFileSync(path.join(projectPath, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2));
|
|
183
363
|
|
|
184
|
-
const gitignore =
|
|
364
|
+
const gitignore = \`node_modules/
|
|
185
365
|
allure-results/
|
|
186
366
|
allure-report/
|
|
367
|
+
test-results/
|
|
368
|
+
playwright-report/
|
|
187
369
|
.env
|
|
188
370
|
*.log
|
|
189
|
-
|
|
371
|
+
dist/
|
|
372
|
+
\`;
|
|
190
373
|
fs.writeFileSync(path.join(projectPath, '.gitignore'), gitignore);
|
|
191
374
|
|
|
192
|
-
|
|
193
|
-
|
|
375
|
+
const readme = \`# \${projectName}
|
|
376
|
+
|
|
377
|
+
## Overview
|
|
378
|
+
Enterprise automation test project powered by **@sridharkikkeri/playwright-common**.
|
|
379
|
+
|
|
380
|
+
## Getting Started
|
|
381
|
+
\\\`\\\`\\\`bash
|
|
382
|
+
npm install
|
|
383
|
+
npm run test:dev
|
|
384
|
+
\\\`\\\`\\\`
|
|
385
|
+
|
|
386
|
+
## Features
|
|
387
|
+
- **Self-Healing**: Powered by AI Action Orchestrator
|
|
388
|
+
- **Visual Regression**: Built-in screenshot comparison
|
|
389
|
+
- **Enterprise Reporting**: Allure reporting with custom steps
|
|
390
|
+
\`;
|
|
391
|
+
fs.writeFileSync(path.join(projectPath, 'README.md'), readme);
|
|
392
|
+
|
|
393
|
+
console.log('ā
Comprehensive Project Structure Created');
|
|
394
|
+
console.log('\\nš¦ Installing dependencies...\\n');
|
|
194
395
|
|
|
195
396
|
try {
|
|
196
397
|
execSync('npm install', { cwd: projectPath, stdio: 'inherit' });
|
|
197
|
-
console.log('
|
|
198
|
-
} catch (error) {
|
|
398
|
+
console.log('\\nā
Dependencies installed');
|
|
399
|
+
} catch (error) {
|
|
400
|
+
console.log('\\nā ļø npm install failed. Please run manually.');
|
|
401
|
+
}
|
|
199
402
|
|
|
200
|
-
console.log(
|
|
403
|
+
console.log(\`\\nš Project ready! cd \${projectName} and try: npm run test:dev\\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.18",
|
|
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",
|