artes 1.7.4 → 1.7.6
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 +781 -779
- package/assets/styles.css +4 -4
- package/cucumber.config.js +253 -253
- package/docs/ciExecutors.md +198 -198
- package/docs/emulationDevicesList.md +152 -152
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +435 -433
- package/executer.js +266 -264
- package/index.js +50 -50
- package/package.json +56 -56
- package/src/helper/contextManager/browserManager.js +74 -74
- package/src/helper/contextManager/requestManager.js +23 -23
- package/src/helper/controller/elementController.js +210 -210
- package/src/helper/controller/findDuplicateTestNames.js +69 -69
- package/src/helper/controller/getEnvInfo.js +94 -94
- package/src/helper/controller/getExecutor.js +109 -109
- package/src/helper/controller/pomCollector.js +83 -83
- package/src/helper/controller/reportCustomizer.js +485 -485
- package/src/helper/controller/screenComparer.js +97 -108
- package/src/helper/controller/status-formatter.js +137 -137
- package/src/helper/controller/testCoverageCalculator.js +111 -111
- package/src/helper/executers/cleaner.js +23 -23
- package/src/helper/executers/exporter.js +19 -19
- package/src/helper/executers/helper.js +193 -191
- package/src/helper/executers/projectCreator.js +226 -222
- package/src/helper/executers/reportGenerator.js +91 -91
- package/src/helper/executers/testRunner.js +28 -28
- package/src/helper/executers/versionChecker.js +31 -31
- package/src/helper/imports/commons.js +65 -65
- package/src/helper/stepFunctions/APIActions.js +495 -495
- package/src/helper/stepFunctions/assertions.js +986 -986
- package/src/helper/stepFunctions/browserActions.js +87 -87
- package/src/helper/stepFunctions/elementInteractions.js +60 -60
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +72 -72
- package/src/helper/stepFunctions/keyboardActions.js +66 -66
- package/src/helper/stepFunctions/mouseActions.js +84 -84
- package/src/helper/stepFunctions/pageActions.js +43 -43
- package/src/hooks/context.js +15 -15
- package/src/hooks/hooks.js +287 -279
- package/src/stepDefinitions/API.steps.js +310 -310
- package/src/stepDefinitions/assertions.steps.js +1303 -1280
- package/src/stepDefinitions/browser.steps.js +74 -74
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +264 -264
- package/src/stepDefinitions/mouseActions.steps.js +378 -378
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +191 -191
|
@@ -1,222 +1,226 @@
|
|
|
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, noDeps) {
|
|
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
|
-
console.log("🚀 Initializing project...");
|
|
20
|
-
execSync(`npm init ${createYes ? "-y" : ""}`, {
|
|
21
|
-
cwd: projectDir,
|
|
22
|
-
stdio: "inherit",
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
if (!noDeps) {
|
|
26
|
-
execSync("npm i artes@latest", { cwd: projectDir, stdio: "inherit" });
|
|
27
|
-
console.log("📦 Setting up browsers...");
|
|
28
|
-
execSync("npx playwright install", { cwd: projectDir, stdio: "inherit" });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const packageJsonPath = path.join(projectDir, "package.json");
|
|
32
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
33
|
-
|
|
34
|
-
if (packageJson.type) {
|
|
35
|
-
delete packageJson.type;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
packageJson.scripts = {
|
|
39
|
-
test: "npx artes",
|
|
40
|
-
testWithReport: "npx artes -r",
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
And User
|
|
117
|
-
And User clicks "
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
And User
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
export function
|
|
161
|
-
// hook for before each
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function
|
|
165
|
-
// hook for before
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function
|
|
169
|
-
// hook for
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function
|
|
173
|
-
// hook for after each
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export function
|
|
177
|
-
// hook for after
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
"cucumber
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
"cucumber.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
);
|
|
202
|
-
fs.writeFileSync(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
fs.writeFileSync(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
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, noDeps) {
|
|
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
|
+
console.log("🚀 Initializing project...");
|
|
20
|
+
execSync(`npm init ${createYes ? "-y" : ""}`, {
|
|
21
|
+
cwd: projectDir,
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (!noDeps) {
|
|
26
|
+
execSync("npm i artes@latest", { cwd: projectDir, stdio: "inherit" });
|
|
27
|
+
console.log("📦 Setting up browsers...");
|
|
28
|
+
execSync("npx playwright install", { cwd: projectDir, stdio: "inherit" });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const packageJsonPath = path.join(projectDir, "package.json");
|
|
32
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
33
|
+
|
|
34
|
+
if (packageJson.type) {
|
|
35
|
+
delete packageJson.type;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
packageJson.scripts = {
|
|
39
|
+
test: "npx artes",
|
|
40
|
+
testWithReport: "npx artes -r",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
packageJson.dependencies = {
|
|
44
|
+
artes: "latest"
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
48
|
+
|
|
49
|
+
const config = `module.exports = {
|
|
50
|
+
// Configuration options:
|
|
51
|
+
// headless: false, // Set to true for headless browser mode
|
|
52
|
+
// env: "", // string - Environment name for tests
|
|
53
|
+
// variables: {} // object - Variables for tests
|
|
54
|
+
// testPercentage: 0, // number - Minimum success rate percentage(Default: 0)
|
|
55
|
+
// baseURL: "", // string - Base URL for API tests
|
|
56
|
+
// paths: [], // string[] - Paths to feature files
|
|
57
|
+
// steps: "", // string - Step definitions files
|
|
58
|
+
// pomPath: "", // string - Path to POM files
|
|
59
|
+
// ai: {
|
|
60
|
+
// ai: false, // boolean - Enable AI-generated bug reports and test summaries
|
|
61
|
+
// url: "", // string - Local AI endpoint URL (e.g., Ollama, LM Studio). Overrides model/key when set
|
|
62
|
+
// model: "gemini 2.5 flash", // string - AI model to use (e.g., "gpt-4o", "gemini 2.5 flash", "claude sonnet", "mistral large")
|
|
63
|
+
// key: "", // string - API key for the selected AI provider
|
|
64
|
+
// language: "English", // string - Language for generated reports (e.g., "English", "Azerbaijani"),
|
|
65
|
+
// maxTokens: 4000, // number - Maximum tokens for AI-generated reports (default: 4000)
|
|
66
|
+
// maxReports: 10, // number - Maximum number of AI reports to generate per test run
|
|
67
|
+
// },
|
|
68
|
+
// timeout : 0, // number - Test timeout in seconds
|
|
69
|
+
// slowMo: 0, // number - Slow down test execution (Default: 0 seconds)
|
|
70
|
+
// parallel: 0, // number - Number of parallel workers
|
|
71
|
+
// report: true, // boolean - Generate report
|
|
72
|
+
// zip: false, // boolean - Generate zip of report
|
|
73
|
+
// uploadReport: false, // boolean - Upload report to Artes Reporting System
|
|
74
|
+
// reporterURL: "", // string - URL of the Artes Reporting System
|
|
75
|
+
// projectName: "Artes Report", // string - Name of the project in the Artes Reporting System
|
|
76
|
+
// projectType: "Artes", // string - Type/category of the project (e.g., UI, API)
|
|
77
|
+
// reportPath: "./report.zip", // string - Path to the report zip file to be uploaded
|
|
78
|
+
// logo: "", // string - Custom logo for the report sidebar. Accepts an absolute path, a relative path, or a direct image URL
|
|
79
|
+
// brandName: "", // string - Brand name displayed next to the logo in the report sidebar
|
|
80
|
+
// reportName: "Artes Report", // string - Report name displayed on the summary widget and in the Artes Reporting System
|
|
81
|
+
// reportSuccess: false, // boolean - Add screenshots and video records to report also for success test cases
|
|
82
|
+
// trace: false, // boolean - Enable tracing
|
|
83
|
+
// reportWithTrace: false, // boolean - Include trace in report
|
|
84
|
+
// format: [], // string[] - Formatter names/paths
|
|
85
|
+
// formatOptions: {}, // object - Formatter options
|
|
86
|
+
// retry: 0, // number - Retry attempts for failing tests
|
|
87
|
+
// tags: "", // string - Tag expression to filter scenarios
|
|
88
|
+
// backtrace: false, // boolean - Show full backtrace for errors
|
|
89
|
+
// dryRun: false, // boolean - Prepare test run without execution
|
|
90
|
+
// browser: "chrome", // "chrome", "firefox", "webkit"
|
|
91
|
+
// offline: false, // boolean - Run browser in offline mode
|
|
92
|
+
// device: "", // string - Emulate specific device (e.g., "iPhone 13", for more devices look at the documentation)
|
|
93
|
+
// width: 1280, // number - Browser width
|
|
94
|
+
// height: 720, // number - Browser height
|
|
95
|
+
// maximizeScreen: true // boolean - Maximize browser window
|
|
96
|
+
// forceExit: false, // boolean - Force process.exit() after tests
|
|
97
|
+
// failFast: false, // boolean - Stop on first test failure
|
|
98
|
+
// import: [], // string[] - Support code paths
|
|
99
|
+
// language: "en", // string - Default feature file language
|
|
100
|
+
// loader: [], // string[] - Module loader specifications
|
|
101
|
+
// name: [], // string[] - Run scenarios matching regex
|
|
102
|
+
// order: "defined", // string - Run order (defined/random)
|
|
103
|
+
// publish: false, // boolean - Publish to cucumber.io
|
|
104
|
+
// requireModule: [], // string[] - Transpilation module names
|
|
105
|
+
// retryTagFilter: "", // string - Tag expression for retries
|
|
106
|
+
// strict: true, // boolean - Fail on pending steps
|
|
107
|
+
// worldParameters: {} // object - World constructor parameters
|
|
108
|
+
};
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
const featureContent = `Feature: Shopping on SauceDemo 🛒
|
|
112
|
+
|
|
113
|
+
Background: Login on SauceDemo
|
|
114
|
+
Given User is on home page of SauceDemo
|
|
115
|
+
And User types "standard_user" in "username_input"
|
|
116
|
+
And User types "secret_sauce" in "password_input"
|
|
117
|
+
And User clicks "#login-button"
|
|
118
|
+
|
|
119
|
+
Scenario Outline: Success Shopping
|
|
120
|
+
And User expects to be in "https://www.saucedemo.com/inventory.html" page
|
|
121
|
+
And User clicks "product_title"
|
|
122
|
+
And User clicks "add_to_cart_button"
|
|
123
|
+
And User clicks "cart_button"
|
|
124
|
+
Then User expects "item_price" should have "$29.99" text
|
|
125
|
+
|
|
126
|
+
Scenario Outline: Failed Shopping
|
|
127
|
+
And User expects to be in "https://www.saucedemo.com/inventory.html" page
|
|
128
|
+
And User clicks "product_title"
|
|
129
|
+
And User clicks "add_to_cart_button"
|
|
130
|
+
And User clicks "cart_button"
|
|
131
|
+
Then User expects "item_price" should not have "$29.99" text
|
|
132
|
+
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
const pomContent = JSON.stringify(
|
|
136
|
+
{
|
|
137
|
+
username_input: { selector: "#user-name" },
|
|
138
|
+
password_input: "#password",
|
|
139
|
+
login_button: "#login-button",
|
|
140
|
+
product_title:
|
|
141
|
+
"xpath=/html/body/div/div/div/div[2]/div/div/div/div[1]/div[2]/div[1]/a/div",
|
|
142
|
+
add_to_cart_button: "#add-to-cart",
|
|
143
|
+
cart_button: ".shopping_cart_link",
|
|
144
|
+
item_price: ".inventory_item_price",
|
|
145
|
+
},
|
|
146
|
+
null,
|
|
147
|
+
2,
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const stepsContent = `
|
|
151
|
+
const {Given,context} = require("artes");
|
|
152
|
+
|
|
153
|
+
// Example step definition
|
|
154
|
+
Given("User is on home page of SauceDemo", async () => {
|
|
155
|
+
await context.page.goto("https://www.saucedemo.com/");
|
|
156
|
+
});
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
const hooksContent = `
|
|
160
|
+
export function BeforeStep() {
|
|
161
|
+
// hook for before each step
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function Before() {
|
|
165
|
+
// hook for before each test
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function BeforeAll() {
|
|
169
|
+
// hook for before all tests
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function AfterStep() {
|
|
173
|
+
// hook for after each step
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function After() {
|
|
177
|
+
// hook for after each test
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function AfterAll() {
|
|
181
|
+
// hook for after all tests
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
|
|
185
|
+
const vsCodeExtension = JSON.stringify({
|
|
186
|
+
recommendations: ["CucumberOpen.cucumber-official"],
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const vsCodeSettings = JSON.stringify({
|
|
190
|
+
"cucumber.glue": [
|
|
191
|
+
"tests/steps/*.{ts,js}",
|
|
192
|
+
"node_modules/artes/src/stepDefinitions/*.{ts,js}",
|
|
193
|
+
],
|
|
194
|
+
"cucumber.features": ["tests/features/**/*.feature"],
|
|
195
|
+
"cucumberautocomplete.syncfeatures": true,
|
|
196
|
+
"cucumberautocomplete.strictGherkinCompletion": true,
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
console.log("📂 Creating project files...");
|
|
200
|
+
|
|
201
|
+
fs.writeFileSync(path.join(projectDir, "artes.config.js"), config, "utf-8");
|
|
202
|
+
fs.writeFileSync(
|
|
203
|
+
path.join(srcDir, "features", "example.feature"),
|
|
204
|
+
featureContent,
|
|
205
|
+
);
|
|
206
|
+
fs.writeFileSync(path.join(srcDir, "POMs", "example.pom.json"), pomContent);
|
|
207
|
+
fs.writeFileSync(path.join(srcDir, "steps", "common.steps.js"), stepsContent);
|
|
208
|
+
fs.writeFileSync(path.join(srcDir, "steps", "hooks.js"), hooksContent);
|
|
209
|
+
|
|
210
|
+
fs.writeFileSync(
|
|
211
|
+
path.join(projectDir, ".vscode", "settings.json"),
|
|
212
|
+
vsCodeSettings,
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
fs.writeFileSync(
|
|
216
|
+
path.join(projectDir, ".vscode", "extensions.json"),
|
|
217
|
+
vsCodeExtension,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
console.log(`✨ Project created successfully in ${projectDir}!`);
|
|
221
|
+
console.log("Happy Testing 🎉");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
module.exports = {
|
|
225
|
+
createProject,
|
|
226
|
+
};
|