artes 1.0.0 → 1.0.2
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 +1 -1
- package/cucumber.config.js +1 -1
- package/package.json +1 -1
- package/src/helper/executers/projectCreator.js +32 -26
- package/src/helper/executers/reportGenerator.js +16 -19
- package/src/hooks/hooks.js +15 -1
package/README.md
CHANGED
|
@@ -266,7 +266,7 @@ You can configure Artes by editing the `artes.config.js` file. Below are the def
|
|
|
266
266
|
| `paths` | `["tests/features/"]` | Array of paths to feature files. |
|
|
267
267
|
| `pomPath` | `"tests/POMs/*.json"` | Path to Page Object Models. |
|
|
268
268
|
| `require` | `"tests/steps/*.js"` | Array of support code paths (CommonJS). |
|
|
269
|
-
| `parallel` | `
|
|
269
|
+
| `parallel` | `1` | Number of parallel workers. |
|
|
270
270
|
| `tags` | `""` | Tag expression to filter scenarios. |
|
|
271
271
|
| `language` | `"en"` | Default language for feature files. |
|
|
272
272
|
| `order` | `"defined"` | Run order (defined or random). |
|
package/cucumber.config.js
CHANGED
|
@@ -43,7 +43,7 @@ module.exports = {
|
|
|
43
43
|
}, // Formatter options
|
|
44
44
|
|
|
45
45
|
// Execution options
|
|
46
|
-
parallel: argusConfig.parallel ||
|
|
46
|
+
parallel: argusConfig.parallel || 1, // Number of parallel workers
|
|
47
47
|
dryRun: argusConfig.dryRun || false, // Prepare test run without execution
|
|
48
48
|
failFast: argusConfig.failFast || false, // Stop on first test failure
|
|
49
49
|
forceExit: argusConfig.forceExit || false, // Force process.exit() after tests
|
package/package.json
CHANGED
|
@@ -64,34 +64,40 @@ function createProject(createYes) {
|
|
|
64
64
|
};
|
|
65
65
|
`;
|
|
66
66
|
|
|
67
|
-
const featureContent = `Feature:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
const featureContent = `Feature: Shopping on SauceDemo 🛒
|
|
68
|
+
|
|
69
|
+
Background: Login on SauceDemo
|
|
70
|
+
Given User navigates to "https://www.saucedemo.com/" page
|
|
71
|
+
And User types "standard_user" in "username_input"
|
|
72
|
+
And User types "secret_sauce" in "password_input"
|
|
73
|
+
And User clicks "#login-button"
|
|
74
|
+
|
|
75
|
+
Scenario Outline: Success Shopping
|
|
76
|
+
And User expects the page url should be "https://www.saucedemo.com/inventory.html"
|
|
77
|
+
And User clicks "product_title"
|
|
78
|
+
And User clicks "add_to_cart_button"
|
|
79
|
+
And User clicks "cart_button"
|
|
80
|
+
Then User expects "item_price" should have "$29.99" text
|
|
81
|
+
|
|
82
|
+
Scenario Outline: Failed Shopping
|
|
83
|
+
And User expects the page url should be "https://www.saucedemo.com/inventory.html"
|
|
84
|
+
And User clicks "product_title"
|
|
85
|
+
And User clicks "add_to_cart_button"
|
|
86
|
+
And User clicks "cart_button"
|
|
87
|
+
Then User expects "item_price" should not have "$29.99" text
|
|
88
|
+
|
|
82
89
|
`;
|
|
83
90
|
|
|
84
91
|
const pomContent = JSON.stringify(
|
|
85
92
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
93
|
+
username_input: { selector: "#user-name" },
|
|
94
|
+
password_input: "#password",
|
|
95
|
+
login_button: "#login-button",
|
|
96
|
+
product_title:
|
|
97
|
+
"xpath=/html/body/div/div/div/div[2]/div/div/div/div[1]/div[2]/div[1]/a/div",
|
|
98
|
+
add_to_cart_button: "#add-to-cart",
|
|
99
|
+
cart_button: ".shopping_cart_link",
|
|
100
|
+
item_price: ".inventory_item_price",
|
|
95
101
|
},
|
|
96
102
|
null,
|
|
97
103
|
2,
|
|
@@ -101,8 +107,8 @@ function createProject(createYes) {
|
|
|
101
107
|
const {Given,context} = require("artes");
|
|
102
108
|
|
|
103
109
|
// Example step definition
|
|
104
|
-
Given("User is on home page of
|
|
105
|
-
await context.page.goto("https://www.
|
|
110
|
+
Given("User is on home page of SauceDemo", async () => {
|
|
111
|
+
await context.page.goto("https://www.saucedemo.com/");
|
|
106
112
|
});
|
|
107
113
|
`;
|
|
108
114
|
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
const { spawnSync } = require("child_process");
|
|
2
2
|
const { moduleConfig } = require("../imports/commons");
|
|
3
|
-
const fs = require("fs");
|
|
4
3
|
|
|
5
4
|
function generateReport() {
|
|
6
5
|
try {
|
|
7
|
-
|
|
8
|
-
console.log("📊 Generating report...");
|
|
6
|
+
console.log("📊 Generating report...");
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const result = spawnSync(
|
|
9
|
+
"npm",
|
|
10
|
+
["run", "testWithReport", moduleConfig.reportPath],
|
|
11
|
+
{
|
|
12
|
+
cwd: moduleConfig.modulePath,
|
|
13
|
+
stdio: "ignore",
|
|
14
|
+
shell: true,
|
|
15
|
+
},
|
|
16
|
+
);
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.log(
|
|
25
|
-
`📋 Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
26
|
-
);
|
|
18
|
+
if (result.error) {
|
|
19
|
+
throw result.error;
|
|
27
20
|
}
|
|
21
|
+
|
|
22
|
+
console.log(
|
|
23
|
+
`📋 Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
24
|
+
);
|
|
28
25
|
} catch (error) {
|
|
29
26
|
console.error("❌ Report generation failed:", error);
|
|
30
27
|
process.exit(1);
|
package/src/hooks/hooks.js
CHANGED
|
@@ -4,6 +4,7 @@ const {
|
|
|
4
4
|
After,
|
|
5
5
|
Status,
|
|
6
6
|
setDefaultTimeout,
|
|
7
|
+
AfterAll,
|
|
7
8
|
} = require("@cucumber/cucumber");
|
|
8
9
|
const { invokeBrowser } = require("../helper/contextManager/browserManager");
|
|
9
10
|
const { invokeRequest } = require("../helper/contextManager/requestManager");
|
|
@@ -20,10 +21,17 @@ setDefaultTimeout(cucumberConfig.cucumberTimeout);
|
|
|
20
21
|
BeforeAll(async function () {
|
|
21
22
|
browser = await invokeBrowser();
|
|
22
23
|
request = await invokeRequest();
|
|
24
|
+
|
|
23
25
|
pomCollector();
|
|
26
|
+
|
|
27
|
+
browser.tracing.start({
|
|
28
|
+
sources: true,
|
|
29
|
+
screenshots: true,
|
|
30
|
+
snapshots: true,
|
|
31
|
+
});
|
|
24
32
|
});
|
|
25
33
|
|
|
26
|
-
Before(async function () {
|
|
34
|
+
Before(async function ({ pickle }) {
|
|
27
35
|
context.page = await browser.newPage();
|
|
28
36
|
context.request = await request;
|
|
29
37
|
});
|
|
@@ -42,6 +50,8 @@ After(async function ({ pickle, result }) {
|
|
|
42
50
|
this.attach(img, "image/png");
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
await browser.tracing.stop({ path: "./trace.zip" });
|
|
54
|
+
|
|
45
55
|
await context.page.close();
|
|
46
56
|
await browser.close();
|
|
47
57
|
|
|
@@ -51,3 +61,7 @@ After(async function ({ pickle, result }) {
|
|
|
51
61
|
await this.attach(webmBuffer, "video/webm");
|
|
52
62
|
}
|
|
53
63
|
});
|
|
64
|
+
|
|
65
|
+
AfterAll(function () {
|
|
66
|
+
browser.tracing.stop({ path: "../../trace.zip" });
|
|
67
|
+
});
|