artes 1.2.18 โ†’ 1.2.19

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/README.md CHANGED
@@ -15,34 +15,40 @@ Artes is a test runner for Playwright that executes [predefined Cucumber tests](
15
15
  ## ๐ŸŒŸ Artes Benefits
16
16
 
17
17
  ### ๐Ÿš€ Fast Setup & Smooth Onboarding
18
+
18
19
  - Install in minutes and create a test project effortlessly
19
20
  - Well-structured, easy-to-follow documentation for a smooth learning curve
20
21
  - Designed for long-term maintainability and scalability
21
22
 
22
23
  ### ๐Ÿงฉ Powerful & Developer-Friendly Architecture
24
+
23
25
  - Intuitive API for writing custom step definitions
24
26
  - Rich set of ready-to-use step definitions to speed up test creation
25
27
  - Fully extensible โ€” add your own step definitions anytime
26
28
 
27
29
  ### ๐ŸŒ Advanced API Testing
30
+
28
31
  - Schema validation to ensure API response correctness
29
32
  - Rich assertion library for precise validations
30
33
  - Support for all HTTP methods
31
34
  - Environment-based API configuration for flexible testing
32
35
 
33
36
  ### ๐Ÿ” Smart Variable & Data Handling
37
+
34
38
  - Page Object Model (POM) support for structured data management
35
39
  - Save, reuse, and share variables across steps
36
40
  - Built-in data randomization for dynamic and realistic test data
37
41
  - Environment-specific variables for clean environment separation
38
42
 
39
43
  ### ๐Ÿ–ฅ๏ธ Modern UI Automation
44
+
40
45
  - Wide locator strategy support (CSS, XPath, text-based, and more)
41
46
  - Built-in browser actions
42
47
  - Cookie management
43
48
  - Local & session storage handling
44
49
 
45
50
  ### โš™๏ธ Flexible Configuration & Hooks
51
+
46
52
  - Environment-based configuration system
47
53
  - Powerful and customizable configuration files
48
54
  - Full hook support:
@@ -50,11 +56,13 @@ Artes is a test runner for Playwright that executes [predefined Cucumber tests](
50
56
  - Step-level and scenario-level hooks
51
57
 
52
58
  ### ๐Ÿงช CLI, CI/CD & Containerization
59
+
53
60
  - Powerful CLI for full control from the command line
54
61
  - Official [Artes Docker image](https://hub.docker.com/r/vahidaghayev/artes) for seamless containerized execution
55
62
  - CI/CD-ready โ€” integrate easily with any pipeline
56
63
 
57
64
  ### ๐Ÿ“Š Artes Reporting System
65
+
58
66
  - Easy installation with docker compose (For detailed info: [Artes Reporting System](https://github.com/4gayev1/artes-reporting-system))
59
67
  - Multiple reporting formats supported
60
68
  - Native Allure reporting integration
@@ -100,6 +108,7 @@ npx artes [options]
100
108
  | ๐Ÿท๏ธ `-v, --version` | Show the current version of Artes | `artes -v` or `artes --version` |
101
109
  | ๐Ÿ—๏ธ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
102
110
  | โœ… `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
111
+ | ๐Ÿšซ --noDeps | Skip installing dependencies when creating example project | `artes -c --noDeps` |
103
112
  | ๐Ÿ“Š `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
104
113
  | `--reportSuccess` | Add screenshots and video records for also Success test cases | `artes --reportSuccess` |
105
114
  | `--trace` | Enable tracing | `artes --trace` |
@@ -393,6 +402,7 @@ Hooks are **user-defined**.
393
402
  ### ๐Ÿ“ Hooks File Location
394
403
 
395
404
  Create the following file **inside your project** (optional):
405
+
396
406
  ```
397
407
  tests/steps/hooks.js
398
408
  ```
@@ -408,27 +418,27 @@ Undefined hooks are automatically skipped.
408
418
  // tests/steps/hooks.js
409
419
 
410
420
  export function BeforeStep() {
411
- // hook for before each step
421
+ // hook for before each step
412
422
  }
413
423
 
414
424
  export function Before() {
415
- // hook for before each test
425
+ // hook for before each test
416
426
  }
417
427
 
418
428
  export function BeforeAll() {
419
- // hook for before all tests
429
+ // hook for before all tests
420
430
  }
421
431
 
422
432
  export function AfterStep() {
423
- // hook for after each step
433
+ // hook for after each step
424
434
  }
425
435
 
426
436
  export function After() {
427
- // hook for after each test
437
+ // hook for after each test
428
438
  }
429
439
 
430
440
  export function AfterAll() {
431
- // hook for after all tests
441
+ // hook for after all tests
432
442
  }
433
443
  ```
434
444
 
@@ -450,6 +460,7 @@ export function AfterAll() {
450
460
  ### โ–ถ๏ธ Execution Order Example
451
461
 
452
462
  For a scenario with steps:
463
+
453
464
  ```
454
465
  BeforeAll
455
466
  Before
@@ -514,18 +525,20 @@ Artes supports environment-specific configurations through environment variables
514
525
  ### Setting Up Environment Variables
515
526
 
516
527
  1. **Configure Environment in artes.config.js:**
528
+
517
529
  ```javascript
518
530
  module.exports = {
519
531
  baseURL: {
520
532
  dev: "https://dev.alma.az",
521
- pre: "https://pre.alma.az",
522
- prod: "https://api.alma.az"
533
+ pre: "https://pre.alma.az",
534
+ prod: "https://api.alma.az",
523
535
  },
524
536
  env: "dev", // Specify which environment to use
525
537
  };
526
538
  ```
527
539
 
528
540
  **Alternative single URL configuration:**
541
+
529
542
  ```javascript
530
543
  module.exports = {
531
544
  baseURL: "https://api.alma.az", // Direct string URL
@@ -536,6 +549,7 @@ Artes supports environment-specific configurations through environment variables
536
549
  Create JSON files under `src/tests/environment_variables/` folder with names matching your environment:
537
550
 
538
551
  **dev.env.json:**
552
+
539
553
  ```json
540
554
  {
541
555
  "api_key": "dev-api-key-12345",
@@ -559,7 +573,7 @@ Artes supports environment-specific configurations through environment variables
559
573
  ### Important Notes
560
574
 
561
575
  - โš ๏ธ **Base URLs must be defined in `artes.config.js`** - they cannot be set in the environment variable JSON files
562
- - ๐Ÿ“ Environment variable files should be placed in `src/tests/environment_variables/`
576
+ - ๐Ÿ“ Environment variable files should be placed in `src/tests/environment_variables/`
563
577
  - ๐Ÿท๏ธ File names must follow the format `{env}.env.json` (e.g., `dev.env.json` for `env: "dev"`)
564
578
  - ๐Ÿ”„ Variables are loaded into variable storage and can be accessed during test runs
565
579
  - ๐ŸŒ Use environment variables for headers, API keys, timeouts, and other environment-specific configurations
@@ -627,4 +641,4 @@ If you don't use the -c or --create option that the package offers, save the fil
627
641
 
628
642
  ---
629
643
 
630
- ## ๐Ÿง‘โ€๐Ÿ’ป Have a Good Testing
644
+ ## ๐Ÿง‘โ€๐Ÿ’ป Have a Good Testing
@@ -32,9 +32,15 @@ const finalFormats = [
32
32
 
33
33
  function resolveEnv(artesConfig) {
34
34
  if (typeof artesConfig.baseURL === "object" && artesConfig.baseURL !== null) {
35
- if (process.env.ENV && artesConfig.baseURL.hasOwnProperty(process.env.ENV.trim())) {
35
+ if (
36
+ process.env.ENV &&
37
+ artesConfig.baseURL.hasOwnProperty(process.env.ENV.trim())
38
+ ) {
36
39
  return process.env.ENV.trim();
37
- } else if (artesConfig.env && artesConfig.baseURL.hasOwnProperty(artesConfig.env.trim())) {
40
+ } else if (
41
+ artesConfig.env &&
42
+ artesConfig.baseURL.hasOwnProperty(artesConfig.env.trim())
43
+ ) {
38
44
  return artesConfig.env.trim();
39
45
  } else {
40
46
  return Object.keys(artesConfig.baseURL)[0];
@@ -131,9 +137,14 @@ module.exports = {
131
137
  // World parameters
132
138
  worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
133
139
  },
134
- report:{
135
- singleFileReport: process.env.SINGLE_FILE_REPORT == "true" ? true : artesConfig.singleFileReport ? true : false,
136
- zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false
140
+ report: {
141
+ singleFileReport:
142
+ process.env.SINGLE_FILE_REPORT == "true"
143
+ ? true
144
+ : artesConfig.singleFileReport
145
+ ? true
146
+ : false,
147
+ zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false,
137
148
  },
138
149
  env: env,
139
150
  baseURL: process.env.BASE_URL
@@ -434,7 +434,6 @@ await getURL();
434
434
  ```
435
435
 
436
436
  - **Returns**:
437
-
438
437
  - _(string)_: The current page URL.
439
438
 
440
439
  ***
@@ -656,7 +655,6 @@ await shouldHaveId("#element-id", "unique-id");
656
655
  ```
657
656
 
658
657
  - **Parameters**:
659
-
660
658
  - `id` _(string)_: The expected ID.
661
659
 
662
660
  Got it! Hereโ€™s the refined format for the assertion methods:
@@ -1544,7 +1542,6 @@ await shouldObjectContaining(".element", { key: "value" });
1544
1542
  ```
1545
1543
 
1546
1544
  - **Parameters**:
1547
-
1548
1545
  - `selector` _(string)_: The CSS selector for the element.
1549
1546
  - `properties` _(object)_: The object properties to check for.
1550
1547
 
@@ -208,12 +208,14 @@
208
208
  # Variable Management
209
209
 
210
210
  ## Manual Variable Assignment
211
+
211
212
  - User saves `{string}` variable from response as `{string}`
212
213
  - User saves `{string}` variable as `{string}`
213
214
 
214
215
  ## Random Variable Management
215
216
 
216
217
  ### Random Words
218
+
217
219
  - User sets random word as `{string}`
218
220
  - User sets random word that has `{int}` character as `{string}`
219
221
  - User sets random word that has character between `{int}` and `{int}` as `{string}`
@@ -222,19 +224,23 @@
222
224
  - User sets random words that range between `{int}` and `{int}` as `{string}`
223
225
 
224
226
  ### Random Numbers
227
+
225
228
  - User sets random number as `{string}`
226
229
  - User sets random number from `{int}` to `{int}` as `{string}`
227
230
 
228
231
  ### Random Text Content
232
+
229
233
  - User sets random paragraph as `{string}`
230
234
  - User sets random paragraph that range between `{int}` and `{int}` as `{string}`
231
235
  - User sets random sentences that has `{int}` paragraph as `{string}`
232
236
 
233
237
  ### Random Characters & Alphanumeric
238
+
234
239
  - User sets random characters from `{string}` as `{string}`
235
240
  - User sets random alphanumeric in range from `{int}` to `{int}` as `{string}`
236
241
 
237
242
  ### Random Personal Information
243
+
238
244
  - User sets random email as `{string}`
239
245
  - User sets random fullname as `{string}`
240
246
  - User sets random first name as `{string}`
@@ -242,18 +248,23 @@
242
248
  - User sets random middle name as `{string}`
243
249
 
244
250
  ### Random Internet Data
251
+
245
252
  - User sets random url as `{string}`
246
253
 
247
254
  ### Random Dates
255
+
248
256
  - User sets random date between `{int}` and `{int}` as `{string}`
249
257
  - User sets date `{int}` days after today as `{string}`
250
258
  - User sets date `{int}` days before today as `{string}`
251
259
 
252
260
  ### Random from API Response
261
+
253
262
  - User sends GET request to `{string}` and save `{string}` variable from `{string}` array as `{string}` randomly
254
263
 
255
264
  ### Random from Array
265
+
256
266
  - User sets random value from given `{string}` array as `{string}`
267
+
257
268
  ---
258
269
 
259
270
  # Debugging / Console Output
@@ -264,7 +275,6 @@
264
275
 
265
276
  ---
266
277
 
267
-
268
278
  # Random Data Generation
269
279
 
270
280
  - User sets random words as `{string}` variable
package/executer.js CHANGED
@@ -25,6 +25,7 @@ const flags = {
25
25
  version: args.includes("-v") || args.includes("--version"),
26
26
  create: args.includes("-c") || args.includes("--create"),
27
27
  createYes: args.includes("-y") || args.includes("--yes"),
28
+ noDeps: args.includes("--noDeps"),
28
29
  report: args.includes("-r") || args.includes("--report"),
29
30
  reportSuccess: args.includes("--reportSuccess"),
30
31
  trace: args.includes("-t") || args.includes("--trace"),
@@ -64,8 +65,7 @@ const height = args[args.indexOf("--height") + 1];
64
65
  const timeout = args[args.indexOf("--timeout") + 1];
65
66
  const slowMo = args[args.indexOf("--slowMo") + 1];
66
67
 
67
-
68
- flags.env ? (process.env.ENV = env) : ""
68
+ flags.env ? (process.env.ENV = env) : "";
69
69
 
70
70
  flags.reportWithTrace ||
71
71
  artesConfig.reportWithTrace ||
@@ -91,11 +91,15 @@ flags.report ? (process.env.REPORT = true) : "";
91
91
 
92
92
  flags.trace ? (process.env.TRACE = true) : "";
93
93
 
94
- flags.reportWithTrace ? (process.env.REPORT_WITH_TRACE = true) : (process.env.REPORT_WITH_TRACE=false);
94
+ flags.reportWithTrace
95
+ ? (process.env.REPORT_WITH_TRACE = true)
96
+ : (process.env.REPORT_WITH_TRACE = false);
95
97
 
96
- flags.singleFileReport ? (process.env.SINGLE_FILE_REPORT = true) : (process.env.SINGLE_FILE_REPORT=false);
98
+ flags.singleFileReport
99
+ ? (process.env.SINGLE_FILE_REPORT = true)
100
+ : (process.env.SINGLE_FILE_REPORT = false);
97
101
 
98
- flags.zip ? (process.env.ZIP = true) : (process.env.ZIP=false);
102
+ flags.zip ? (process.env.ZIP = true) : (process.env.ZIP = false);
99
103
 
100
104
  flags.headless &&
101
105
  console.log("Running mode:", flags.headless ? "headless" : "headed");
@@ -131,7 +135,7 @@ flags.slowMo ? (process.env.SLOWMO = slowMo) : "";
131
135
  function main() {
132
136
  if (flags.help) return showHelp();
133
137
  if (flags.version) return showVersion();
134
- if (flags.create) return createProject(flags.createYes);
138
+ if (flags.create) return createProject(flags.createYes, flags.noDeps);
135
139
 
136
140
  runTests();
137
141
  if (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@ const invokeBrowser = async () => {
8
8
 
9
9
  if (typeof cucumberConfig.baseURL === "object") {
10
10
  const env = (cucumberConfig.env || "").trim();
11
- baseURL = cucumberConfig.baseURL[env];
11
+ baseURL = cucumberConfig.baseURL[env];
12
12
  } else {
13
13
  baseURL = cucumberConfig.baseURL;
14
14
  }
@@ -5,14 +5,14 @@ let baseURL = "";
5
5
 
6
6
  if (typeof cucumberConfig.baseURL === "object") {
7
7
  const env = (cucumberConfig.env || "").trim();
8
- baseURL = cucumberConfig.baseURL[env];
8
+ baseURL = cucumberConfig.baseURL[env];
9
9
  } else {
10
10
  baseURL = cucumberConfig.baseURL;
11
11
  }
12
12
 
13
13
  const requestContextOptions = {
14
14
  baseURL: baseURL,
15
- ignoreHTTPSErrors: true
15
+ ignoreHTTPSErrors: true,
16
16
  };
17
17
 
18
18
  async function invokeRequest() {
@@ -21,6 +21,9 @@ function showHelp() {
21
21
 
22
22
  โœ… -y, --yes Skip confirmation prompt for creating example project
23
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
24
27
 
25
28
  ๐Ÿ“Š -r, --report Run tests and generate Allure report
26
29
  Usage: artes -r or artes --report
@@ -4,7 +4,7 @@ const fs = require("fs");
4
4
  const path = require("path");
5
5
  const { execSync } = require("child_process");
6
6
 
7
- function createProject(createYes) {
7
+ function createProject(createYes, noDeps) {
8
8
  const projectDir = path.join(process.cwd(), "artes");
9
9
  const srcDir = path.join(projectDir, "tests");
10
10
 
@@ -16,13 +16,16 @@ function createProject(createYes) {
16
16
  path.join(projectDir, ".vscode"),
17
17
  ].forEach((dir) => fs.mkdirSync(dir, { recursive: true }));
18
18
 
19
-
20
19
  console.log("๐Ÿš€ Initializing project...");
21
- execSync(`npm init ${createYes ? "-y" : ""}`, {cwd: projectDir, stdio: "inherit" });
22
- execSync("npm i artes", {cwd: projectDir, stdio: "inherit" });
20
+ execSync(`npm init ${createYes ? "-y" : ""}`, {
21
+ cwd: projectDir,
22
+ stdio: "inherit",
23
+ });
24
+
25
+ !noDeps ? execSync("npm i artes", { cwd: projectDir, stdio: "inherit" }) : "";
23
26
 
24
27
  console.log("๐Ÿ“ฆ Setting up browsers...");
25
- execSync("npx playwright install", {cwd: projectDir, stdio: "inherit" });
28
+ execSync("npx playwright install", { cwd: projectDir, stdio: "inherit" });
26
29
 
27
30
  const packageJsonPath = path.join(projectDir, "package.json");
28
31
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
@@ -128,7 +131,7 @@ await context.page.goto("https://www.saucedemo.com/");
128
131
  });
129
132
  `;
130
133
 
131
- const hooksContent = `
134
+ const hooksContent = `
132
135
  export function BeforeStep() {
133
136
  // hook for before each step
134
137
  }
@@ -5,22 +5,37 @@ const { spawnSync } = require("child_process");
5
5
  const { moduleConfig } = require("../imports/commons");
6
6
 
7
7
  function generateReport() {
8
-
9
8
  try {
10
9
  console.log("๐Ÿ“Š Generating report...");
11
10
 
12
- spawnSync("allure", [ "generate", "--clean", `${process.env.SINGLE_FILE_REPORT == "true" ? "--single-file" : "" }`, "allure-result", "--output", moduleConfig.reportPath], {
13
- cwd: moduleConfig.modulePath,
14
- stdio: "ignore",
15
- shell: true,
16
- });
11
+ spawnSync(
12
+ "allure",
13
+ [
14
+ "generate",
15
+ "--clean",
16
+ `${process.env.SINGLE_FILE_REPORT == "true" ? "--single-file" : ""}`,
17
+ "allure-result",
18
+ "--output",
19
+ moduleConfig.reportPath,
20
+ ],
21
+ {
22
+ cwd: moduleConfig.modulePath,
23
+ stdio: "ignore",
24
+ shell: true,
25
+ },
26
+ );
17
27
 
18
- console.log(`๐Ÿ“‹ Report generated successfully in ${moduleConfig.reportPath}!`);
28
+ console.log(
29
+ `๐Ÿ“‹ Report generated successfully in ${moduleConfig.reportPath}!`,
30
+ );
19
31
 
20
32
  if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP) {
21
33
  console.log(`๐Ÿ—œ๏ธ Zipping report folder`);
22
34
 
23
- const zipPath = path.join(path.dirname(moduleConfig.reportPath), "report.zip");
35
+ const zipPath = path.join(
36
+ path.dirname(moduleConfig.reportPath),
37
+ "report.zip",
38
+ );
24
39
 
25
40
  let done = false;
26
41
  let error = null;
@@ -46,9 +61,10 @@ function generateReport() {
46
61
  console.log(`๐Ÿ—œ๏ธ Zipped in ${moduleConfig.reportPath}/report.zip!`);
47
62
  if (error) throw error;
48
63
  } else {
49
- console.warn(`โš ๏ธ Report folder does not exist: ${moduleConfig.reportPath}`);
64
+ console.warn(
65
+ `โš ๏ธ Report folder does not exist: ${moduleConfig.reportPath}`,
66
+ );
50
67
  }
51
-
52
68
  } catch (err) {
53
69
  console.error("โŒ Report generation failed:", err);
54
70
  process.env.EXIT_CODE = 1;
@@ -34,7 +34,8 @@ const moduleConfig = {
34
34
  featuresPath: path.join(projectPath, "/tests/features/"),
35
35
  stepsPath: path.join(projectPath, "/tests/steps/*.js"),
36
36
  pomPath: path.join(projectPath, "/tests/POMs"),
37
- cleanUpPaths: "allure-result allure-results test-results @rerun.txt testsStatus EXIT_CODE.txt",
37
+ cleanUpPaths:
38
+ "allure-result allure-results test-results @rerun.txt testsStatus EXIT_CODE.txt",
38
39
  };
39
40
 
40
41
  module.exports = {
@@ -31,9 +31,8 @@ function getMimeType(filePath) {
31
31
  function processForm(requestBody) {
32
32
  let formData = {};
33
33
  for (const [key, value] of Object.entries(requestBody)) {
34
-
35
34
  if (value === null || value === undefined) {
36
- continue;
35
+ continue;
37
36
  }
38
37
 
39
38
  if (typeof value === "object") {
@@ -360,4 +359,4 @@ const api = {
360
359
  },
361
360
  };
362
361
 
363
- module.exports = { api };
362
+ module.exports = { api };
@@ -46,8 +46,10 @@ function saveTestStatus(result, pickle) {
46
46
  );
47
47
  }
48
48
 
49
-
50
- const projectHooksPath = path.resolve(moduleConfig.projectPath, "tests/steps/hooks.js");
49
+ const projectHooksPath = path.resolve(
50
+ moduleConfig.projectPath,
51
+ "tests/steps/hooks.js",
52
+ );
51
53
 
52
54
  let projectHooks = {};
53
55
 
@@ -72,7 +74,6 @@ BeforeAll(async () => {
72
74
  });
73
75
 
74
76
  Before(async function () {
75
-
76
77
  context.vars = {};
77
78
 
78
79
  const envFilePath = path.join(
@@ -223,7 +224,6 @@ After(async function ({ pickle, result }) {
223
224
  }
224
225
  }
225
226
  }
226
-
227
227
  });
228
228
 
229
229
  AfterAll(async () => {