artes 1.7.4 → 1.7.6

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 (48) hide show
  1. package/README.md +781 -779
  2. package/assets/styles.css +4 -4
  3. package/cucumber.config.js +253 -253
  4. package/docs/ciExecutors.md +198 -198
  5. package/docs/emulationDevicesList.md +152 -152
  6. package/docs/functionDefinitions.md +2401 -2401
  7. package/docs/stepDefinitions.md +435 -433
  8. package/executer.js +266 -264
  9. package/index.js +50 -50
  10. package/package.json +56 -56
  11. package/src/helper/contextManager/browserManager.js +74 -74
  12. package/src/helper/contextManager/requestManager.js +23 -23
  13. package/src/helper/controller/elementController.js +210 -210
  14. package/src/helper/controller/findDuplicateTestNames.js +69 -69
  15. package/src/helper/controller/getEnvInfo.js +94 -94
  16. package/src/helper/controller/getExecutor.js +109 -109
  17. package/src/helper/controller/pomCollector.js +83 -83
  18. package/src/helper/controller/reportCustomizer.js +485 -485
  19. package/src/helper/controller/screenComparer.js +97 -108
  20. package/src/helper/controller/status-formatter.js +137 -137
  21. package/src/helper/controller/testCoverageCalculator.js +111 -111
  22. package/src/helper/executers/cleaner.js +23 -23
  23. package/src/helper/executers/exporter.js +19 -19
  24. package/src/helper/executers/helper.js +193 -191
  25. package/src/helper/executers/projectCreator.js +226 -222
  26. package/src/helper/executers/reportGenerator.js +91 -91
  27. package/src/helper/executers/testRunner.js +28 -28
  28. package/src/helper/executers/versionChecker.js +31 -31
  29. package/src/helper/imports/commons.js +65 -65
  30. package/src/helper/stepFunctions/APIActions.js +495 -495
  31. package/src/helper/stepFunctions/assertions.js +986 -986
  32. package/src/helper/stepFunctions/browserActions.js +87 -87
  33. package/src/helper/stepFunctions/elementInteractions.js +60 -60
  34. package/src/helper/stepFunctions/exporter.js +19 -19
  35. package/src/helper/stepFunctions/frameActions.js +72 -72
  36. package/src/helper/stepFunctions/keyboardActions.js +66 -66
  37. package/src/helper/stepFunctions/mouseActions.js +84 -84
  38. package/src/helper/stepFunctions/pageActions.js +43 -43
  39. package/src/hooks/context.js +15 -15
  40. package/src/hooks/hooks.js +287 -279
  41. package/src/stepDefinitions/API.steps.js +310 -310
  42. package/src/stepDefinitions/assertions.steps.js +1303 -1280
  43. package/src/stepDefinitions/browser.steps.js +74 -74
  44. package/src/stepDefinitions/frameActions.steps.js +76 -76
  45. package/src/stepDefinitions/keyboardActions.steps.js +264 -264
  46. package/src/stepDefinitions/mouseActions.steps.js +378 -378
  47. package/src/stepDefinitions/page.steps.js +71 -71
  48. package/src/stepDefinitions/random.steps.js +191 -191
package/README.md CHANGED
@@ -1,779 +1,781 @@
1
- <p align="center">
2
- <img alt="artesLogo" src="https://github.com/user-attachments/assets/e0641011-0e96-4330-8ad5-935b395b0838" width="280">
3
- </p>
4
-
5
- <h1 align="center">Artes</h1>
6
-
7
- <p >
8
- <a href="https://www.npmjs.com/package/artes">
9
- <img src="https://img.shields.io/npm/dm/artes?label=npm&logo=npm&color=blue" alt="npm version">
10
- </a>
11
-
12
- <a href="https://github.com/4gayev1/Artes">
13
- <img src="https://img.shields.io/badge/GitHub-Artes-181717?logo=github&logoColor=white" alt="GitHub Artes">
14
- </a>
15
-
16
- <a href="https://hub.docker.com/r/vahidaghayev/artes">
17
- <img src="https://img.shields.io/badge/Docker-Artes-blue?logo=docker&logoColor=white" alt="Docker Artes">
18
- </a>
19
-
20
- <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">
21
- <img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=black" alt="JavaScript">
22
- </a>
23
-
24
- <a href="https://playwright.dev/">
25
- <img src="https://img.shields.io/badge/Playwright-2EAD33?logo=playwright&logoColor=white" alt="Playwright">
26
- </a>
27
-
28
- <a href="https://cucumber.io/">
29
- <img src="https://img.shields.io/badge/Cucumber-23D96C?logo=cucumber&logoColor=white" alt="Cucumber">
30
- </a>
31
-
32
- <a href="https://www.apache.org/licenses/LICENSE-2.0">
33
- <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="Apache 2.0 License">
34
- </a>
35
-
36
- </p>
37
-
38
- Artes is a test runner for Playwright that executes [predefined Cucumber tests](./docs/stepDefinitions.md) and can generate Allure reports for test results. It simplifies setting up Playwright with Cucumber in your automation workflow. With Artes, you can easily run tests without writing step definitions, generate reports, and customize your testing environment.
39
-
40
- ![artes demonstration](https://github.com/user-attachments/assets/c46172f7-103d-45d1-a37d-8d4267df0967)
41
-
42
- ---
43
-
44
- ## 🌟 Artes Benefits
45
-
46
- ### 🚀 Fast Setup & Smooth Onboarding
47
-
48
- - Install in minutes and create a test project effortlessly
49
- - Well-structured, easy-to-follow documentation for a smooth learning curve
50
- - Designed for long-term maintainability and scalability
51
-
52
- ### 🧩 Powerful & QA-Friendly Architecture
53
-
54
- - Intuitive API for writing custom step definitions
55
- - Rich set of ready-to-use step definitions to speed up test creation
56
- - Fully extensible — add your own step definitions anytime
57
-
58
- ### 🌐 Advanced API Testing
59
-
60
- - Schema validation to ensure API response correctness
61
- - Rich assertion library for precise validations
62
- - Support for all HTTP methods
63
- - Environment-based API configuration for flexible testing
64
-
65
- ### 🔁 Smart Variable & Data Handling
66
-
67
- - Page Object Model (POM) support for structured data management
68
- - Save, reuse, and share variables across steps
69
- - Built-in data randomization for dynamic and realistic test data
70
- - Environment-specific variables for clean environment separation
71
-
72
- ### 🖥️ Modern UI Automation
73
-
74
- - Wide locator strategy support (CSS, XPath, text-based, and more)
75
- - Built-in browser actions
76
- - Cookie management
77
- - Local & session storage handling
78
-
79
- ### ⚙️ Flexible Configuration & Hooks
80
-
81
- - Environment-based configuration system
82
- - Powerful and customizable configuration files
83
- - Full hook support:
84
- - Before / After
85
- - Step-level and scenario-level hooks
86
-
87
- ### 🧪 CLI, CI/CD & Containerization
88
-
89
- - Powerful CLI for full control from the command line
90
- - Quality gate support — set a minimum success rate threshold to automatically fail the pipeline when test results drop below the required percentage
91
- - Official [Artes Docker image](https://hub.docker.com/r/vahidaghayev/artes) for seamless containerized execution
92
- - CI/CD-ready — integrate easily with any pipeline
93
-
94
- ### 🤖 AI-Powered Bug Reports & Test Summaries
95
-
96
- - Automatically generates professional bug reports for failed test cases
97
- - Generates concise test summaries for passed scenarios
98
- - Supports multiple AI providers — OpenAI, Google Gemini, Anthropic Claude, Mistral, Groq, Cohere, DeepSeek (see [Supported AI Providers](docs/aiProviders.md) for full model list and setup)
99
- - Works with local AI models (Ollama, LM Studio) — no API key required
100
- - Multi-language report generation — produce reports in any language
101
- - Configurable report cap to control API usage and costs
102
-
103
- ### 📊 Artes Reporting System
104
-
105
- - Easy installation with docker compose (For detailed info: [Artes Reporting System](https://github.com/4gayev1/artes-reporting-system))
106
- - Multiple reporting formats supported
107
- - Native Allure reporting integration
108
- - Customizable Artes Reporting System
109
-
110
- ---
111
-
112
- ## 🧑‍💻 Installation
113
-
114
- You can install **Artes** via npm. To install it globally **(RECOMMENDED)**, run the following command:
115
-
116
- ```bash
117
- npm install -g artes
118
- ```
119
-
120
- To install it locally in your project, run:
121
-
122
- ```bash
123
- npm install artes
124
- ```
125
-
126
- Once installed, you can run **Artes** using:
127
-
128
- ```bash
129
- npx artes [options]
130
- ```
131
-
132
- ---
133
-
134
- ## 💡 Usage
135
-
136
- **Artes** has following CLI options:
137
-
138
- ```bash
139
- npx artes [options]
140
- ```
141
-
142
-
143
- ### General ( artes -h or artes --help )
144
-
145
- | Option | Description | Usage Example |
146
- | --- | --- | --- |
147
- | `-h, --help` | Show this help message | `artes -h` or `artes --help` |
148
- | `-v, --version` | Show current version of artes | `artes -v` or `artes --version` |
149
- | `-c, --create` | Create example artes project | `artes -c` or `artes --create` |
150
-
151
- ### Reporting & Branding ( artes report --help )
152
-
153
- | Option | Description | Usage Example |
154
- | --- | --- | --- |
155
- | `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
156
- | `--reportSuccess` | Generate screenshot and video with successful tests too | `artes --reportSuccess` |
157
- | `--trace` | Enable tracing for all tests | `artes --trace` |
158
- | `-rwt, --reportWithTrace` | Include trace in the report | `artes -rwt` or `artes --reportWithTrace` |
159
- | `--singleFileReport` | Generate single file Allure report | `artes -r --singleFileReport` |
160
- | `--zip` | Zip the report folder after generation | `artes -r --zip` |
161
- | `--logo` | Set a custom logo in the report sidebar | `artes --logo logo.png` |
162
- | `--brandName` | Set the brand name displayed next to the logo | `artes --brandName 'My Company'` |
163
- | `--reportName` | Report name on the summary widget | `artes --reportName 'Alma UI'` |
164
- | `--uploadReport` | Upload the generated report to Artes Reporting System | `artes -r --zip --uploadReport --reporterURL "https://example.com"` |
165
- | `--reporterURL` | URL of the Artes Reporting System | `artes --uploadReport --reporterURL "https://example.com"` |
166
- | `--projectName` | Project name in the Artes Reporting System (default: `"Artes Report"`) | `artes --uploadReport --reporterURL "https://example.com" --projectName "My Project"` |
167
- | `--projectType` | Project type for reporting, e.g., UI, API (default: `"Artes"`) | `artes --uploadReport --reporterURL "https://example.com" --projectType "API"` |
168
- | `--reportPath` | Path to the report zip file to upload (default: `./report.zip`) | `artes --uploadReport --reporterURL "https://example.com" --reportPath "./my_report.zip"` |
169
-
170
- ### Browser ( artes browser --help )
171
-
172
- | Option | Description | Usage Example |
173
- | --- | --- | --- |
174
- | `--browser` | Specify browser to use (`chromium`, `firefox`, `webkit`) | `artes --browser chromium` |
175
- | `--device` | Emulate a specific device (e.g., `"iPhone 13"`) | `artes --device "iPhone 13"` |
176
- | `--maxScreen` | Maximize browser window on launch | `artes --maxScreen` |
177
- | `--width` | Set browser width (default: `1280`) | `artes --width 1920` |
178
- | `--height` | Set browser height (default: `720`) | `artes --height 1080` |
179
-
180
- ### Execution ( artes execution --help )
181
-
182
- | Option | Description | Usage Example |
183
- | --- | --- | --- |
184
- | `--headless` | Run browser in headless mode | `artes --headless` |
185
- | `--baseURL` | Set base URL for the tests | `artes --baseURL "https://example.com"` |
186
- | `--offline` | Run browser in offline mode | `artes --offline` |
187
- | `--features` | Specify feature file paths to run (comma-separated) | `artes --features "tests/features/Alma,tests/features/Banan.feature"` |
188
- | `--stepDef` | Specify step definition file paths to use (comma-separated) | `artes --stepDef "tests/steps/login.js,tests/steps/home.js"` |
189
- | `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke and not @wip"` |
190
- | `--env` | Set the environment for the test run | `artes --env "dev"` |
191
- | `--saveVar` | Set variables from CLI | `artes --saveVar '{"armud":20,"banana":200}'` |
192
- | `--parallel` | Run tests in parallel mode | `artes --parallel 3` |
193
- | `--retry` | Retry failed tests | `artes --retry 2` |
194
- | `--rerun` | Rerun only failed tests from previous run | `artes --rerun @rerun.txt` |
195
- | `--dryRun` | Perform a dry run without executing tests | `artes --dryRun` |
196
- | `--percentage` | Set minimum success percentage to pass test run (default: `0`) | `artes --percentage 85` |
197
- | `--timeout` | Set timeout for each test step in seconds (default: `30`) | `artes --timeout 10` |
198
- | `--slowMo` | Slow down execution for clear view (default: `0`) | `artes --slowMo 1` |
199
-
200
- ### AI Bug Reporter ( artes ai --help )
201
-
202
- | Option | Description | Usage Example |
203
- | --- | --- | --- |
204
- | `--ai` | Enable AI-generated bug reports and test summaries | `artes --ai` |
205
- | `--aiModel` | AI model to use for report generation | `artes --ai --aiModel "gemini 2.5 flash"` |
206
- | `--aiKey` | API key for the selected AI provider | `artes --ai --aiKey "your-api-key"` |
207
- | `--aiURL` | Local AI endpoint URL (e.g., Ollama, LM Studio). Overrides `--aiModel` and `--aiKey` when set | `artes --ai --aiURL "http://localhost:11434/api/chat"` |
208
- | `--aiLanguage` | Language for AI-generated reports (default: `"English"`) | `artes --ai --aiLanguage "Azerbaijani"` |
209
- | `--maxTokens` | Maximum tokens for AI-generated reports (default: `4000`) | `artes --ai --maxTokens 8000` |
210
- | `--maxReports` | Maximum number of AI reports to generate per test run (default: `10`) | `artes --ai --maxReports 5` |
211
-
212
-
213
- \*\* To just run the tests: <br>
214
- Globally: artes <br>
215
- Locally: npx artes
216
-
217
- ---
218
-
219
- ## 🎯 Best Practices
220
-
221
- - **Global Installation:**
222
- For ease of use, it's recommended that Artes be installed globally. You can do this by running the following command:
223
-
224
- ```bash
225
- npm install -g artes
226
- ```
227
-
228
- - **Project Creation (Recommended):**
229
- To create a new project with Artes, use the `-c` flag. This will automatically set up the folder structure and configuration for you. Run the command:
230
-
231
- ```bash
232
- artes -c
233
- ```
234
-
235
- 🗂️ Example Project Structure: <br/>
236
- After running the `-c` flag to create a new project, the structure will look like this:
237
-
238
- ```
239
- /artes (Project Name)
240
- /tests
241
- /features
242
- (Your feature files here)
243
- /POMs // Optional
244
- (POM JSON file here)
245
- /steps // For custom steps and hooks
246
- (Your step definition and hooks JS files here)
247
- artes.config.js
248
- /report
249
- (Generated Allure report HTML here)
250
- ```
251
-
252
- **If you choose not to use the `-c` flag**, you can still download Artes to your testing project and use the prepared steps by running:
253
-
254
- ```bash
255
- npx artes
256
- ```
257
-
258
- You must customize the paths of features, steps, and other configurations by editing the `artes.config.js` file located inside your project folder (or create it).
259
-
260
- For example:
261
-
262
- ```javascript
263
- module.exports = {
264
- paths: ["tests/features/"], // Custom path for feature files
265
- require: ["tests/steps/*.js"], // Custom path for step definitions files
266
- pomPath: "tests/POMS/*.js", // Custom path for POM files
267
- };
268
- ```
269
-
270
- ---
271
-
272
- ## 📝 Writing Feature Files and POM Files
273
-
274
- Artes simplifies your test writing with structured feature files and organized Page Object Models (POM). Here’s how you can create them:
275
-
276
- ### 1. 📄 Feature File Structure
277
-
278
- ```gherkin
279
- Feature: Searching on Google 🔍
280
- Scenario Outline: Search for a term on Google
281
- Given User is on "https://www.google.com/" page
282
- When User types "alma" in "google_search_input"
283
- And User clicks "google_search_button"
284
- And User waits 10 seconds
285
- Then "google_text" should have "Alma" text
286
- ```
287
-
288
- - **Feature**: Describes the main feature being tested (e.g., Google search).
289
- - **Scenario Outline**: Defines a test case with steps.
290
- - **Steps**: Use `Given`, `When`, `And`, `Then` keywords to describe actions and expectations.
291
- - **Selectors**: The element names (e.g., `google_search_input`, `google_search_button`) map to the POM file or can be defined directly.
292
-
293
- ### 2. 📂 POM File Example
294
-
295
- ```json
296
- {
297
- "google_search_input": { "selector": "#APjFqb" },
298
- "google_search_button": {
299
- "selector": "input.gNO89b"
300
- },
301
- "google_text": {
302
- "selector": "#rso div h3",
303
- "waitTime": 5 //seconds
304
- }
305
- }
306
- ```
307
-
308
- - 📑 Using POM File is optional but it is **RECOMMENDED**
309
- - 🔗 Using Selector in Feature File is possible
310
- ```gherkin
311
- When User types "alma" in "#APjFqb"
312
- ```
313
- - 🐍 It is good to use snake_case for element names
314
- - ⏳ "waitTime" is to define custom wait for elements, but the feature currently under development.
315
- "selector" must be used if "waitTime" is used, but when using only selector is not needed mention in "selector"
316
-
317
- ---
318
-
319
- ## 🔄 Variable Management
320
-
321
- Artes provides powerful variable management capabilities that allow you to save, reuse, and share variables across test steps.
322
-
323
- ### Saving Variables from API Responses
324
-
325
- You can save variables directly from API responses, even using dot notation to extract nested values:
326
-
327
- ```gherkin
328
- When User sends GET request to "https://www.test.com" and saves "id" variables
329
- And User sends GET request to "https://www.test.com/items/{{id}}"
330
- Then User expects that response should have 200 status code
331
- ```
332
-
333
- ### Manual Variable Assignment
334
-
335
- Save variables manually using the dedicated step:
336
-
337
- ```gherkin
338
- And User saves "15" variable as "id"
339
- ```
340
-
341
- ### Variable Randomization
342
-
343
- Artes includes built-in randomization for generating dynamic test data:
344
-
345
- ```gherkin
346
- And User sets random email as "email"
347
- And User sets random 5 words as "description"
348
- And User sets random fullname as "fullName"
349
- ```
350
-
351
- ### Using Variables in Tests
352
-
353
- Reference saved variables anywhere in your tests using double curly braces:
354
-
355
- ```gherkin
356
- When User types "{{email}}" in "email_input"
357
- ```
358
-
359
- 📚 **For detailed information and complete step definitions**, visit the [Variable Management Documentation](https://github.com/4gayev1/Artes/blob/main/docs/stepDefinitions.md#variable-management).
360
-
361
- ---
362
-
363
- ## 🛠️ Customization
364
-
365
- ## ✍️ Writing Custom Step Definitions
366
-
367
- Artes allows you to extend its functionality by writing custom step definitions. Here's how you can do it:
368
-
369
- ### Import Required APIs
370
-
371
- ```javascript
372
- const {
373
- expect,
374
- Given,
375
- When,
376
- Then,
377
- element,
378
- context,
379
- keyboard,
380
- mouse,
381
- frame,
382
- assert,
383
- elementInteractions,
384
- } = require("artes"); // Common JS
385
- import { expect, Given, When, Then, element, context } from "artes"; // ES Modules (Do not RECOMMENDED)
386
- ```
387
-
388
- - **`Given`, `When`, `Then`**: These define your steps in Cucumber syntax. Example:
389
-
390
- ```javascript
391
- Given("User is on the login page", async () => {
392
- await context.page.navigateTo("https://example.com/login");
393
- });
394
- ```
395
-
396
- - **`page`**: Provides higher-level page actions such as navigation and waiting(Same as PlayWright). Examples:
397
- - Navigate to a URL:
398
- ```javascript
399
- await context.page.navigate("https://example.com");
400
- ```
401
- - Wait for a selector:
402
- ```javascript
403
- await context.page.waitForSelector("#loadingSpinner");
404
- ```
405
- - **`request`**: Use for sending HTTP requests. _(Note: This feature is currently under development.)_
406
-
407
- - **`element`**: Use for interacting with elements on the web page. Examples:
408
- - Clicking a button:
409
- ```javascript
410
- await element("#submitButton").click();
411
- ```
412
- - Filling an input:
413
- ```javascript
414
- await element("#username").fill("testUser");
415
- ```
416
- - **`expect`**: Use for assertions in your steps. For example:
417
- ```javascript
418
- expect(actualValue).toBe(expectedValue);
419
- expect(element("Page_Title")).toHaveText(expectedValue);
420
- ```
421
-
422
- ## 📋 Simplified Functions
423
-
424
- If you don't want to deal with Playwright methods directly, you can simply use the following predefined actions methods by import them:
425
-
426
- ```javascript
427
- const { mouse, keyboard, frame, elementInteractions, page } = require("artes");
428
- ```
429
-
430
- - **Mouse Actions:**
431
- `mouse.click(element)`
432
-
433
- - **Keyboard Actions:**
434
- `keyboard.press(key)`
435
-
436
- - **Element Interactions:**
437
- `elementInteractions.isChecked()`
438
-
439
- - **Assertions:**
440
- `assert.shouldBeTruthy(element)`
441
-
442
- - **Frame Actions:**
443
- `frame.first()`
444
-
445
- - **API Actions:**
446
- `api.post(url, payload, requestDataType)`
447
-
448
- ---
449
-
450
- For a detailed explanation of each function, please refer to the [function definitions](./docs/functionDefinitions.md).
451
-
452
- ---
453
-
454
- ### Example of Custom Step Definition
455
-
456
- ```javascript
457
- const { Given, When, Then, expect, element, page } = require("artes");
458
-
459
- Given("User is on the home page", async () => {
460
- await page.navigate("https://example.com");
461
- });
462
-
463
- When("User clicks the login button", async () => {
464
- await element("#loginButton").click();
465
- });
466
-
467
- Then("User should see the login form", async () => {
468
- expect(element("#loginForm")).toBeVisible(true);
469
- });
470
- ```
471
-
472
- ## 🪝 Hooks (Lifecycle Hooks)
473
-
474
- Artes supports **hooks** that allow you to execute custom logic **before and after tests, scenarios, and steps**.
475
-
476
- Hooks are **user-defined**.
477
-
478
- ---
479
-
480
- ### 📁 Hooks File Location
481
-
482
- Create the following file **inside your project** (optional):
483
-
484
- ```
485
- tests/steps/hooks.js
486
- ```
487
-
488
- ---
489
-
490
- ### ✍️ Writing Hooks
491
-
492
- You can define **only the hooks you need** in hooks.js under the steps folder.
493
- Undefined hooks are automatically skipped.
494
-
495
- ```js
496
- // tests/steps/hooks.js
497
-
498
- export function BeforeStep() {
499
- // hook for before each step
500
- }
501
-
502
- export function Before() {
503
- // hook for before each test
504
- }
505
-
506
- export function BeforeAll() {
507
- // hook for before all tests
508
- }
509
-
510
- export function AfterStep() {
511
- // hook for after each step
512
- }
513
-
514
- export function After() {
515
- // hook for after each test
516
- }
517
-
518
- export function AfterAll() {
519
- // hook for after all tests
520
- }
521
- ```
522
-
523
- ---
524
-
525
- ### 🔁 Supported Hook Types
526
-
527
- | Hook Name | Execution Time |
528
- | ------------ | ----------------------------- |
529
- | `BeforeAll` | Once before **all scenarios** |
530
- | `Before` | Before **each scenario** |
531
- | `BeforeStep` | Before **each step** |
532
- | `AfterStep` | After **each step** |
533
- | `After` | After **each scenario** |
534
- | `AfterAll` | Once after **all scenarios** |
535
-
536
- ---
537
-
538
- ### ▶️ Execution Order Example
539
-
540
- For a scenario with steps:
541
-
542
- ```
543
- BeforeAll
544
- Before
545
- BeforeStep
546
- (step executes)
547
- AfterStep
548
- After
549
- AfterAll
550
- ```
551
-
552
- ---
553
-
554
- ## ⚙️ Configuration
555
-
556
- You can configure Artes by editing the `artes.config.js` file. Below are the default configuration options with explanations:
557
-
558
- | **Option** | **Default Value** | **Description** |
559
- | ----------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------- |
560
- | `headless` | `false` | Run browser in headless mode. |
561
- | `env` | `""` | Environment name for tests. |
562
- | `variables` | `{}` | Variables for tests. |
563
- | `baseURL` | `""` | Base URL for API or web tests. |
564
- | `timeout` | `30` | Default timeout in seconds. |
565
- | `slowMo` | `0` | Default slow motion in seconds. |
566
- | `paths` | `[moduleConfig.featuresPath]` | Paths to feature files. |
567
- | `require` | `[moduleConfig.stepsPath, "src/stepDefinitions/*.js", "src/hooks/hooks.js"]` | Support code paths (CommonJS). |
568
- | `pomPath` | `moduleConfig.pomPath` | Path to Page Object Models. |
569
- | `import` | `[]` | Support code paths. |
570
- | `testPercentage` | `0` | Define test coverage percentage |
571
- | `report` | `false` | Generate report |
572
- | `zip` | `false` | Generate zip of report |
573
- | `reportSuccess` | `false` | Add screenshots and video records also for success test cases |
574
- | `trace` | `false` | Enable tracing |
575
- | `reportWithTrace` | `false` | Include trace in report |
576
- | `logo` | `""` (uses default Artes logo) | Custom logo for the report sidebar. Accepts an absolute path, a relative path, or a direct image URL |
577
- | `brandName`| `""` | Brand name displayed next to the logo in the report sidebar |
578
- | `reportName`| `""` | Report name displayed on the summary widget |
579
- | `format` | `["rerun:@rerun.txt", "allure-cucumberjs/reporter"]` | Formatter names/paths. |
580
- | `formatOptions` | `{ "resultsDir": "allure-result" }` | Formatter options. |
581
- | `parallel` | `1` | Number of parallel workers. |
582
- | `browser` | `"chrome"` | Browser to use: "chrome", "firefox", "webkit". |
583
- | `offline` | `false` | Run browser in offline mode. |
584
- | `device` | `""` | Emulate specific device (e.g., "iPhone 13"). |
585
- | `width` | `1280` | Browser width in pixels. |
586
- | `height` | `720` | Browser height in pixels. |
587
- | `maximizeScreen` | `true` | Maximize browser window on start. |
588
- | `dryRun` | `false` | Prepare test run without execution. |
589
- | `failFast` | `false` | Stop on first test failure. |
590
- | `forceExit` | `false` | Force `process.exit()` after tests |
591
- | `strict` | `true` | Fail on pending steps. |
592
- | `backtrace` | `false` | Show full backtrace for errors. |
593
- | `tags` | `""` | Tag expression to filter scenarios. |
594
- | `name` | `[]` | Run scenarios matching regex. |
595
- | `order` | `"defined"` | Run order (defined/random). |
596
- | `language` | `"en"` | Default feature file language. |
597
- | `loader` | `[]` | Module loader specifications. |
598
- | `requireModule` | `[]` | Transpilation module names. |
599
- | `retry` | `0` | Retry attempts for failing tests. |
600
- | `retryTagFilter` | `""` | Tag expression for retries. |
601
- | `publish` | `false` | Publish to cucumber.io. |
602
- | `worldParameters` | `{}` | Custom world parameters. |
603
-
604
- ---
605
-
606
- ## 🤖 AI Configuration
607
-
608
- | **Option** | **Default Value** | **Description** |
609
- | -------------------- | ----------------- | ---------------------------------------------------------------------------------------------------- |
610
- | `ai.ai` | `false` | Enable AI-generated bug reports and test summaries. |
611
- | `ai.model` | `"gpt-4o"` | AI model to use for report generation (e.g. `"gemini 2.5 flash"`, `"claude sonnet"`) |
612
- | `ai.key` | `""` | API key for the selected AI provider. |
613
- | `ai.url` | `""` | Local AI endpoint URL (e.g. Ollama, LM Studio). Overrides `model` and `key` when set. |
614
- | `ai.language` | `"English"` | Language for AI-generated reports (e.g. `"Azerbaijani"`, `"German"`). |
615
- | ai.maxTokens | 4000 | Maximum tokens for AI response output |
616
- | `ai.maxReports` | `10` | Maximum number of AI reports to generate per test run. |
617
-
618
- ---
619
-
620
- ## 🌍 Environment Configuration
621
-
622
- | **Option** | **Default Value** | **Description** |
623
- | ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |
624
- | `env` | `""` | Environment configuration. Should match the name with the baseURL object, like "dev" |
625
- | `baseURL` | `""` | Base URL for API requests. Can be object {"dev":"dev-api.com", "pre":"pre-api.com"}, or string "dev-api.com" |
626
-
627
- ### Environment Variables Configuration
628
-
629
- Artes supports environment-specific configurations through environment variables. This feature allows to manage different settings for environments.
630
-
631
- ### Setting Up Environment Variables
632
-
633
- 1. **Configure Environment in artes.config.js:**
634
-
635
- ```javascript
636
- module.exports = {
637
- baseURL: {
638
- dev: "https://dev.alma.az",
639
- pre: "https://pre.alma.az",
640
- prod: "https://api.alma.az",
641
- },
642
- env: "dev", // Specify which environment to use
643
- };
644
- ```
645
-
646
- **Alternative single URL configuration:**
647
-
648
- ```javascript
649
- module.exports = {
650
- baseURL: "https://api.alma.az", // Direct string URL
651
- };
652
- ```
653
-
654
- 2. **Create Environment Variable Files:**
655
- Create JSON files under `src/tests/environment_variables/` folder with names matching your environment:
656
-
657
- **dev.env.json:**
658
-
659
- ```json
660
- {
661
- "api_key": "dev-api-key-12345",
662
- "auth_token": "dev-auth-token",
663
- "database_url": "dev-db.example.com",
664
- "timeout": 5000,
665
- "headers": {
666
- "Authorization": "Bearer dev-token",
667
- "Content-Type": "application/json"
668
- }
669
- }
670
- ```
671
-
672
- ### How It Works
673
-
674
- 1. **Environment Detection:** When Artes runs, it reads the `env` value from `artes.config.js`
675
- 2. **Base URL Resolution:** If `baseURL` is an object, it uses the environment key to find the corresponding URL. If `baseURL` is a string, it uses it directly
676
- 3. **Variable Loading:** Artes looks for a JSON file matching the environment name in `src/tests/environment_variables/`
677
- 4. **Runtime Access:** All variables from the environment file become available during test execution
678
-
679
- ### Important Notes
680
-
681
- - ⚠️ **Base URLs must be defined in `artes.config.js`** - they cannot be set in the environment variable JSON files
682
- - 📁 Environment variable files should be placed in `src/tests/environment_variables/`
683
- - 🏷️ File names must follow the format `{env}.env.json` (e.g., `dev.env.json` for `env: "dev"`)
684
- - 🔄 Variables are loaded into variable storage and can be accessed during test runs
685
- - 🌐 Use environment variables for headers, API keys, timeouts, and other environment-specific configurations
686
-
687
- ---
688
-
689
- ### Browser Configuration
690
-
691
- | Option | Default Value | Description |
692
- | ------------- | ------------------------------ | ------------------------------------------------------ |
693
- | `browserType` | `"chrome"` | Browser type (`"chrome"`, `"firefox"`, or `"webkit"`). |
694
- | `viewport` | `{ width: 1280, height: 720 }` | Browser viewport size. |
695
- | `headless` | `true` | Run browser in headless mode (`true` or `false`). |
696
- | `offline` | `false` | Run browser in offline mode (`true` or `false`). |
697
-
698
-
699
- ### Device Configuration
700
-
701
- | Option | Default Value | Description |
702
- | ------------- | ------------------------------ | ------------------------------------------------------ |
703
- | `device` | `""` | [Device List](./docs/emulationDevicesList.md) |
704
-
705
-
706
- ## 📊 Reporting
707
-
708
- Artes can generate Allure reports. After running tests with the `-r` flag, the reports will be stored in the `report` folder in HTML format. You can view them in your browser after the tests complete.
709
-
710
- ### Integration with Artes Reporting System
711
-
712
- Artes has a built-in integration with the Artes Reporting System. By configuring the options below, you can automatically upload your test reports and keep your pipeline stages clean and organized.
713
-
714
- | **Option** | **Default Value** | **Description** |
715
- | ---------------- | ----------------------------- | ---------------------------------------------------------------------- |
716
- | `uploadReport` | `false` | Automatically upload the report to Artes Reporting System after tests. |
717
- | `reporterURL` | `""` | URL of the Artes Reporting System instance to upload the report to. |
718
- | `projectName` | `"Artes Report"` | Name of the project in the Artes Reporting System. |
719
- | `projectType` | `"Artes"` | Type/category of the project (e.g., UI, API). |
720
- | `reportName` | `"Artes Report"` | Display name of the report in the Artes Reporting System. |
721
- | `reportPath` | `"./report.zip"` | Path to the report zip file to be uploaded. |
722
-
723
- ---
724
-
725
- ## 🐳 Docker Image for CI/CD
726
-
727
- A Docker image `vahidaghayev/artes` is available for running Artes in CI/CD pipelines. This image includes:
728
-
729
- - **Playwright Browsers**: Pre-installed to support UI testing.
730
- - **Xvfb**: Enables running UI tests with video recording in a virtual display.
731
-
732
- ### Recommended Settings for Best Quality
733
-
734
- To achieve the best video recording quality, use the following command:
735
- ```bash
736
- xvfb-run -a --server-args="-screen 0 3840x1180x24" --auto-servernum npx artes --width 1600 --height 900
737
- ```
738
-
739
- ### CI/CD Executor on Report
740
-
741
- Artes automatically detects your CI/CD environment and displays executor information — pipeline name, build number, and a direct link to the build — on the generated report.
742
-
743
- **No configuration needed.** Artes reads the standard environment variables that each CI platform sets automatically. Supported platforms include GitHub Actions, Jenkins, GitLab CI, Bitbucket Pipelines, CircleCI, Azure Pipelines, TeamCity, Travis CI, and Bamboo. When running locally, the executor is shown as "Local Run".
744
-
745
- For full details, platform-specific examples, and the list of detected environment variables, see the [CI/CD Executor Integration guide](./docs/ciExecutors.md).
746
-
747
- ---
748
-
749
- ## 👍 Good To Use
750
-
751
- If you don't use the -c or --create option that the package offers, save the file below under the `.vscode` folder:
752
-
753
- - Those configurations will help autocomplete both predefined and custom step definitions in your features file
754
-
755
- **extensions.json**
756
-
757
- ```json
758
- {
759
- "recommendations": ["CucumberOpen.cucumber-official"]
760
- }
761
- ```
762
-
763
- **settings.json**
764
-
765
- ```json
766
- {
767
- "cucumber.glue": [
768
- "tests/steps/*.{ts,js}",
769
- "node_modules/artes/src/tests/stepDefinitions/*.{ts,js}"
770
- ],
771
- "cucumber.features": ["tests/features/*.features"],
772
- "cucumberautocomplete.syncfeatures": true,
773
- "cucumberautocomplete.strictGherkinCompletion": true
774
- }
775
- ```
776
-
777
- ---
778
-
779
- ## 🧑‍💻 Have a Good Testing
1
+ <p align="center">
2
+ <img alt="artesLogo" src="https://github.com/user-attachments/assets/e0641011-0e96-4330-8ad5-935b395b0838" width="280">
3
+ </p>
4
+
5
+ <h1 align="center">Artes</h1>
6
+
7
+ <p >
8
+ <a href="https://www.npmjs.com/package/artes">
9
+ <img src="https://img.shields.io/npm/dm/artes?label=npm&logo=npm&color=blue" alt="npm version">
10
+ </a>
11
+
12
+ <a href="https://github.com/4gayev1/Artes">
13
+ <img src="https://img.shields.io/badge/GitHub-Artes-181717?logo=github&logoColor=white" alt="GitHub Artes">
14
+ </a>
15
+
16
+ <a href="https://hub.docker.com/r/vahidaghayev/artes">
17
+ <img src="https://img.shields.io/badge/Docker-Artes-blue?logo=docker&logoColor=white" alt="Docker Artes">
18
+ </a>
19
+
20
+ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">
21
+ <img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=black" alt="JavaScript">
22
+ </a>
23
+
24
+ <a href="https://playwright.dev/">
25
+ <img src="https://img.shields.io/badge/Playwright-2EAD33?logo=playwright&logoColor=white" alt="Playwright">
26
+ </a>
27
+
28
+ <a href="https://cucumber.io/">
29
+ <img src="https://img.shields.io/badge/Cucumber-23D96C?logo=cucumber&logoColor=white" alt="Cucumber">
30
+ </a>
31
+
32
+ <a href="https://www.apache.org/licenses/LICENSE-2.0">
33
+ <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="Apache 2.0 License">
34
+ </a>
35
+
36
+ </p>
37
+
38
+ Artes is a test runner for Playwright that executes [predefined Cucumber tests](./docs/stepDefinitions.md) and can generate Allure reports for test results. It simplifies setting up Playwright with Cucumber in your automation workflow. With Artes, you can easily run tests without writing step definitions, generate reports, and customize your testing environment.
39
+
40
+ ![artes demonstration](https://github.com/user-attachments/assets/c46172f7-103d-45d1-a37d-8d4267df0967)
41
+
42
+ ---
43
+
44
+ ## 🌟 Artes Benefits
45
+
46
+ ### 🚀 Fast Setup & Smooth Onboarding
47
+
48
+ - Install in minutes and create a test project effortlessly
49
+ - Well-structured, easy-to-follow documentation for a smooth learning curve
50
+ - Designed for long-term maintainability and scalability
51
+
52
+ ### 🧩 Powerful & QA-Friendly Architecture
53
+
54
+ - Intuitive API for writing custom step definitions
55
+ - Rich set of ready-to-use step definitions to speed up test creation
56
+ - Fully extensible — add your own step definitions anytime
57
+
58
+ ### 🌐 Advanced API Testing
59
+
60
+ - Schema validation to ensure API response correctness
61
+ - Rich assertion library for precise validations
62
+ - Support for all HTTP methods
63
+ - Environment-based API configuration for flexible testing
64
+
65
+ ### 🔁 Smart Variable & Data Handling
66
+
67
+ - Page Object Model (POM) support for structured data management
68
+ - Save, reuse, and share variables across steps
69
+ - Built-in data randomization for dynamic and realistic test data
70
+ - Environment-specific variables for clean environment separation
71
+
72
+ ### 🖥️ Modern UI Automation
73
+
74
+ - Wide locator strategy support (CSS, XPath, text-based, and more)
75
+ - Built-in browser actions
76
+ - Cookie management
77
+ - Local & session storage handling
78
+
79
+ ### ⚙️ Flexible Configuration & Hooks
80
+
81
+ - Environment-based configuration system
82
+ - Powerful and customizable configuration files
83
+ - Full hook support:
84
+ - Before / After
85
+ - Step-level and scenario-level hooks
86
+
87
+ ### 🧪 CLI, CI/CD & Containerization
88
+
89
+ - Powerful CLI for full control from the command line
90
+ - Quality gate support — set a minimum success rate threshold to automatically fail the pipeline when test results drop below the required percentage
91
+ - Official [Artes Docker image](https://hub.docker.com/r/vahidaghayev/artes) for seamless containerized execution
92
+ - CI/CD-ready — integrate easily with any pipeline
93
+
94
+ ### 🤖 AI-Powered Bug Reports & Test Summaries
95
+
96
+ - Automatically generates professional bug reports for failed test cases
97
+ - Generates concise test summaries for passed scenarios
98
+ - Supports multiple AI providers — OpenAI, Google Gemini, Anthropic Claude, Mistral, Groq, Cohere, DeepSeek (see [Supported AI Providers](docs/aiProviders.md) for full model list and setup)
99
+ - Works with local AI models (Ollama, LM Studio) — no API key required
100
+ - Multi-language report generation — produce reports in any language
101
+ - Configurable report cap to control API usage and costs
102
+
103
+ ### 📊 Artes Reporting System
104
+
105
+ - Easy installation with docker compose (For detailed info: [Artes Reporting System](https://github.com/4gayev1/artes-reporting-system))
106
+ - Multiple reporting formats supported
107
+ - Native Allure reporting integration
108
+ - Customizable Artes Reporting System
109
+
110
+ ---
111
+
112
+ ## 🧑‍💻 Installation
113
+
114
+ You can install **Artes** via npm. To install it globally **(RECOMMENDED)**, run the following command:
115
+
116
+ ```bash
117
+ npm install -g artes
118
+ ```
119
+
120
+ To install it locally in your project, run:
121
+
122
+ ```bash
123
+ npm install artes
124
+ ```
125
+
126
+ Once installed, you can run **Artes** using:
127
+
128
+ ```bash
129
+ npx artes [options]
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 💡 Usage
135
+
136
+ **Artes** has following CLI options:
137
+
138
+ ```bash
139
+ npx artes [options]
140
+ ```
141
+
142
+
143
+ ### General ( artes -h or artes --help )
144
+
145
+ | Option | Description | Usage Example |
146
+ | --- | --- | --- |
147
+ | `-h, --help` | Show this help message | `artes -h` or `artes --help` |
148
+ | `-v, --version` | Show current version of artes | `artes -v` or `artes --version` |
149
+ | `-c, --create` | Create example artes project | `artes -c` or `artes --create` |
150
+ | `-y, --yes` | Skip confirmation prompt when creating a project | `artes -c -y` or `artes -c --yes` |
151
+ | `--noDeps` | Create project without installing dependencies | `artes -c --noDeps` |
152
+
153
+ ### Reporting & Branding ( artes report --help )
154
+
155
+ | Option | Description | Usage Example |
156
+ | --- | --- | --- |
157
+ | `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
158
+ | `--reportSuccess` | Generate screenshot and video with successful tests too | `artes --reportSuccess` |
159
+ | `--trace` | Enable tracing for all tests | `artes --trace` |
160
+ | `-rwt, --reportWithTrace` | Include trace in the report | `artes -rwt` or `artes --reportWithTrace` |
161
+ | `--singleFileReport` | Generate single file Allure report | `artes -r --singleFileReport` |
162
+ | `--zip` | Zip the report folder after generation | `artes -r --zip` |
163
+ | `--logo` | Set a custom logo in the report sidebar | `artes --logo logo.png` |
164
+ | `--brandName` | Set the brand name displayed next to the logo | `artes --brandName 'My Company'` |
165
+ | `--reportName` | Report name on the summary widget | `artes --reportName 'Alma UI'` |
166
+ | `--uploadReport` | Upload the generated report to Artes Reporting System | `artes -r --zip --uploadReport --reporterURL "https://example.com"` |
167
+ | `--reporterURL` | URL of the Artes Reporting System | `artes --uploadReport --reporterURL "https://example.com"` |
168
+ | `--projectName` | Project name in the Artes Reporting System (default: `"Artes Report"`) | `artes --uploadReport --reporterURL "https://example.com" --projectName "My Project"` |
169
+ | `--projectType` | Project type for reporting, e.g., UI, API (default: `"Artes"`) | `artes --uploadReport --reporterURL "https://example.com" --projectType "API"` |
170
+ | `--reportPath` | Path to the report zip file to upload (default: `./report.zip`) | `artes --uploadReport --reporterURL "https://example.com" --reportPath "./my_report.zip"` |
171
+
172
+ ### Browser ( artes browser --help )
173
+
174
+ | Option | Description | Usage Example |
175
+ | --- | --- | --- |
176
+ | `--browser` | Specify browser to use (`chromium`, `firefox`, `webkit`) | `artes --browser chromium` |
177
+ | `--device` | Emulate a specific device (e.g., `"iPhone 13"`) | `artes --device "iPhone 13"` |
178
+ | `--maxScreen` | Maximize browser window on launch | `artes --maxScreen` |
179
+ | `--width` | Set browser width (default: `1280`) | `artes --width 1920` |
180
+ | `--height` | Set browser height (default: `720`) | `artes --height 1080` |
181
+
182
+ ### Execution ( artes execution --help )
183
+
184
+ | Option | Description | Usage Example |
185
+ | --- | --- | --- |
186
+ | `--headless` | Run browser in headless mode | `artes --headless` |
187
+ | `--baseURL` | Set base URL for the tests | `artes --baseURL "https://example.com"` |
188
+ | `--offline` | Run browser in offline mode | `artes --offline` |
189
+ | `--features` | Specify feature file paths to run (comma-separated) | `artes --features "tests/features/Alma,tests/features/Banan.feature"` |
190
+ | `--stepDef` | Specify step definition file paths to use (comma-separated) | `artes --stepDef "tests/steps/login.js,tests/steps/home.js"` |
191
+ | `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke and not @wip"` |
192
+ | `--env` | Set the environment for the test run | `artes --env "dev"` |
193
+ | `--saveVar` | Set variables from CLI | `artes --saveVar '{"armud":20,"banana":200}'` |
194
+ | `--parallel` | Run tests in parallel mode | `artes --parallel 3` |
195
+ | `--retry` | Retry failed tests | `artes --retry 2` |
196
+ | `--rerun` | Rerun only failed tests from previous run | `artes --rerun @rerun.txt` |
197
+ | `--dryRun` | Perform a dry run without executing tests | `artes --dryRun` |
198
+ | `--percentage` | Set minimum success percentage to pass test run (default: `0`) | `artes --percentage 85` |
199
+ | `--timeout` | Set timeout for each test step in seconds (default: `30`) | `artes --timeout 10` |
200
+ | `--slowMo` | Slow down execution for clear view (default: `0`) | `artes --slowMo 1` |
201
+
202
+ ### AI Bug Reporter ( artes ai --help )
203
+
204
+ | Option | Description | Usage Example |
205
+ | --- | --- | --- |
206
+ | `--ai` | Enable AI-generated bug reports and test summaries | `artes --ai` |
207
+ | `--aiModel` | AI model to use for report generation | `artes --ai --aiModel "gemini 2.5 flash"` |
208
+ | `--aiKey` | API key for the selected AI provider | `artes --ai --aiKey "your-api-key"` |
209
+ | `--aiURL` | Local AI endpoint URL (e.g., Ollama, LM Studio). Overrides `--aiModel` and `--aiKey` when set | `artes --ai --aiURL "http://localhost:11434/api/chat"` |
210
+ | `--aiLanguage` | Language for AI-generated reports (default: `"English"`) | `artes --ai --aiLanguage "Azerbaijani"` |
211
+ | `--maxTokens` | Maximum tokens for AI-generated reports (default: `4000`) | `artes --ai --maxTokens 8000` |
212
+ | `--maxReports` | Maximum number of AI reports to generate per test run (default: `10`) | `artes --ai --maxReports 5` |
213
+
214
+
215
+ \*\* To just run the tests: <br>
216
+ Globally: artes <br>
217
+ Locally: npx artes
218
+
219
+ ---
220
+
221
+ ## 🎯 Best Practices
222
+
223
+ - **Global Installation:**
224
+ For ease of use, it's recommended that Artes be installed globally. You can do this by running the following command:
225
+
226
+ ```bash
227
+ npm install -g artes
228
+ ```
229
+
230
+ - **Project Creation (Recommended):**
231
+ To create a new project with Artes, use the `-c` flag. This will automatically set up the folder structure and configuration for you. Run the command:
232
+
233
+ ```bash
234
+ artes -c
235
+ ```
236
+
237
+ 🗂️ Example Project Structure: <br/>
238
+ After running the `-c` flag to create a new project, the structure will look like this:
239
+
240
+ ```
241
+ /artes (Project Name)
242
+ /tests
243
+ /features
244
+ (Your feature files here)
245
+ /POMs // Optional
246
+ (POM JSON file here)
247
+ /steps // For custom steps and hooks
248
+ (Your step definition and hooks JS files here)
249
+ artes.config.js
250
+ /report
251
+ (Generated Allure report HTML here)
252
+ ```
253
+
254
+ **If you choose not to use the `-c` flag**, you can still download Artes to your testing project and use the prepared steps by running:
255
+
256
+ ```bash
257
+ npx artes
258
+ ```
259
+
260
+ You must customize the paths of features, steps, and other configurations by editing the `artes.config.js` file located inside your project folder (or create it).
261
+
262
+ For example:
263
+
264
+ ```javascript
265
+ module.exports = {
266
+ paths: ["tests/features/"], // Custom path for feature files
267
+ require: ["tests/steps/*.js"], // Custom path for step definitions files
268
+ pomPath: "tests/POMS/*.js", // Custom path for POM files
269
+ };
270
+ ```
271
+
272
+ ---
273
+
274
+ ## 📝 Writing Feature Files and POM Files
275
+
276
+ Artes simplifies your test writing with structured feature files and organized Page Object Models (POM). Here’s how you can create them:
277
+
278
+ ### 1. 📄 Feature File Structure
279
+
280
+ ```gherkin
281
+ Feature: Searching on Google 🔍
282
+ Scenario Outline: Search for a term on Google
283
+ Given User is on "https://www.google.com/" page
284
+ When User types "alma" in "google_search_input"
285
+ And User clicks "google_search_button"
286
+ And User waits 10 seconds
287
+ Then "google_text" should have "Alma" text
288
+ ```
289
+
290
+ - **Feature**: Describes the main feature being tested (e.g., Google search).
291
+ - **Scenario Outline**: Defines a test case with steps.
292
+ - **Steps**: Use `Given`, `When`, `And`, `Then` keywords to describe actions and expectations.
293
+ - **Selectors**: The element names (e.g., `google_search_input`, `google_search_button`) map to the POM file or can be defined directly.
294
+
295
+ ### 2. 📂 POM File Example
296
+
297
+ ```json
298
+ {
299
+ "google_search_input": { "selector": "#APjFqb" },
300
+ "google_search_button": {
301
+ "selector": "input.gNO89b"
302
+ },
303
+ "google_text": {
304
+ "selector": "#rso div h3",
305
+ "waitTime": 5 //seconds
306
+ }
307
+ }
308
+ ```
309
+
310
+ - 📑 Using POM File is optional but it is **RECOMMENDED**
311
+ - 🔗 Using Selector in Feature File is possible
312
+ ```gherkin
313
+ When User types "alma" in "#APjFqb"
314
+ ```
315
+ - 🐍 It is good to use snake_case for element names
316
+ - ⏳ "waitTime" is to define custom wait for elements, but the feature currently under development.
317
+ "selector" must be used if "waitTime" is used, but when using only selector is not needed mention in "selector"
318
+
319
+ ---
320
+
321
+ ## 🔄 Variable Management
322
+
323
+ Artes provides powerful variable management capabilities that allow you to save, reuse, and share variables across test steps.
324
+
325
+ ### Saving Variables from API Responses
326
+
327
+ You can save variables directly from API responses, even using dot notation to extract nested values:
328
+
329
+ ```gherkin
330
+ When User sends GET request to "https://www.test.com" and saves "id" variables
331
+ And User sends GET request to "https://www.test.com/items/{{id}}"
332
+ Then User expects that response should have 200 status code
333
+ ```
334
+
335
+ ### Manual Variable Assignment
336
+
337
+ Save variables manually using the dedicated step:
338
+
339
+ ```gherkin
340
+ And User saves "15" variable as "id"
341
+ ```
342
+
343
+ ### Variable Randomization
344
+
345
+ Artes includes built-in randomization for generating dynamic test data:
346
+
347
+ ```gherkin
348
+ And User sets random email as "email"
349
+ And User sets random 5 words as "description"
350
+ And User sets random fullname as "fullName"
351
+ ```
352
+
353
+ ### Using Variables in Tests
354
+
355
+ Reference saved variables anywhere in your tests using double curly braces:
356
+
357
+ ```gherkin
358
+ When User types "{{email}}" in "email_input"
359
+ ```
360
+
361
+ 📚 **For detailed information and complete step definitions**, visit the [Variable Management Documentation](https://github.com/4gayev1/Artes/blob/main/docs/stepDefinitions.md#variable-management).
362
+
363
+ ---
364
+
365
+ ## 🛠️ Customization
366
+
367
+ ## ✍️ Writing Custom Step Definitions
368
+
369
+ Artes allows you to extend its functionality by writing custom step definitions. Here's how you can do it:
370
+
371
+ ### Import Required APIs
372
+
373
+ ```javascript
374
+ const {
375
+ expect,
376
+ Given,
377
+ When,
378
+ Then,
379
+ element,
380
+ context,
381
+ keyboard,
382
+ mouse,
383
+ frame,
384
+ assert,
385
+ elementInteractions,
386
+ } = require("artes"); // Common JS
387
+ import { expect, Given, When, Then, element, context } from "artes"; // ES Modules (Do not RECOMMENDED)
388
+ ```
389
+
390
+ - **`Given`, `When`, `Then`**: These define your steps in Cucumber syntax. Example:
391
+
392
+ ```javascript
393
+ Given("User is on the login page", async () => {
394
+ await context.page.navigateTo("https://example.com/login");
395
+ });
396
+ ```
397
+
398
+ - **`page`**: Provides higher-level page actions such as navigation and waiting(Same as PlayWright). Examples:
399
+ - Navigate to a URL:
400
+ ```javascript
401
+ await context.page.navigate("https://example.com");
402
+ ```
403
+ - Wait for a selector:
404
+ ```javascript
405
+ await context.page.waitForSelector("#loadingSpinner");
406
+ ```
407
+ - **`request`**: Use for sending HTTP requests. _(Note: This feature is currently under development.)_
408
+
409
+ - **`element`**: Use for interacting with elements on the web page. Examples:
410
+ - Clicking a button:
411
+ ```javascript
412
+ await element("#submitButton").click();
413
+ ```
414
+ - Filling an input:
415
+ ```javascript
416
+ await element("#username").fill("testUser");
417
+ ```
418
+ - **`expect`**: Use for assertions in your steps. For example:
419
+ ```javascript
420
+ expect(actualValue).toBe(expectedValue);
421
+ expect(element("Page_Title")).toHaveText(expectedValue);
422
+ ```
423
+
424
+ ## 📋 Simplified Functions
425
+
426
+ If you don't want to deal with Playwright methods directly, you can simply use the following predefined actions methods by import them:
427
+
428
+ ```javascript
429
+ const { mouse, keyboard, frame, elementInteractions, page } = require("artes");
430
+ ```
431
+
432
+ - **Mouse Actions:**
433
+ `mouse.click(element)`
434
+
435
+ - **Keyboard Actions:**
436
+ `keyboard.press(key)`
437
+
438
+ - **Element Interactions:**
439
+ `elementInteractions.isChecked()`
440
+
441
+ - **Assertions:**
442
+ `assert.shouldBeTruthy(element)`
443
+
444
+ - **Frame Actions:**
445
+ `frame.first()`
446
+
447
+ - **API Actions:**
448
+ `api.post(url, payload, requestDataType)`
449
+
450
+ ---
451
+
452
+ For a detailed explanation of each function, please refer to the [function definitions](./docs/functionDefinitions.md).
453
+
454
+ ---
455
+
456
+ ### Example of Custom Step Definition
457
+
458
+ ```javascript
459
+ const { Given, When, Then, expect, element, page } = require("artes");
460
+
461
+ Given("User is on the home page", async () => {
462
+ await page.navigate("https://example.com");
463
+ });
464
+
465
+ When("User clicks the login button", async () => {
466
+ await element("#loginButton").click();
467
+ });
468
+
469
+ Then("User should see the login form", async () => {
470
+ expect(element("#loginForm")).toBeVisible(true);
471
+ });
472
+ ```
473
+
474
+ ## 🪝 Hooks (Lifecycle Hooks)
475
+
476
+ Artes supports **hooks** that allow you to execute custom logic **before and after tests, scenarios, and steps**.
477
+
478
+ Hooks are **user-defined**.
479
+
480
+ ---
481
+
482
+ ### 📁 Hooks File Location
483
+
484
+ Create the following file **inside your project** (optional):
485
+
486
+ ```
487
+ tests/steps/hooks.js
488
+ ```
489
+
490
+ ---
491
+
492
+ ### ✍️ Writing Hooks
493
+
494
+ You can define **only the hooks you need** in hooks.js under the steps folder.
495
+ Undefined hooks are automatically skipped.
496
+
497
+ ```js
498
+ // tests/steps/hooks.js
499
+
500
+ export function BeforeStep() {
501
+ // hook for before each step
502
+ }
503
+
504
+ export function Before() {
505
+ // hook for before each test
506
+ }
507
+
508
+ export function BeforeAll() {
509
+ // hook for before all tests
510
+ }
511
+
512
+ export function AfterStep() {
513
+ // hook for after each step
514
+ }
515
+
516
+ export function After() {
517
+ // hook for after each test
518
+ }
519
+
520
+ export function AfterAll() {
521
+ // hook for after all tests
522
+ }
523
+ ```
524
+
525
+ ---
526
+
527
+ ### 🔁 Supported Hook Types
528
+
529
+ | Hook Name | Execution Time |
530
+ | ------------ | ----------------------------- |
531
+ | `BeforeAll` | Once before **all scenarios** |
532
+ | `Before` | Before **each scenario** |
533
+ | `BeforeStep` | Before **each step** |
534
+ | `AfterStep` | After **each step** |
535
+ | `After` | After **each scenario** |
536
+ | `AfterAll` | Once after **all scenarios** |
537
+
538
+ ---
539
+
540
+ ### ▶️ Execution Order Example
541
+
542
+ For a scenario with steps:
543
+
544
+ ```
545
+ BeforeAll
546
+ Before
547
+ BeforeStep
548
+ (step executes)
549
+ AfterStep
550
+ After
551
+ AfterAll
552
+ ```
553
+
554
+ ---
555
+
556
+ ## ⚙️ Configuration
557
+
558
+ You can configure Artes by editing the `artes.config.js` file. Below are the default configuration options with explanations:
559
+
560
+ | **Option** | **Default Value** | **Description** |
561
+ | ----------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------- |
562
+ | `headless` | `false` | Run browser in headless mode. |
563
+ | `env` | `""` | Environment name for tests. |
564
+ | `variables` | `{}` | Variables for tests. |
565
+ | `baseURL` | `""` | Base URL for API or web tests. |
566
+ | `timeout` | `30` | Default timeout in seconds. |
567
+ | `slowMo` | `0` | Default slow motion in seconds. |
568
+ | `paths` | `[moduleConfig.featuresPath]` | Paths to feature files. |
569
+ | `require` | `[moduleConfig.stepsPath, "src/stepDefinitions/*.js", "src/hooks/hooks.js"]` | Support code paths (CommonJS). |
570
+ | `pomPath` | `moduleConfig.pomPath` | Path to Page Object Models. |
571
+ | `import` | `[]` | Support code paths. |
572
+ | `testPercentage` | `0` | Define test coverage percentage |
573
+ | `report` | `false` | Generate report |
574
+ | `zip` | `false` | Generate zip of report |
575
+ | `reportSuccess` | `false` | Add screenshots and video records also for success test cases |
576
+ | `trace` | `false` | Enable tracing |
577
+ | `reportWithTrace` | `false` | Include trace in report |
578
+ | `logo` | `""` (uses default Artes logo) | Custom logo for the report sidebar. Accepts an absolute path, a relative path, or a direct image URL |
579
+ | `brandName`| `""` | Brand name displayed next to the logo in the report sidebar |
580
+ | `reportName`| `""` | Report name displayed on the summary widget |
581
+ | `format` | `["rerun:@rerun.txt", "allure-cucumberjs/reporter"]` | Formatter names/paths. |
582
+ | `formatOptions` | `{ "resultsDir": "allure-result" }` | Formatter options. |
583
+ | `parallel` | `1` | Number of parallel workers. |
584
+ | `browser` | `"chrome"` | Browser to use: "chrome", "firefox", "webkit". |
585
+ | `offline` | `false` | Run browser in offline mode. |
586
+ | `device` | `""` | Emulate specific device (e.g., "iPhone 13"). |
587
+ | `width` | `1280` | Browser width in pixels. |
588
+ | `height` | `720` | Browser height in pixels. |
589
+ | `maximizeScreen` | `true` | Maximize browser window on start. |
590
+ | `dryRun` | `false` | Prepare test run without execution. |
591
+ | `failFast` | `false` | Stop on first test failure. |
592
+ | `forceExit` | `false` | Force `process.exit()` after tests |
593
+ | `strict` | `true` | Fail on pending steps. |
594
+ | `backtrace` | `false` | Show full backtrace for errors. |
595
+ | `tags` | `""` | Tag expression to filter scenarios. |
596
+ | `name` | `[]` | Run scenarios matching regex. |
597
+ | `order` | `"defined"` | Run order (defined/random). |
598
+ | `language` | `"en"` | Default feature file language. |
599
+ | `loader` | `[]` | Module loader specifications. |
600
+ | `requireModule` | `[]` | Transpilation module names. |
601
+ | `retry` | `0` | Retry attempts for failing tests. |
602
+ | `retryTagFilter` | `""` | Tag expression for retries. |
603
+ | `publish` | `false` | Publish to cucumber.io. |
604
+ | `worldParameters` | `{}` | Custom world parameters. |
605
+
606
+ ---
607
+
608
+ ## 🤖 AI Configuration
609
+
610
+ | **Option** | **Default Value** | **Description** |
611
+ | -------------------- | ----------------- | ---------------------------------------------------------------------------------------------------- |
612
+ | `ai.ai` | `false` | Enable AI-generated bug reports and test summaries. |
613
+ | `ai.model` | `"gpt-4o"` | AI model to use for report generation (e.g. `"gemini 2.5 flash"`, `"claude sonnet"`) |
614
+ | `ai.key` | `""` | API key for the selected AI provider. |
615
+ | `ai.url` | `""` | Local AI endpoint URL (e.g. Ollama, LM Studio). Overrides `model` and `key` when set. |
616
+ | `ai.language` | `"English"` | Language for AI-generated reports (e.g. `"Azerbaijani"`, `"German"`). |
617
+ | ai.maxTokens | 4000 | Maximum tokens for AI response output |
618
+ | `ai.maxReports` | `10` | Maximum number of AI reports to generate per test run. |
619
+
620
+ ---
621
+
622
+ ## 🌍 Environment Configuration
623
+
624
+ | **Option** | **Default Value** | **Description** |
625
+ | ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |
626
+ | `env` | `""` | Environment configuration. Should match the name with the baseURL object, like "dev" |
627
+ | `baseURL` | `""` | Base URL for API requests. Can be object {"dev":"dev-api.com", "pre":"pre-api.com"}, or string "dev-api.com" |
628
+
629
+ ### Environment Variables Configuration
630
+
631
+ Artes supports environment-specific configurations through environment variables. This feature allows to manage different settings for environments.
632
+
633
+ ### Setting Up Environment Variables
634
+
635
+ 1. **Configure Environment in artes.config.js:**
636
+
637
+ ```javascript
638
+ module.exports = {
639
+ baseURL: {
640
+ dev: "https://dev.alma.az",
641
+ pre: "https://pre.alma.az",
642
+ prod: "https://api.alma.az",
643
+ },
644
+ env: "dev", // Specify which environment to use
645
+ };
646
+ ```
647
+
648
+ **Alternative single URL configuration:**
649
+
650
+ ```javascript
651
+ module.exports = {
652
+ baseURL: "https://api.alma.az", // Direct string URL
653
+ };
654
+ ```
655
+
656
+ 2. **Create Environment Variable Files:**
657
+ Create JSON files under `src/tests/environment_variables/` folder with names matching your environment:
658
+
659
+ **dev.env.json:**
660
+
661
+ ```json
662
+ {
663
+ "api_key": "dev-api-key-12345",
664
+ "auth_token": "dev-auth-token",
665
+ "database_url": "dev-db.example.com",
666
+ "timeout": 5000,
667
+ "headers": {
668
+ "Authorization": "Bearer dev-token",
669
+ "Content-Type": "application/json"
670
+ }
671
+ }
672
+ ```
673
+
674
+ ### How It Works
675
+
676
+ 1. **Environment Detection:** When Artes runs, it reads the `env` value from `artes.config.js`
677
+ 2. **Base URL Resolution:** If `baseURL` is an object, it uses the environment key to find the corresponding URL. If `baseURL` is a string, it uses it directly
678
+ 3. **Variable Loading:** Artes looks for a JSON file matching the environment name in `src/tests/environment_variables/`
679
+ 4. **Runtime Access:** All variables from the environment file become available during test execution
680
+
681
+ ### Important Notes
682
+
683
+ - ⚠️ **Base URLs must be defined in `artes.config.js`** - they cannot be set in the environment variable JSON files
684
+ - 📁 Environment variable files should be placed in `src/tests/environment_variables/`
685
+ - 🏷️ File names must follow the format `{env}.env.json` (e.g., `dev.env.json` for `env: "dev"`)
686
+ - 🔄 Variables are loaded into variable storage and can be accessed during test runs
687
+ - 🌐 Use environment variables for headers, API keys, timeouts, and other environment-specific configurations
688
+
689
+ ---
690
+
691
+ ### Browser Configuration
692
+
693
+ | Option | Default Value | Description |
694
+ | ------------- | ------------------------------ | ------------------------------------------------------ |
695
+ | `browserType` | `"chrome"` | Browser type (`"chrome"`, `"firefox"`, or `"webkit"`). |
696
+ | `viewport` | `{ width: 1280, height: 720 }` | Browser viewport size. |
697
+ | `headless` | `true` | Run browser in headless mode (`true` or `false`). |
698
+ | `offline` | `false` | Run browser in offline mode (`true` or `false`). |
699
+
700
+
701
+ ### Device Configuration
702
+
703
+ | Option | Default Value | Description |
704
+ | ------------- | ------------------------------ | ------------------------------------------------------ |
705
+ | `device` | `""` | [Device List](./docs/emulationDevicesList.md) |
706
+
707
+
708
+ ## 📊 Reporting
709
+
710
+ Artes can generate Allure reports. After running tests with the `-r` flag, the reports will be stored in the `report` folder in HTML format. You can view them in your browser after the tests complete.
711
+
712
+ ### Integration with Artes Reporting System
713
+
714
+ Artes has a built-in integration with the Artes Reporting System. By configuring the options below, you can automatically upload your test reports and keep your pipeline stages clean and organized.
715
+
716
+ | **Option** | **Default Value** | **Description** |
717
+ | ---------------- | ----------------------------- | ---------------------------------------------------------------------- |
718
+ | `uploadReport` | `false` | Automatically upload the report to Artes Reporting System after tests. |
719
+ | `reporterURL` | `""` | URL of the Artes Reporting System instance to upload the report to. |
720
+ | `projectName` | `"Artes Report"` | Name of the project in the Artes Reporting System. |
721
+ | `projectType` | `"Artes"` | Type/category of the project (e.g., UI, API). |
722
+ | `reportName` | `"Artes Report"` | Display name of the report in the Artes Reporting System. |
723
+ | `reportPath` | `"./report.zip"` | Path to the report zip file to be uploaded. |
724
+
725
+ ---
726
+
727
+ ## 🐳 Docker Image for CI/CD
728
+
729
+ A Docker image `vahidaghayev/artes` is available for running Artes in CI/CD pipelines. This image includes:
730
+
731
+ - **Playwright Browsers**: Pre-installed to support UI testing.
732
+ - **Xvfb**: Enables running UI tests with video recording in a virtual display.
733
+
734
+ ### Recommended Settings for Best Quality
735
+
736
+ To achieve the best video recording quality, use the following command:
737
+ ```bash
738
+ xvfb-run -a --server-args="-screen 0 3840x1180x24" --auto-servernum npx artes --width 1600 --height 900
739
+ ```
740
+
741
+ ### CI/CD Executor on Report
742
+
743
+ Artes automatically detects your CI/CD environment and displays executor information pipeline name, build number, and a direct link to the build on the generated report.
744
+
745
+ **No configuration needed.** Artes reads the standard environment variables that each CI platform sets automatically. Supported platforms include GitHub Actions, Jenkins, GitLab CI, Bitbucket Pipelines, CircleCI, Azure Pipelines, TeamCity, Travis CI, and Bamboo. When running locally, the executor is shown as "Local Run".
746
+
747
+ For full details, platform-specific examples, and the list of detected environment variables, see the [CI/CD Executor Integration guide](./docs/ciExecutors.md).
748
+
749
+ ---
750
+
751
+ ## 👍 Good To Use
752
+
753
+ If you don't use the -c or --create option that the package offers, save the file below under the `.vscode` folder:
754
+
755
+ - Those configurations will help autocomplete both predefined and custom step definitions in your features file
756
+
757
+ **extensions.json**
758
+
759
+ ```json
760
+ {
761
+ "recommendations": ["CucumberOpen.cucumber-official"]
762
+ }
763
+ ```
764
+
765
+ **settings.json**
766
+
767
+ ```json
768
+ {
769
+ "cucumber.glue": [
770
+ "tests/steps/*.{ts,js}",
771
+ "node_modules/artes/src/tests/stepDefinitions/*.{ts,js}"
772
+ ],
773
+ "cucumber.features": ["tests/features/*.features"],
774
+ "cucumberautocomplete.syncfeatures": true,
775
+ "cucumberautocomplete.strictGherkinCompletion": true
776
+ }
777
+ ```
778
+
779
+ ---
780
+
781
+ ## 🧑‍💻 Have a Good Testing