artes 1.4.6 → 1.4.7

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
@@ -292,6 +292,110 @@ function testCoverageCalculation() {
292
292
  };
293
293
  }
294
294
 
295
+ function getExecutor() {
296
+ // GitHub Actions
297
+ if (process.env.GITHUB_RUN_ID) {
298
+ return {
299
+ name: "GitHub Actions",
300
+ type: "github",
301
+ buildName: `Workflow #${process.env.GITHUB_RUN_NUMBER}`,
302
+ buildOrder: Number(process.env.GITHUB_RUN_NUMBER),
303
+ buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
304
+ };
305
+
306
+ // Jenkins
307
+ } else if (process.env.JENKINS_HOME) {
308
+ return {
309
+ name: "Jenkins",
310
+ type: "jenkins",
311
+ buildName: process.env.JOB_NAME || "Manual Run",
312
+ buildOrder: Number(process.env.BUILD_NUMBER) || 1,
313
+ buildUrl: process.env.BUILD_URL || ""
314
+ };
315
+
316
+ // GitLab CI
317
+ } else if (process.env.CI_PIPELINE_ID) {
318
+ return {
319
+ name: "GitLab CI",
320
+ type: "gitlab",
321
+ buildName: `Pipeline #${process.env.CI_PIPELINE_IID}`,
322
+ buildOrder: Number(process.env.CI_PIPELINE_IID) || 1,
323
+ buildUrl: process.env.CI_PIPELINE_URL || ""
324
+ };
325
+
326
+ // Bitbucket Pipelines
327
+ } else if (process.env.BITBUCKET_BUILD_NUMBER) {
328
+ return {
329
+ name: "Bitbucket Pipelines",
330
+ type: "bitbucket",
331
+ buildName: `Build #${process.env.BITBUCKET_BUILD_NUMBER}`,
332
+ buildOrder: Number(process.env.BITBUCKET_BUILD_NUMBER),
333
+ buildUrl: process.env.BITBUCKET_BUILD_URL || ""
334
+ };
335
+
336
+ // CircleCI
337
+ } else if (process.env.CIRCLE_WORKFLOW_ID) {
338
+ return {
339
+ name: "CircleCI",
340
+ type: "circleci",
341
+ buildName: `Workflow #${process.env.CIRCLE_WORKFLOW_ID}`,
342
+ buildOrder: Number(process.env.CIRCLE_BUILD_NUM) || 1,
343
+ buildUrl: process.env.CIRCLE_BUILD_URL || ""
344
+ };
345
+
346
+ // Azure Pipelines
347
+ } else if (process.env.BUILD_BUILDID) {
348
+ return {
349
+ name: "Azure Pipelines",
350
+ type: "azure",
351
+ buildName: `Build #${process.env.BUILD_BUILDID}`,
352
+ buildOrder: Number(process.env.BUILD_BUILDID) || 1,
353
+ buildUrl: process.env.BUILD_BUILDURI || ""
354
+ };
355
+
356
+ // TeamCity
357
+ } else if (process.env.BUILD_NUMBER && process.env.TEAMCITY_VERSION) {
358
+ return {
359
+ name: "TeamCity",
360
+ type: "teamcity",
361
+ buildName: `Build #${process.env.BUILD_NUMBER}`,
362
+ buildOrder: Number(process.env.BUILD_NUMBER) || 1,
363
+ buildUrl: process.env.BUILD_URL || ""
364
+ };
365
+
366
+ // Travis CI
367
+ } else if (process.env.TRAVIS_BUILD_NUMBER) {
368
+ return {
369
+ name: "Travis CI",
370
+ type: "travis",
371
+ buildName: `Build #${process.env.TRAVIS_BUILD_NUMBER}`,
372
+ buildOrder: Number(process.env.TRAVIS_BUILD_NUMBER) || 1,
373
+ buildUrl: process.env.TRAVIS_BUILD_WEB_URL || ""
374
+ };
375
+
376
+ // Bamboo
377
+ } else if (process.env.bamboo_buildNumber) {
378
+ return {
379
+ name: "Bamboo",
380
+ type: "bamboo",
381
+ buildName: `Build #${process.env.bamboo_buildNumber}`,
382
+ buildOrder: Number(process.env.bamboo_buildNumber) || 1,
383
+ buildUrl: process.env.bamboo_resultsUrl || ""
384
+ };
385
+
386
+ // Default fallback (local/manual)
387
+ } else {
388
+ return {
389
+ name: "Local Run",
390
+ type: "local",
391
+ buildName: "Manual Execution",
392
+ buildOrder: 1,
393
+ buildUrl: ""
394
+ };
395
+ }
396
+ }
397
+
398
+
295
399
  function main() {
296
400
  if (flags.help) return showHelp();
297
401
  if (flags.version) return showVersion();
@@ -332,13 +436,22 @@ if (fs.existsSync(path.join(process.cwd(), "node_modules", "artes" , "@rerun.txt
332
436
  });
333
437
  }
334
438
 
439
+
440
+
335
441
  if (
336
442
  flags.reportWithTrace ||
337
443
  artesConfig.reportWithTrace ||
338
444
  flags.report ||
339
445
  artesConfig.report
340
- )
341
- generateReport();
446
+ ){
447
+ const executor = getExecutor();
448
+
449
+ fs.writeFileSync(
450
+ path.join(process.cwd(), "node_modules", "artes",'allure-result',"executor.json"),
451
+ JSON.stringify(executor, null, 2)
452
+ );
453
+ generateReport();
454
+ }
342
455
 
343
456
 
344
457
  if (!( process.env.TRACE === "true"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,7 +37,7 @@ async function attachResponse(attachFn) {
37
37
  ? `${key}:\n${JSON.stringify(value, null, 2)}`
38
38
  : `${key}:\n${value}`;
39
39
 
40
- await attachFn(key, text, "text/plain");
40
+ await attachFn(key, text, "application/json");
41
41
  }
42
42
  }
43
43
 
@@ -146,6 +146,10 @@ After(async function ({result, pickle}) {
146
146
  await projectHooks.After();
147
147
  }
148
148
 
149
+ await attachResponse(allure.attachment);
150
+ context.response = await {};
151
+ allure.attachment('Variables', JSON.stringify(context.vars, null, 2), 'application/json')
152
+
149
153
  const shouldReport =
150
154
  cucumberConfig.default.successReport || result?.status !== Status.PASSED;
151
155
 
@@ -178,8 +182,6 @@ After(async function ({result, pickle}) {
178
182
  }
179
183
  }
180
184
 
181
- await attachResponse(allure.attachment);
182
- context.response = await {};
183
185
 
184
186
  await context.page?.close();
185
187
  await context.browserContext?.close();
@@ -24,6 +24,7 @@ When(
24
24
  "User types {string} by hand in {int} th of {string}",
25
25
  async (text, order, elements) => {
26
26
  const nthElement = await frame.nth(elements, order);
27
+ text = resolveVariable(text)
27
28
  await nthElement.pressSequentially(text);
28
29
  },
29
30
  );
@@ -55,6 +56,7 @@ When(
55
56
  "User types {string} in {int} th of {string}",
56
57
  async (text, order, elements) => {
57
58
  const nthElement = await frame.nth(elements, order);
59
+ text = resolveVariable(text)
58
60
  await nthElement.fill(text);
59
61
  },
60
62
  );
@@ -65,6 +67,7 @@ When(
65
67
  const elementCount = await frame.count(selectors);
66
68
  value = await resolveVariable(value);
67
69
  for (let i = 0; i < elementCount; i++) {
70
+ value = resolveVariable(value)
68
71
  await frame.nth(selectors, i).fill(value);
69
72
  }
70
73
  },