simple-playwright-framework 0.0.5 → 0.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-playwright-framework",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "A modular Playwright framework with fixtures, loaders, and demo scaffolding.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "report": "playwright show-report"
14
14
  },
15
15
  "bin": {
16
- "init-framework-project": "./scripts/init-framework-project.js",
17
- "init-demo-project": "./scripts/init-demo-project.js"
16
+ "init-framework-project": "scripts/init-framework-project.js",
17
+ "init-demo-project": "scripts/init-demo-project.js"
18
18
  },
19
19
  "files": [
20
20
  "dist/**/*",
@@ -1,67 +1,120 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  const fs = require("fs");
3
3
  const path = require("path");
4
+ const { execSync } = require("child_process");
4
5
 
5
6
  const cwd = process.cwd();
6
7
  const demoDir = path.join(cwd, "demo-project");
7
8
  fs.mkdirSync(demoDir, { recursive: true });
8
9
 
10
+ function writeFileSafe(filePath, content) {
11
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
12
+ fs.writeFileSync(filePath, content);
13
+ console.log(`šŸ“„ Created: ${filePath}`);
14
+ }
15
+
16
+ function run(cmd, cwd) {
17
+ console.log(`> ${cmd}`);
18
+ execSync(cmd, { stdio: "inherit", cwd });
19
+ }
20
+
9
21
  // package.json
10
- fs.writeFileSync(path.join(demoDir, "package.json"), JSON.stringify({
11
- name: "demo-project",
12
- version: "1.0.0",
13
- private: true,
14
- scripts: { test: "playwright test" },
15
- devDependencies: {
16
- "@playwright/test": "^1.58.2",
17
- "simple-playwright-framework": "latest"
18
- }
19
- }, null, 2));
22
+ writeFileSafe(path.join(demoDir, "package.json"),
23
+ JSON.stringify({
24
+ name: "demo-project",
25
+ version: "1.0.0",
26
+ private: true,
27
+ scripts: {
28
+ init: "node ../framework/scripts/init-demo-project.js",
29
+ clean: "rimraf dist tsconfig.tsbuildinfo",
30
+ build: "tsc --build --force",
31
+ test: "playwright test"
32
+ },
33
+ devDependencies: {
34
+ "@playwright/test": "^1.58.2",
35
+ "simple-playwright-framework": "latest",
36
+ "@types/node": "^20.0.0",
37
+ "rimraf": "^5.0.0"
38
+ }
39
+ }, null, 2)
40
+ );
41
+
42
+ // tsconfig.json
43
+ writeFileSafe(path.join(demoDir, "tsconfig.json"),
44
+ JSON.stringify({
45
+ compilerOptions: {
46
+ target: "ESNext",
47
+ module: "CommonJS",
48
+ strict: true,
49
+ noImplicitAny: true,
50
+ esModuleInterop: true,
51
+ moduleResolution: "Node",
52
+ resolveJsonModule: true,
53
+ types: ["@playwright/test", "simple-playwright-framework", "node"],
54
+ baseUrl: ".",
55
+ paths: { "@demo-project/*": ["./*"] },
56
+ outDir: "dist"
57
+ },
58
+ include: ["tests/**/*.ts", "global.d.ts"]
59
+ }, null, 2)
60
+ );
20
61
 
21
62
  // playwright.config.ts
22
- fs.writeFileSync(path.join(demoDir, "playwright.config.ts"), `import { defineConfig } from '@playwright/test';
23
- export default defineConfig({
24
- testDir: './tests',
25
- reporter: [['html']],
26
- });
63
+ writeFileSafe(path.join(demoDir, "playwright.config.ts"), `import { defineConfig } from '@playwright/test';
64
+ export default defineConfig({ testDir: './tests', reporter: [['html']] });
27
65
  `);
28
66
 
29
67
  // config
30
- const configDir = path.join(demoDir, "config");
31
- fs.mkdirSync(configDir, { recursive: true });
32
- fs.writeFileSync(path.join(configDir, "environments.json"), JSON.stringify({
33
- defaults: { timeout: 30000, retries: 1, autoLaunch: false },
34
- dev: { baseUrl: "https://dev.orangehrm.example.com", authStorage: { enabled: true, provider: "OrangeHRMLogin" } },
35
- qa: { baseUrl: "https://qa.orangehrm.example.com", authStorage: { enabled: true, provider: "OrangeHRMLogin" } },
36
- prod: { baseUrl: "https://opensource-demo.orangehrmlive.com/", authStorage: { enabled: true, provider: "OrangeHRMLogin" } }
37
- }, null, 2));
38
-
39
- // data
40
- const dataDir = path.join(demoDir, "data/login");
41
- fs.mkdirSync(dataDir, { recursive: true });
42
- fs.writeFileSync(path.join(dataDir, "login.json"), JSON.stringify({
43
- prod: {
44
- users: {
45
- admin: { username: "Admin", password: "admin123" },
46
- employee: { username: "Emp", password: "emp123" },
47
- locked: { username: "LockedUser", password: "locked123" }
68
+ writeFileSafe(path.join(demoDir, "config/environments.json"),
69
+ JSON.stringify({
70
+ defaults: { timeout: 30000, retries: 1, autoLaunch: false },
71
+ dev: { baseUrl: "https://dev.orangehrm.example.com", authStorage: { enabled: true, provider: "OrangeHRMLogin" } },
72
+ qa: { baseUrl: "https://qa.orangehrm.example.com", authStorage: { enabled: true, provider: "OrangeHRMLogin" } },
73
+ prod: { baseUrl: "https://opensource-demo.orangehrmlive.com/", authStorage: { enabled: true, provider: "OrangeHRMLogin" } }
74
+ }, null, 2)
75
+ );
76
+
77
+ // data/login
78
+ writeFileSafe(path.join(demoDir, "data/login/login.json"),
79
+ JSON.stringify({
80
+ prod: {
81
+ users: {
82
+ admin: { username: "Admin", password: "admin123" },
83
+ employee: { username: "Emp", password: "emp123" },
84
+ locked: { username: "LockedUser", password: "locked123" },
85
+ problem: { username: "ProblemUser", password: "problem123" }
86
+ }
48
87
  }
49
- }
50
- }, null, 2));
51
- fs.writeFileSync(path.join(dataDir, "login.scenarios.json"), JSON.stringify({
52
- prod: [
53
- { name: "Valid login", url: "https://opensource-demo.orangehrmlive.com/", username: "Admin", password: "admin123", expected: "success", tags: ["smoke"] },
54
- { name: "Invalid login", url: "https://opensource-demo.orangehrmlive.com/", username: "WrongUser", password: "WrongPass", expected: "failure", tags: ["negative"] }
55
- ]
56
- }, null, 2));
57
- fs.writeFileSync(path.join(dataDir, "loginwithauthstorage.json"), JSON.stringify({
58
- prod: { users: { admin: { username: "Admin", password: "admin123" } } }
59
- }, null, 2));
88
+ }, null, 2)
89
+ );
90
+ writeFileSafe(path.join(demoDir, "data/login/login.scenarios.json"),
91
+ JSON.stringify({
92
+ prod: [
93
+ { name: "Valid login", url: "https://opensource-demo.orangehrmlive.com/", username: "Admin", password: "admin123", expected: "success", tags: ["smoke"] },
94
+ { name: "Invalid login", url: "https://opensource-demo.orangehrmlive.com/", username: "WrongUser", password: "WrongPass", expected: "failure", tags: ["negative"] },
95
+ { name: "Valid login Two", url: "https://opensource-demo.orangehrmlive.com/", username: "akshay.emp.61499", password: "October@2020", expected: "success", tags: ["regression","positive"] }
96
+ ]
97
+ }, null, 2)
98
+ );
99
+ writeFileSafe(path.join(demoDir, "data/login/loginwithauthstorage.json"),
100
+ JSON.stringify({ prod: { users: { admin: { username: "Admin", password: "admin123" } } } }, null, 2)
101
+ );
102
+
103
+ // data/api
104
+ writeFileSafe(path.join(demoDir, "data/api/payload.json"),
105
+ JSON.stringify({ createUser: { username: "demoUser", password: "demoPass" } }, null, 2)
106
+ );
107
+
108
+ // data/ui
109
+ writeFileSafe(path.join(demoDir, "data/ui/sample.txt"), "This is a sample file used for upload tests.\n");
110
+
111
+ // storage
112
+ writeFileSafe(path.join(demoDir, "storage/authStorage.json"),
113
+ JSON.stringify({ session: { validityMinutes: 30, provider: "OrangeHRMLogin" } }, null, 2)
114
+ );
60
115
 
61
116
  // auth
62
- const authDir = path.join(demoDir, "auth");
63
- fs.mkdirSync(authDir, { recursive: true });
64
- fs.writeFileSync(path.join(authDir, "orangehrm.login.ts"), `import { Page } from '@playwright/test';
117
+ writeFileSafe(path.join(demoDir, "auth/orangehrm.login.ts"), `import { Page } from '@playwright/test';
65
118
  import { AuthProvider } from 'simple-playwright-framework/fixtures/src/types/auth';
66
119
  export class OrangeHRMLogin implements AuthProvider {
67
120
  constructor(private creds: { username: string; password: string }) {}
@@ -74,19 +127,8 @@ export class OrangeHRMLogin implements AuthProvider {
74
127
  }
75
128
  `);
76
129
 
77
- // storage
78
- const storageDir = path.join(demoDir, "storage");
79
- fs.mkdirSync(storageDir, { recursive: true });
80
- fs.writeFileSync(path.join(storageDir, "authStorage.json"), JSON.stringify({
81
- session: { validityMinutes: 30, provider: "OrangeHRMLogin" }
82
- }, null, 2));
83
-
84
- // tests
85
- const testsDir = path.join(demoDir, "tests");
86
- fs.mkdirSync(path.join(testsDir, "login"), { recursive: true });
87
- fs.mkdirSync(path.join(testsDir, "filehandling"), { recursive: true });
88
-
89
- fs.writeFileSync(path.join(testsDir, "login/login.test.ts"), `import { test, expect } from 'simple-playwright-framework';
130
+ // tests/login
131
+ writeFileSafe(path.join(demoDir, "tests/login/login.test.ts"), `import { test, expect } from 'simple-playwright-framework';
90
132
  test('login with Admin user @smoke', async ({ page, envConfig, td }) => {
91
133
  await page.goto(envConfig.baseUrl);
92
134
  await page.fill('input[name="username"]', td.users.admin.username);
@@ -96,8 +138,8 @@ test('login with Admin user @smoke', async ({ page, envConfig, td }) => {
96
138
  });
97
139
  `);
98
140
 
99
- fs.writeFileSync(path.join(testsDir, "login/login.scenarios.spec.ts"), `import { test, expect, scenarioLoader, initAuthSession } from 'simple-playwright-framework';
100
- import { providerRegistry } from '@project/auth';
141
+ writeFileSafe(path.join(demoDir, "tests/login/login.scenarios.spec.ts"), `import { test, expect, scenarioLoader, initAuthSession } from 'simple-playwright-framework';
142
+ import { providerRegistry } from '@demo-project/auth';
101
143
  const scenarios = scenarioLoader(__filename);
102
144
  test.describe.parallel("Login scenarios", () => {
103
145
  for (const sc of scenarios) {
@@ -114,8 +156,8 @@ test.describe.parallel("Login scenarios", () => {
114
156
  });
115
157
  `);
116
158
 
117
- fs.writeFileSync(path.join(testsDir, "login/loginwithauthstorage.spec.ts"), `import { test, expect, initAuthSession } from 'simple-playwright-framework';
118
- import { providerRegistry } from '@project/auth';
159
+ writeFileSafe(path.join(demoDir, "tests/login/loginwithauthstorage.spec.ts"), `import { test, expect, initAuthSession } from 'simple-playwright-framework';
160
+ import { providerRegistry } from '@demo-project/auth';
119
161
  test('login with Admin user using Auth Storage', async ({ page, envConfig, td }) => {
120
162
  await page.goto(envConfig.baseUrl);
121
163
  await initAuthSession(page, envConfig.authStorage!, { username: td.users.admin.username, password: td.users.admin.password }, providerRegistry);
@@ -123,7 +165,7 @@ test('login with Admin user using Auth Storage', async ({ page, envConfig, td })
123
165
  });
124
166
  `);
125
167
 
126
- fs.writeFileSync(path.join(testsDir, "login/login.testrail.spec.ts"), `import { test, expect } from 'simple-playwright-framework';
168
+ writeFileSafe(path.join(demoDir, "tests/login/login.testrail.spec.ts"), `import { test, expect } from 'simple-playwright-framework';
127
169
  test('Login linked to TestRail case C1234', async ({ page, envConfig, testrail }) => {
128
170
  await page.goto(envConfig.baseUrl);
129
171
  await page.fill('input[name="username"]', 'Admin');
@@ -139,7 +181,8 @@ test('Login linked to TestRail case C1234', async ({ page, envConfig, testrail }
139
181
  });
140
182
  `);
141
183
 
142
- fs.writeFileSync(path.join(testsDir, "filehandling/filehandling.spec.ts"), `import { test } from 'simple-playwright-framework/fixtures';
184
+ // tests/filehandling
185
+ writeFileSafe(path.join(demoDir, "tests/filehandling/filehandling.spec.ts"), `import { test } from 'simple-playwright-framework/fixtures';
143
186
  test("upload and download demo", async ({ page, fileUtils }) => {
144
187
  await page.goto("https://the-internet.herokuapp.com/upload");
145
188
  await fileUtils.uploadFile("#file-upload", "data/ui/sample.txt");
@@ -150,4 +193,43 @@ test("upload and download demo", async ({ page, fileUtils }) => {
150
193
  });
151
194
  `);
152
195
 
153
- console.log("āœ… Demo project created in ./demo-project with configs, data, auth, storage, and sample tests.");
196
+ // tests/api
197
+ writeFileSafe(path.join(demoDir, "tests/api/api.test.ts"), `import { test, expect } from 'simple-playwright-framework';
198
+ test('sample API call', async ({ request, envConfig }) => {
199
+ const response = await request.get(\`\${envConfig.baseUrl}/api/health\`);
200
+ expect(response.status()).toBe(200);
201
+ });
202
+ `);
203
+
204
+ // tests/utils
205
+ writeFileSafe(path.join(demoDir, "tests/utils/fileutils.test.ts"), `import { test } from 'simple-playwright-framework/fixtures';
206
+ test('use fileUtils directly', async ({ fileUtils }) => {
207
+ const path = await fileUtils.downloadFile("https://example.com/file.txt");
208
+ console.log("Downloaded:", path);
209
+ });
210
+ `);
211
+
212
+ // tests/reporting
213
+ writeFileSafe(path.join(demoDir, "tests/reporting/testrail.test.ts"), `import { test } from 'simple-playwright-framework';
214
+ test('reporting example', async ({ testrail }) => {
215
+ await testrail.addResult(5678, 1, "Reporting fixture works āœ…");
216
+ });
217
+ `);
218
+
219
+ // README
220
+ writeFileSafe(path.join(demoDir, "README.md"), `# Demo Project
221
+
222
+ This is a scaffolded Playwright demo project using **simple-playwright-framework**.
223
+ Run \`npm run test\` to execute the sample tests.
224
+ `);
225
+
226
+ // Final step: install deps + build
227
+ try {
228
+ console.log("šŸš€ Installing dependencies and building demo-project...");
229
+ run("npm install", demoDir);
230
+ run("npm run build", demoDir);
231
+ console.log("āœ… Demo project initialized. Ready to run Playwright tests!");
232
+ } catch (err) {
233
+ console.error("āŒ Init failed:", err.message);
234
+ process.exit(1);
235
+ }
@@ -1,52 +1,75 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  const fs = require("fs");
3
3
  const path = require("path");
4
+ const readline = require("readline");
4
5
 
5
- const cwd = process.cwd();
6
- const demoDir = path.join(cwd, "demo-project");
7
- fs.mkdirSync(demoDir, { recursive: true });
8
-
9
- // package.json
10
- fs.writeFileSync(path.join(demoDir, "package.json"), JSON.stringify({
11
- name: "demo-project",
12
- version: "1.0.0",
13
- private: true,
14
- scripts: { test: "playwright test" },
15
- devDependencies: {
16
- "@playwright/test": "^1.58.2",
17
- "simple-playwright-framework": "latest"
6
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
7
+ const ask = (q) => new Promise(res => rl.question(q, ans => res(ans.trim())));
8
+
9
+ async function scaffoldFile(filePath, content) {
10
+ if (fs.existsSync(filePath)) {
11
+ console.log(`āš ļø ALERT: ${filePath} already exists.`);
12
+ const ans = await ask(`Do you want to overwrite ${filePath}? (y/N): `);
13
+ if (ans.toLowerCase() !== "y") {
14
+ console.log(`āŒ Skipped ${filePath}`);
15
+ return;
16
+ }
17
+ console.log(`āœ… Approved overwrite for ${filePath}`);
18
+ } else {
19
+ const ans = await ask(`Create new file ${filePath}? (y/N): `);
20
+ if (ans.toLowerCase() !== "y") {
21
+ console.log(`āŒ Skipped ${filePath}`);
22
+ return;
23
+ }
24
+ console.log(`āœ… Approved creation of ${filePath}`);
18
25
  }
19
- }, null, 2));
20
-
21
- // config
22
- fs.mkdirSync(path.join(demoDir, "config"), { recursive: true });
23
- fs.writeFileSync(path.join(demoDir, "config/environments.json"), JSON.stringify({
24
- defaults: { timeout: 30000, retries: 1, autoLaunch: false },
25
- dev: { baseUrl: "https://dev.orangehrm.example.com", authStorage: { enabled: true, provider: "OrangeHRMLogin" } },
26
- qa: { baseUrl: "https://qa.orangehrm.example.com", authStorage: { enabled: true, provider: "OrangeHRMLogin" } },
27
- prod: { baseUrl: "https://opensource-demo.orangehrmlive.com/", authStorage: { enabled: true, provider: "OrangeHRMLogin" } }
28
- }, null, 2));
29
-
30
- // data
31
- const dataDir = path.join(demoDir, "data/login");
32
- fs.mkdirSync(dataDir, { recursive: true });
33
- fs.writeFileSync(path.join(dataDir, "login.json"), JSON.stringify({
34
- prod: { users: { admin: { username: "Admin", password: "admin123" }, employee: { username: "Emp", password: "emp123" } }
35
- }, null, 2));
36
- fs.writeFileSync(path.join(dataDir, "login.scenarios.json"), JSON.stringify({
37
- prod: [
38
- { name: "Valid login", url: "https://opensource-demo.orangehrmlive.com/", username: "Admin", password: "admin123", expected: "success" },
39
- { name: "Invalid login", url: "https://opensource-demo.orangehrmlive.com/", username: "WrongUser", password: "WrongPass", expected: "failure" }
40
- ]
41
- }, null, 2));
42
- fs.writeFileSync(path.join(dataDir, "loginwithauthstorage.json"), JSON.stringify({
43
- prod: { users: { admin: { username: "Admin", password: "admin123" } } }
44
- }, null, 2));
45
-
46
- // auth
47
- const authDir = path.join(demoDir, "auth");
48
- fs.mkdirSync(authDir, { recursive: true });
49
- fs.writeFileSync(path.join(authDir, "orangehrm.login.ts"), `import { Page } from '@playwright/test';
26
+
27
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
28
+ fs.writeFileSync(filePath, content);
29
+ console.log(`šŸ“„ File created/updated: ${filePath}`);
30
+ }
31
+
32
+ (async () => {
33
+ const cwd = process.cwd();
34
+ console.log("šŸš€ Starting framework integration with confirmations...");
35
+
36
+ // config
37
+ await scaffoldFile(path.join(cwd, "config/environments.json"),
38
+ JSON.stringify({
39
+ defaults: { timeout: 30000, retries: 1, autoLaunch: false },
40
+ qa: { baseUrl: "http://localhost:3000", authStorage: { enabled: true, provider: "OrangeHRMLogin" } }
41
+ }, null, 2)
42
+ );
43
+
44
+ // data/login
45
+ await scaffoldFile(path.join(cwd, "data/login/login.json"),
46
+ JSON.stringify({ qa: { users: { admin: { username: "Admin", password: "admin123" } } } }, null, 2)
47
+ );
48
+ await scaffoldFile(path.join(cwd, "data/login/login.scenarios.json"),
49
+ JSON.stringify({ qa: [
50
+ { name: "Valid login", username: "Admin", password: "admin123", expected: "success" },
51
+ { name: "Invalid login", username: "WrongUser", password: "WrongPass", expected: "failure" }
52
+ ] }, null, 2)
53
+ );
54
+ await scaffoldFile(path.join(cwd, "data/login/loginwithauthstorage.json"),
55
+ JSON.stringify({ qa: { users: { admin: { username: "Admin", password: "admin123" } } } }, null, 2)
56
+ );
57
+
58
+ // data/api
59
+ await scaffoldFile(path.join(cwd, "data/api/payload.json"),
60
+ JSON.stringify({ createUser: { username: "demoUser", password: "demoPass" } }, null, 2)
61
+ );
62
+
63
+ // data/ui
64
+ await scaffoldFile(path.join(cwd, "data/ui/sample.txt"), "This is a sample file used for upload tests.\n");
65
+
66
+ // storage
67
+ await scaffoldFile(path.join(cwd, "storage/authStorage.json"),
68
+ JSON.stringify({ session: { validityMinutes: 30, provider: "OrangeHRMLogin" } }, null, 2)
69
+ );
70
+
71
+ // auth
72
+ await scaffoldFile(path.join(cwd, "auth/orangehrm.login.ts"), `import { Page } from '@playwright/test';
50
73
  import { AuthProvider } from 'simple-playwright-framework/fixtures/src/types/auth';
51
74
  export class OrangeHRMLogin implements AuthProvider {
52
75
  constructor(private creds: { username: string; password: string }) {}
@@ -59,19 +82,8 @@ export class OrangeHRMLogin implements AuthProvider {
59
82
  }
60
83
  `);
61
84
 
62
- // storage
63
- const storageDir = path.join(demoDir, "storage");
64
- fs.mkdirSync(storageDir, { recursive: true });
65
- fs.writeFileSync(path.join(storageDir, "authStorage.json"), JSON.stringify({
66
- session: { validityMinutes: 30, provider: "OrangeHRMLogin" }
67
- }, null, 2));
68
-
69
- // tests
70
- const testsDir = path.join(demoDir, "tests");
71
- fs.mkdirSync(path.join(testsDir, "login"), { recursive: true });
72
- fs.mkdirSync(path.join(testsDir, "filehandling"), { recursive: true });
73
-
74
- fs.writeFileSync(path.join(testsDir, "login/login.test.ts"), `import { test, expect } from 'simple-playwright-framework';
85
+ // tests/login
86
+ await scaffoldFile(path.join(cwd, "tests/login/login.test.ts"), `import { test, expect } from 'simple-playwright-framework';
75
87
  test('login with Admin user @smoke', async ({ page, envConfig, td }) => {
76
88
  await page.goto(envConfig.baseUrl);
77
89
  await page.fill('input[name="username"]', td.users.admin.username);
@@ -81,7 +93,7 @@ test('login with Admin user @smoke', async ({ page, envConfig, td }) => {
81
93
  });
82
94
  `);
83
95
 
84
- fs.writeFileSync(path.join(testsDir, "login/login.scenarios.spec.ts"), `import { test, expect, scenarioLoader, initAuthSession } from 'simple-playwright-framework';
96
+ await scaffoldFile(path.join(cwd, "tests/login/login.scenarios.spec.ts"), `import { test, expect, scenarioLoader, initAuthSession } from 'simple-playwright-framework';
85
97
  import { providerRegistry } from '@project/auth';
86
98
  const scenarios = scenarioLoader(__filename);
87
99
  test.describe.parallel("Login scenarios", () => {
@@ -99,4 +111,68 @@ test.describe.parallel("Login scenarios", () => {
99
111
  });
100
112
  `);
101
113
 
102
- fs.writeFileSync(path.join(testsDir, "login/loginwithauthstorage.spec.ts"), `import { test, expect, initAuthSession } from '
114
+ await scaffoldFile(path.join(cwd, "tests/login/loginwithauthstorage.spec.ts"), `import { test, expect, initAuthSession } from 'simple-playwright-framework';
115
+ import { providerRegistry } from '@project/auth';
116
+ test('login with Admin user using Auth Storage', async ({ page, envConfig, td }) => {
117
+ await page.goto(envConfig.baseUrl);
118
+ await initAuthSession(page, envConfig.authStorage!, { username: td.users.admin.username, password: td.users.admin.password }, providerRegistry);
119
+ await expect(page).toHaveURL(/dashboard/);
120
+ });
121
+ `);
122
+
123
+ await scaffoldFile(path.join(cwd, "tests/login/login.testrail.spec.ts"), `import { test, expect } from 'simple-playwright-framework';
124
+ test('Login linked to TestRail case C1234', async ({ page, envConfig, testrail }) => {
125
+ await page.goto(envConfig.baseUrl);
126
+ await page.fill('input[name="username"]', 'Admin');
127
+ await page.fill('input[name="password"]', 'admin123');
128
+ await page.click('button[type="submit"]');
129
+ try {
130
+ await expect(page).toHaveURL(/dashboard/);
131
+ await testrail.addResult(1234, 1, "Login passed āœ…");
132
+ } catch (err) {
133
+ await testrail.addResult(1234, 5, "Login failed āŒ");
134
+ throw err;
135
+ }
136
+ });
137
+ `);
138
+
139
+ // tests/filehandling
140
+ await scaffoldFile(path.join(cwd, "tests/filehandling/filehandling.spec.ts"), `import { test } from 'simple-playwright-framework/fixtures';
141
+ test("upload and download demo", async ({ page, fileUtils }) => {
142
+ await page.goto("https://the-internet.herokuapp.com/upload");
143
+ await fileUtils.uploadFile("#file-upload", "data/ui/sample.txt");
144
+ await page.click("#file-submit");
145
+ await page.goto("https://the-internet.herokuapp.com/download");
146
+ const downloadedPath = await fileUtils.downloadFile("a[href*='some-file.txt']");
147
+ console.log("Downloaded file path:", downloadedPath);
148
+ });
149
+ `);
150
+
151
+ // tests/api
152
+ await scaffoldFile(path.join(cwd, "tests/api/api.test.ts"), `import { test, expect } from 'simple-playwright-framework';
153
+ test('sample API call', async ({ request, envConfig }) => {
154
+ const response = await request.get(\`\${envConfig.baseUrl}/api/health\`);
155
+ expect(response.status()).toBe(200);
156
+ });
157
+ `);
158
+
159
+ // tests/utils
160
+ await scaffoldFile(path.join(cwd, "tests/utils/fileutils.test.ts"), `import { test } from 'simple-playwright-framework/fixtures';
161
+ test('use fileUtils directly', async ({ fileUtils }) => {
162
+ const path = await fileUtils.downloadFile("https://example.com/file.txt");
163
+ console.log("Downloaded:", path);
164
+ });
165
+ `);
166
+
167
+ // tests/reporting
168
+ await scaffoldFile(path.join(cwd, "tests/reporting/testrail.test.ts"), `import { test } from 'simple-playwright-framework';
169
+ test('reporting example', async ({ testrail }) => {
170
+ await testrail.addResult(5678, 1, "Reporting fixture works āœ…");
171
+ });
172
+ `);
173
+
174
+ rl.close();
175
+ console.log("\nšŸŽ‰ Framework integration complete with confirmations.");
176
+ console.log("šŸ‘‰ Next step: commit and push these changes to GitHub:");
177
+ console.log(" git add . && git commit -m \"Integrate Playwright framework\" && git push");
178
+ })();