artes 1.5.8 → 1.5.9

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/executer.js CHANGED
@@ -13,6 +13,7 @@ const path = require("path");
13
13
  const { testCoverageCalculator } = require("./src/helper/controller/testCoverageCalculator");
14
14
  const { getExecutor } = require("./src/helper/controller/getExecutor");
15
15
  const { findDuplicateTestNames } = require("./src/helper/controller/findDuplicateTestNames");
16
+ const { getEnvInfo } = require("artes/src/helper/controller/getEnvInfo");
16
17
 
17
18
 
18
19
  const artesConfigPath = path.resolve(process.cwd(), "artes.config.js");
@@ -219,16 +220,10 @@ if (fs.existsSync(source)) {
219
220
  flags.report ||
220
221
  artesConfig.report
221
222
  ){
222
- const executor = getExecutor();
223
223
 
224
- if(fs.existsSync(path.join(process.cwd(), "node_modules", "artes",'allure-result'))){
225
- fs.writeFileSync(
226
- path.join(process.cwd(), "node_modules", "artes",'allure-result',"executor.json"),
227
- JSON.stringify(executor, null, 2)
228
- );
229
- }
230
-
231
- generateReport();
224
+ getExecutor();
225
+ getEnvInfo()
226
+ generateReport();
232
227
 
233
228
  }
234
229
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,73 @@
1
+ const os = require("os");
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+ const { moduleConfig } = require("artes/src/helper/imports/commons");
5
+
6
+
7
+ async function getEnvInfo() {
8
+
9
+ delete require.cache[require.resolve("../../../cucumber.config.js")];
10
+ const cucumberConfig = require("../../../cucumber.config.js");
11
+
12
+ if (fs.existsSync(path.join(moduleConfig.modulePath, "browser-info.json"))) {
13
+ browserInfo = JSON.parse(fs.readFileSync(path.join(moduleConfig.modulePath, "browser-info.json"), "utf8"));
14
+ }
15
+
16
+ const environment = {
17
+ // ── System ──────────────────────────────
18
+ "OS_Name": os.type(),
19
+ "OS_Version": os.release(),
20
+ "OS_Platform": process.platform,
21
+ "OS_Arch": os.arch(),
22
+ "CPU_Cores": os.cpus().length,
23
+ "CPU_Model": os.cpus()[0]?.model ?? "N/A",
24
+ "RAM_Total": `${(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)} GB`,
25
+ "RAM_Free": `${(os.freemem() / 1024 / 1024 / 1024).toFixed(2)} GB`,
26
+ "Hostname": os.hostname(),
27
+
28
+ // ── Node ────────────────────────────────
29
+ "Node_Version": process.version,
30
+ "NPM_Version": process.env.npm_config_user_agent ?? "N/A",
31
+ "Working_Dir": process.cwd(),
32
+
33
+ // ── Browser ─────────────────────────────
34
+ "Browser_Name": cucumberConfig.browser.browserType,
35
+ "Browser_Version": browserInfo.BROWSER_VERSION,
36
+ "Screen_Size": `w: ${browserInfo.BROWSER_WIDTH}px h:${browserInfo.BROWSER_HEIGHT}px`,
37
+ "Headless": cucumberConfig.browser.headless ?? "N/A",
38
+
39
+ // ── Test Config ─────────────────────────
40
+ "Base_URL": cucumberConfig.baseURL || "N/A",
41
+ "Environment": cucumberConfig.env || "local",
42
+ "Timeout": cucumberConfig.default.timeout ?? "N/A",
43
+
44
+ // ── Git ─────────────────────────────────
45
+ "Git_Branch": process.env.GIT_BRANCH ?? process.env.BRANCH_NAME ?? "N/A",
46
+ "Git_Commit": process.env.GIT_COMMIT ?? process.env.GIT_SHA ?? "N/A",
47
+ "Git_Author": process.env.GIT_AUTHOR ?? "N/A",
48
+
49
+ // ── Timestamps ──────────────────────────
50
+ "Run_Date": new Date().toLocaleDateString(),
51
+ "Run_Time": new Date().toLocaleTimeString(),
52
+ "Timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
53
+ };
54
+
55
+ const allureResultsDir = path.join(moduleConfig.modulePath, "allure-result");
56
+
57
+ if (!fs.existsSync(allureResultsDir)) {
58
+ fs.mkdirSync(allureResultsDir, { recursive: true });
59
+ }
60
+
61
+ const propertiesContent = Object.entries(environment)
62
+ .map(([key, value]) => `${key}=${value}`)
63
+ .join("\n");
64
+
65
+ fs.writeFileSync(
66
+ path.join(allureResultsDir, "environment.properties"),
67
+ propertiesContent
68
+ );
69
+
70
+ return environment;
71
+ }
72
+
73
+ module.exports ={getEnvInfo}
@@ -1,104 +1,108 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
1
4
  function getExecutor() {
5
+ let executor;
6
+
7
+ if (process.env.GITHUB_RUN_ID) {
8
+ executor = {
9
+ name: "GitHub Actions",
10
+ type: "github",
11
+ buildName: `Workflow #${process.env.GITHUB_RUN_NUMBER}`,
12
+ buildOrder: Number(process.env.GITHUB_RUN_NUMBER),
13
+ buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
14
+ };
15
+
16
+ } else if (process.env.JENKINS_HOME) {
17
+ executor = {
18
+ name: "Jenkins",
19
+ type: "jenkins",
20
+ buildName: process.env.JOB_NAME || "Manual Run",
21
+ buildOrder: Number(process.env.BUILD_NUMBER) || 1,
22
+ buildUrl: process.env.BUILD_URL || ""
23
+ };
24
+
25
+ } else if (process.env.CI_PIPELINE_ID) {
26
+ executor = {
27
+ name: "GitLab CI",
28
+ type: "gitlab",
29
+ buildName: `Pipeline #${process.env.CI_PIPELINE_IID}`,
30
+ buildOrder: Number(process.env.CI_PIPELINE_IID) || 1,
31
+ buildUrl: process.env.CI_PIPELINE_URL || ""
32
+ };
33
+
34
+ } else if (process.env.BITBUCKET_BUILD_NUMBER) {
35
+ executor = {
36
+ name: "Bitbucket Pipelines",
37
+ type: "bitbucket",
38
+ buildName: `Build #${process.env.BITBUCKET_BUILD_NUMBER}`,
39
+ buildOrder: Number(process.env.BITBUCKET_BUILD_NUMBER),
40
+ buildUrl: process.env.BITBUCKET_BUILD_URL || ""
41
+ };
42
+
43
+ } else if (process.env.CIRCLE_WORKFLOW_ID) {
44
+ executor = {
45
+ name: "CircleCI",
46
+ type: "circleci",
47
+ buildName: `Workflow #${process.env.CIRCLE_WORKFLOW_ID}`,
48
+ buildOrder: Number(process.env.CIRCLE_BUILD_NUM) || 1,
49
+ buildUrl: process.env.CIRCLE_BUILD_URL || ""
50
+ };
51
+
52
+ } else if (process.env.BUILD_BUILDID) {
53
+ executor = {
54
+ name: "Azure Pipelines",
55
+ type: "azure",
56
+ buildName: `Build #${process.env.BUILD_BUILDID}`,
57
+ buildOrder: Number(process.env.BUILD_BUILDID) || 1,
58
+ buildUrl: process.env.BUILD_BUILDURI || ""
59
+ };
2
60
 
3
- if (process.env.GITHUB_RUN_ID) {
4
- return {
5
- name: "GitHub Actions",
6
- type: "github",
7
- buildName: `Workflow #${process.env.GITHUB_RUN_NUMBER}`,
8
- buildOrder: Number(process.env.GITHUB_RUN_NUMBER),
9
- buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
10
- };
11
-
12
-
13
- } else if (process.env.JENKINS_HOME) {
14
- return {
15
- name: "Jenkins",
16
- type: "jenkins",
17
- buildName: process.env.JOB_NAME || "Manual Run",
18
- buildOrder: Number(process.env.BUILD_NUMBER) || 1,
19
- buildUrl: process.env.BUILD_URL || ""
20
- };
21
-
22
-
23
- } else if (process.env.CI_PIPELINE_ID) {
24
- return {
25
- name: "GitLab CI",
26
- type: "gitlab",
27
- buildName: `Pipeline #${process.env.CI_PIPELINE_IID}`,
28
- buildOrder: Number(process.env.CI_PIPELINE_IID) || 1,
29
- buildUrl: process.env.CI_PIPELINE_URL || ""
30
- };
31
-
32
-
33
- } else if (process.env.BITBUCKET_BUILD_NUMBER) {
34
- return {
35
- name: "Bitbucket Pipelines",
36
- type: "bitbucket",
37
- buildName: `Build #${process.env.BITBUCKET_BUILD_NUMBER}`,
38
- buildOrder: Number(process.env.BITBUCKET_BUILD_NUMBER),
39
- buildUrl: process.env.BITBUCKET_BUILD_URL || ""
40
- };
41
-
42
-
43
- } else if (process.env.CIRCLE_WORKFLOW_ID) {
44
- return {
45
- name: "CircleCI",
46
- type: "circleci",
47
- buildName: `Workflow #${process.env.CIRCLE_WORKFLOW_ID}`,
48
- buildOrder: Number(process.env.CIRCLE_BUILD_NUM) || 1,
49
- buildUrl: process.env.CIRCLE_BUILD_URL || ""
50
- };
51
-
52
-
53
- } else if (process.env.BUILD_BUILDID) {
54
- return {
55
- name: "Azure Pipelines",
56
- type: "azure",
57
- buildName: `Build #${process.env.BUILD_BUILDID}`,
58
- buildOrder: Number(process.env.BUILD_BUILDID) || 1,
59
- buildUrl: process.env.BUILD_BUILDURI || ""
60
- };
61
-
62
-
63
- } else if (process.env.BUILD_NUMBER && process.env.TEAMCITY_VERSION) {
64
- return {
65
- name: "TeamCity",
66
- type: "teamcity",
67
- buildName: `Build #${process.env.BUILD_NUMBER}`,
68
- buildOrder: Number(process.env.BUILD_NUMBER) || 1,
69
- buildUrl: process.env.BUILD_URL || ""
70
- };
71
-
72
-
73
- } else if (process.env.TRAVIS_BUILD_NUMBER) {
74
- return {
75
- name: "Travis CI",
76
- type: "travis",
77
- buildName: `Build #${process.env.TRAVIS_BUILD_NUMBER}`,
78
- buildOrder: Number(process.env.TRAVIS_BUILD_NUMBER) || 1,
79
- buildUrl: process.env.TRAVIS_BUILD_WEB_URL || ""
80
- };
81
-
82
-
83
- } else if (process.env.bamboo_buildNumber) {
84
- return {
85
- name: "Bamboo",
86
- type: "bamboo",
87
- buildName: `Build #${process.env.bamboo_buildNumber}`,
88
- buildOrder: Number(process.env.bamboo_buildNumber) || 1,
89
- buildUrl: process.env.bamboo_resultsUrl || ""
90
- };
91
-
92
-
93
- } else {
94
- return {
95
- name: "Local Run",
96
- type: "local",
97
- buildName: "Manual Execution",
98
- buildOrder: 1,
99
- buildUrl: ""
100
- };
101
- }
61
+ } else if (process.env.BUILD_NUMBER && process.env.TEAMCITY_VERSION) {
62
+ executor = {
63
+ name: "TeamCity",
64
+ type: "teamcity",
65
+ buildName: `Build #${process.env.BUILD_NUMBER}`,
66
+ buildOrder: Number(process.env.BUILD_NUMBER) || 1,
67
+ buildUrl: process.env.BUILD_URL || ""
68
+ };
69
+
70
+ } else if (process.env.TRAVIS_BUILD_NUMBER) {
71
+ executor = {
72
+ name: "Travis CI",
73
+ type: "travis",
74
+ buildName: `Build #${process.env.TRAVIS_BUILD_NUMBER}`,
75
+ buildOrder: Number(process.env.TRAVIS_BUILD_NUMBER) || 1,
76
+ buildUrl: process.env.TRAVIS_BUILD_WEB_URL || ""
77
+ };
78
+
79
+ } else if (process.env.bamboo_buildNumber) {
80
+ executor = {
81
+ name: "Bamboo",
82
+ type: "bamboo",
83
+ buildName: `Build #${process.env.bamboo_buildNumber}`,
84
+ buildOrder: Number(process.env.bamboo_buildNumber) || 1,
85
+ buildUrl: process.env.bamboo_resultsUrl || ""
86
+ };
87
+
88
+ } else {
89
+ executor = {
90
+ name: "Local Run",
91
+ type: "local",
92
+ buildName: "Manual Execution",
93
+ buildOrder: 1,
94
+ buildUrl: ""
95
+ };
102
96
  }
103
97
 
104
- module.exports = { getExecutor };
98
+ if (fs.existsSync(path.join(process.cwd(), "node_modules", "artes", "allure-result"))) {
99
+ fs.writeFileSync(
100
+ path.join(process.cwd(), "node_modules", "artes", "allure-result", "executor.json"),
101
+ JSON.stringify(executor, null, 2)
102
+ );
103
+ }
104
+
105
+ return executor;
106
+ }
107
+
108
+ module.exports= {getExecutor}
@@ -340,7 +340,7 @@ function inferExtFromMime(mime) {
340
340
  }
341
341
 
342
342
  function generateCss(report, today, reportName, logoUrl) {
343
- return `.side-nav{background: #091628 !important; max-width:200px !important}.side-nav__brand{background:url('${logoUrl}') no-repeat center left !important;background-size:contain !important;height:80px;width:200px;display:flex !important;align-items:center;padding-left:80px}.side-nav__brand img,.side-nav__brand svg{display:none !important}.side-nav__brand-text{font-size:0 !important;display:block !important;padding: 0 8px;}.side-nav__brand-text::after{content:'${report.brandName}';font-size:23px;color:white;}.widget__title{font-weight:lighter;margin-bottom:15px;margin-top:0;text-transform:uppercase}.widget__flex-line:first-child .widget__title{font-size:0}.widget__flex-line:first-child .widget__title::before{content:'${reportName} ${today}';font-size:18px;font-weight:lighter;text-transform:uppercase}.widget__flex-line:first-child .widget__subtitle{font-size:14px}.widget__flex-line:not(:first-child) .widget__title{font-size:inherit;font-weight:lighter}`;
343
+ return `.side-nav{background: #091628 !important; max-width:200px !important}.side-nav__brand{background:url('${logoUrl}') no-repeat center left !important;background-size:contain !important;height:80px;width:200px;display:flex !important;align-items:center;padding-left:80px}.side-nav__brand img,.side-nav__brand svg{display:none !important}.side-nav__brand-text{font-size:0 !important;display:block !important;padding: 0 8px;}.side-nav__brand-text::after{content:'${report.brandName}';font-size:23px;color:white;}.widget__title{font-weight:lighter;margin-bottom:15px;margin-top:0;text-transform:uppercase}.widget__flex-line:first-child .widget__title{font-size:0}.widget__flex-line:first-child .widget__title::before{content:'${reportName} ${today}';display:block;font-size:18px;font-weight:lighter;text-transform:uppercase}.widget__flex-line:first-child .widget__subtitle::after{content:' ${Intl.DateTimeFormat().resolvedOptions().timeZone}';font-size:14px;}.widget__flex-line:first-child .widget__subtitle{font-size:14px}.widget__flex-line:not(:first-child) .widget__title{font-size:inherit;font-weight:lighter}`;
344
344
  }
345
345
 
346
346
  function injectCssAndReturn(cssPath, dynamicCss) {
@@ -41,7 +41,8 @@ const moduleConfig = {
41
41
  "@rerun.txt",
42
42
  "test-status",
43
43
  "null",
44
- "pomDuplicateWarnings.json"
44
+ "pomDuplicateWarnings.json",
45
+ "browser-info.json"
45
46
  ]
46
47
  };
47
48
 
@@ -107,6 +107,22 @@ Before(async function ({pickle}) {
107
107
  context.page = await browserContext.newPage();
108
108
  context.request = requestInstance;
109
109
 
110
+ const dimensions = await context.page.evaluate(() => {
111
+ return {
112
+ width: window.innerWidth,
113
+ height: window.innerHeight,
114
+ };
115
+ });
116
+
117
+ fs.writeFileSync(
118
+ path.join(moduleConfig.modulePath, "browser-info.json"),
119
+ JSON.stringify({
120
+ BROWSER_WIDTH: dimensions.width,
121
+ BROWSER_HEIGHT: dimensions.height,
122
+ BROWSER_VERSION: browser.version()
123
+ })
124
+ );
125
+
110
126
  await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
111
127
 
112
128
  if (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {