artes 1.0.87 → 1.0.89
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 +11 -9
- package/cucumber.config.js +22 -8
- package/executer.js +6 -4
- package/package.json +1 -1
- package/src/helper/contextManager/browserManager.js +1 -0
- package/src/helper/executers/helper.js +5 -2
- package/src/helper/executers/projectCreator.js +3 -2
- package/src/helper/executers/versionChecker.js +6 -5
- package/src/hooks/hooks.js +2 -2
- package/src/stepDefinitions/keyboardActions.steps.js +17 -9
package/README.md
CHANGED
|
@@ -45,24 +45,25 @@ npx artes [options]
|
|
|
45
45
|
| Option | Description | Usage Example |
|
|
46
46
|
| ------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
47
47
|
| 🆘 `-h, --help` | Show the usage options | `artes -h` or `artes --help` |
|
|
48
|
-
| 🏷️ `-v, --version`
|
|
49
|
-
| 🏗️ `-c, --create`
|
|
50
|
-
| ✅ `-y, --yes`
|
|
48
|
+
| 🏷️ `-v, --version` | Show the current version of Artes | `artes -v` or `artes --version` |
|
|
49
|
+
| 🏗️ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
|
|
50
|
+
| ✅ `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
|
|
51
51
|
| 📊 `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
|
|
52
52
|
| 📁 `--features` | Specify one or more feature files' relative paths to run (comma-separated) | `artes --features "tests/features/Alma,tests/features/Banan.feature"` |
|
|
53
53
|
| 🔖 `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke or @wip"` |
|
|
54
54
|
| 🌐 `--env` | Set the environment for the test run | `artes --env "dev"` |
|
|
55
|
-
| 🕶️ `--headless`
|
|
56
|
-
| ⚡ `--parallel`
|
|
55
|
+
| 🕶️ `--headless` | Run browser in headless mode | `artes --headless` |
|
|
56
|
+
| ⚡ `--parallel` | Run tests in parallel mode | `artes --parallel 2` |
|
|
57
57
|
| 🔁 `--retry` | Retry failed tests | `artes --retry 3` |
|
|
58
|
-
| 🎭 `--
|
|
58
|
+
| 🎭 `--dryRun` | Perform a dry run without executing tests | `artes --dryRun` |
|
|
59
59
|
| 📈 `--percentage` | Set minimum success percentage to pass test run (default is 0) | `artes --percentage 85` |
|
|
60
60
|
| 🌍 `--browser` | Specify browser to use (`chromium`, `firefox`, or `webkit`) | `artes --browser chromium` |
|
|
61
61
|
| 🔗 `--baseURL` | Set base URL for the tests | `artes --baseURL "https://example.com"` |
|
|
62
|
-
| 🖥️ `--maxScreen`
|
|
62
|
+
| 🖥️ `--maxScreen` | Maximize browser window on launch | `artes --maxScreen` |
|
|
63
63
|
| 📏 `--width` | Set browser width (default is 1280) | `artes --width 1920` |
|
|
64
64
|
| 📐 `--height` | Set browser height (default is 720) | `artes --height 1080` |
|
|
65
|
-
| ⏱️ `--timeout` | Set timeout for each test step in seconds (default is 30) | `artes --timeout 10` |
|
|
65
|
+
| ⏱️ `--timeout` | Set timeout for each test step in seconds (default is 30 seconds) | `artes --timeout 10` |
|
|
66
|
+
| 🐢 `--slowMo` | Slow down text execution for clear view (default: 0 seconds) | `artes --slowMo 1` |
|
|
66
67
|
|
|
67
68
|
\*\* To just run the tests: <br>
|
|
68
69
|
Globally: artes <br>
|
|
@@ -285,7 +286,8 @@ You can configure Artes by editing the `artes.config.js` file. Below are the def
|
|
|
285
286
|
|
|
286
287
|
| **Option** | **Default Value** | **Description** |
|
|
287
288
|
| ----------------- | ---------------------------------------------------------------------------- | ----------------------------------- |
|
|
288
|
-
| `timeout` | `30` | Default timeout in
|
|
289
|
+
| `timeout` | `30` | Default timeout in seconds. |
|
|
290
|
+
| `slowMo` | `0` | Default slow motion in seconds |
|
|
289
291
|
| `paths` | `[moduleConfig.featuresPath]` | Paths to feature files. |
|
|
290
292
|
| `require` | `[moduleConfig.stepsPath, "src/stepDefinitions/*.js", "src/hooks/hooks.js"]` | Support code paths (CommonJS). |
|
|
291
293
|
| `pomPath` | `moduleConfig.pomPath` | Path to Page Object Models. |
|
package/cucumber.config.js
CHANGED
|
@@ -14,6 +14,22 @@ try {
|
|
|
14
14
|
console.log("Proceeding with default config.");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
const defaultFormats = [
|
|
18
|
+
"rerun:@rerun.txt",
|
|
19
|
+
"progress-bar"];
|
|
20
|
+
|
|
21
|
+
const userFormatsFromEnv = process.env.REPORT_FORMAT
|
|
22
|
+
? JSON.parse(process.env.REPORT_FORMAT)
|
|
23
|
+
: [];
|
|
24
|
+
|
|
25
|
+
const userFormatsFromConfig = artesConfig.format || [];
|
|
26
|
+
|
|
27
|
+
const finalFormats = [...new Set([
|
|
28
|
+
...defaultFormats,
|
|
29
|
+
...userFormatsFromEnv,
|
|
30
|
+
...userFormatsFromConfig,
|
|
31
|
+
])];
|
|
32
|
+
|
|
17
33
|
module.exports = {
|
|
18
34
|
default: {
|
|
19
35
|
// File paths and patterns
|
|
@@ -21,8 +37,8 @@ module.exports = {
|
|
|
21
37
|
? Number(process.env.PERCENTAGE)
|
|
22
38
|
: artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
|
|
23
39
|
timeout: process.env.TIMEOUT
|
|
24
|
-
? Number(process.env.TIMEOUT)
|
|
25
|
-
: artesConfig.timeout || 30, // Default timeout in
|
|
40
|
+
? Number(process.env.TIMEOUT) * 1000
|
|
41
|
+
: artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
|
|
26
42
|
paths: process.env.FEATURES
|
|
27
43
|
? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
|
|
28
44
|
: artesConfig.features
|
|
@@ -41,12 +57,7 @@ module.exports = {
|
|
|
41
57
|
import: artesConfig.import || [], // Support code paths
|
|
42
58
|
|
|
43
59
|
// Formatting and output
|
|
44
|
-
format:
|
|
45
|
-
? JSON.parse(process.env.REPORT_FORMAT)
|
|
46
|
-
: artesConfig.format || [
|
|
47
|
-
"rerun:@rerun.txt",
|
|
48
|
-
"allure-cucumberjs/reporter",
|
|
49
|
-
], // Formatter names/paths
|
|
60
|
+
format: finalFormats, // Formatter names/paths
|
|
50
61
|
formatOptions: artesConfig.formatOptions || {
|
|
51
62
|
resultsDir: `allure-result`,
|
|
52
63
|
}, // Formatter options
|
|
@@ -116,5 +127,8 @@ module.exports = {
|
|
|
116
127
|
: artesConfig?.headless !== undefined
|
|
117
128
|
? artesConfig.headless
|
|
118
129
|
: true,
|
|
130
|
+
slowMo: process.env.SLOWMO
|
|
131
|
+
? Number(process.env.SLOWMO) * 1000
|
|
132
|
+
: artesConfig?.slowMo * 1000 || 0
|
|
119
133
|
},
|
|
120
134
|
};
|
package/executer.js
CHANGED
|
@@ -23,7 +23,7 @@ const flags = {
|
|
|
23
23
|
headless: args.includes("--headless"),
|
|
24
24
|
parallel: args.includes("--parallel"),
|
|
25
25
|
retry: args.includes("--retry"),
|
|
26
|
-
|
|
26
|
+
dryRun: args.includes("--dryRun"),
|
|
27
27
|
percentage: args.includes("--percentage"),
|
|
28
28
|
browser: args.includes("--browser"),
|
|
29
29
|
baseURL: args.includes("--baseURL"),
|
|
@@ -31,6 +31,7 @@ const flags = {
|
|
|
31
31
|
width: args.includes("--width"),
|
|
32
32
|
height: args.includes("--height"),
|
|
33
33
|
timeout: args.includes("--timeout"),
|
|
34
|
+
slowMo: args.includes("--slowMo"),
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
const env = args[args.indexOf("--env") + 1];
|
|
@@ -45,14 +46,13 @@ const baseURL = args[args.indexOf("--baseURL") + 1];
|
|
|
45
46
|
const width = args[args.indexOf("--width") + 1];
|
|
46
47
|
const height = args[args.indexOf("--height") + 1];
|
|
47
48
|
const timeout = args[args.indexOf("--timeout") + 1];
|
|
49
|
+
const slowMo = args[args.indexOf("--slowMo") + 1];
|
|
48
50
|
|
|
49
51
|
flags.env && console.log("Running env:", env);
|
|
50
52
|
flags.env ? (process.env.ENV = JSON.stringify(env)) : "";
|
|
51
53
|
|
|
52
54
|
flags.report
|
|
53
55
|
? (process.env.REPORT_FORMAT = JSON.stringify([
|
|
54
|
-
"rerun:@rerun.txt",
|
|
55
|
-
"progress-bar",
|
|
56
56
|
"allure-cucumberjs/reporter:./allure-results",
|
|
57
57
|
]))
|
|
58
58
|
: "";
|
|
@@ -71,7 +71,7 @@ flags.parallel ? (process.env.PARALLEL = parallel) : "";
|
|
|
71
71
|
|
|
72
72
|
flags.retry ? (process.env.RETRY = retry) : "";
|
|
73
73
|
|
|
74
|
-
flags.
|
|
74
|
+
flags.dryRun ? (process.env.DRYRUN = flags.dryRun) : "";
|
|
75
75
|
|
|
76
76
|
flags.percentage ? (process.env.PERCENTAGE = percentage) : "";
|
|
77
77
|
|
|
@@ -92,6 +92,8 @@ flags.height ? (process.env.HEIGHT = height) : "";
|
|
|
92
92
|
|
|
93
93
|
flags.timeout ? (process.env.TIMEOUT = timeout) : "";
|
|
94
94
|
|
|
95
|
+
flags.slowMo ? (process.env.SLOWMO = slowMo) : "";
|
|
96
|
+
|
|
95
97
|
function main() {
|
|
96
98
|
if (flags.help) return showHelp();
|
|
97
99
|
if (flags.version) return showVersion();
|
package/package.json
CHANGED
|
@@ -43,8 +43,8 @@ function showHelp() {
|
|
|
43
43
|
🔁 --retry Retry failed tests
|
|
44
44
|
Usage: artes --retry 2
|
|
45
45
|
|
|
46
|
-
🎭 --
|
|
47
|
-
Usage: artes --
|
|
46
|
+
🎭 --dryRun Perform a dry run without executing tests
|
|
47
|
+
Usage: artes --dryRun
|
|
48
48
|
|
|
49
49
|
📈 --percentage Set minimum success percentage to pass test run
|
|
50
50
|
Usage: artes --percentage 85
|
|
@@ -66,6 +66,9 @@ function showHelp() {
|
|
|
66
66
|
|
|
67
67
|
⏱️ --timeout Set timeout for each test step (default: 30 seconds)
|
|
68
68
|
Usage: artes --timeout 10
|
|
69
|
+
|
|
70
|
+
🐢 --slowMo Slow down text execution for clear view (default: 0 seconds)
|
|
71
|
+
Usage: artes --slowMo 1
|
|
69
72
|
`);
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -46,6 +46,7 @@ function createProject(createYes) {
|
|
|
46
46
|
// steps: "", // string - Step definitions files
|
|
47
47
|
// pomPath: "", // string - Path to POM files
|
|
48
48
|
// timeout : 0, // number - Test timeout in seconds
|
|
49
|
+
// slowMo: 0, // number - Slow down test execution (Default: 0 seconds)
|
|
49
50
|
// parallel: 0, // number - Number of parallel workers
|
|
50
51
|
// format: [], // string[] - Formatter names/paths
|
|
51
52
|
// formatOptions: {}, // object - Formatter options
|
|
@@ -81,14 +82,14 @@ function createProject(createYes) {
|
|
|
81
82
|
And User clicks "#login-button"
|
|
82
83
|
|
|
83
84
|
Scenario Outline: Success Shopping
|
|
84
|
-
And User expects
|
|
85
|
+
And User expects to be in "https://www.saucedemo.com/inventory.html" page
|
|
85
86
|
And User clicks "product_title"
|
|
86
87
|
And User clicks "add_to_cart_button"
|
|
87
88
|
And User clicks "cart_button"
|
|
88
89
|
Then User expects "item_price" should have "$29.99" text
|
|
89
90
|
|
|
90
91
|
Scenario Outline: Failed Shopping
|
|
91
|
-
And User expects
|
|
92
|
+
And User expects to be in "https://www.saucedemo.com/inventory.html" page
|
|
92
93
|
And User clicks "product_title"
|
|
93
94
|
And User clicks "add_to_cart_button"
|
|
94
95
|
And User clicks "cart_button"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
const { execSync } = require("child_process");
|
|
2
|
+
const path = require("path");
|
|
1
3
|
const fs = require("fs");
|
|
2
|
-
const { moduleConfig } = require("../imports/commons");
|
|
3
4
|
|
|
4
5
|
function showVersion() {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const artesVersion = execSync("npm root -g").toString().trim();
|
|
7
|
+
const artesGPackageJSONPath = path.join(artesVersion, "artes/package.json");
|
|
8
|
+
const asrtesGPackageJSON = JSON.parse(fs.readFileSync(artesGPackageJSONPath, "utf8"));
|
|
9
|
+
console.log(`ARTES Version: ${asrtesGPackageJSON.version}`);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
module.exports = {
|
package/src/hooks/hooks.js
CHANGED
|
@@ -19,7 +19,7 @@ const path = require("path");
|
|
|
19
19
|
|
|
20
20
|
const statusDir = path.join(process.cwd(), "testsStatus");
|
|
21
21
|
|
|
22
|
-
setDefaultTimeout(cucumberConfig.default.timeout
|
|
22
|
+
setDefaultTimeout(cucumberConfig.default.timeout);
|
|
23
23
|
|
|
24
24
|
BeforeAll(async function () {
|
|
25
25
|
pomCollector();
|
|
@@ -36,7 +36,7 @@ Before(async function () {
|
|
|
36
36
|
context.page = await browserContext.newPage();
|
|
37
37
|
context.request = requestInstance;
|
|
38
38
|
|
|
39
|
-
await context.page.setDefaultTimeout(cucumberConfig.default.timeout
|
|
39
|
+
await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
|
|
40
40
|
|
|
41
41
|
await context.browserContext.tracing.start({
|
|
42
42
|
sources: true,
|
|
@@ -6,25 +6,25 @@ When("User presses {string} on {string}", async function (key, selector) {
|
|
|
6
6
|
await keyboard.press(selector, key);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
// User presses keys sequentially on a specific selector
|
|
9
10
|
When(
|
|
10
|
-
"User types {string}
|
|
11
|
-
async (
|
|
12
|
-
|
|
13
|
-
await nthElement.fill(text);
|
|
11
|
+
"User types {string} by hand in {string}",
|
|
12
|
+
async function (keys, selector) {
|
|
13
|
+
await keyboard.pressSequentially(selector, keys);
|
|
14
14
|
},
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
// User presses keys sequentially on a specific selector
|
|
18
17
|
When(
|
|
19
|
-
"User
|
|
20
|
-
async
|
|
21
|
-
await
|
|
18
|
+
"User types {string} by hand in {int} th of {string}",
|
|
19
|
+
async (text, order, elements) => {
|
|
20
|
+
const nthElement = await frame.nth(elements, order);
|
|
21
|
+
await nthElement.pressSequentially(text);
|
|
22
22
|
},
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
// User presses keys sequentially with a delay on a specific selector
|
|
26
26
|
When(
|
|
27
|
-
"User
|
|
27
|
+
"User types {string} by hand with delay {int} in {string}",
|
|
28
28
|
async function (keys, delay, selector) {
|
|
29
29
|
await keyboard.pressSequentiallyDelay(selector, keys, delay);
|
|
30
30
|
},
|
|
@@ -35,6 +35,14 @@ When("User types {string} in {string}", async function (value, selector) {
|
|
|
35
35
|
await keyboard.fill(selector, value);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
+
When(
|
|
39
|
+
"User types {string} in {int} th of {string}",
|
|
40
|
+
async (text, order, elements) => {
|
|
41
|
+
const nthElement = await frame.nth(elements, order);
|
|
42
|
+
await nthElement.fill(text);
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
38
46
|
When(
|
|
39
47
|
"User types {string} in multiple {string}",
|
|
40
48
|
async function (value, selectors) {
|