artes 1.1.30 → 1.1.32
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 +3 -3
- package/executer.js +16 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -356,7 +356,7 @@ Artes supports environment-specific configurations through environment variables
|
|
|
356
356
|
```
|
|
357
357
|
|
|
358
358
|
2. **Create Environment Variable Files:**
|
|
359
|
-
Create JSON files under `src/tests/
|
|
359
|
+
Create JSON files under `src/tests/environment_variables/` folder with names matching your environment:
|
|
360
360
|
|
|
361
361
|
**dev.env.json:**
|
|
362
362
|
```json
|
|
@@ -376,13 +376,13 @@ Artes supports environment-specific configurations through environment variables
|
|
|
376
376
|
|
|
377
377
|
1. **Environment Detection:** When Artes runs, it reads the `env` value from `artes.config.js`
|
|
378
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/
|
|
379
|
+
3. **Variable Loading:** Artes looks for a JSON file matching the environment name in `src/tests/environment_variables/`
|
|
380
380
|
4. **Runtime Access:** All variables from the environment file become available during test execution
|
|
381
381
|
|
|
382
382
|
### Important Notes
|
|
383
383
|
|
|
384
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/
|
|
385
|
+
- 📁 Environment variable files should be placed in `src/tests/environment_variables/`
|
|
386
386
|
- 🏷️ File names must follow the format `{env}.env.json` (e.g., `dev.env.json` for `env: "dev"`)
|
|
387
387
|
- 🔄 Variables are loaded into variable storage and can be accessed during test runs
|
|
388
388
|
- 🌐 Use environment variables for headers, API keys, timeouts, and other environment-specific configurations
|
package/executer.js
CHANGED
|
@@ -55,8 +55,22 @@ const height = args[args.indexOf("--height") + 1];
|
|
|
55
55
|
const timeout = args[args.indexOf("--timeout") + 1];
|
|
56
56
|
const slowMo = args[args.indexOf("--slowMo") + 1];
|
|
57
57
|
|
|
58
|
-
flags.env
|
|
59
|
-
|
|
58
|
+
if (flags.env) {
|
|
59
|
+
const envCandidate = env.trim();
|
|
60
|
+
if (typeof artesConfig.baseURL === "object" && artesConfig.baseURL !== null) {
|
|
61
|
+
if (artesConfig.baseURL.hasOwnProperty(envCandidate)) {
|
|
62
|
+
process.env.ENV = JSON.stringify(envCandidate);
|
|
63
|
+
console.log("Running env:", envCandidate);
|
|
64
|
+
} else {
|
|
65
|
+
const firstKey = Object.keys(artesConfig.baseURL)[0];
|
|
66
|
+
process.env.ENV = JSON.stringify(firstKey);
|
|
67
|
+
console.log(`Env "${envCandidate}" not found, falling back to:`, firstKey);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
process.env.ENV = JSON.stringify(envCandidate);
|
|
71
|
+
console.log("Running env:", envCandidate);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
60
74
|
|
|
61
75
|
flags.reportWithTrace ||
|
|
62
76
|
artesConfig.reportWithTrace ||
|