artes 1.4.7 → 1.4.9

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.
Files changed (40) hide show
  1. package/README.md +668 -668
  2. package/cucumber.config.js +223 -223
  3. package/docs/emulationDevicesList.md +152 -152
  4. package/docs/functionDefinitions.md +2401 -2401
  5. package/docs/stepDefinitions.md +402 -402
  6. package/executer.js +479 -479
  7. package/index.js +50 -50
  8. package/package.json +52 -52
  9. package/src/helper/contextManager/browserManager.js +74 -74
  10. package/src/helper/contextManager/requestManager.js +23 -23
  11. package/src/helper/controller/elementController.js +203 -185
  12. package/src/helper/controller/pomCollector.js +82 -82
  13. package/src/helper/executers/cleaner.js +19 -19
  14. package/src/helper/executers/exporter.js +15 -15
  15. package/src/helper/executers/helper.js +110 -110
  16. package/src/helper/executers/projectCreator.js +206 -206
  17. package/src/helper/executers/reportGenerator.js +70 -70
  18. package/src/helper/executers/testRunner.js +28 -28
  19. package/src/helper/executers/versionChecker.js +31 -31
  20. package/src/helper/imports/commons.js +57 -57
  21. package/src/helper/stepFunctions/APIActions.js +495 -495
  22. package/src/helper/stepFunctions/assertions.js +989 -989
  23. package/src/helper/stepFunctions/browserActions.js +22 -22
  24. package/src/helper/stepFunctions/elementInteractions.js +60 -60
  25. package/src/helper/stepFunctions/exporter.js +19 -19
  26. package/src/helper/stepFunctions/frameActions.js +72 -72
  27. package/src/helper/stepFunctions/keyboardActions.js +66 -66
  28. package/src/helper/stepFunctions/mouseActions.js +83 -83
  29. package/src/helper/stepFunctions/pageActions.js +43 -43
  30. package/src/hooks/context.js +15 -15
  31. package/src/hooks/hooks.js +215 -215
  32. package/src/stepDefinitions/API.steps.js +310 -310
  33. package/src/stepDefinitions/assertions.steps.js +1092 -1092
  34. package/src/stepDefinitions/browser.steps.js +7 -7
  35. package/src/stepDefinitions/frameActions.steps.js +76 -76
  36. package/src/stepDefinitions/keyboardActions.steps.js +265 -265
  37. package/src/stepDefinitions/mouseActions.steps.js +378 -378
  38. package/src/stepDefinitions/page.steps.js +71 -71
  39. package/src/stepDefinitions/random.steps.js +188 -188
  40. package/status-formatter.js +138 -138
@@ -1,110 +1,110 @@
1
- function showHelp() {
2
- console.log(`
3
- 🚀 Artes - Playwright Test Runner
4
-
5
- Description:
6
- Artes is a test runner for Playwright that executes Cucumber tests
7
- and can generate Allure reports.
8
-
9
- Usage:
10
- npx artes [options]
11
-
12
- Options:
13
- 🆘 -h, --help Show this help message
14
- Usage: artes -h or artes --help
15
-
16
- 🏷️ -v, --version Show current version of artes
17
- Usage: artes -v or artes --version
18
-
19
- 🏗️ -c, --create Create example project with artes
20
- Usage: artes -c or artes --create
21
-
22
- ✅ -y, --yes Skip confirmation prompt for creating example project
23
- Usage: artes -c -y or artes --create --yes
24
-
25
- 🚫 --noDeps Skip installing dependencies when creating example project
26
- Usage: artes -c --noDeps or artes --create --noDeps
27
-
28
- 📊 -r, --report Run tests and generate Allure report
29
- Usage: artes -r or artes --report
30
-
31
- ✅ --reportSuccess Generate screenshot and video record with also successful tests
32
- Usage: artes --reportSuccess
33
-
34
- ⚡ --trace Enable tracing for all tests
35
- Usage: artes --trace
36
-
37
- 🔍 -rwt, --reportWithTrace Include trace in the report
38
- Usage: artes --reportWithTrace
39
-
40
- 📄 --singleFileReport Generate single file Allure report
41
- Usage: artes -r --singleFileReport
42
-
43
- 🗜️ --zip Zip the report folder after generation
44
- Usage: artes -r --zip
45
-
46
- 📁 --features Specify one or more feature files' relative paths to run (comma-separated)
47
- Usage: artes --features "tests/features/Alma, tests/features/Banan.feature"
48
-
49
- 📜 --stepDef Specify one or more step definition files' relative paths to use (comma-separated)
50
- Usage: artes --stepDef "tests/steps/login.js, tests/steps/home.js"
51
-
52
- 🔖 --tags Run tests with specified Cucumber tags
53
- Usage: artes --tags "@smoke and not @wip"
54
-
55
- 🌐 --env Set environment for the test run
56
- Usage: artes --env "dev"
57
-
58
- --saveVar Set variables from cli
59
- artes --saveVar '{"armud":20,"banana":200}'
60
-
61
- 🕶️ --headless Run browser in headless mode
62
- Usage: artes --headless
63
-
64
- ⚡ --parallel Run tests in parallel mode
65
- Usage: artes --parallel 3
66
-
67
- 🔁 --retry Retry failed tests
68
- Usage: artes --retry 2
69
-
70
- 🔄 --rerun Rerun only the failed tests from previous run
71
- Usage: artes --rerun @rerun.txt
72
-
73
- 🎭 --dryRun Perform a dry run without executing tests
74
- Usage: artes --dryRun
75
-
76
- 📈 --percentage Set minimum success percentage to pass test run
77
- Usage: artes --percentage 85
78
-
79
- 🌐 --browser Specify browser to use (chromium, firefox, webkit)
80
- Usage: artes --browser chromium
81
-
82
- --offline Run browser in offline mode
83
- Usage: artes --offline
84
-
85
- 📱 --device Emulate specific device (e.g., "iPhone 13")
86
- Usage: artes --device "iPhone 13"
87
-
88
- 🌐 --baseURL Set base URL for the tests
89
- Usage: artes --baseURL "https://example.com"
90
-
91
- 📏 --maxScreen Maximize browser window
92
- Usage: artes --maxScreen
93
-
94
- 📐 --width Set browser width (default: 1280)
95
- Usage: artes --width 1920
96
-
97
- 📏 --height Set browser height (default: 720)
98
- Usage: artes --height 1080
99
-
100
- ⏱️ --timeout Set timeout for each test step (default: 30 seconds)
101
- Usage: artes --timeout 10
102
-
103
- 🐢 --slowMo Slow down text execution for clear view (default: 0 seconds)
104
- Usage: artes --slowMo 1
105
- `);
106
- }
107
-
108
- module.exports = {
109
- showHelp,
110
- };
1
+ function showHelp() {
2
+ console.log(`
3
+ 🚀 Artes - Playwright Test Runner
4
+
5
+ Description:
6
+ Artes is a test runner for Playwright that executes Cucumber tests
7
+ and can generate Allure reports.
8
+
9
+ Usage:
10
+ npx artes [options]
11
+
12
+ Options:
13
+ 🆘 -h, --help Show this help message
14
+ Usage: artes -h or artes --help
15
+
16
+ 🏷️ -v, --version Show current version of artes
17
+ Usage: artes -v or artes --version
18
+
19
+ 🏗️ -c, --create Create example project with artes
20
+ Usage: artes -c or artes --create
21
+
22
+ ✅ -y, --yes Skip confirmation prompt for creating example project
23
+ Usage: artes -c -y or artes --create --yes
24
+
25
+ 🚫 --noDeps Skip installing dependencies when creating example project
26
+ Usage: artes -c --noDeps or artes --create --noDeps
27
+
28
+ 📊 -r, --report Run tests and generate Allure report
29
+ Usage: artes -r or artes --report
30
+
31
+ ✅ --reportSuccess Generate screenshot and video record with also successful tests
32
+ Usage: artes --reportSuccess
33
+
34
+ ⚡ --trace Enable tracing for all tests
35
+ Usage: artes --trace
36
+
37
+ 🔍 -rwt, --reportWithTrace Include trace in the report
38
+ Usage: artes --reportWithTrace
39
+
40
+ 📄 --singleFileReport Generate single file Allure report
41
+ Usage: artes -r --singleFileReport
42
+
43
+ 🗜️ --zip Zip the report folder after generation
44
+ Usage: artes -r --zip
45
+
46
+ 📁 --features Specify one or more feature files' relative paths to run (comma-separated)
47
+ Usage: artes --features "tests/features/Alma, tests/features/Banan.feature"
48
+
49
+ 📜 --stepDef Specify one or more step definition files' relative paths to use (comma-separated)
50
+ Usage: artes --stepDef "tests/steps/login.js, tests/steps/home.js"
51
+
52
+ 🔖 --tags Run tests with specified Cucumber tags
53
+ Usage: artes --tags "@smoke and not @wip"
54
+
55
+ 🌐 --env Set environment for the test run
56
+ Usage: artes --env "dev"
57
+
58
+ --saveVar Set variables from cli
59
+ artes --saveVar '{"armud":20,"banana":200}'
60
+
61
+ 🕶️ --headless Run browser in headless mode
62
+ Usage: artes --headless
63
+
64
+ ⚡ --parallel Run tests in parallel mode
65
+ Usage: artes --parallel 3
66
+
67
+ 🔁 --retry Retry failed tests
68
+ Usage: artes --retry 2
69
+
70
+ 🔄 --rerun Rerun only the failed tests from previous run
71
+ Usage: artes --rerun @rerun.txt
72
+
73
+ 🎭 --dryRun Perform a dry run without executing tests
74
+ Usage: artes --dryRun
75
+
76
+ 📈 --percentage Set minimum success percentage to pass test run
77
+ Usage: artes --percentage 85
78
+
79
+ 🌐 --browser Specify browser to use (chromium, firefox, webkit)
80
+ Usage: artes --browser chromium
81
+
82
+ --offline Run browser in offline mode
83
+ Usage: artes --offline
84
+
85
+ 📱 --device Emulate specific device (e.g., "iPhone 13")
86
+ Usage: artes --device "iPhone 13"
87
+
88
+ 🌐 --baseURL Set base URL for the tests
89
+ Usage: artes --baseURL "https://example.com"
90
+
91
+ 📏 --maxScreen Maximize browser window
92
+ Usage: artes --maxScreen
93
+
94
+ 📐 --width Set browser width (default: 1280)
95
+ Usage: artes --width 1920
96
+
97
+ 📏 --height Set browser height (default: 720)
98
+ Usage: artes --height 1080
99
+
100
+ ⏱️ --timeout Set timeout for each test step (default: 30 seconds)
101
+ Usage: artes --timeout 10
102
+
103
+ 🐢 --slowMo Slow down text execution for clear view (default: 0 seconds)
104
+ Usage: artes --slowMo 1
105
+ `);
106
+ }
107
+
108
+ module.exports = {
109
+ showHelp,
110
+ };
@@ -1,206 +1,206 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const { execSync } = require("child_process");
6
-
7
- function createProject(createYes, noDeps) {
8
- const projectDir = path.join(process.cwd(), "artes");
9
- const srcDir = path.join(projectDir, "tests");
10
-
11
- [
12
- projectDir,
13
- path.join(srcDir, "features"),
14
- path.join(srcDir, "POMs"),
15
- path.join(srcDir, "steps"),
16
- path.join(projectDir, ".vscode"),
17
- ].forEach((dir) => fs.mkdirSync(dir, { recursive: true }));
18
-
19
- console.log("🚀 Initializing project...");
20
- execSync(`npm init ${createYes ? "-y" : ""}`, {
21
- cwd: projectDir,
22
- stdio: "inherit",
23
- });
24
-
25
- if (!noDeps) {
26
- execSync("npm i artes@latest", { cwd: projectDir, stdio: "inherit" });
27
- console.log("📦 Setting up browsers...");
28
- execSync("npx playwright install", { cwd: projectDir, stdio: "inherit" });
29
- }
30
-
31
- const packageJsonPath = path.join(projectDir, "package.json");
32
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
33
-
34
- if (packageJson.type) {
35
- delete packageJson.type;
36
- }
37
-
38
- packageJson.scripts = {
39
- test: "npx artes",
40
- testWithReport: "npx artes -r",
41
- };
42
-
43
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
44
-
45
- const config = `module.exports = {
46
- headless: false, // Set to true for headless browser mode
47
-
48
- // Configuration options:
49
- // env: "", // string - Environment name for tests
50
- // variables: {} // object - Variables for tests
51
- // testPercentage: 0, // number - Minimum success rate percentage(Default: 0)
52
- // baseURL: "", // string - Base URL for API tests
53
- // paths: [], // string[] - Paths to feature files
54
- // steps: "", // string - Step definitions files
55
- // pomPath: "", // string - Path to POM files
56
- // timeout : 0, // number - Test timeout in seconds
57
- // slowMo: 0, // number - Slow down test execution (Default: 0 seconds)
58
- // parallel: 0, // number - Number of parallel workers
59
- // report: true // boolean - Generate report
60
- // zip: false // boolean - Generate zip of report
61
- // reportSuccess: false, // boolean - Add screenshots and video records to report also for success test cases
62
- // trace: false, // boolean - Enable tracing
63
- // reportWithTrace: false, // boolean - Include trace in report
64
- // format: [], // string[] - Formatter names/paths
65
- // formatOptions: {}, // object - Formatter options
66
- // retry: 0, // number - Retry attempts for failing tests
67
- // tags: "", // string - Tag expression to filter scenarios
68
- // backtrace: false, // boolean - Show full backtrace for errors
69
- // dryRun: false, // boolean - Prepare test run without execution
70
- // browser: "chrome", // "chrome", "firefox", "webkit"
71
- // offline: false, // boolean - Run browser in offline mode
72
- // device: "", // string - Emulate specific device (e.g., "iPhone 13", for more devices look at the documentation)
73
- // width: 1280, // number - Browser width
74
- // height: 720, // number - Browser height
75
- // maximizeScreen: true // boolean - Maximize browser window
76
- // forceExit: false, // boolean - Force process.exit() after tests
77
- // failFast: false, // boolean - Stop on first test failure
78
- // import: [], // string[] - Support code paths
79
- // language: "en", // string - Default feature file language
80
- // loader: [], // string[] - Module loader specifications
81
- // name: [], // string[] - Run scenarios matching regex
82
- // order: "defined", // string - Run order (defined/random)
83
- // publish: false, // boolean - Publish to cucumber.io
84
- // requireModule: [], // string[] - Transpilation module names
85
- // retryTagFilter: "", // string - Tag expression for retries
86
- // strict: true, // boolean - Fail on pending steps
87
- // worldParameters: {} // object - World constructor parameters
88
- };
89
- `;
90
-
91
- const featureContent = `Feature: Shopping on SauceDemo 🛒
92
-
93
- Background: Login on SauceDemo
94
- Given User is on home page of SauceDemo
95
- And User types "standard_user" in "username_input"
96
- And User types "secret_sauce" in "password_input"
97
- And User clicks "#login-button"
98
-
99
- Scenario Outline: Success Shopping
100
- And User expects to be in "https://www.saucedemo.com/inventory.html" page
101
- And User clicks "product_title"
102
- And User clicks "add_to_cart_button"
103
- And User clicks "cart_button"
104
- Then User expects "item_price" should have "$29.99" text
105
-
106
- Scenario Outline: Failed Shopping
107
- And User expects to be in "https://www.saucedemo.com/inventory.html" page
108
- And User clicks "product_title"
109
- And User clicks "add_to_cart_button"
110
- And User clicks "cart_button"
111
- Then User expects "item_price" should not have "$29.99" text
112
-
113
- `;
114
-
115
- const pomContent = JSON.stringify(
116
- {
117
- username_input: { selector: "#user-name" },
118
- password_input: "#password",
119
- login_button: "#login-button",
120
- product_title:
121
- "xpath=/html/body/div/div/div/div[2]/div/div/div/div[1]/div[2]/div[1]/a/div",
122
- add_to_cart_button: "#add-to-cart",
123
- cart_button: ".shopping_cart_link",
124
- item_price: ".inventory_item_price",
125
- },
126
- null,
127
- 2,
128
- );
129
-
130
- const stepsContent = `
131
- const {Given,context} = require("artes");
132
-
133
- // Example step definition
134
- Given("User is on home page of SauceDemo", async () => {
135
- await context.page.goto("https://www.saucedemo.com/");
136
- });
137
- `;
138
-
139
- const hooksContent = `
140
- export function BeforeStep() {
141
- // hook for before each step
142
- }
143
-
144
- export function Before() {
145
- // hook for before each test
146
- }
147
-
148
- export function BeforeAll() {
149
- // hook for before all tests
150
- }
151
-
152
- export function AfterStep() {
153
- // hook for after each step
154
- }
155
-
156
- export function After() {
157
- // hook for after each test
158
- }
159
-
160
- export function AfterAll() {
161
- // hook for after all tests
162
- }
163
- `;
164
-
165
- const vsCodeExtension = JSON.stringify({
166
- recommendations: ["CucumberOpen.cucumber-official"],
167
- });
168
-
169
- const vsCodeSettings = JSON.stringify({
170
- "cucumber.glue": [
171
- "tests/steps/*.{ts,js}",
172
- "node_modules/artes/src/stepDefinitions/*.{ts,js}",
173
- ],
174
- "cucumber.features": ["tests/features/**/*.feature"],
175
- "cucumberautocomplete.syncfeatures": true,
176
- "cucumberautocomplete.strictGherkinCompletion": true,
177
- });
178
-
179
- console.log("📂 Creating project files...");
180
-
181
- fs.writeFileSync(path.join(projectDir, "artes.config.js"), config, "utf-8");
182
- fs.writeFileSync(
183
- path.join(srcDir, "features", "example.feature"),
184
- featureContent,
185
- );
186
- fs.writeFileSync(path.join(srcDir, "POMs", "example.pom.json"), pomContent);
187
- fs.writeFileSync(path.join(srcDir, "steps", "common.steps.js"), stepsContent);
188
- fs.writeFileSync(path.join(srcDir, "steps", "hooks.js"), hooksContent);
189
-
190
- fs.writeFileSync(
191
- path.join(projectDir, ".vscode", "settings.json"),
192
- vsCodeSettings,
193
- );
194
-
195
- fs.writeFileSync(
196
- path.join(projectDir, ".vscode", "extensions.json"),
197
- vsCodeExtension,
198
- );
199
-
200
- console.log(`✨ Project created successfully in ${projectDir}!`);
201
- console.log("Happy Testing 🎉");
202
- }
203
-
204
- module.exports = {
205
- createProject,
206
- };
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const { execSync } = require("child_process");
6
+
7
+ function createProject(createYes, noDeps) {
8
+ const projectDir = path.join(process.cwd(), "artes");
9
+ const srcDir = path.join(projectDir, "tests");
10
+
11
+ [
12
+ projectDir,
13
+ path.join(srcDir, "features"),
14
+ path.join(srcDir, "POMs"),
15
+ path.join(srcDir, "steps"),
16
+ path.join(projectDir, ".vscode"),
17
+ ].forEach((dir) => fs.mkdirSync(dir, { recursive: true }));
18
+
19
+ console.log("🚀 Initializing project...");
20
+ execSync(`npm init ${createYes ? "-y" : ""}`, {
21
+ cwd: projectDir,
22
+ stdio: "inherit",
23
+ });
24
+
25
+ if (!noDeps) {
26
+ execSync("npm i artes@latest", { cwd: projectDir, stdio: "inherit" });
27
+ console.log("📦 Setting up browsers...");
28
+ execSync("npx playwright install", { cwd: projectDir, stdio: "inherit" });
29
+ }
30
+
31
+ const packageJsonPath = path.join(projectDir, "package.json");
32
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
33
+
34
+ if (packageJson.type) {
35
+ delete packageJson.type;
36
+ }
37
+
38
+ packageJson.scripts = {
39
+ test: "npx artes",
40
+ testWithReport: "npx artes -r",
41
+ };
42
+
43
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
44
+
45
+ const config = `module.exports = {
46
+ headless: false, // Set to true for headless browser mode
47
+
48
+ // Configuration options:
49
+ // env: "", // string - Environment name for tests
50
+ // variables: {} // object - Variables for tests
51
+ // testPercentage: 0, // number - Minimum success rate percentage(Default: 0)
52
+ // baseURL: "", // string - Base URL for API tests
53
+ // paths: [], // string[] - Paths to feature files
54
+ // steps: "", // string - Step definitions files
55
+ // pomPath: "", // string - Path to POM files
56
+ // timeout : 0, // number - Test timeout in seconds
57
+ // slowMo: 0, // number - Slow down test execution (Default: 0 seconds)
58
+ // parallel: 0, // number - Number of parallel workers
59
+ // report: true // boolean - Generate report
60
+ // zip: false // boolean - Generate zip of report
61
+ // reportSuccess: false, // boolean - Add screenshots and video records to report also for success test cases
62
+ // trace: false, // boolean - Enable tracing
63
+ // reportWithTrace: false, // boolean - Include trace in report
64
+ // format: [], // string[] - Formatter names/paths
65
+ // formatOptions: {}, // object - Formatter options
66
+ // retry: 0, // number - Retry attempts for failing tests
67
+ // tags: "", // string - Tag expression to filter scenarios
68
+ // backtrace: false, // boolean - Show full backtrace for errors
69
+ // dryRun: false, // boolean - Prepare test run without execution
70
+ // browser: "chrome", // "chrome", "firefox", "webkit"
71
+ // offline: false, // boolean - Run browser in offline mode
72
+ // device: "", // string - Emulate specific device (e.g., "iPhone 13", for more devices look at the documentation)
73
+ // width: 1280, // number - Browser width
74
+ // height: 720, // number - Browser height
75
+ // maximizeScreen: true // boolean - Maximize browser window
76
+ // forceExit: false, // boolean - Force process.exit() after tests
77
+ // failFast: false, // boolean - Stop on first test failure
78
+ // import: [], // string[] - Support code paths
79
+ // language: "en", // string - Default feature file language
80
+ // loader: [], // string[] - Module loader specifications
81
+ // name: [], // string[] - Run scenarios matching regex
82
+ // order: "defined", // string - Run order (defined/random)
83
+ // publish: false, // boolean - Publish to cucumber.io
84
+ // requireModule: [], // string[] - Transpilation module names
85
+ // retryTagFilter: "", // string - Tag expression for retries
86
+ // strict: true, // boolean - Fail on pending steps
87
+ // worldParameters: {} // object - World constructor parameters
88
+ };
89
+ `;
90
+
91
+ const featureContent = `Feature: Shopping on SauceDemo 🛒
92
+
93
+ Background: Login on SauceDemo
94
+ Given User is on home page of SauceDemo
95
+ And User types "standard_user" in "username_input"
96
+ And User types "secret_sauce" in "password_input"
97
+ And User clicks "#login-button"
98
+
99
+ Scenario Outline: Success Shopping
100
+ And User expects to be in "https://www.saucedemo.com/inventory.html" page
101
+ And User clicks "product_title"
102
+ And User clicks "add_to_cart_button"
103
+ And User clicks "cart_button"
104
+ Then User expects "item_price" should have "$29.99" text
105
+
106
+ Scenario Outline: Failed Shopping
107
+ And User expects to be in "https://www.saucedemo.com/inventory.html" page
108
+ And User clicks "product_title"
109
+ And User clicks "add_to_cart_button"
110
+ And User clicks "cart_button"
111
+ Then User expects "item_price" should not have "$29.99" text
112
+
113
+ `;
114
+
115
+ const pomContent = JSON.stringify(
116
+ {
117
+ username_input: { selector: "#user-name" },
118
+ password_input: "#password",
119
+ login_button: "#login-button",
120
+ product_title:
121
+ "xpath=/html/body/div/div/div/div[2]/div/div/div/div[1]/div[2]/div[1]/a/div",
122
+ add_to_cart_button: "#add-to-cart",
123
+ cart_button: ".shopping_cart_link",
124
+ item_price: ".inventory_item_price",
125
+ },
126
+ null,
127
+ 2,
128
+ );
129
+
130
+ const stepsContent = `
131
+ const {Given,context} = require("artes");
132
+
133
+ // Example step definition
134
+ Given("User is on home page of SauceDemo", async () => {
135
+ await context.page.goto("https://www.saucedemo.com/");
136
+ });
137
+ `;
138
+
139
+ const hooksContent = `
140
+ export function BeforeStep() {
141
+ // hook for before each step
142
+ }
143
+
144
+ export function Before() {
145
+ // hook for before each test
146
+ }
147
+
148
+ export function BeforeAll() {
149
+ // hook for before all tests
150
+ }
151
+
152
+ export function AfterStep() {
153
+ // hook for after each step
154
+ }
155
+
156
+ export function After() {
157
+ // hook for after each test
158
+ }
159
+
160
+ export function AfterAll() {
161
+ // hook for after all tests
162
+ }
163
+ `;
164
+
165
+ const vsCodeExtension = JSON.stringify({
166
+ recommendations: ["CucumberOpen.cucumber-official"],
167
+ });
168
+
169
+ const vsCodeSettings = JSON.stringify({
170
+ "cucumber.glue": [
171
+ "tests/steps/*.{ts,js}",
172
+ "node_modules/artes/src/stepDefinitions/*.{ts,js}",
173
+ ],
174
+ "cucumber.features": ["tests/features/**/*.feature"],
175
+ "cucumberautocomplete.syncfeatures": true,
176
+ "cucumberautocomplete.strictGherkinCompletion": true,
177
+ });
178
+
179
+ console.log("📂 Creating project files...");
180
+
181
+ fs.writeFileSync(path.join(projectDir, "artes.config.js"), config, "utf-8");
182
+ fs.writeFileSync(
183
+ path.join(srcDir, "features", "example.feature"),
184
+ featureContent,
185
+ );
186
+ fs.writeFileSync(path.join(srcDir, "POMs", "example.pom.json"), pomContent);
187
+ fs.writeFileSync(path.join(srcDir, "steps", "common.steps.js"), stepsContent);
188
+ fs.writeFileSync(path.join(srcDir, "steps", "hooks.js"), hooksContent);
189
+
190
+ fs.writeFileSync(
191
+ path.join(projectDir, ".vscode", "settings.json"),
192
+ vsCodeSettings,
193
+ );
194
+
195
+ fs.writeFileSync(
196
+ path.join(projectDir, ".vscode", "extensions.json"),
197
+ vsCodeExtension,
198
+ );
199
+
200
+ console.log(`✨ Project created successfully in ${projectDir}!`);
201
+ console.log("Happy Testing 🎉");
202
+ }
203
+
204
+ module.exports = {
205
+ createProject,
206
+ };