artes 1.0.60 โ 1.0.62
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 +356 -340
- package/cucumber.config.js +98 -98
- package/docs/functionDefinitions.md +2343 -2101
- package/docs/stepDefinitions.md +352 -269
- package/executer.js +59 -59
- package/index.js +44 -44
- package/package.json +50 -50
- package/src/helper/contextManager/browserManager.js +66 -66
- package/src/helper/contextManager/requestManager.js +30 -30
- package/src/helper/executers/cleaner.js +23 -23
- package/src/helper/executers/exporter.js +15 -15
- package/src/helper/executers/helper.js +44 -44
- package/src/helper/executers/projectCreator.js +162 -162
- package/src/helper/executers/reportGenerator.js +29 -29
- package/src/helper/executers/testRunner.js +59 -59
- package/src/helper/executers/versionChecker.js +13 -13
- package/src/helper/imports/commons.js +51 -51
- package/src/helper/pomController/elementController.js +146 -146
- package/src/helper/pomController/pomCollector.js +20 -18
- package/src/helper/stepFunctions/APIActions.js +271 -303
- package/src/helper/stepFunctions/assertions.js +523 -523
- package/src/helper/stepFunctions/browserActions.js +21 -19
- package/src/helper/stepFunctions/elementInteractions.js +38 -38
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +50 -50
- package/src/helper/stepFunctions/keyboardActions.js +41 -36
- package/src/helper/stepFunctions/mouseActions.js +145 -145
- package/src/helper/stepFunctions/pageActions.js +27 -27
- package/src/hooks/context.js +15 -15
- package/src/hooks/hooks.js +76 -74
- package/src/stepDefinitions/API.steps.js +248 -248
- package/src/stepDefinitions/assertions.steps.js +826 -826
- package/src/stepDefinitions/browser.steps.js +7 -7
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +87 -87
- package/src/stepDefinitions/mouseActions.steps.js +256 -256
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +25 -25
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const { execSync } = require("child_process");
|
|
6
|
-
|
|
7
|
-
function createProject(createYes) {
|
|
8
|
-
const projectDir = path.join(process.cwd(), "artes");
|
|
9
|
-
const srcDir = path.join(projectDir, "tests");
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
projectDir,
|
|
13
|
-
path.join(srcDir, "features"),
|
|
14
|
-
path.join(srcDir, "POMs"),
|
|
15
|
-
path.join(srcDir, "steps"),
|
|
16
|
-
path.join(projectDir, ".vscode"),
|
|
17
|
-
].forEach((dir) => fs.mkdirSync(dir, { recursive: true }));
|
|
18
|
-
|
|
19
|
-
process.chdir(projectDir);
|
|
20
|
-
|
|
21
|
-
console.log("๐ Initializing project...");
|
|
22
|
-
execSync(`npm init ${createYes ? "-y" : ""}`, { stdio: "inherit" });
|
|
23
|
-
execSync("npm i artes", { stdio: "inherit" });
|
|
24
|
-
|
|
25
|
-
console.log("๐ฆ Setting up browsers...");
|
|
26
|
-
execSync("npx playwright install", { stdio: "inherit" });
|
|
27
|
-
|
|
28
|
-
const packageJsonPath = path.join(projectDir, "package.json");
|
|
29
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
30
|
-
|
|
31
|
-
packageJson.scripts = {
|
|
32
|
-
test: "npx artes",
|
|
33
|
-
testWithReport: "npx artes -r",
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
37
|
-
|
|
38
|
-
const config = `module.exports = {
|
|
39
|
-
headless: false, // Set to true for headless browser mode
|
|
40
|
-
|
|
41
|
-
// Configuration options:
|
|
42
|
-
// env: "", // string - Environment name for tests
|
|
43
|
-
// baseURL: "", // string - Base URL for API tests
|
|
44
|
-
// paths: [], // string[] - Paths to feature files
|
|
45
|
-
// steps: "", // string - Step definitions files
|
|
46
|
-
// pomPath: "", // string - Path to POM files
|
|
47
|
-
// timeout : 0, // number - Test timeout in seconds
|
|
48
|
-
// parallel: 0, // number - Number of parallel workers
|
|
49
|
-
// format: [], // string[] - Formatter names/paths
|
|
50
|
-
// formatOptions: {}, // object - Formatter options
|
|
51
|
-
// retry: 0, // number - Retry attempts for failing tests
|
|
52
|
-
// tags: "", // string - Tag expression to filter scenarios
|
|
53
|
-
// backtrace: false, // boolean - Show full backtrace for errors
|
|
54
|
-
// dryRun: false, // boolean - Prepare test run without execution
|
|
55
|
-
// browser: "chrome", // "chrome", "firefox", "webkit"
|
|
56
|
-
// width: 1280, // number - Browser width
|
|
57
|
-
// height: 720, // number - Browser height
|
|
58
|
-
// maximizeScreen: true // boolean - Maximize browser window
|
|
59
|
-
// forceExit: false, // boolean - Force process.exit() after tests
|
|
60
|
-
// failFast: false, // boolean - Stop on first test failure
|
|
61
|
-
// import: [], // string[] - Support code paths
|
|
62
|
-
// language: "en", // string - Default feature file language
|
|
63
|
-
// loader: [], // string[] - Module loader specifications
|
|
64
|
-
// name: [], // string[] - Run scenarios matching regex
|
|
65
|
-
// order: "defined", // string - Run order (defined/random)
|
|
66
|
-
// publish: false, // boolean - Publish to cucumber.io
|
|
67
|
-
// requireModule: [], // string[] - Transpilation module names
|
|
68
|
-
// retryTagFilter: "", // string - Tag expression for retries
|
|
69
|
-
// strict: true, // boolean - Fail on pending steps
|
|
70
|
-
// worldParameters: {} // object - World constructor parameters
|
|
71
|
-
};
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
const featureContent = `Feature: Shopping on SauceDemo ๐
|
|
75
|
-
|
|
76
|
-
Background: Login on SauceDemo
|
|
77
|
-
Given User is on home page of SauceDemo
|
|
78
|
-
And User types "standard_user" in "username_input"
|
|
79
|
-
And User types "secret_sauce" in "password_input"
|
|
80
|
-
And User clicks "#login-button"
|
|
81
|
-
|
|
82
|
-
Scenario Outline: Success 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 have "$29.99" text
|
|
88
|
-
|
|
89
|
-
Scenario Outline: Failed Shopping
|
|
90
|
-
And User expects the page url should be "https://www.saucedemo.com/inventory.html"
|
|
91
|
-
And User clicks "product_title"
|
|
92
|
-
And User clicks "add_to_cart_button"
|
|
93
|
-
And User clicks "cart_button"
|
|
94
|
-
Then User expects "item_price" should not have "$29.99" text
|
|
95
|
-
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
const pomContent = JSON.stringify(
|
|
99
|
-
{
|
|
100
|
-
username_input: { selector: "#user-name" },
|
|
101
|
-
password_input: "#password",
|
|
102
|
-
login_button: "#login-button",
|
|
103
|
-
product_title:
|
|
104
|
-
"xpath=/html/body/div/div/div/div[2]/div/div/div/div[1]/div[2]/div[1]/a/div",
|
|
105
|
-
add_to_cart_button: "#add-to-cart",
|
|
106
|
-
cart_button: ".shopping_cart_link",
|
|
107
|
-
item_price: ".inventory_item_price",
|
|
108
|
-
},
|
|
109
|
-
null,
|
|
110
|
-
2,
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const stepsContent = `
|
|
114
|
-
const {Given,context} = require("artes");
|
|
115
|
-
|
|
116
|
-
// Example step definition
|
|
117
|
-
Given("User is on home page of SauceDemo", async () => {
|
|
118
|
-
await context.page.goto("https://www.saucedemo.com/");
|
|
119
|
-
});
|
|
120
|
-
`;
|
|
121
|
-
|
|
122
|
-
const vsCodeExtension = JSON.stringify({
|
|
123
|
-
recommendations: ["CucumberOpen.cucumber-official"],
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const vsCodeSettings = JSON.stringify({
|
|
127
|
-
"cucumber.glue": [
|
|
128
|
-
"tests/steps/*.{ts,js}",
|
|
129
|
-
"node_modules/artes/src/stepDefinitions/*.{ts,js}",
|
|
130
|
-
],
|
|
131
|
-
"cucumber.features": ["tests/features/**/*.feature"],
|
|
132
|
-
"cucumberautocomplete.syncfeatures": true,
|
|
133
|
-
"cucumberautocomplete.strictGherkinCompletion": true,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
console.log("๐ Creating project files...");
|
|
137
|
-
|
|
138
|
-
fs.writeFileSync(path.join(projectDir, "artes.config.js"), config, "utf-8");
|
|
139
|
-
fs.writeFileSync(
|
|
140
|
-
path.join(srcDir, "features", "example.feature"),
|
|
141
|
-
featureContent,
|
|
142
|
-
);
|
|
143
|
-
fs.writeFileSync(path.join(srcDir, "POMs", "example.pom.json"), pomContent);
|
|
144
|
-
fs.writeFileSync(path.join(srcDir, "steps", "common.steps.js"), stepsContent);
|
|
145
|
-
|
|
146
|
-
fs.writeFileSync(
|
|
147
|
-
path.join(projectDir, ".vscode", "settings.json"),
|
|
148
|
-
vsCodeSettings,
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
fs.writeFileSync(
|
|
152
|
-
path.join(projectDir, ".vscode", "extensions.json"),
|
|
153
|
-
vsCodeExtension,
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
console.log(`โจ Project created successfully in ${projectDir}!`);
|
|
157
|
-
console.log("Happy Testing ๐");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
module.exports = {
|
|
161
|
-
createProject,
|
|
162
|
-
};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { execSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
function createProject(createYes) {
|
|
8
|
+
const projectDir = path.join(process.cwd(), "artes");
|
|
9
|
+
const srcDir = path.join(projectDir, "tests");
|
|
10
|
+
|
|
11
|
+
[
|
|
12
|
+
projectDir,
|
|
13
|
+
path.join(srcDir, "features"),
|
|
14
|
+
path.join(srcDir, "POMs"),
|
|
15
|
+
path.join(srcDir, "steps"),
|
|
16
|
+
path.join(projectDir, ".vscode"),
|
|
17
|
+
].forEach((dir) => fs.mkdirSync(dir, { recursive: true }));
|
|
18
|
+
|
|
19
|
+
process.chdir(projectDir);
|
|
20
|
+
|
|
21
|
+
console.log("๐ Initializing project...");
|
|
22
|
+
execSync(`npm init ${createYes ? "-y" : ""}`, { stdio: "inherit" });
|
|
23
|
+
execSync("npm i artes", { stdio: "inherit" });
|
|
24
|
+
|
|
25
|
+
console.log("๐ฆ Setting up browsers...");
|
|
26
|
+
execSync("npx playwright install", { stdio: "inherit" });
|
|
27
|
+
|
|
28
|
+
const packageJsonPath = path.join(projectDir, "package.json");
|
|
29
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
30
|
+
|
|
31
|
+
packageJson.scripts = {
|
|
32
|
+
test: "npx artes",
|
|
33
|
+
testWithReport: "npx artes -r",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
37
|
+
|
|
38
|
+
const config = `module.exports = {
|
|
39
|
+
headless: false, // Set to true for headless browser mode
|
|
40
|
+
|
|
41
|
+
// Configuration options:
|
|
42
|
+
// env: "", // string - Environment name for tests
|
|
43
|
+
// baseURL: "", // string - Base URL for API tests
|
|
44
|
+
// paths: [], // string[] - Paths to feature files
|
|
45
|
+
// steps: "", // string - Step definitions files
|
|
46
|
+
// pomPath: "", // string - Path to POM files
|
|
47
|
+
// timeout : 0, // number - Test timeout in seconds
|
|
48
|
+
// parallel: 0, // number - Number of parallel workers
|
|
49
|
+
// format: [], // string[] - Formatter names/paths
|
|
50
|
+
// formatOptions: {}, // object - Formatter options
|
|
51
|
+
// retry: 0, // number - Retry attempts for failing tests
|
|
52
|
+
// tags: "", // string - Tag expression to filter scenarios
|
|
53
|
+
// backtrace: false, // boolean - Show full backtrace for errors
|
|
54
|
+
// dryRun: false, // boolean - Prepare test run without execution
|
|
55
|
+
// browser: "chrome", // "chrome", "firefox", "webkit"
|
|
56
|
+
// width: 1280, // number - Browser width
|
|
57
|
+
// height: 720, // number - Browser height
|
|
58
|
+
// maximizeScreen: true // boolean - Maximize browser window
|
|
59
|
+
// forceExit: false, // boolean - Force process.exit() after tests
|
|
60
|
+
// failFast: false, // boolean - Stop on first test failure
|
|
61
|
+
// import: [], // string[] - Support code paths
|
|
62
|
+
// language: "en", // string - Default feature file language
|
|
63
|
+
// loader: [], // string[] - Module loader specifications
|
|
64
|
+
// name: [], // string[] - Run scenarios matching regex
|
|
65
|
+
// order: "defined", // string - Run order (defined/random)
|
|
66
|
+
// publish: false, // boolean - Publish to cucumber.io
|
|
67
|
+
// requireModule: [], // string[] - Transpilation module names
|
|
68
|
+
// retryTagFilter: "", // string - Tag expression for retries
|
|
69
|
+
// strict: true, // boolean - Fail on pending steps
|
|
70
|
+
// worldParameters: {} // object - World constructor parameters
|
|
71
|
+
};
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const featureContent = `Feature: Shopping on SauceDemo ๐
|
|
75
|
+
|
|
76
|
+
Background: Login on SauceDemo
|
|
77
|
+
Given User is on home page of SauceDemo
|
|
78
|
+
And User types "standard_user" in "username_input"
|
|
79
|
+
And User types "secret_sauce" in "password_input"
|
|
80
|
+
And User clicks "#login-button"
|
|
81
|
+
|
|
82
|
+
Scenario Outline: Success 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 have "$29.99" text
|
|
88
|
+
|
|
89
|
+
Scenario Outline: Failed Shopping
|
|
90
|
+
And User expects the page url should be "https://www.saucedemo.com/inventory.html"
|
|
91
|
+
And User clicks "product_title"
|
|
92
|
+
And User clicks "add_to_cart_button"
|
|
93
|
+
And User clicks "cart_button"
|
|
94
|
+
Then User expects "item_price" should not have "$29.99" text
|
|
95
|
+
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const pomContent = JSON.stringify(
|
|
99
|
+
{
|
|
100
|
+
username_input: { selector: "#user-name" },
|
|
101
|
+
password_input: "#password",
|
|
102
|
+
login_button: "#login-button",
|
|
103
|
+
product_title:
|
|
104
|
+
"xpath=/html/body/div/div/div/div[2]/div/div/div/div[1]/div[2]/div[1]/a/div",
|
|
105
|
+
add_to_cart_button: "#add-to-cart",
|
|
106
|
+
cart_button: ".shopping_cart_link",
|
|
107
|
+
item_price: ".inventory_item_price",
|
|
108
|
+
},
|
|
109
|
+
null,
|
|
110
|
+
2,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const stepsContent = `
|
|
114
|
+
const {Given,context} = require("artes");
|
|
115
|
+
|
|
116
|
+
// Example step definition
|
|
117
|
+
Given("User is on home page of SauceDemo", async () => {
|
|
118
|
+
await context.page.goto("https://www.saucedemo.com/");
|
|
119
|
+
});
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
const vsCodeExtension = JSON.stringify({
|
|
123
|
+
recommendations: ["CucumberOpen.cucumber-official"],
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const vsCodeSettings = JSON.stringify({
|
|
127
|
+
"cucumber.glue": [
|
|
128
|
+
"tests/steps/*.{ts,js}",
|
|
129
|
+
"node_modules/artes/src/stepDefinitions/*.{ts,js}",
|
|
130
|
+
],
|
|
131
|
+
"cucumber.features": ["tests/features/**/*.feature"],
|
|
132
|
+
"cucumberautocomplete.syncfeatures": true,
|
|
133
|
+
"cucumberautocomplete.strictGherkinCompletion": true,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
console.log("๐ Creating project files...");
|
|
137
|
+
|
|
138
|
+
fs.writeFileSync(path.join(projectDir, "artes.config.js"), config, "utf-8");
|
|
139
|
+
fs.writeFileSync(
|
|
140
|
+
path.join(srcDir, "features", "example.feature"),
|
|
141
|
+
featureContent,
|
|
142
|
+
);
|
|
143
|
+
fs.writeFileSync(path.join(srcDir, "POMs", "example.pom.json"), pomContent);
|
|
144
|
+
fs.writeFileSync(path.join(srcDir, "steps", "common.steps.js"), stepsContent);
|
|
145
|
+
|
|
146
|
+
fs.writeFileSync(
|
|
147
|
+
path.join(projectDir, ".vscode", "settings.json"),
|
|
148
|
+
vsCodeSettings,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
fs.writeFileSync(
|
|
152
|
+
path.join(projectDir, ".vscode", "extensions.json"),
|
|
153
|
+
vsCodeExtension,
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
console.log(`โจ Project created successfully in ${projectDir}!`);
|
|
157
|
+
console.log("Happy Testing ๐");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
module.exports = {
|
|
161
|
+
createProject,
|
|
162
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const { spawnSync } = require("child_process");
|
|
2
|
-
const { moduleConfig } = require("../imports/commons");
|
|
3
|
-
|
|
4
|
-
function generateReport() {
|
|
5
|
-
try {
|
|
6
|
-
console.log("๐ Generating report...");
|
|
7
|
-
|
|
8
|
-
const result = spawnSync(
|
|
9
|
-
"npm",
|
|
10
|
-
["run", "testWithReport", moduleConfig.reportPath],
|
|
11
|
-
{
|
|
12
|
-
cwd: moduleConfig.modulePath,
|
|
13
|
-
stdio: "ignore",
|
|
14
|
-
shell: true,
|
|
15
|
-
},
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
console.log(
|
|
19
|
-
`๐ Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
20
|
-
);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.error("โ Report generation failed:", error);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
generateReport,
|
|
29
|
-
};
|
|
1
|
+
const { spawnSync } = require("child_process");
|
|
2
|
+
const { moduleConfig } = require("../imports/commons");
|
|
3
|
+
|
|
4
|
+
function generateReport() {
|
|
5
|
+
try {
|
|
6
|
+
console.log("๐ Generating report...");
|
|
7
|
+
|
|
8
|
+
const result = spawnSync(
|
|
9
|
+
"npm",
|
|
10
|
+
["run", "testWithReport", moduleConfig.reportPath],
|
|
11
|
+
{
|
|
12
|
+
cwd: moduleConfig.modulePath,
|
|
13
|
+
stdio: "ignore",
|
|
14
|
+
shell: true,
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(
|
|
19
|
+
`๐ Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
20
|
+
);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error("โ Report generation failed:", error);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
generateReport,
|
|
29
|
+
};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
const { spawnSync } = require("child_process");
|
|
2
|
-
const { moduleConfig } = require("../imports/commons");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
function runTests(args, flags) {
|
|
6
|
-
const env = args[args.indexOf("--env") + 1];
|
|
7
|
-
|
|
8
|
-
const featureFiles = args[args.indexOf("--features") + 1];
|
|
9
|
-
const features = flags.features && featureFiles;
|
|
10
|
-
|
|
11
|
-
const tags = args[args.indexOf("--tags") + 1];
|
|
12
|
-
|
|
13
|
-
flags.env && console.log("Running env:", env);
|
|
14
|
-
flags.env ? (process.env.ENV = JSON.stringify(env)) : "";
|
|
15
|
-
|
|
16
|
-
flags.report
|
|
17
|
-
? (process.env.REPORT_FORMAT = JSON.stringify([
|
|
18
|
-
"rerun:@rerun.txt",
|
|
19
|
-
"allure-cucumberjs/reporter",
|
|
20
|
-
]))
|
|
21
|
-
: "";
|
|
22
|
-
|
|
23
|
-
flags.tags && console.log("Running tags:", tags);
|
|
24
|
-
flags.tags ? (process.env.RUN_TAGS = JSON.stringify(tags)) : "";
|
|
25
|
-
|
|
26
|
-
flags.features && console.log("Running features:", features);
|
|
27
|
-
flags.features ? (process.env.FEATURES = features) : "";
|
|
28
|
-
|
|
29
|
-
flags.headless &&
|
|
30
|
-
console.log("Running mode:", flags.headless ? "headless" : "headed");
|
|
31
|
-
flags.headless ? (process.env.MODE = JSON.stringify(true)) : false;
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
console.log("๐งช Running tests...");
|
|
35
|
-
process.env.FORCE_COLOR = "1";
|
|
36
|
-
process.env.FORCE_STDIO_TTY = "1";
|
|
37
|
-
|
|
38
|
-
const result = spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
|
|
39
|
-
cwd: moduleConfig.modulePath,
|
|
40
|
-
stdio: "inherit",
|
|
41
|
-
shell: true,
|
|
42
|
-
env: {
|
|
43
|
-
...process.env,
|
|
44
|
-
FORCE_TTY: "1",
|
|
45
|
-
FORCE_COLOR: "1",
|
|
46
|
-
CI: "false",
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
console.log("โ
Tests completed successfully!");
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.error("โ Test execution failed:", error);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
module.exports = {
|
|
58
|
-
runTests,
|
|
59
|
-
};
|
|
1
|
+
const { spawnSync } = require("child_process");
|
|
2
|
+
const { moduleConfig } = require("../imports/commons");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
function runTests(args, flags) {
|
|
6
|
+
const env = args[args.indexOf("--env") + 1];
|
|
7
|
+
|
|
8
|
+
const featureFiles = args[args.indexOf("--features") + 1];
|
|
9
|
+
const features = flags.features && featureFiles;
|
|
10
|
+
|
|
11
|
+
const tags = args[args.indexOf("--tags") + 1];
|
|
12
|
+
|
|
13
|
+
flags.env && console.log("Running env:", env);
|
|
14
|
+
flags.env ? (process.env.ENV = JSON.stringify(env)) : "";
|
|
15
|
+
|
|
16
|
+
flags.report
|
|
17
|
+
? (process.env.REPORT_FORMAT = JSON.stringify([
|
|
18
|
+
"rerun:@rerun.txt",
|
|
19
|
+
"allure-cucumberjs/reporter",
|
|
20
|
+
]))
|
|
21
|
+
: "";
|
|
22
|
+
|
|
23
|
+
flags.tags && console.log("Running tags:", tags);
|
|
24
|
+
flags.tags ? (process.env.RUN_TAGS = JSON.stringify(tags)) : "";
|
|
25
|
+
|
|
26
|
+
flags.features && console.log("Running features:", features);
|
|
27
|
+
flags.features ? (process.env.FEATURES = features) : "";
|
|
28
|
+
|
|
29
|
+
flags.headless &&
|
|
30
|
+
console.log("Running mode:", flags.headless ? "headless" : "headed");
|
|
31
|
+
flags.headless ? (process.env.MODE = JSON.stringify(true)) : false;
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
console.log("๐งช Running tests...");
|
|
35
|
+
process.env.FORCE_COLOR = "1";
|
|
36
|
+
process.env.FORCE_STDIO_TTY = "1";
|
|
37
|
+
|
|
38
|
+
const result = spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
|
|
39
|
+
cwd: moduleConfig.modulePath,
|
|
40
|
+
stdio: "inherit",
|
|
41
|
+
shell: true,
|
|
42
|
+
env: {
|
|
43
|
+
...process.env,
|
|
44
|
+
FORCE_TTY: "1",
|
|
45
|
+
FORCE_COLOR: "1",
|
|
46
|
+
CI: "false",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log("โ
Tests completed successfully!");
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("โ Test execution failed:", error);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
runTests,
|
|
59
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const { moduleConfig } = require("../imports/commons");
|
|
3
|
-
|
|
4
|
-
function showVersion() {
|
|
5
|
-
const packageJson = JSON.parse(
|
|
6
|
-
fs.readFileSync(moduleConfig.modulePackageJsonPath, "utf-8"),
|
|
7
|
-
);
|
|
8
|
-
console.log(`๐ Artes version: ${packageJson.version}`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
showVersion,
|
|
13
|
-
};
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const { moduleConfig } = require("../imports/commons");
|
|
3
|
+
|
|
4
|
+
function showVersion() {
|
|
5
|
+
const packageJson = JSON.parse(
|
|
6
|
+
fs.readFileSync(moduleConfig.modulePackageJsonPath, "utf-8"),
|
|
7
|
+
);
|
|
8
|
+
console.log(`๐ Artes version: ${packageJson.version}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
showVersion,
|
|
13
|
+
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
const { expect } = require("playwright/test");
|
|
2
|
-
const { Given, When, Then } = require("@cucumber/cucumber");
|
|
3
|
-
const {
|
|
4
|
-
getElement,
|
|
5
|
-
getSelector,
|
|
6
|
-
extractVarsFromResponse,
|
|
7
|
-
saveVar,
|
|
8
|
-
resolveVariable,
|
|
9
|
-
} = require("../pomController/elementController");
|
|
10
|
-
const { faker } = require("@faker-js/faker");
|
|
11
|
-
const { context } = require("../../hooks/context");
|
|
12
|
-
|
|
13
|
-
const element = getElement;
|
|
14
|
-
const selector = getSelector;
|
|
15
|
-
const page = context.page;
|
|
16
|
-
const request = context.request;
|
|
17
|
-
const random = faker;
|
|
18
|
-
|
|
19
|
-
const path = require("path");
|
|
20
|
-
const modulePath = process.cwd();
|
|
21
|
-
const projectPath = modulePath.split(/[/\\]/).slice(0, -2).join("/");
|
|
22
|
-
|
|
23
|
-
const moduleConfig = {
|
|
24
|
-
projectPath: projectPath,
|
|
25
|
-
modulePackageJsonPath: path.join(modulePath, "/package.json"),
|
|
26
|
-
modulePath: path.join(modulePath, "/node_modules/artes"),
|
|
27
|
-
reportPath: path.join(modulePath, "/report"),
|
|
28
|
-
tracerPath: path.join(projectPath, "/trace.zip"),
|
|
29
|
-
cucumberConfigPath: path.join(projectPath, "/artes.config.js"),
|
|
30
|
-
featuresPath: path.join(projectPath, "/tests/features/"),
|
|
31
|
-
stepsPath: path.join(projectPath, "/tests/steps/*.js"),
|
|
32
|
-
pomPath: path.join(projectPath, "/tests/POMs"),
|
|
33
|
-
cleanUpPaths: "allure-result test-results @rerun.txt",
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
module.exports = {
|
|
37
|
-
expect,
|
|
38
|
-
Given,
|
|
39
|
-
When,
|
|
40
|
-
Then,
|
|
41
|
-
element,
|
|
42
|
-
selector,
|
|
43
|
-
extractVarsFromResponse,
|
|
44
|
-
saveVar,
|
|
45
|
-
resolveVariable,
|
|
46
|
-
random,
|
|
47
|
-
page,
|
|
48
|
-
request,
|
|
49
|
-
context,
|
|
50
|
-
moduleConfig,
|
|
51
|
-
};
|
|
1
|
+
const { expect } = require("playwright/test");
|
|
2
|
+
const { Given, When, Then } = require("@cucumber/cucumber");
|
|
3
|
+
const {
|
|
4
|
+
getElement,
|
|
5
|
+
getSelector,
|
|
6
|
+
extractVarsFromResponse,
|
|
7
|
+
saveVar,
|
|
8
|
+
resolveVariable,
|
|
9
|
+
} = require("../pomController/elementController");
|
|
10
|
+
const { faker } = require("@faker-js/faker");
|
|
11
|
+
const { context } = require("../../hooks/context");
|
|
12
|
+
|
|
13
|
+
const element = getElement;
|
|
14
|
+
const selector = getSelector;
|
|
15
|
+
const page = context.page;
|
|
16
|
+
const request = context.request;
|
|
17
|
+
const random = faker;
|
|
18
|
+
|
|
19
|
+
const path = require("path");
|
|
20
|
+
const modulePath = process.cwd();
|
|
21
|
+
const projectPath = modulePath.split(/[/\\]/).slice(0, -2).join("/");
|
|
22
|
+
|
|
23
|
+
const moduleConfig = {
|
|
24
|
+
projectPath: projectPath,
|
|
25
|
+
modulePackageJsonPath: path.join(modulePath, "/package.json"),
|
|
26
|
+
modulePath: path.join(modulePath, "/node_modules/artes"),
|
|
27
|
+
reportPath: path.join(modulePath, "/report"),
|
|
28
|
+
tracerPath: path.join(projectPath, "/trace.zip"),
|
|
29
|
+
cucumberConfigPath: path.join(projectPath, "/artes.config.js"),
|
|
30
|
+
featuresPath: path.join(projectPath, "/tests/features/"),
|
|
31
|
+
stepsPath: path.join(projectPath, "/tests/steps/*.js"),
|
|
32
|
+
pomPath: path.join(projectPath, "/tests/POMs"),
|
|
33
|
+
cleanUpPaths: "allure-result test-results @rerun.txt",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
expect,
|
|
38
|
+
Given,
|
|
39
|
+
When,
|
|
40
|
+
Then,
|
|
41
|
+
element,
|
|
42
|
+
selector,
|
|
43
|
+
extractVarsFromResponse,
|
|
44
|
+
saveVar,
|
|
45
|
+
resolveVariable,
|
|
46
|
+
random,
|
|
47
|
+
page,
|
|
48
|
+
request,
|
|
49
|
+
context,
|
|
50
|
+
moduleConfig,
|
|
51
|
+
};
|