artes 1.1.24 → 1.1.26

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 (2) hide show
  1. package/README.md +62 -82
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -175,86 +175,6 @@ Feature: Searching on Google 🔍
175
175
 
176
176
  ---
177
177
 
178
- ## 🌍 Environment Variables Configuration
179
-
180
- Artes now supports environment-specific configurations through environment variables. This feature allows you to manage different settings for development, staging, and production environments.
181
-
182
- ### Setting Up Environment Variables
183
-
184
- 1. **Configure Environment in artes.config.js:**
185
-
186
- ```javascript
187
- module.exports = {
188
- baseURL: {
189
- dev: "https://dev.dlp.az",
190
- pre: "https://pre.dlp.az",
191
- prod: "https://api.dlp.az",
192
- },
193
- env: "dev", // Specify which environment to use
194
- // ... other configurations
195
- };
196
- ```
197
-
198
- **Alternative single URL configuration:**
199
-
200
- ```javascript
201
- module.exports = {
202
- baseURL: "https://api.example.com", // Direct string URL
203
- env: "dev",
204
- // ... other configurations
205
- };
206
- ```
207
-
208
- 2. **Create Environment Variable Files:**
209
- Create JSON files under `src/tests/environment-variables/` folder with names matching your environment:
210
-
211
- **dev.json:**
212
-
213
- ```json
214
- {
215
- "api_key": "dev-api-key-12345",
216
- "auth_token": "dev-auth-token",
217
- "database_url": "dev-db.example.com",
218
- "timeout": 5000,
219
- "headers": {
220
- "Authorization": "Bearer dev-token",
221
- "Content-Type": "application/json"
222
- }
223
- }
224
- ```
225
-
226
- **pre.json:**
227
-
228
- ```json
229
- {
230
- "api_key": "pre-api-key-67890",
231
- "auth_token": "pre-auth-token",
232
- "database_url": "pre-db.example.com",
233
- "timeout": 3000,
234
- "headers": {
235
- "Authorization": "Bearer pre-token",
236
- "Content-Type": "application/json"
237
- }
238
- }
239
- ```
240
-
241
- ### How It Works
242
-
243
- 1. **Environment Detection:** When Artes runs, it reads the `env` value from `artes.config.js`
244
- 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
245
- 3. **Variable Loading:** Artes looks for a JSON file matching the environment name in `src/tests/environment-variables/`
246
- 4. **Runtime Access:** All variables from the environment file become available during test execution
247
-
248
- ### Important Notes
249
-
250
- - ⚠️ **Base URLs must be defined in `artes.config.js`** - they cannot be set in the environment variable JSON files
251
- - 📁 Environment variable files should be placed in `src/tests/environment-variables/`
252
- - 🏷️ File names must exactly match the environment name (e.g., `dev.json` for `env: "dev"`)
253
- - 🔄 Variables are loaded into variable storage and can be accessed during test runs
254
- - 🌐 Use environment variables for headers, API keys, timeouts, and other environment-specific configurations
255
-
256
- ---
257
-
258
178
  ## 🛠️ Customization
259
179
 
260
180
  ## ✍️ Writing Custom Step Definitions
@@ -400,13 +320,73 @@ You can configure Artes by editing the `artes.config.js` file. Below are the def
400
320
  | `publish` | `false` | Publish to cucumber.io. |
401
321
  | `worldParameters` | `{}` | Custom world parameters. |
402
322
 
403
- ### Environment Configuration
323
+ ---
324
+
325
+ ## 🌍 Environment Configuration
404
326
 
405
327
  | **Option** | **Default Value** | **Description** |
406
328
  | ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |
407
329
  | `env` | `""` | Environment configuration. Should match the name with the baseURL object, like "dev" |
408
330
  | `baseURL` | `""` | Base URL for API requests. Can be object {"dev":"dev-api.com", "pre":"pre-api.com"}, or string "dev-api.com" |
409
331
 
332
+
333
+ ### Environment Variables Configuration
334
+
335
+ Artes supports environment-specific configurations through environment variables. This feature allows to manage different settings for environments.
336
+
337
+ ### Setting Up Environment Variables
338
+
339
+ 1. **Configure Environment in artes.config.js:**
340
+ ```javascript
341
+ module.exports = {
342
+ baseURL: {
343
+ dev: "https://dev.alma.az",
344
+ pre: "https://pre.alma.az",
345
+ prod: "https://api.alma.az"
346
+ },
347
+ env: "dev", // Specify which environment to use
348
+ };
349
+ ```
350
+
351
+ **Alternative single URL configuration:**
352
+ ```javascript
353
+ module.exports = {
354
+ baseURL: "https://api.alma.az", // Direct string URL
355
+ };
356
+ ```
357
+
358
+ 2. **Create Environment Variable Files:**
359
+ Create JSON files under `src/tests/environment-variables/` folder with names matching your environment:
360
+
361
+ **dev.env.json:**
362
+ ```json
363
+ {
364
+ "api_key": "dev-api-key-12345",
365
+ "auth_token": "dev-auth-token",
366
+ "database_url": "dev-db.example.com",
367
+ "timeout": 5000,
368
+ "headers": {
369
+ "Authorization": "Bearer dev-token",
370
+ "Content-Type": "application/json"
371
+ }
372
+ }
373
+ ```
374
+
375
+ ### How It Works
376
+
377
+ 1. **Environment Detection:** When Artes runs, it reads the `env` value from `artes.config.js`
378
+ 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
379
+ 3. **Variable Loading:** Artes looks for a JSON file matching the environment name in `src/tests/environment-variables/`
380
+ 4. **Runtime Access:** All variables from the environment file become available during test execution
381
+
382
+ ### Important Notes
383
+
384
+ - ⚠️ **Base URLs must be defined in `artes.config.js`** - they cannot be set in the environment variable JSON files
385
+ - 📁 Environment variable files should be placed in `src/tests/environment-variables/`
386
+ - 🏷️ File names must follow the format `{env}.env.json` (e.g., `dev.env.json` for `env: "dev"`)
387
+ - 🔄 Variables are loaded into variable storage and can be accessed during test runs
388
+ - 🌐 Use environment variables for headers, API keys, timeouts, and other environment-specific configurations
389
+
410
390
  ---
411
391
 
412
392
  ### Browser Configuration
@@ -476,4 +456,4 @@ If you don't use the -c or --create option that the package offers, save the fil
476
456
 
477
457
  ---
478
458
 
479
- ## 🧑‍💻 Have a Good Testing
459
+ ## 🧑‍💻 Have a Good Testing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {